working version

Dependencies:   mbed mbed-rtos SimpleDMA FreescaleIAP eeprom

Fork of CDMS_CODE_FM_28JAN2017 by samp Srinivasan

Committer:
samp1234
Date:
Sun Apr 03 15:35:53 2022 +0000
Revision:
357:f3d48d62e00e
Parent:
352:022c513aee03
First commit test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aniruddhv 262:752c8689944a 1 #define RESET_CDMS_TC {\
aniruddhv 262:752c8689944a 2 Base_tc *RESET_tc = new Short_tc;\
aniruddhv 262:752c8689944a 3 RESET_tc->next_TC = NULL;\
aniruddhv 262:752c8689944a 4 PUTshort_or_long(RESET_tc,SHORT_TC_CODE);\
aniruddhv 262:752c8689944a 5 PUTcrc_pass(RESET_tc,0x1);\
aniruddhv 262:752c8689944a 6 PUTexec_status(RESET_tc,0);\
aniruddhv 262:752c8689944a 7 RESET_tc->TC_string[0] = 0x01;\
aniruddhv 262:752c8689944a 8 RESET_tc->TC_string[1] = 0x81;\
aniruddhv 262:752c8689944a 9 RESET_tc->TC_string[2] = 0x81;\
aniruddhv 262:752c8689944a 10 RESET_tc->TC_string[3] = 0x38;\
aniruddhv 262:752c8689944a 11 RESET_tc->TC_string[4] = 0;\
aniruddhv 262:752c8689944a 12 RESET_tc->TC_string[5] = 0;\
aniruddhv 262:752c8689944a 13 RESET_tc->TC_string[6] = 0;\
aniruddhv 262:752c8689944a 14 RESET_tc->TC_string[7] = 0;\
aniruddhv 262:752c8689944a 15 RESET_tc->TC_string[8] = 0;\
aniruddhv 262:752c8689944a 16 uint16_t crc16 = crc16_gen(RESET_tc->TC_string, 9);\
aniruddhv 262:752c8689944a 17 RESET_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\
aniruddhv 262:752c8689944a 18 RESET_tc->TC_string[10] = (crc16 & 0x00FF);\
aniruddhv 262:752c8689944a 19 Base_tm *tm_ptr = NULL;\
aniruddhv 262:752c8689944a 20 tm_ptr = FCTN_CDMS_RLY_TMTC(RESET_tc);\
aniruddhv 262:752c8689944a 21 delete RESET_tc;\
aniruddhv 262:752c8689944a 22 /*DELETE THE TM AFTER USE*/\
aniruddhv 262:752c8689944a 23 Base_tm *del_tm = tm_ptr;\
aniruddhv 262:752c8689944a 24 while( del_tm != NULL ){\
aniruddhv 262:752c8689944a 25 Base_tm *temp = del_tm->next_TM;\
aniruddhv 262:752c8689944a 26 delete del_tm;\
aniruddhv 262:752c8689944a 27 del_tm = temp;\
aniruddhv 262:752c8689944a 28 }\
aniruddhv 262:752c8689944a 29 }
aniruddhv 262:752c8689944a 30
aniruddhv 262:752c8689944a 31 #define resume_bcn {\
aniruddhv 262:752c8689944a 32 Base_tc *beacon_tc = new Long_tc;\
aniruddhv 262:752c8689944a 33 beacon_tc->next_TC = NULL;\
aniruddhv 262:752c8689944a 34 PUTshort_or_long(beacon_tc,LONG_TC_CODE);\
aniruddhv 262:752c8689944a 35 PUTcrc_pass(beacon_tc,0x1);\
aniruddhv 262:752c8689944a 36 PUTexec_status(beacon_tc,0);\
aniruddhv 262:752c8689944a 37 beacon_tc->TC_string[0] = 0x01;\
aniruddhv 262:752c8689944a 38 beacon_tc->TC_string[1] = BCN_APID_SOURCE;\
aniruddhv 262:752c8689944a 39 beacon_tc->TC_string[2] = BCN_SERVICE;\
aniruddhv 262:752c8689944a 40 beacon_tc->TC_string[3] = 0xE2;\
aniruddhv 262:752c8689944a 41 beacon_tc->TC_string[4] = 0x00;\
aniruddhv 262:752c8689944a 42 beacon_tc->TC_string[5] = 0;\
aniruddhv 262:752c8689944a 43 beacon_tc->TC_string[6] = 0;\
aniruddhv 262:752c8689944a 44 beacon_tc->TC_string[7] = 0;\
aniruddhv 262:752c8689944a 45 beacon_tc->TC_string[8] = 0;\
aniruddhv 262:752c8689944a 46 uint16_t crc16 = crc16_gen(beacon_tc->TC_string, 9);\
aniruddhv 262:752c8689944a 47 beacon_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\
aniruddhv 262:752c8689944a 48 beacon_tc->TC_string[10] = (crc16 & 0x00FF);\
aniruddhv 262:752c8689944a 49 for(int i = 11; i < 135; i++){\
aniruddhv 262:752c8689944a 50 beacon_tc->TC_string[i] = 0;\
aniruddhv 262:752c8689944a 51 }\
aniruddhv 262:752c8689944a 52 Base_tm *tm_ptr = NULL;\
aniruddhv 262:752c8689944a 53 tm_ptr = FCTN_CDMS_RLY_TMTC(beacon_tc);\
aniruddhv 262:752c8689944a 54 delete beacon_tc;\
aniruddhv 262:752c8689944a 55 /*DELETE THE TM AFTER USE*/\
aniruddhv 262:752c8689944a 56 Base_tm *del_tm = tm_ptr;\
aniruddhv 262:752c8689944a 57 int overCount = 0;\
aniruddhv 262:752c8689944a 58 while( del_tm != NULL ){\
aniruddhv 262:752c8689944a 59 if( (overCount < TM_OVERFLOW_CONSTANT) ){\
aniruddhv 262:752c8689944a 60 Base_tm *temp = del_tm->next_TM;\
aniruddhv 262:752c8689944a 61 delete del_tm;\
aniruddhv 262:752c8689944a 62 del_tm = temp;\
aniruddhv 262:752c8689944a 63 ++overCount;\
aniruddhv 262:752c8689944a 64 }\
aniruddhv 262:752c8689944a 65 else{\
aniruddhv 262:752c8689944a 66 RESET_CDMS;\
aniruddhv 262:752c8689944a 67 break;\
aniruddhv 262:752c8689944a 68 }\
aniruddhv 262:752c8689944a 69 }\
aniruddhv 262:752c8689944a 70 }
aniruddhv 262:752c8689944a 71
shreeshas95 4:104dd82c99b8 72 #define COM_POWER_OFF_TX {\
ee12b079 295:699801854b71 73 /*gPC.puts("Inside COM_POWER_OFF_TX\r\n");*/\
samp1234 352:022c513aee03 74 COM_DATA_fromuC_ENAIN = 0;\
samp1234 352:022c513aee03 75 COM_DATA_fromISO_ENAOUT=0;\
aniruddhv 262:752c8689944a 76 COM_TX_CNTRL = 0;\
shreeshas95 4:104dd82c99b8 77 RX1M.attach(&rx_read, Serial::RxIrq);\
shreeshas95 4:104dd82c99b8 78 gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\
aniruddhv 262:752c8689944a 79 RF_SW_CNTRL_BCN = 1;\
aniruddhv 262:752c8689944a 80 Thread::wait(25);\
aniruddhv 262:752c8689944a 81 RF_SW_CNTRL_BCN = 0;\
ee12b079 319:c11a52b91d25 82 gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);/*RF_SW_STATUS_FLAG set to RF_COM_BCN*/\
aniruddhv 262:752c8689944a 83 if( gFLAGS & COM_AUTO_POWER_OFF_BAE_FLAG ){\
ee12b079 295:699801854b71 84 /*gPC.puts("powering on bae\r\n")*/;\
chaithanyarss 333:cddef120cae3 85 SW_ON_BAE();\
aniruddhv 262:752c8689944a 86 gFLAGS & (~COM_AUTO_POWER_OFF_BAE_FLAG);\
aniruddhv 264:f7d8f9f361e3 87 gPC.puts("resumning bcn\r\n");\
aniruddhv 262:752c8689944a 88 resume_bcn;\
aniruddhv 262:752c8689944a 89 }\
aniruddhv 262:752c8689944a 90 else{\
aniruddhv 264:f7d8f9f361e3 91 if( /*gFLAGS & BAE_SW_EN_FLAG*/true ){\
aniruddhv 264:f7d8f9f361e3 92 gPC.puts("resumning bcn2\r\n");\
aniruddhv 262:752c8689944a 93 resume_bcn;\
aniruddhv 262:752c8689944a 94 }\
aniruddhv 262:752c8689944a 95 }\
shreeshas95 4:104dd82c99b8 96 gFLAGS = gFLAGS & (~COM_PA_HOT_FLAG);\
aniruddhv 262:752c8689944a 97 gFLAGS = gFLAGS & (~COM_PA_OC_FLAG);\
shreeshas95 4:104dd82c99b8 98 gCOM_PA_COOLING_TIMEOUT.detach();\
shreeshas95 4:104dd82c99b8 99 gFLAGS = gFLAGS & (~COM_TX_FLAG);\
aniruddhv 262:752c8689944a 100 gFLAGS = gFLAGS & (~COM_SESSION_TIMEOUT_FLAG);\
ee12b079 295:699801854b71 101 /*gPC.puts("completed com_power_off tx\r\n")*/;\
shreeshas95 4:104dd82c99b8 102 }