CDMS code for testing sbc

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Committer:
aniruddhv
Date:
Mon Apr 11 12:10:59 2016 +0000
Revision:
155:ca7365c03fd7
Parent:
144:4c20fcc105ce
Child:
156:f661cf9e02d1
testing

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aniruddhv 144:4c20fcc105ce 1 #define SET_BCN_STANDBY(tm_ptr){\
aniruddhv 137:489a93a04d6b 2 Base_tc *beacon_tc = new Short_tc;\
aniruddhv 137:489a93a04d6b 3 beacon_tc->next_TC = NULL;\
aniruddhv 144:4c20fcc105ce 4 PUTshort_or_long(beacon_tc,SHORT_TC_CODE);\
aniruddhv 137:489a93a04d6b 5 PUTcrc_pass(beacon_tc,0x1);\
aniruddhv 137:489a93a04d6b 6 PUTexec_status(beacon_tc,0);\
aniruddhv 137:489a93a04d6b 7 beacon_tc->TC_string[0] = 0x01;\
aniruddhv 144:4c20fcc105ce 8 beacon_tc->TC_string[1] = BCN_APID_SOURCE;\
aniruddhv 144:4c20fcc105ce 9 beacon_tc->TC_string[2] = BCN_SERVICE;\
aniruddhv 144:4c20fcc105ce 10 beacon_tc->TC_string[3] = BCN_DISABLE_PID;\
aniruddhv 137:489a93a04d6b 11 beacon_tc->TC_string[4] = 0x00;\
aniruddhv 137:489a93a04d6b 12 beacon_tc->TC_string[5] = 0;\
aniruddhv 137:489a93a04d6b 13 beacon_tc->TC_string[6] = 0;\
aniruddhv 137:489a93a04d6b 14 beacon_tc->TC_string[7] = 0;\
aniruddhv 137:489a93a04d6b 15 beacon_tc->TC_string[8] = 0;\
aniruddhv 137:489a93a04d6b 16 uint16_t crc16 = crc16_gen(beacon_tc->TC_string, 9);\
aniruddhv 137:489a93a04d6b 17 beacon_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\
aniruddhv 137:489a93a04d6b 18 beacon_tc->TC_string[10] = (crc16 & 0x00FF);\
aniruddhv 137:489a93a04d6b 19 tm_ptr = FCTN_CDMS_RLY_TMTC(beacon_tc);\
aniruddhv 137:489a93a04d6b 20 }
aniruddhv 137:489a93a04d6b 21
aniruddhv 137:489a93a04d6b 22 #define reset_bae {\
aniruddhv 137:489a93a04d6b 23 Base_tc *reset_BAE = new Short_tc;\
aniruddhv 137:489a93a04d6b 24 reset_BAE->next_TC = NULL;\
aniruddhv 144:4c20fcc105ce 25 PUTshort_or_long(reset_BAE,SHORT_TC_CODE);\
aniruddhv 137:489a93a04d6b 26 PUTcrc_pass(reset_BAE,0x1);\
aniruddhv 137:489a93a04d6b 27 PUTexec_status(reset_BAE,0);\
aniruddhv 137:489a93a04d6b 28 reset_BAE->TC_string[0] = 0x01;\
aniruddhv 144:4c20fcc105ce 29 reset_BAE->TC_string[1] = BAE_APID_SOURCE;\
aniruddhv 144:4c20fcc105ce 30 reset_BAE->TC_string[2] = BAE_SERVICE;\
aniruddhv 144:4c20fcc105ce 31 reset_BAE->TC_string[3] = BAE_RESET_PID;\
aniruddhv 137:489a93a04d6b 32 reset_BAE->TC_string[4] = 0;\
aniruddhv 137:489a93a04d6b 33 reset_BAE->TC_string[5] = 0;\
aniruddhv 137:489a93a04d6b 34 reset_BAE->TC_string[6] = 0;\
aniruddhv 137:489a93a04d6b 35 reset_BAE->TC_string[7] = 0;\
aniruddhv 137:489a93a04d6b 36 reset_BAE->TC_string[8] = 0;\
aniruddhv 137:489a93a04d6b 37 uint16_t crc16 = crc16_gen(reset_BAE->TC_string, 9);\
aniruddhv 137:489a93a04d6b 38 reset_BAE->TC_string[9] = (crc16 & 0xFF00)>>8;\
aniruddhv 137:489a93a04d6b 39 reset_BAE->TC_string[10] = (crc16 & 0x00FF);\
aniruddhv 137:489a93a04d6b 40 Base_tm *tm_ptr = new Short_tm;\
aniruddhv 137:489a93a04d6b 41 tm_ptr = FCTN_CDMS_RLY_TMTC(reset_BAE);\
aniruddhv 137:489a93a04d6b 42 /*DELETE THE TM AFTER USE*/\
aniruddhv 144:4c20fcc105ce 43 Base_tm *del_tm = tm_ptr;\
aniruddhv 137:489a93a04d6b 44 int overCount = 0;\
aniruddhv 144:4c20fcc105ce 45 while( del_tm != NULL ){\
aniruddhv 137:489a93a04d6b 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 137:489a93a04d6b 50 ++overCount;\
aniruddhv 137:489a93a04d6b 51 }\
aniruddhv 137:489a93a04d6b 52 else{\
aniruddhv 155:ca7365c03fd7 53 RESET_CDMS;\
aniruddhv 137:489a93a04d6b 54 break;\
aniruddhv 137:489a93a04d6b 55 }\
aniruddhv 137:489a93a04d6b 56 }\
aniruddhv 137:489a93a04d6b 57 }
aniruddhv 137:489a93a04d6b 58
aniruddhv 137:489a93a04d6b 59 #define power_off_bae {\
aniruddhv 137:489a93a04d6b 60 Base_tc *power_off_BAE = new Short_tc;\
aniruddhv 137:489a93a04d6b 61 power_off_BAE->next_TC = NULL;\
aniruddhv 144:4c20fcc105ce 62 PUTshort_or_long(power_off_BAE,SHORT_TC_CODE);\
aniruddhv 137:489a93a04d6b 63 PUTcrc_pass(power_off_BAE,0x1);\
aniruddhv 137:489a93a04d6b 64 PUTexec_status(power_off_BAE,0);\
aniruddhv 137:489a93a04d6b 65 power_off_BAE->TC_string[0] = 0x01;\
aniruddhv 144:4c20fcc105ce 66 power_off_BAE->TC_string[1] = BAE_APID_SOURCE;\
aniruddhv 144:4c20fcc105ce 67 power_off_BAE->TC_string[2] = BAE_SERVICE;\
aniruddhv 144:4c20fcc105ce 68 power_off_BAE->TC_string[3] = BAE_POWER_OFF_PID;\
aniruddhv 137:489a93a04d6b 69 power_off_BAE->TC_string[4] = 0;\
aniruddhv 137:489a93a04d6b 70 power_off_BAE->TC_string[5] = 0;\
aniruddhv 137:489a93a04d6b 71 power_off_BAE->TC_string[6] = 0;\
aniruddhv 137:489a93a04d6b 72 power_off_BAE->TC_string[7] = 0;\
aniruddhv 137:489a93a04d6b 73 power_off_BAE->TC_string[8] = 0;\
aniruddhv 137:489a93a04d6b 74 uint16_t crc16 = crc16_gen(power_off_BAE->TC_string, 9);\
aniruddhv 137:489a93a04d6b 75 power_off_BAE->TC_string[9] = (crc16 & 0xFF00)>>8;\
aniruddhv 137:489a93a04d6b 76 power_off_BAE->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(power_off_BAE);\
aniruddhv 137:489a93a04d6b 79 /*DELETE THE TM AFTER USE*/\
aniruddhv 144:4c20fcc105ce 80 Base_tm *del_tm = tm_ptr;\
aniruddhv 137:489a93a04d6b 81 int overCount = 0;\
aniruddhv 144:4c20fcc105ce 82 while( del_tm != NULL ){\
aniruddhv 137:489a93a04d6b 83 if( (overCount < TM_OVERFLOW_CONSTANT) ){\
aniruddhv 144:4c20fcc105ce 84 Base_tm *temp = del_tm->next_TM;\
aniruddhv 144:4c20fcc105ce 85 delete del_tm;\
aniruddhv 144:4c20fcc105ce 86 del_tm = temp;\
aniruddhv 144:4c20fcc105ce 87 ++overCount;\
aniruddhv 144:4c20fcc105ce 88 }\
aniruddhv 144:4c20fcc105ce 89 else{\
aniruddhv 155:ca7365c03fd7 90 RESET_CDMS;\
aniruddhv 144:4c20fcc105ce 91 break;\
aniruddhv 144:4c20fcc105ce 92 }\
aniruddhv 144:4c20fcc105ce 93 }\
aniruddhv 144:4c20fcc105ce 94 }
aniruddhv 144:4c20fcc105ce 95
aniruddhv 144:4c20fcc105ce 96 #define P_CDMS_HK_MAIN {\
aniruddhv 144:4c20fcc105ce 97 Base_tc *hk_main_ptr = new Short_tc;\
aniruddhv 144:4c20fcc105ce 98 hk_main_ptr->next_TC = NULL;\
aniruddhv 144:4c20fcc105ce 99 PUTshort_or_long(hk_main_ptr,SHORT_TC_CODE);\
aniruddhv 144:4c20fcc105ce 100 PUTcrc_pass(hk_main_ptr,0x1);\
aniruddhv 144:4c20fcc105ce 101 PUTexec_status(hk_main_ptr,0);\
aniruddhv 144:4c20fcc105ce 102 hk_main_ptr->TC_string[0] = 0x01;\
aniruddhv 144:4c20fcc105ce 103 hk_main_ptr->TC_string[1] = 0x81;\
aniruddhv 144:4c20fcc105ce 104 hk_main_ptr->TC_string[2] = 0x81;\
aniruddhv 144:4c20fcc105ce 105 hk_main_ptr->TC_string[3] = 0x04;\
aniruddhv 144:4c20fcc105ce 106 hk_main_ptr->TC_string[4] = 0;\
aniruddhv 144:4c20fcc105ce 107 hk_main_ptr->TC_string[5] = 0;\
aniruddhv 144:4c20fcc105ce 108 hk_main_ptr->TC_string[6] = 0;\
aniruddhv 144:4c20fcc105ce 109 hk_main_ptr->TC_string[7] = 0;\
aniruddhv 144:4c20fcc105ce 110 hk_main_ptr->TC_string[8] = 0;\
aniruddhv 144:4c20fcc105ce 111 uint16_t crc16 = crc16_gen(hk_main_ptr->TC_string, 9);\
aniruddhv 144:4c20fcc105ce 112 hk_main_ptr->TC_string[9] = (crc16 & 0xFF00)>>8;\
aniruddhv 144:4c20fcc105ce 113 hk_main_ptr->TC_string[10] = (crc16 & 0x00FF);\
aniruddhv 144:4c20fcc105ce 114 Base_tm *tm_ptr = new Short_tm;\
aniruddhv 155:ca7365c03fd7 115 tm_ptr = FCTN_CDMS_RLY_TMTC(hk_main_ptr);\
aniruddhv 144:4c20fcc105ce 116 /*DELETE THE TM AFTER USE*/\
aniruddhv 144:4c20fcc105ce 117 Base_tm *del_tm = tm_ptr;\
aniruddhv 144:4c20fcc105ce 118 int overCount = 0;\
aniruddhv 144:4c20fcc105ce 119 while( del_tm != NULL ){\
aniruddhv 144:4c20fcc105ce 120 if( (overCount < TM_OVERFLOW_CONSTANT) ){\
aniruddhv 144:4c20fcc105ce 121 Base_tm *temp = del_tm->next_TM;\
aniruddhv 144:4c20fcc105ce 122 delete del_tm;\
aniruddhv 144:4c20fcc105ce 123 del_tm = temp;\
aniruddhv 137:489a93a04d6b 124 ++overCount;\
aniruddhv 137:489a93a04d6b 125 }\
aniruddhv 137:489a93a04d6b 126 else{\
aniruddhv 155:ca7365c03fd7 127 RESET_CDMS;\
aniruddhv 137:489a93a04d6b 128 break;\
aniruddhv 137:489a93a04d6b 129 }\
aniruddhv 137:489a93a04d6b 130 }\
aniruddhv 137:489a93a04d6b 131 }
aniruddhv 137:489a93a04d6b 132
aniruddhv 144:4c20fcc105ce 133 #define P_BCN_TX_MAIN(tm_ptr) {\
aniruddhv 144:4c20fcc105ce 134 Base_tc *bcn_tx_main_ptr = new Short_tc;\
aniruddhv 144:4c20fcc105ce 135 bcn_tx_main_ptr->next_TC = NULL;\
aniruddhv 144:4c20fcc105ce 136 PUTshort_or_long(bcn_tx_main_ptr,SHORT_TC_CODE);\
aniruddhv 144:4c20fcc105ce 137 PUTcrc_pass(bcn_tx_main_ptr,0x1);\
aniruddhv 144:4c20fcc105ce 138 PUTexec_status(bcn_tx_main_ptr,0);\
aniruddhv 144:4c20fcc105ce 139 bcn_tx_main_ptr->TC_string[0] = 0x01;\
aniruddhv 144:4c20fcc105ce 140 bcn_tx_main_ptr->TC_string[1] = 0x41;\
aniruddhv 144:4c20fcc105ce 141 bcn_tx_main_ptr->TC_string[2] = 0x81;\
aniruddhv 144:4c20fcc105ce 142 bcn_tx_main_ptr->TC_string[3] = 0x07;\
aniruddhv 144:4c20fcc105ce 143 bcn_tx_main_ptr->TC_string[4] = 0;\
aniruddhv 144:4c20fcc105ce 144 bcn_tx_main_ptr->TC_string[5] = 0;\
aniruddhv 144:4c20fcc105ce 145 bcn_tx_main_ptr->TC_string[6] = 0;\
aniruddhv 144:4c20fcc105ce 146 bcn_tx_main_ptr->TC_string[7] = 0;\
aniruddhv 144:4c20fcc105ce 147 bcn_tx_main_ptr->TC_string[8] = 0;\
aniruddhv 144:4c20fcc105ce 148 uint16_t crc16 = crc16_gen(bcn_tx_main_ptr->TC_string, 9);\
aniruddhv 144:4c20fcc105ce 149 bcn_tx_main_ptr->TC_string[9] = (crc16 & 0xFF00)>>8;\
aniruddhv 144:4c20fcc105ce 150 bcn_tx_main_ptr->TC_string[10] = (crc16 & 0x00FF);\
aniruddhv 155:ca7365c03fd7 151 tm_ptr = FCTN_CDMS_RLY_TMTC(bcn_tx_main_ptr);\
aniruddhv 144:4c20fcc105ce 152 }
aniruddhv 144:4c20fcc105ce 153
aniruddhv 144:4c20fcc105ce 154 void COM_POWER_ON_TX() {
aniruddhv 144:4c20fcc105ce 155 if (DEBUG)
aniruddhv 144:4c20fcc105ce 156 gPC.puts("Inside COM_POWER_ON_TX\r\n");
aniruddhv 144:4c20fcc105ce 157 if( !(gFLAGS & COM_TX_FLAG) ){
aniruddhv 144:4c20fcc105ce 158 gFLAGS = gFLAGS | COM_TX_FLAG;
aniruddhv 144:4c20fcc105ce 159 if( gFLAGS & BAE_SW_EN_FLAG ){
aniruddhv 144:4c20fcc105ce 160 /*WARNING: INFINITE WHILE LOOP POSSIBLE: if standby ack received and bcn tx main status = 0*/
aniruddhv 144:4c20fcc105ce 161 bool retryFlag = true;
aniruddhv 144:4c20fcc105ce 162 while( retryFlag == true ){
aniruddhv 144:4c20fcc105ce 163 Base_tm *tm_ptr = new Short_tm;
aniruddhv 144:4c20fcc105ce 164 SET_BCN_STANDBY(tm_ptr);
aniruddhv 144:4c20fcc105ce 165 uint8_t standbyAck = 0;
aniruddhv 144:4c20fcc105ce 166 uint16_t crc = crc16_gen(tm_ptr->TM_string, TM_SHORT_SIZE-2);
aniruddhv 144:4c20fcc105ce 167 if( (tm_ptr->TM_string[11] == ((crc & 0xFF00) >> 8)) && (tm_ptr->TM_string[12] == (crc & 0x00FF)))
aniruddhv 144:4c20fcc105ce 168 standbyAck = 1;
aniruddhv 144:4c20fcc105ce 169 if( standbyAck ){
aniruddhv 144:4c20fcc105ce 170 /*ACK RECCEIVED*/
aniruddhv 144:4c20fcc105ce 171 uint8_t bcn_main_status = (tm_ptr->TM_string[2] & 0xEF);
aniruddhv 144:4c20fcc105ce 172 if( bcn_main_status == 0xE0 ){
aniruddhv 144:4c20fcc105ce 173 retryFlag = false;
aniruddhv 144:4c20fcc105ce 174 RF_SW_CNTRL_TX = 1;
aniruddhv 144:4c20fcc105ce 175 Thread::wait(25);
aniruddhv 144:4c20fcc105ce 176 RF_SW_CNTRL_TX = 0;
aniruddhv 144:4c20fcc105ce 177 gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);
aniruddhv 144:4c20fcc105ce 178 }
aniruddhv 144:4c20fcc105ce 179 else{
aniruddhv 144:4c20fcc105ce 180 Thread::wait(5000);
aniruddhv 144:4c20fcc105ce 181 }
aniruddhv 144:4c20fcc105ce 182 }
aniruddhv 144:4c20fcc105ce 183 else{
aniruddhv 144:4c20fcc105ce 184 reset_bae;
aniruddhv 144:4c20fcc105ce 185 Base_tm *tm_ptr2 = new Short_tm;
aniruddhv 144:4c20fcc105ce 186 SET_BCN_STANDBY(tm_ptr2);
aniruddhv 144:4c20fcc105ce 187 uint8_t standbyAck2 = 0;
aniruddhv 144:4c20fcc105ce 188 uint16_t crc2 = crc16_gen(tm_ptr2->TM_string, TM_SHORT_SIZE-2);
aniruddhv 144:4c20fcc105ce 189 if( (tm_ptr2->TM_string[11] == ((crc2 & 0xFF00) >> 8)) && (tm_ptr2->TM_string[12] == (crc2 & 0x00FF)))
aniruddhv 144:4c20fcc105ce 190 standbyAck2 = 1;
aniruddhv 144:4c20fcc105ce 191 if( standbyAck2 ){
aniruddhv 144:4c20fcc105ce 192 uint8_t bcn_main_status2 = (tm_ptr2->TM_string[2] & 0xEF);
aniruddhv 144:4c20fcc105ce 193 if( bcn_main_status2 == 0xE0 ){
aniruddhv 144:4c20fcc105ce 194 retryFlag = false;
aniruddhv 144:4c20fcc105ce 195 RF_SW_CNTRL_TX = 1;
aniruddhv 144:4c20fcc105ce 196 Thread::wait(25);
aniruddhv 144:4c20fcc105ce 197 RF_SW_CNTRL_TX = 0;
aniruddhv 144:4c20fcc105ce 198 gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);
aniruddhv 144:4c20fcc105ce 199 }
aniruddhv 144:4c20fcc105ce 200 else{
aniruddhv 144:4c20fcc105ce 201 Thread::wait(5000);
aniruddhv 144:4c20fcc105ce 202 }\
aniruddhv 144:4c20fcc105ce 203 }
aniruddhv 144:4c20fcc105ce 204 else{
aniruddhv 144:4c20fcc105ce 205 retryFlag = false;
aniruddhv 144:4c20fcc105ce 206 power_off_bae;
aniruddhv 144:4c20fcc105ce 207 gFLAGS = gFLAGS | COM_AUTO_POWER_OFF_BAE_FLAG;
aniruddhv 144:4c20fcc105ce 208 gFLAGS = gFLAGS & (~BAE_SW_EN_FLAG);
aniruddhv 144:4c20fcc105ce 209 RF_SW_CNTRL_TX = 1;
aniruddhv 144:4c20fcc105ce 210 Thread::wait(25);
aniruddhv 144:4c20fcc105ce 211 RF_SW_CNTRL_TX = 0;
aniruddhv 144:4c20fcc105ce 212 gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);
aniruddhv 144:4c20fcc105ce 213 }
aniruddhv 144:4c20fcc105ce 214 /*DELETE THE TM AFTER USE*/
aniruddhv 144:4c20fcc105ce 215 Base_tm *del_tm = tm_ptr2;
aniruddhv 144:4c20fcc105ce 216 int overCount = 0;
aniruddhv 144:4c20fcc105ce 217 while( del_tm != NULL ){
aniruddhv 144:4c20fcc105ce 218 if( (overCount < TM_OVERFLOW_CONSTANT) ){
aniruddhv 144:4c20fcc105ce 219 Base_tm *temp = del_tm->next_TM;
aniruddhv 144:4c20fcc105ce 220 delete del_tm;
aniruddhv 144:4c20fcc105ce 221 del_tm = temp;
aniruddhv 144:4c20fcc105ce 222 ++overCount;
aniruddhv 144:4c20fcc105ce 223 }
aniruddhv 144:4c20fcc105ce 224 else{
aniruddhv 155:ca7365c03fd7 225 RESET_CDMS;
aniruddhv 144:4c20fcc105ce 226 break;
aniruddhv 144:4c20fcc105ce 227 }
aniruddhv 144:4c20fcc105ce 228 }
aniruddhv 144:4c20fcc105ce 229 }
aniruddhv 144:4c20fcc105ce 230 /*DELETE THE TM AFTER USE*/
aniruddhv 144:4c20fcc105ce 231 Base_tm *del_tm = tm_ptr;
aniruddhv 144:4c20fcc105ce 232 int overCount = 0;
aniruddhv 144:4c20fcc105ce 233 while( del_tm != NULL ){
aniruddhv 144:4c20fcc105ce 234 if( (overCount < TM_OVERFLOW_CONSTANT) ){
aniruddhv 144:4c20fcc105ce 235 Base_tm *temp = del_tm->next_TM;
aniruddhv 144:4c20fcc105ce 236 delete del_tm;
aniruddhv 144:4c20fcc105ce 237 del_tm = temp;
aniruddhv 144:4c20fcc105ce 238 ++overCount;
aniruddhv 144:4c20fcc105ce 239 }
aniruddhv 144:4c20fcc105ce 240 else{
aniruddhv 155:ca7365c03fd7 241 RESET_CDMS;
aniruddhv 144:4c20fcc105ce 242 break;
aniruddhv 144:4c20fcc105ce 243 }
aniruddhv 144:4c20fcc105ce 244 }
aniruddhv 144:4c20fcc105ce 245 }
aniruddhv 144:4c20fcc105ce 246 }
aniruddhv 144:4c20fcc105ce 247 else{
aniruddhv 144:4c20fcc105ce 248 power_off_bae;
aniruddhv 144:4c20fcc105ce 249 gFLAGS = gFLAGS & (~BAE_SW_EN_FLAG);
aniruddhv 144:4c20fcc105ce 250 RF_SW_CNTRL_TX = 1;
aniruddhv 144:4c20fcc105ce 251 Thread::wait(25);
aniruddhv 144:4c20fcc105ce 252 RF_SW_CNTRL_TX = 0;
aniruddhv 144:4c20fcc105ce 253 gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);
aniruddhv 144:4c20fcc105ce 254 }
aniruddhv 144:4c20fcc105ce 255 }
aniruddhv 155:ca7365c03fd7 256 COM_TX_CNTRL = 1;
aniruddhv 144:4c20fcc105ce 257 uint8_t adfConfigPass = 0xFF;
aniruddhv 144:4c20fcc105ce 258 for( int i = 0 ; i < COM_TX_CONFIG_LIMIT ; ++i ){
aniruddhv 144:4c20fcc105ce 259 /*PENDING: CONFIGURE ADF*/
aniruddhv 144:4c20fcc105ce 260 if( adfConfigPass == 0xFF ){
aniruddhv 144:4c20fcc105ce 261 break;
aniruddhv 144:4c20fcc105ce 262 }
aniruddhv 144:4c20fcc105ce 263 }
aniruddhv 144:4c20fcc105ce 264 if( adfConfigPass == 0xFF ){
aniruddhv 144:4c20fcc105ce 265 /*adf successfully configured*/
aniruddhv 155:ca7365c03fd7 266 gFLAGS = gFLAGS | COM_TX_STATUS_FLAG;
aniruddhv 144:4c20fcc105ce 267 /*CALL SIGN*/
aniruddhv 144:4c20fcc105ce 268 Base_tm *power_on_tm = NULL;
aniruddhv 144:4c20fcc105ce 269 Base_tm *power_on_tm_head = NULL;
aniruddhv 144:4c20fcc105ce 270 get_call_sign( power_on_tm_head );
aniruddhv 144:4c20fcc105ce 271 power_on_tm = power_on_tm_head;
aniruddhv 144:4c20fcc105ce 272 /*ACK L1*/
aniruddhv 144:4c20fcc105ce 273 get_ack_l1(power_on_tm->next_TM);
aniruddhv 144:4c20fcc105ce 274 int overFlowCountADF = 0;
aniruddhv 144:4c20fcc105ce 275 while( power_on_tm->next_TM != NULL ){
aniruddhv 144:4c20fcc105ce 276 if( overFlowCountADF < TM_OVERFLOW_CONSTANT ){
aniruddhv 144:4c20fcc105ce 277 power_on_tm = power_on_tm->next_TM;
aniruddhv 144:4c20fcc105ce 278 ++overFlowCountADF;
aniruddhv 144:4c20fcc105ce 279 }
aniruddhv 144:4c20fcc105ce 280 else{
aniruddhv 155:ca7365c03fd7 281 RESET_CDMS;
aniruddhv 144:4c20fcc105ce 282 break;
aniruddhv 144:4c20fcc105ce 283 }
aniruddhv 144:4c20fcc105ce 284 }
aniruddhv 144:4c20fcc105ce 285 get_tc_list(power_on_tm->next_TM, 0x00);
aniruddhv 144:4c20fcc105ce 286 /*Call Sign, ACK_L1, TC_LIST*/
aniruddhv 144:4c20fcc105ce 287 /*snd_tm.head_pointer(power_on_tm_head);*/
aniruddhv 144:4c20fcc105ce 288 /*transmit_adf;*/
aniruddhv 144:4c20fcc105ce 289 /*deleting the telemetry*/
aniruddhv 144:4c20fcc105ce 290 power_on_tm = power_on_tm_head;
aniruddhv 144:4c20fcc105ce 291 overFlowCountADF = 0;
aniruddhv 144:4c20fcc105ce 292 while( power_on_tm != NULL ){
aniruddhv 144:4c20fcc105ce 293 if( overFlowCountADF < TM_OVERFLOW_CONSTANT ){
aniruddhv 144:4c20fcc105ce 294 Base_tm *temp = power_on_tm->next_TM;
aniruddhv 144:4c20fcc105ce 295 delete power_on_tm;
aniruddhv 144:4c20fcc105ce 296 power_on_tm = temp;
aniruddhv 144:4c20fcc105ce 297 ++overFlowCountADF;
aniruddhv 144:4c20fcc105ce 298 }
aniruddhv 144:4c20fcc105ce 299 else{
aniruddhv 155:ca7365c03fd7 300 RESET_CDMS;
aniruddhv 144:4c20fcc105ce 301 break;
aniruddhv 144:4c20fcc105ce 302 }
aniruddhv 144:4c20fcc105ce 303 }
aniruddhv 144:4c20fcc105ce 304 if( true /*NOT Transmitted succesfully*/){
aniruddhv 144:4c20fcc105ce 305 COM_POWER_OFF_TX;
aniruddhv 144:4c20fcc105ce 306 P_CDMS_HK_MAIN;
aniruddhv 144:4c20fcc105ce 307 uint8_t ackReceived = 0x00;
aniruddhv 144:4c20fcc105ce 308 Base_tm *tm_ptr;
aniruddhv 144:4c20fcc105ce 309 P_BCN_TX_MAIN(tm_ptr);
aniruddhv 144:4c20fcc105ce 310 if( ackReceived == 0xFF ){
aniruddhv 144:4c20fcc105ce 311 Thread::wait(5000);
aniruddhv 155:ca7365c03fd7 312 RESET_CDMS;
aniruddhv 144:4c20fcc105ce 313 }
aniruddhv 144:4c20fcc105ce 314 else{
aniruddhv 155:ca7365c03fd7 315 RESET_CDMS;
aniruddhv 144:4c20fcc105ce 316 }
aniruddhv 144:4c20fcc105ce 317 /*DELETE THE TM AFTER USE*/
aniruddhv 144:4c20fcc105ce 318 Base_tm *del_tm = tm_ptr;
aniruddhv 144:4c20fcc105ce 319 int overCount = 0;
aniruddhv 144:4c20fcc105ce 320 while( del_tm != NULL ){
aniruddhv 144:4c20fcc105ce 321 if( (overCount < TM_OVERFLOW_CONSTANT) ){
aniruddhv 144:4c20fcc105ce 322 Base_tm *temp = del_tm->next_TM;
aniruddhv 144:4c20fcc105ce 323 delete del_tm;
aniruddhv 144:4c20fcc105ce 324 del_tm = temp;
aniruddhv 144:4c20fcc105ce 325 ++overCount;
aniruddhv 144:4c20fcc105ce 326 }
aniruddhv 144:4c20fcc105ce 327 else{
aniruddhv 155:ca7365c03fd7 328 RESET_CDMS;
aniruddhv 144:4c20fcc105ce 329 break;
aniruddhv 144:4c20fcc105ce 330 }
aniruddhv 144:4c20fcc105ce 331 }
aniruddhv 144:4c20fcc105ce 332 }
aniruddhv 144:4c20fcc105ce 333 }
aniruddhv 144:4c20fcc105ce 334 else{
aniruddhv 155:ca7365c03fd7 335 /*ADF not configured*/
aniruddhv 155:ca7365c03fd7 336 gFLAGS = gFLAGS & (~COM_TX_STATUS_FLAG);
aniruddhv 144:4c20fcc105ce 337 COM_POWER_OFF_TX;
aniruddhv 144:4c20fcc105ce 338 P_CDMS_HK_MAIN;
aniruddhv 144:4c20fcc105ce 339 uint8_t ackReceived = 0x00;
aniruddhv 144:4c20fcc105ce 340 Base_tm *tm_ptr;
aniruddhv 144:4c20fcc105ce 341 P_BCN_TX_MAIN(tm_ptr);
aniruddhv 144:4c20fcc105ce 342 if( ackReceived == 0xFF ){
aniruddhv 144:4c20fcc105ce 343 Thread::wait(5000);
aniruddhv 155:ca7365c03fd7 344 RESET_CDMS;
aniruddhv 144:4c20fcc105ce 345 }
aniruddhv 144:4c20fcc105ce 346 else{
aniruddhv 155:ca7365c03fd7 347 RESET_CDMS;
aniruddhv 144:4c20fcc105ce 348 }
aniruddhv 144:4c20fcc105ce 349 /*DELETE THE TM AFTER USE*/
aniruddhv 144:4c20fcc105ce 350 Base_tm *del_tm = tm_ptr;
aniruddhv 144:4c20fcc105ce 351 int overCount = 0;
aniruddhv 144:4c20fcc105ce 352 while( del_tm != NULL ){
aniruddhv 144:4c20fcc105ce 353 if( (overCount < TM_OVERFLOW_CONSTANT) ){
aniruddhv 144:4c20fcc105ce 354 Base_tm *temp = del_tm->next_TM;
aniruddhv 144:4c20fcc105ce 355 delete del_tm;
aniruddhv 144:4c20fcc105ce 356 del_tm = temp;
aniruddhv 144:4c20fcc105ce 357 ++overCount;
aniruddhv 144:4c20fcc105ce 358 }
aniruddhv 144:4c20fcc105ce 359 else{
aniruddhv 155:ca7365c03fd7 360 RESET_CDMS;
aniruddhv 144:4c20fcc105ce 361 break;
aniruddhv 144:4c20fcc105ce 362 }
aniruddhv 144:4c20fcc105ce 363 }
aniruddhv 144:4c20fcc105ce 364 }
aniruddhv 144:4c20fcc105ce 365 /*gPC.puts("COMPLETED COM_POWER_ON_TX\r\n");*/
shreeshas95 4:104dd82c99b8 366 }