Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
FragmentationMath.h
00001 #ifndef _FRAGMENTATION_MATH_H 00002 #define _FRAGMENTATION_MATH_H 00003 #ifdef FOTA 00004 00005 #include "mbed.h" 00006 #include "mDot.h" 00007 #include "WriteFile.h" 00008 00009 #define FRAG_SESSION_ONGOING 0xffffffff 00010 #ifndef MAX_PARITY 00011 #define MAX_PARITY 300 00012 #endif 00013 class FragmentationMath 00014 { 00015 public: 00016 FragmentationMath(mDot* dot, uint16_t frame_count, uint8_t frame_size, WriteFile* fh); 00017 ~FragmentationMath(); 00018 bool Init(); 00019 int getLostFrameCount(); 00020 void reset(uint16_t fcount); 00021 void setFrameFound(uint16_t frameCounter); 00022 bool processParityFrag(uint16_t frameCounter, uint8_t *pFrag); 00023 00024 int FragmentationPrbs23(int x); 00025 bool IsPowerOfTwo(unsigned int x); 00026 int32_t FindMissingFrameIndex(uint16_t x); 00027 int32_t FindTrueFrameIndex(uint16_t x); 00028 void GetRowInFlash(int l, uint8_t *rowData); 00029 int FindFirstOne(uint8_t *boolData, int size); 00030 void StoreRowInFlash(uint8_t *rowData, int index); 00031 void XorLineData(uint8_t *dataL1, uint8_t *dataL2, int size); 00032 void XorLineBit(uint8_t *dataL1, uint8_t *dataL2, int size); 00033 void XorRowWithMatrix(uint8_t* row, int matrix_row_num); 00034 void FragmentationGetParityMatrixRow(int N, int M, uint8_t *matrixRow); 00035 void CondenseRow(uint8_t *row, int row_number, int start); 00036 void ExpandAndXorRow(uint8_t *row, int row_number); 00037 bool CheckIfMissing(int row_number, int index); 00038 void CompleteRow(int row_num); 00039 void printMatrix(); 00040 00041 uint8_t _frame_size; 00042 uint16_t _frame_count; 00043 uint16_t _max_parity; 00044 uint16_t numFramesMissing; 00045 uint16_t lastReceiveFrameCnt; 00046 00047 uint8_t *matrix; 00048 uint8_t *matrixRow; 00049 uint8_t *parity_frag; 00050 uint8_t *missingFrameIndex; 00051 uint8_t *frag_in_flash; 00052 00053 bool empty; 00054 int index_of_first; 00055 int matrix_row_num; 00056 int index; 00057 00058 mDot* _dot; 00059 WriteFile* _fh; 00060 }; 00061 #endif 00062 #endif // _FRAGMENTATION_MATH_H
Generated on Wed Jul 13 2022 16:42:53 by
1.7.2