Latest FM Code with EEPROM
Dependencies: FreescaleIAP SimpleDMA eeprom mbed-rtos mbed
Fork of CDMS_QM_03MAR2017_Flash_with_obsrs by
Diff: COM_MNG_TMTC.h
- Revision:
- 345:cdde554477cd
- Parent:
- 344:1675dbde0bae
diff -r 1675dbde0bae -r cdde554477cd COM_MNG_TMTC.h --- a/COM_MNG_TMTC.h Sun Jan 08 14:52:55 2017 +0000 +++ b/COM_MNG_TMTC.h Sun Jan 22 03:12:16 2017 +0000 @@ -480,14 +480,12 @@ scp_threshold_m0[z] = tc_ptr->TC_string[z+5]; for(uint8_t z=24;z<32;z++) scp_threshold_m0[z+8] = tc_ptr->TC_string[z+5]; - //int strt_add = flash_size() - (11*SECTOR_SIZE); - //uint32_t flasharray[32] = {0}; for(uint8_t z=0;z<24;z++) - flasharray_thres[z] = scp_threshold_m0[z]; + flasharray_thres[z] = scp_thresfhold_m0[z]; for(uint8_t z=24;z<32;z++) flasharray_thres[z] = scp_threshold_m0[z+8]; - //erase_sector(strt_add_thres); - //program_flash(strt_add_thres, (char*)flasharray_thres,32); + + THRES_WRITE_TO EEPROM(mid, (int8_t*)flasharray_thres); Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); @@ -497,12 +495,11 @@ { for(uint8_t z=0;z<12;z++) scp_threshold_m0[z+40] = tc_ptr->TC_string[z+5]; - //int strt_add = flash_size() - (10*SECTOR_SIZE); - //uint32_t flasharray[32] = {0}; for(uint8_t z=0;z<12;z++) flasharray_thres[z] = scp_threshold_m0[z+40]; - //erase_sector(strt_add_thres+SECTOR_SIZE); - //program_flash(strt_add_thres+SECTOR_SIZE, (char*)flasharray_thres,32); + + THRES_WRITE_TO EEPROM(mid, (int8_t*)flasharray_thres); + Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short; @@ -511,12 +508,11 @@ { for(uint8_t z=0;z<32;z++) scp_threshold_m1[z] = tc_ptr->TC_string[z+5]; - //int strt_add = flash_size() - (9*SECTOR_SIZE); - //uint32_t flasharray[32] = {0}; for(uint8_t z=0;z<32;z++) flasharray_thres[z] = scp_threshold_m1[z]; - //erase_sector(strt_add_thres+(2*SECTOR_SIZE)); - //program_flash(strt_add_thres+(2*SECTOR_SIZE), (char*)flasharray_thres,32); + + THRES_WRITE_TO EEPROM(mid, (int8_t*)flasharray_thres); + Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short; @@ -525,12 +521,11 @@ { for(uint8_t z=0;z<20;z++) scp_threshold_m1[z+32] = tc_ptr->TC_string[z+5]; - //int strt_add = flash_size() - (8*SECTOR_SIZE); - //uint32_t flasharray[32] = {0}; for(uint8_t z=0;z<20;z++) flasharray_thres[z] = scp_threshold_m1[z+32]; - //erase_sector(strt_add_thres+(3*SECTOR_SIZE)); - //program_flash(strt_add_thres+(3*SECTOR_SIZE), (char*)flasharray_thres,32); + + THRES_WRITE_TO EEPROM(mid, (int8_t*)flasharray_thres); + Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short; @@ -546,8 +541,6 @@ scp_sfp_threshold_m0_2[0] = tc_ptr->TC_string[14]; scp_sfp_threshold_m0_2[1] = tc_ptr->TC_string[15]; scp_sfp_threshold_m0_2[2] = tc_ptr->TC_string[16]; - //int strt_add = flash_size() - (7*SECTOR_SIZE); - //uint32_t flasharray[32] = {0}; flasharray_thres[0] = scp_threshold_m0_1[7]; flasharray_thres[1] = scp_threshold_m0_1[5]; flasharray_thres[2] = scp_threshold_m0_1[8]; @@ -557,8 +550,9 @@ flasharray_thres[9] = scp_sfp_threshold_m0_2[0]; flasharray_thres[10] = scp_sfp_threshold_m0_2[1]; flasharray_thres[11] = scp_sfp_threshold_m0_2[2]; - //erase_sector(strt_add_thres+(4*SECTOR_SIZE)); - //program_flash(strt_add_thres+(4*SECTOR_SIZE), (char*)flasharray_thres,32); + + THRES_WRITE_TO EEPROM(mid, (int8_t*)flasharray_thres); + Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short; @@ -569,14 +563,13 @@ sfp_threshold_m0[z] = tc_ptr->TC_string[z+5]; for(uint8_t z=24;z<32;z++) sfp_threshold_m0[z+8] = tc_ptr->TC_string[z+5]; - //int strt_add_thres = flash_size() - (6*SECTOR_SIZE); - //uint32_t flasharray_thres[32] = {0}; for(uint8_t z=0;z<24;z++) flasharray_thres[z] = sfp_threshold_m0[z]; for(uint8_t z=24;z<32;z++) flasharray_thres[z] = sfp_threshold_m0[z+8]; - //erase_sector(strt_add_thres+(5*SECTOR_SIZE)); - //program_flash(strt_add_thres+(5*SECTOR_SIZE), (char*)flasharray_thres,32); + + THRES_WRITE_TO EEPROM(mid, (int8_t*)flasharray_thres); + Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short; @@ -585,12 +578,11 @@ { for(uint8_t z=0;z<12;z++) sfp_threshold_m0[z+40] = tc_ptr->TC_string[z+5]; - //int strt_add_thres = flash_size() - (5*SECTOR_SIZE); - //uint32_t flasharray_thres[32] = {0}; for(uint8_t z=0;z<12;z++) flasharray_thres[z] = sfp_threshold_m0[z+40]; - //erase_sector(strt_add_thres+(6*SECTOR_SIZE)); - //program_flash(strt_add_thres+(6*SECTOR_SIZE), (char*)flasharray_thres,32); + + THRES_WRITE_TO EEPROM(mid, (int8_t*)flasharray_thres); + Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short; @@ -599,12 +591,11 @@ { for(uint8_t z=0;z<32;z++) sfp_threshold_m1[z] = tc_ptr->TC_string[z+5]; - //int strt_add_thres = flash_size() - (4*SECTOR_SIZE); - //uint32_t flasharray_thres[32] = {0}; for(uint8_t z=0;z<32;z++) flasharray_thres[z] = sfp_threshold_m1[z]; - //erase_sector(strt_add_thres+(7*SECTOR_SIZE)); - //program_flash(strt_add_thres+(7*SECTOR_SIZE), (char*)flasharray_thres,32); + + THRES_WRITE_TO EEPROM(mid, (int8_t*)flasharray_thres); + Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short; @@ -613,12 +604,11 @@ { for(uint8_t z=0;z<20;z++) sfp_threshold_m1[z+32] = tc_ptr->TC_string[z+5]; - //int strt_add_thres = flash_size() - (3*SECTOR_SIZE); - //uint32_t flasharray_thres[32] = {0}; for(uint8_t z=0;z<20;z++) flasharray_thres[z] = sfp_threshold_m1[z+32]; - //erase_sector(strt_add_thres+(8*SECTOR_SIZE)); - //program_flash(strt_add_thres+(8*SECTOR_SIZE), (char*)flasharray_thres,32); + + THRES_WRITE_TO EEPROM(mid, (int8_t*)flasharray_thres); + Base_tm *tm_ptr_short = new Short_tm; ACK_L234(tm_ptr_short,0xA0,GETpacket_seq_count(tc_ptr)); return tm_ptr_short;