for frequency correction testing
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Flash.h@259:066a7abd2a5f, 2016-07-12 (annotated)
- Committer:
- ee12b079
- Date:
- Tue Jul 12 17:30:04 2016 +0000
- Revision:
- 259:066a7abd2a5f
- Parent:
- 257:7d404e9dc9e2
- Child:
- 261:1e54415b34d3
adding chaitanya's changes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aniruddhv | 52:0bd68655c651 | 1 | #include "FreescaleIAP.h" |
aniruddhv | 52:0bd68655c651 | 2 | |
ee12b079 | 259:066a7abd2a5f | 3 | void FCTN_CDMS_WR_FLASH(uint16_t , uint32_t); |
chaithanyarss | 257:7d404e9dc9e2 | 4 | int strt_add = flash_size() - (2*SECTOR_SIZE); |
chaithanyarss | 257:7d404e9dc9e2 | 5 | uint32_t flasharray[32]; //256+(3*1024) |
chaithanyarss | 257:7d404e9dc9e2 | 6 | uint32_t INITIAL_FLASH[32]; |
chaithanyarss | 257:7d404e9dc9e2 | 7 | /*corrected*/ |
chaithanyarss | 257:7d404e9dc9e2 | 8 | int *nativeflash = (int*)strt_add; |
chaithanyarss | 257:7d404e9dc9e2 | 9 | |
chaithanyarss | 257:7d404e9dc9e2 | 10 | void FLASH_INI() |
chaithanyarss | 257:7d404e9dc9e2 | 11 | { |
chaithanyarss | 257:7d404e9dc9e2 | 12 | uint32_t read[32]; |
chaithanyarss | 257:7d404e9dc9e2 | 13 | for(int i=0;i<32;i++) |
chaithanyarss | 257:7d404e9dc9e2 | 14 | { |
chaithanyarss | 257:7d404e9dc9e2 | 15 | read[i] = nativeflash[i]; |
chaithanyarss | 257:7d404e9dc9e2 | 16 | } |
chaithanyarss | 257:7d404e9dc9e2 | 17 | |
chaithanyarss | 257:7d404e9dc9e2 | 18 | if(read[0] == -1) |
chaithanyarss | 257:7d404e9dc9e2 | 19 | for(int j=0;j<32;j++) |
chaithanyarss | 257:7d404e9dc9e2 | 20 | { |
chaithanyarss | 257:7d404e9dc9e2 | 21 | FCTN_CDMS_WR_FLASH(j,INITIAL_FLASH[j]); |
chaithanyarss | 257:7d404e9dc9e2 | 22 | } |
chaithanyarss | 257:7d404e9dc9e2 | 23 | else |
chaithanyarss | 257:7d404e9dc9e2 | 24 | { |
chaithanyarss | 257:7d404e9dc9e2 | 25 | for(int j=0;j<32;j++) |
chaithanyarss | 257:7d404e9dc9e2 | 26 | { |
chaithanyarss | 257:7d404e9dc9e2 | 27 | read[j] = nativeflash[j]; |
chaithanyarss | 257:7d404e9dc9e2 | 28 | } |
ee12b079 | 259:066a7abd2a5f | 29 | EPS_V_A_EN_STATUS = read[0]; |
ee12b079 | 259:066a7abd2a5f | 30 | BAE_SW_STATUS = read[1]; |
ee12b079 | 259:066a7abd2a5f | 31 | CDMS_SD_SW_STATUS = read[2]; |
ee12b079 | 259:066a7abd2a5f | 32 | PL_BEE_SW_STATUS = read[3]; |
ee12b079 | 259:066a7abd2a5f | 33 | PL_EPS_LATCH_SW_EN = read[4]; |
ee12b079 | 259:066a7abd2a5f | 34 | RTC_INIT_STATUS = read[5]; |
ee12b079 | 259:066a7abd2a5f | 35 | CDMS_RTC_DISABLE = read[6]; |
ee12b079 | 259:066a7abd2a5f | 36 | CDMS_RESET_COUNTER = read[7]; |
ee12b079 | 259:066a7abd2a5f | 37 | TIME_LATEST_CDSMS_RESET = read[8]; |
ee12b079 | 259:066a7abd2a5f | 38 | COM_TC_BYTES_LIMIT = read[9]; |
ee12b079 | 259:066a7abd2a5f | 39 | COM_RX_CURRENT_MAX = read[10]; |
ee12b079 | 259:066a7abd2a5f | 40 | COM_RX_DISABLE_TIMEOUT = read[11]; |
ee12b079 | 259:066a7abd2a5f | 41 | COM_PA_TMP_HIGH = read[12]; |
ee12b079 | 259:066a7abd2a5f | 42 | COM_PA_RECOVERY_TIMEOUT = read[13]; |
ee12b079 | 259:066a7abd2a5f | 43 | COM_SESSION_TIMEOUT = read[14]; |
ee12b079 | 259:066a7abd2a5f | 44 | COM_RSSI_MIN = read[15]; |
ee12b079 | 259:066a7abd2a5f | 45 | SD_LIB_BLK_CURRENT = read[16]; |
chaithanyarss | 257:7d404e9dc9e2 | 46 | } |
chaithanyarss | 257:7d404e9dc9e2 | 47 | |
chaithanyarss | 257:7d404e9dc9e2 | 48 | } |
aniruddhv | 52:0bd68655c651 | 49 | |
aniruddhv | 52:0bd68655c651 | 50 | /*Writing to the Flash*/ |
chaithanyarss | 257:7d404e9dc9e2 | 51 | void FCTN_CDMS_WR_FLASH(uint16_t j,uint32_t datablock) //j-position to write address ; fdata - flash data to be written |
aniruddhv | 52:0bd68655c651 | 52 | { |
chaithanyarss | 257:7d404e9dc9e2 | 53 | for(int i=0;i<5;i++) |
aniruddhv | 52:0bd68655c651 | 54 | { |
aniruddhv | 52:0bd68655c651 | 55 | flasharray[i]=nativeflash[i]; |
aniruddhv | 52:0bd68655c651 | 56 | } |
chaithanyarss | 257:7d404e9dc9e2 | 57 | flasharray[j]=datablock; |
aniruddhv | 52:0bd68655c651 | 58 | erase_sector(strt_add); |
chaithanyarss | 257:7d404e9dc9e2 | 59 | program_flash(strt_add, (char*)flasharray,32); |
aniruddhv | 52:0bd68655c651 | 60 | } |
aniruddhv | 52:0bd68655c651 | 61 | /*End*/ |
aniruddhv | 52:0bd68655c651 | 62 | |
chaithanyarss | 257:7d404e9dc9e2 | 63 | /*===================================================MMS Functions=================================================*/ |