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.
Dependents: mdot_two_way unh-hackathon-example unh-hackathon-example-raw TelitSensorToCloud ... more
Fork of libmDot-dev-mbed5-deprecated by
FragmentationMath.h
00001 /********************************************************************** 00002 * COPYRIGHT 2018 MULTI-TECH SYSTEMS, INC. 00003 * 00004 * ALL RIGHTS RESERVED BY AND FOR THE EXCLUSIVE BENEFIT OF 00005 * MULTI-TECH SYSTEMS, INC. 00006 * 00007 * MULTI-TECH SYSTEMS, INC. - CONFIDENTIAL AND PROPRIETARY 00008 * INFORMATION AND/OR TRADE SECRET. 00009 * 00010 * NOTICE: ALL CODE, PROGRAM, INFORMATION, SCRIPT, INSTRUCTION, 00011 * DATA, AND COMMENT HEREIN IS AND SHALL REMAIN THE CONFIDENTIAL 00012 * INFORMATION AND PROPERTY OF MULTI-TECH SYSTEMS, INC. 00013 * USE AND DISCLOSURE THEREOF, EXCEPT AS STRICTLY AUTHORIZED IN A 00014 * WRITTEN AGREEMENT SIGNED BY MULTI-TECH SYSTEMS, INC. IS PROHIBITED. 00015 * 00016 ***********************************************************************/ 00017 00018 #ifndef _FRAGMENTATION_MATH_H 00019 #define _FRAGMENTATION_MATH_H 00020 #ifdef FOTA 00021 00022 #include "mbed.h" 00023 #include "mDot.h" 00024 #include "WriteFile.h" 00025 00026 #define FRAG_SESSION_ONGOING 0xffffffff 00027 00028 #ifndef MAX_PARITY 00029 #define MAX_PARITY 300 00030 #endif 00031 00032 class FragmentationMath 00033 { 00034 public: 00035 FragmentationMath(mDot* dot, uint16_t frame_count, uint8_t frame_size, WriteFile* fh); 00036 ~FragmentationMath(); 00037 bool Init(); 00038 int getLostFrameCount(); 00039 int getTotalMissingFrameCount(); 00040 int getTotalRcvdFrameCount(); 00041 void reset(uint16_t fcount); 00042 void setFrameFound(uint16_t frameCounter); 00043 bool processParityFrag(uint16_t frameCounter, uint8_t *pFrag); 00044 00045 int FragmentationPrbs23(int x); 00046 bool IsPowerOfTwo(unsigned int x); 00047 int32_t FindMissingFrameIndex(uint16_t x); 00048 int32_t FindTrueFrameIndex(uint16_t x); 00049 void GetRowInFlash(int l, uint8_t *rowData); 00050 int FindFirstOne(uint8_t *boolData, int size); 00051 void StoreRowInFlash(uint8_t *rowData, int index); 00052 void XorLineData(uint8_t *dataL1, uint8_t *dataL2, int size); 00053 void XorLineBit(uint8_t *dataL1, uint8_t *dataL2, int size); 00054 void XorRowWithMatrix(uint8_t* row, int matrix_row_num); 00055 void FragmentationGetParityMatrixRow(int N, int M, uint8_t *matrixRow); 00056 void CondenseRow(uint8_t *row, int row_number, int start); 00057 void ExpandAndXorRow(uint8_t *row, int row_number); 00058 bool CheckIfMissing(int row_number, int index); 00059 void CompleteRow(int row_num); 00060 void printMatrix(); 00061 00062 uint8_t _frame_size; 00063 uint16_t _frame_count; 00064 uint16_t _max_parity; 00065 int16_t numFramesMissing; 00066 uint16_t lastReceiveFrameCnt; 00067 int filled; 00068 00069 uint8_t *matrix; 00070 uint8_t *matrixRow; 00071 uint8_t *parity_frag; 00072 uint8_t *missingFrameIndex; 00073 uint8_t *frag_in_flash; 00074 00075 bool empty; 00076 int index_of_first; 00077 int matrix_row_num; 00078 int index; 00079 00080 mDot* _dot; 00081 WriteFile* _fh; 00082 }; 00083 #endif 00084 #endif // _FRAGMENTATION_MATH_H
Generated on Wed Jul 13 2022 11:43:06 by
1.7.2


