working version

Dependencies:   mbed mbed-rtos SimpleDMA FreescaleIAP eeprom

Fork of CDMS_CODE_FM_28JAN2017 by samp Srinivasan

Committer:
aniruddhv
Date:
Sun Jul 03 05:37:25 2016 +0000
Revision:
212:3d13a06bcd3a
Parent:
211:77bee0cbebfe
ACK_L1, P_COM_HK, Changed BAE TCs to long, COM_POWER_ON_TX, after_cooling_timeout, Update TC status, Execute OBOSC, Removed OBSRS  execution from MNG_TMTC, RCV_TC in ThreadsandFunctions to include byte_limit

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 212:3d13a06bcd3a 19 Base_tm *tm_ptr = NULL;\
aniruddhv 212:3d13a06bcd3a 20 tm_ptr = FCTN_CDMS_RLY_TMTC(RESET_tc);\
aniruddhv 211:77bee0cbebfe 21 delete RESET_tc;\
aniruddhv 212:3d13a06bcd3a 22 /*DELETE THE TM AFTER USE*/\
aniruddhv 212:3d13a06bcd3a 23 Base_tm *del_tm = tm_ptr;\
aniruddhv 212:3d13a06bcd3a 24 while( del_tm != NULL ){\
aniruddhv 212:3d13a06bcd3a 25 Base_tm *temp = del_tm->next_TM;\
aniruddhv 212:3d13a06bcd3a 26 delete del_tm;\
aniruddhv 212:3d13a06bcd3a 27 del_tm = temp;\
aniruddhv 212:3d13a06bcd3a 28 }\
aniruddhv 155:ca7365c03fd7 29 }
aniruddhv 155:ca7365c03fd7 30
aniruddhv 137:489a93a04d6b 31 #define power_on_bae {\
aniruddhv 144:4c20fcc105ce 32 Base_tc *power_on_BAE = new Short_tc;\
aniruddhv 144:4c20fcc105ce 33 power_on_BAE->next_TC = NULL;\
aniruddhv 144:4c20fcc105ce 34 PUTshort_or_long(power_on_BAE,SHORT_TC_CODE);\
aniruddhv 144:4c20fcc105ce 35 PUTcrc_pass(power_on_BAE,0x1);\
aniruddhv 144:4c20fcc105ce 36 PUTexec_status(power_on_BAE,0);\
aniruddhv 144:4c20fcc105ce 37 power_on_BAE->TC_string[0] = 0x01;\
aniruddhv 144:4c20fcc105ce 38 power_on_BAE->TC_string[1] = BAE_APID_SOURCE;\
aniruddhv 144:4c20fcc105ce 39 power_on_BAE->TC_string[2] = BAE_SERVICE;\
aniruddhv 144:4c20fcc105ce 40 power_on_BAE->TC_string[3] = BAE_POWER_ON_PID;\
aniruddhv 144:4c20fcc105ce 41 power_on_BAE->TC_string[4] = 0;\
aniruddhv 144:4c20fcc105ce 42 power_on_BAE->TC_string[5] = 0;\
aniruddhv 144:4c20fcc105ce 43 power_on_BAE->TC_string[6] = 0;\
aniruddhv 144:4c20fcc105ce 44 power_on_BAE->TC_string[7] = 0;\
aniruddhv 144:4c20fcc105ce 45 power_on_BAE->TC_string[8] = 0;\
aniruddhv 144:4c20fcc105ce 46 uint16_t crc16 = crc16_gen(power_on_BAE->TC_string, 9);\
aniruddhv 144:4c20fcc105ce 47 power_on_BAE->TC_string[9] = (crc16 & 0xFF00)>>8;\
aniruddhv 144:4c20fcc105ce 48 power_on_BAE->TC_string[10] = (crc16 & 0x00FF);\
aniruddhv 212:3d13a06bcd3a 49 Base_tm *tm_ptr = NULL;\
aniruddhv 144:4c20fcc105ce 50 tm_ptr = FCTN_CDMS_RLY_TMTC(power_on_BAE);\
aniruddhv 211:77bee0cbebfe 51 delete power_on_BAE;\
aniruddhv 144:4c20fcc105ce 52 /*DELETE THE TM AFTER USE*/\
aniruddhv 144:4c20fcc105ce 53 Base_tm *del_tm = tm_ptr;\
aniruddhv 144:4c20fcc105ce 54 int overCount = 0;\
aniruddhv 144:4c20fcc105ce 55 while( del_tm != NULL ){\
aniruddhv 144:4c20fcc105ce 56 if( (overCount < TM_OVERFLOW_CONSTANT) ){\
aniruddhv 144:4c20fcc105ce 57 Base_tm *temp = del_tm->next_TM;\
aniruddhv 144:4c20fcc105ce 58 delete del_tm;\
aniruddhv 144:4c20fcc105ce 59 del_tm = temp;\
aniruddhv 144:4c20fcc105ce 60 ++overCount;\
aniruddhv 144:4c20fcc105ce 61 }\
aniruddhv 144:4c20fcc105ce 62 else{\
aniruddhv 155:ca7365c03fd7 63 RESET_CDMS;\
aniruddhv 144:4c20fcc105ce 64 break;\
aniruddhv 144:4c20fcc105ce 65 }\
aniruddhv 144:4c20fcc105ce 66 }\
aniruddhv 137:489a93a04d6b 67 }
aniruddhv 137:489a93a04d6b 68
aniruddhv 137:489a93a04d6b 69 #define resume_bcn {\
aniruddhv 212:3d13a06bcd3a 70 Base_tc *beacon_tc = new Long_tc;\
aniruddhv 137:489a93a04d6b 71 beacon_tc->next_TC = NULL;\
aniruddhv 212:3d13a06bcd3a 72 PUTshort_or_long(beacon_tc,LONG_TC_CODE);\
aniruddhv 137:489a93a04d6b 73 PUTcrc_pass(beacon_tc,0x1);\
aniruddhv 137:489a93a04d6b 74 PUTexec_status(beacon_tc,0);\
aniruddhv 137:489a93a04d6b 75 beacon_tc->TC_string[0] = 0x01;\
aniruddhv 144:4c20fcc105ce 76 beacon_tc->TC_string[1] = BCN_APID_SOURCE;\
aniruddhv 144:4c20fcc105ce 77 beacon_tc->TC_string[2] = BCN_SERVICE;\
aniruddhv 160:ef280e6dda44 78 beacon_tc->TC_string[3] = 0xE2;\
aniruddhv 137:489a93a04d6b 79 beacon_tc->TC_string[4] = 0x00;\
aniruddhv 137:489a93a04d6b 80 beacon_tc->TC_string[5] = 0;\
aniruddhv 137:489a93a04d6b 81 beacon_tc->TC_string[6] = 0;\
aniruddhv 137:489a93a04d6b 82 beacon_tc->TC_string[7] = 0;\
aniruddhv 160:ef280e6dda44 83 beacon_tc->TC_string[8] = 0;\
aniruddhv 137:489a93a04d6b 84 uint16_t crc16 = crc16_gen(beacon_tc->TC_string, 9);\
aniruddhv 137:489a93a04d6b 85 beacon_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\
aniruddhv 137:489a93a04d6b 86 beacon_tc->TC_string[10] = (crc16 & 0x00FF);\
aniruddhv 212:3d13a06bcd3a 87 for(int i = 11; i < 135; i++){\
aniruddhv 212:3d13a06bcd3a 88 beacon_tc->TC_string[i] = 0;\
aniruddhv 212:3d13a06bcd3a 89 }\
aniruddhv 212:3d13a06bcd3a 90 Base_tm *tm_ptr = NULL;\
aniruddhv 137:489a93a04d6b 91 tm_ptr = FCTN_CDMS_RLY_TMTC(beacon_tc);\
aniruddhv 211:77bee0cbebfe 92 delete beacon_tc;\
aniruddhv 212:3d13a06bcd3a 93 /*DELETE THE TM AFTER USE*/\
aniruddhv 212:3d13a06bcd3a 94 Base_tm *del_tm = tm_ptr;\
aniruddhv 212:3d13a06bcd3a 95 int overCount = 0;\
aniruddhv 212:3d13a06bcd3a 96 while( del_tm != NULL ){\
aniruddhv 212:3d13a06bcd3a 97 if( (overCount < TM_OVERFLOW_CONSTANT) ){\
aniruddhv 212:3d13a06bcd3a 98 Base_tm *temp = del_tm->next_TM;\
aniruddhv 212:3d13a06bcd3a 99 delete del_tm;\
aniruddhv 212:3d13a06bcd3a 100 del_tm = temp;\
aniruddhv 212:3d13a06bcd3a 101 ++overCount;\
aniruddhv 212:3d13a06bcd3a 102 }\
aniruddhv 212:3d13a06bcd3a 103 else{\
aniruddhv 212:3d13a06bcd3a 104 RESET_CDMS;\
aniruddhv 212:3d13a06bcd3a 105 break;\
aniruddhv 212:3d13a06bcd3a 106 }\
aniruddhv 212:3d13a06bcd3a 107 }\
aniruddhv 137:489a93a04d6b 108 }
aniruddhv 137:489a93a04d6b 109
shreeshas95 4:104dd82c99b8 110 #define COM_POWER_OFF_TX {\
aniruddhv 12:ffdb29353058 111 /*gPC.puts("Inside COM_POWER_OFF_TX\r\n");*/\
aniruddhv 155:ca7365c03fd7 112 COM_TX_CNTRL = 0;\
shreeshas95 4:104dd82c99b8 113 RX1M.attach(&rx_read, Serial::RxIrq);\
shreeshas95 4:104dd82c99b8 114 gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\
aniruddhv 144:4c20fcc105ce 115 RF_SW_CNTRL_BCN = 1;\
aniruddhv 144:4c20fcc105ce 116 Thread::wait(25);\
aniruddhv 144:4c20fcc105ce 117 RF_SW_CNTRL_BCN = 0;\
aniruddhv 137:489a93a04d6b 118 gFLAGS = gFLAGS | RF_SW_STATUS_FLAG;\
aniruddhv 137:489a93a04d6b 119 if( gFLAGS & COM_AUTO_POWER_OFF_BAE_FLAG ){\
aniruddhv 137:489a93a04d6b 120 power_on_bae;\
aniruddhv 137:489a93a04d6b 121 gFLAGS = gFLAGS | BAE_SW_EN_FLAG;\
aniruddhv 137:489a93a04d6b 122 gFLAGS & (~COM_AUTO_POWER_OFF_BAE_FLAG);\
aniruddhv 137:489a93a04d6b 123 resume_bcn;\
aniruddhv 137:489a93a04d6b 124 }\
aniruddhv 137:489a93a04d6b 125 else{\
aniruddhv 137:489a93a04d6b 126 if( gFLAGS & BAE_SW_EN_FLAG ){\
aniruddhv 137:489a93a04d6b 127 resume_bcn;\
aniruddhv 137:489a93a04d6b 128 }\
aniruddhv 137:489a93a04d6b 129 }\
shreeshas95 4:104dd82c99b8 130 gFLAGS = gFLAGS & (~COM_PA_HOT_FLAG);\
aniruddhv 212:3d13a06bcd3a 131 gFLAGS = gFLAGS & (~COM_PA_OC_FLAG);\
shreeshas95 4:104dd82c99b8 132 gCOM_PA_COOLING_TIMEOUT.detach();\
shreeshas95 4:104dd82c99b8 133 gFLAGS = gFLAGS & (~COM_TX_FLAG);\
aniruddhv 137:489a93a04d6b 134 gFLAGS = gFLAGS & (~COM_SESSION_TIMEOUT_FLAG);\
aniruddhv 137:489a93a04d6b 135 /*gPC.puts("completed com_power_off tx\r\n");*/\
shreeshas95 4:104dd82c99b8 136 }