for frequency correction testing

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Committer:
aniruddhv
Date:
Fri Apr 01 19:57:02 2016 +0000
Revision:
144:4c20fcc105ce
Parent:
137:489a93a04d6b
Child:
155:ca7365c03fd7
Removed errors

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aniruddhv 137:489a93a04d6b 1 #define power_on_bae {\
aniruddhv 144:4c20fcc105ce 2 Base_tc *power_on_BAE = new Short_tc;\
aniruddhv 144:4c20fcc105ce 3 power_on_BAE->next_TC = NULL;\
aniruddhv 144:4c20fcc105ce 4 PUTshort_or_long(power_on_BAE,SHORT_TC_CODE);\
aniruddhv 144:4c20fcc105ce 5 PUTcrc_pass(power_on_BAE,0x1);\
aniruddhv 144:4c20fcc105ce 6 PUTexec_status(power_on_BAE,0);\
aniruddhv 144:4c20fcc105ce 7 power_on_BAE->TC_string[0] = 0x01;\
aniruddhv 144:4c20fcc105ce 8 power_on_BAE->TC_string[1] = BAE_APID_SOURCE;\
aniruddhv 144:4c20fcc105ce 9 power_on_BAE->TC_string[2] = BAE_SERVICE;\
aniruddhv 144:4c20fcc105ce 10 power_on_BAE->TC_string[3] = BAE_POWER_ON_PID;\
aniruddhv 144:4c20fcc105ce 11 power_on_BAE->TC_string[4] = 0;\
aniruddhv 144:4c20fcc105ce 12 power_on_BAE->TC_string[5] = 0;\
aniruddhv 144:4c20fcc105ce 13 power_on_BAE->TC_string[6] = 0;\
aniruddhv 144:4c20fcc105ce 14 power_on_BAE->TC_string[7] = 0;\
aniruddhv 144:4c20fcc105ce 15 power_on_BAE->TC_string[8] = 0;\
aniruddhv 144:4c20fcc105ce 16 uint16_t crc16 = crc16_gen(power_on_BAE->TC_string, 9);\
aniruddhv 144:4c20fcc105ce 17 power_on_BAE->TC_string[9] = (crc16 & 0xFF00)>>8;\
aniruddhv 144:4c20fcc105ce 18 power_on_BAE->TC_string[10] = (crc16 & 0x00FF);\
aniruddhv 144:4c20fcc105ce 19 Base_tm *tm_ptr = new Short_tm;\
aniruddhv 144:4c20fcc105ce 20 tm_ptr = FCTN_CDMS_RLY_TMTC(power_on_BAE);\
aniruddhv 144:4c20fcc105ce 21 /*DELETE THE TM AFTER USE*/\
aniruddhv 144:4c20fcc105ce 22 Base_tm *del_tm = tm_ptr;\
aniruddhv 144:4c20fcc105ce 23 int overCount = 0;\
aniruddhv 144:4c20fcc105ce 24 while( del_tm != NULL ){\
aniruddhv 144:4c20fcc105ce 25 if( (overCount < TM_OVERFLOW_CONSTANT) ){\
aniruddhv 144:4c20fcc105ce 26 Base_tm *temp = del_tm->next_TM;\
aniruddhv 144:4c20fcc105ce 27 delete del_tm;\
aniruddhv 144:4c20fcc105ce 28 del_tm = temp;\
aniruddhv 144:4c20fcc105ce 29 ++overCount;\
aniruddhv 144:4c20fcc105ce 30 }\
aniruddhv 144:4c20fcc105ce 31 else{\
aniruddhv 144:4c20fcc105ce 32 /*PENDING: RESET CDMS: MEMORY LEAK FOUND*/\
aniruddhv 144:4c20fcc105ce 33 break;\
aniruddhv 144:4c20fcc105ce 34 }\
aniruddhv 144:4c20fcc105ce 35 }\
aniruddhv 137:489a93a04d6b 36 }
aniruddhv 137:489a93a04d6b 37
aniruddhv 137:489a93a04d6b 38 #define resume_bcn {\
aniruddhv 137:489a93a04d6b 39 Base_tc *beacon_tc = new Short_tc;\
aniruddhv 137:489a93a04d6b 40 beacon_tc->next_TC = NULL;\
aniruddhv 144:4c20fcc105ce 41 PUTshort_or_long(beacon_tc,SHORT_TC_CODE);\
aniruddhv 137:489a93a04d6b 42 PUTcrc_pass(beacon_tc,0x1);\
aniruddhv 137:489a93a04d6b 43 PUTexec_status(beacon_tc,0);\
aniruddhv 137:489a93a04d6b 44 beacon_tc->TC_string[0] = 0x01;\
aniruddhv 144:4c20fcc105ce 45 beacon_tc->TC_string[1] = BCN_APID_SOURCE;\
aniruddhv 144:4c20fcc105ce 46 beacon_tc->TC_string[2] = BCN_SERVICE;\
aniruddhv 144:4c20fcc105ce 47 beacon_tc->TC_string[3] = BCN_ENABLE_PID;\
aniruddhv 137:489a93a04d6b 48 beacon_tc->TC_string[4] = 0x00;\
aniruddhv 137:489a93a04d6b 49 beacon_tc->TC_string[5] = 0;\
aniruddhv 137:489a93a04d6b 50 beacon_tc->TC_string[6] = 0;\
aniruddhv 137:489a93a04d6b 51 beacon_tc->TC_string[7] = 0;\
aniruddhv 137:489a93a04d6b 52 beacon_tc->TC_string[8] = 0x01;\
aniruddhv 137:489a93a04d6b 53 uint16_t crc16 = crc16_gen(beacon_tc->TC_string, 9);\
aniruddhv 137:489a93a04d6b 54 beacon_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\
aniruddhv 137:489a93a04d6b 55 beacon_tc->TC_string[10] = (crc16 & 0x00FF);\
aniruddhv 137:489a93a04d6b 56 Base_tm *tm_ptr = new Short_tm;\
aniruddhv 137:489a93a04d6b 57 tm_ptr = FCTN_CDMS_RLY_TMTC(beacon_tc);\
aniruddhv 137:489a93a04d6b 58 }
aniruddhv 137:489a93a04d6b 59
shreeshas95 4:104dd82c99b8 60 #define COM_POWER_OFF_TX {\
aniruddhv 12:ffdb29353058 61 /*gPC.puts("Inside COM_POWER_OFF_TX\r\n");*/\
shreeshas95 4:104dd82c99b8 62 /*PENDING: POWER OFF TRANSMITTER*/\
aniruddhv 137:489a93a04d6b 63 /*power_on_com_tx_pin = 0;*/\
shreeshas95 4:104dd82c99b8 64 RX1M.attach(&rx_read, Serial::RxIrq);\
shreeshas95 4:104dd82c99b8 65 gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\
aniruddhv 144:4c20fcc105ce 66 RF_SW_CNTRL_BCN = 1;\
aniruddhv 144:4c20fcc105ce 67 Thread::wait(25);\
aniruddhv 144:4c20fcc105ce 68 RF_SW_CNTRL_BCN = 0;\
aniruddhv 137:489a93a04d6b 69 gFLAGS = gFLAGS | RF_SW_STATUS_FLAG;\
aniruddhv 137:489a93a04d6b 70 if( gFLAGS & COM_AUTO_POWER_OFF_BAE_FLAG ){\
aniruddhv 137:489a93a04d6b 71 power_on_bae;\
aniruddhv 137:489a93a04d6b 72 gFLAGS = gFLAGS | BAE_SW_EN_FLAG;\
aniruddhv 137:489a93a04d6b 73 gFLAGS & (~COM_AUTO_POWER_OFF_BAE_FLAG);\
aniruddhv 137:489a93a04d6b 74 resume_bcn;\
aniruddhv 137:489a93a04d6b 75 }\
aniruddhv 137:489a93a04d6b 76 else{\
aniruddhv 137:489a93a04d6b 77 if( gFLAGS & BAE_SW_EN_FLAG ){\
aniruddhv 137:489a93a04d6b 78 resume_bcn;\
aniruddhv 137:489a93a04d6b 79 }\
aniruddhv 137:489a93a04d6b 80 }\
shreeshas95 4:104dd82c99b8 81 gFLAGS = gFLAGS & (~COM_PA_HOT_FLAG);\
shreeshas95 4:104dd82c99b8 82 gCOM_PA_COOLING_TIMEOUT.detach();\
shreeshas95 4:104dd82c99b8 83 gFLAGS = gFLAGS & (~COM_TX_FLAG);\
aniruddhv 137:489a93a04d6b 84 gFLAGS = gFLAGS & (~COM_SESSION_TIMEOUT_FLAG);\
aniruddhv 137:489a93a04d6b 85 /*gPC.puts("completed com_power_off tx\r\n");*/\
shreeshas95 4:104dd82c99b8 86 }