vr1.1
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of CDMS_RTOS_v1_1 by
Diff: TC.cpp
- Revision:
- 11:d6dc9074075b
- Parent:
- 8:607ae92fa6af
- Child:
- 12:cb3ee1ac3638
--- a/TC.cpp Sat Jul 04 10:48:18 2015 +0000 +++ b/TC.cpp Mon Jul 06 06:25:14 2015 +0000 @@ -78,43 +78,62 @@ case 1: { sc.printf("READ FROM MEMORY\r\r\n"); - if(appdata[0]==2){ //appdata[0] is pid - sc.printf("RD_L_FLASH1\r\r\n"); //tm is lmb - //P_CDMS_RD_FLASH - - for(int i=0;i<128;i++){ - telemetry_type1[i]=long_memory_block_tm[i-1]; - } - for(int i=128;i<130;i++){ - telemetry_type1[i]=crc_tm[i-128]; - } + if(appdata[0]==2) + { //appdata[0] is pid + sc.printf("RD_L_FLASH1\r\r\n"); //tm is lmb + if((appdata[4]<<8|appdata[5])<=4+((appdata[2]<<8)|appdata[3])) + { + for(uint16_t i=((appdata[2]<<8)|appdata[3]);i<(appdata[4]<<8|appdata[5])+1;i++) + { + long_memory_block_tm[i]=FCTN_CDMS_RD_FLASH(i); + } + } + else + { + for(uint16_t i=((appdata[2]<<8)|appdata[3]);i<(appdata[2]<<8|appdata[3])+5;i++) + { + long_memory_block_tm[i]=FCTN_CDMS_RD_FLASH(i); + } + } + for(int i=0;i<128;i++) + { + telemetry_type1[i]=long_memory_block_tm[i-1]; + } + for(int i=128;i<130;i++) + { + telemetry_type1[i]=crc_tm[i-128]; + } } - else if ((appdata[0]&0xF0)==0x10){ - sc.printf("RD_L_FLASH2\r\r\n"); //tm is lmb + else if ((appdata[0]&0xF0)==0x10) + { + sc.printf("RD_L_FLASH2\r\r\n"); //tm is lmb + for(int i=0;i<128;i++) + { + telemetry_type1[i]=long_memory_block_tm[i-1]; + } + for(int i=128;i<130;i++) + { + telemetry_type1[i]=crc_tm[i-128]; + } + } + else if (appdata[0]==0x22) + { + sc.printf("RD_S_FLASH1\r\r\n"); //tm is smb //P_CDMS_RD_FLASH - for(int i=0;i<128;i++){ - telemetry_type1[i]=long_memory_block_tm[i-1]; - } - for(int i=128;i<130;i++){ - telemetry_type1[i]=crc_tm[i-128]; - } - } - else if (appdata[0]==0x22){ - sc.printf("RD_S_FLASH1\r\r\n"); //tm is smb - //P_CDMS_RD_FLASH - - telemetry_type2[0]=tmid3_spr_tm; - telemetry_type2[1]=tc_pac_seq_cnt_tm; - telemetry_type2[2]=tm_pac_seq_cnt_tm; - for(int i=4;i<11;i++){ - telemetry_type2[i]=small_memory_block_tm[i-4]; + telemetry_type2[0]=tmid3_spr_tm; + telemetry_type2[1]=tc_pac_seq_cnt_tm; + telemetry_type2[2]=tm_pac_seq_cnt_tm; + for(int i=4;i<11;i++) + { + telemetry_type2[i]=small_memory_block_tm[i-4]; } - for(int i=11;i<13;i++){ - telemetry_type2[i]=crc_tm[i-11]; + for(int i=11;i<13;i++) + { + telemetry_type2[i]=crc_tm[i-11]; } - } - else if ((appdata[0]&0xF0)==0x30){ + } + else if ((appdata[0]&0xF0)==0x30){ sc.printf("RD_S_FLASH2\r\r\n"); //tm is smb //P_CDMS_RD_FLASH