June 30

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Committer:
chaithanyarss
Date:
Sat Jul 02 13:36:18 2016 +0000
Revision:
191:d14b1c783736
Parent:
160:ef280e6dda44
;

Who changed what in which revision?

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