aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Common
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2020-05-13 13:27:01 +0300
committerAvi Levkovich <avi@twine-s.com>2020-05-13 13:27:01 +0300
commit15dfc2cdcbc2e518c09c1ee75f32ff149d4a337d (patch)
tree4c0b49773706b85282e6f6b1ec3d2e949d3ca22e /Software/Embedded_SW/Embedded/Common
parent6a49e917c587dcbbfe8175b8dde73840b7d105fc (diff)
parentcd750d626d3780990797faf09446033bbaa4311c (diff)
downloadTango-15dfc2cdcbc2e518c09c1ee75f32ff149d4a337d.tar.gz
Tango-15dfc2cdcbc2e518c09c1ee75f32ff149d4a337d.zip
commit merge
Diffstat (limited to 'Software/Embedded_SW/Embedded/Common')
-rw-r--r--Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.c78
-rw-r--r--Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.h14
-rw-r--r--Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c2
-rw-r--r--Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c2
4 files changed, 94 insertions, 2 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.c b/Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.c
new file mode 100644
index 000000000..391946698
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.c
@@ -0,0 +1,78 @@
+/*
+ * Checksum.c
+ *
+ * Created on: May 7, 2020
+ * Author: avi
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "Include.h"
+
+//*****************************************************************************
+//
+//! CheckSum() Calculates an 8 bit checksum
+//!
+//! \param pui8Data is a pointer to an array of 8 bit data of size ui8Size.
+//! \param ui8Size is the size of the array that will run through the checksum
+//! algorithm.
+//!
+//! This function simply calculates an 8 bit checksum on the data passed in.
+//!
+//! \return The function returns the calculated checksum.
+//
+//*****************************************************************************
+uint8_t
+CheckSum8bit(uint8_t *pui8Data, uint8_t ui8Size)
+{
+ int32_t i;
+ uint8_t ui8CheckSum;
+
+ ui8CheckSum = 0;
+
+ for(i = 0; i < ui8Size; ++i)
+ {
+ ui8CheckSum += pui8Data[i];
+ }
+ return(ui8CheckSum);
+}
+
+
+//*****************************************************************************
+//
+//! Calculates an 8-bit checksum
+//!
+//! \param pui8Data is a pointer to an array of 8-bit data of size ui32Size.
+//! \param ui32Size is the size of the array that will run through the checksum
+//! algorithm.
+//!
+//! This function simply calculates an 8-bit checksum on the data passed in.
+//!
+//! \return Returns the calculated checksum.
+//
+//*****************************************************************************
+uint32_t
+CheckSum32bit(const uint8_t *pui8Data, uint32_t ui32Size)
+{
+ uint32_t ui32CheckSum;
+
+ //
+ // Initialize the checksum to zero.
+ //
+ ui32CheckSum = 0;
+
+ //
+ // Add up all the bytes, do not do anything for an overflow.
+ //
+ while(ui32Size--)
+ {
+ ui32CheckSum += *pui8Data++;
+ }
+
+ //
+ // Return the calculated check sum.
+ //
+ return(ui32CheckSum & 0xff);
+}
+
+
diff --git a/Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.h b/Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.h
new file mode 100644
index 000000000..2d245f81a
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.h
@@ -0,0 +1,14 @@
+/*
+ * Checksum.h
+ *
+ * Created on: May 7, 2020
+ * Author: avi
+ */
+
+#ifndef CHECKSUM_H_
+#define CHECKSUM_H_
+
+uint8_t CheckSum8bit(uint8_t *pui8Data, uint8_t ui8Size);
+uint32_t CheckSum32bit(const uint8_t *pui8Data, uint32_t ui32Size);
+
+#endif /* CHECKSUM_H_ */
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
index feac91829..84d8fa725 100644
--- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
+++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
@@ -194,7 +194,7 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer)
else
{
FileReceivedLength += WrittenBytes;
- ReportWithPackageFilter(CommFilter,"Chunk received", __FILE__,WrittenBytes,FileReceivedLength, RpMessage,msec_millisecondCounter-save_milisec, 0);
+ ReportWithPackageFilter(CommFilter,"Chunk received", __FILE__,FileLength,FileReceivedLength, RpMessage,msec_millisecondCounter-save_milisec, 0);
//REPORT_MSG (FileReceivedLength,"file upload chunk");
if (FileReceivedLength == FileLength)
diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c
index 80b4719fb..86f8fecc1 100644
--- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c
+++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c
@@ -20,7 +20,7 @@ typedef struct
} TangoVersion_t;
-TangoVersion_t _gTangoVersion = {1,4,6,24};
+TangoVersion_t _gTangoVersion = {1,4,6,25};
#define BUILD_DATE __DATE__
char Dat[50] = BUILD_DATE;
char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d