Compression code changed and RLY_TMTC pointers managed

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 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 137:489a93a04d6b 53 /*PENDING: RESET CDMS: MEMORY LEAK FOUND*/\
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 144:4c20fcc105ce 90 /*PENDING: RESET CDMS: MEMORY LEAK FOUND*/\
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 144:4c20fcc105ce 115 /*PENDING*/\
aniruddhv 144:4c20fcc105ce 116 /*tm_ptr = FCTN_CDMS_RLY_TMTC(hk_main_ptr);*/\
aniruddhv 144:4c20fcc105ce 117 /*DELETE THE TM AFTER USE*/\
aniruddhv 144:4c20fcc105ce 118 Base_tm *del_tm = tm_ptr;\
aniruddhv 144:4c20fcc105ce 119 int overCount = 0;\
aniruddhv 144:4c20fcc105ce 120 while( del_tm != NULL ){\
aniruddhv 144:4c20fcc105ce 121 if( (overCount < TM_OVERFLOW_CONSTANT) ){\
aniruddhv 144:4c20fcc105ce 122 Base_tm *temp = del_tm->next_TM;\
aniruddhv 144:4c20fcc105ce 123 delete del_tm;\
aniruddhv 144:4c20fcc105ce 124 del_tm = temp;\
aniruddhv 137:489a93a04d6b 125 ++overCount;\
aniruddhv 137:489a93a04d6b 126 }\
aniruddhv 137:489a93a04d6b 127 else{\
aniruddhv 137:489a93a04d6b 128 /*PENDING: RESET CDMS: MEMORY LEAK FOUND*/\
aniruddhv 137:489a93a04d6b 129 break;\
aniruddhv 137:489a93a04d6b 130 }\
aniruddhv 137:489a93a04d6b 131 }\
aniruddhv 137:489a93a04d6b 132 }
aniruddhv 137:489a93a04d6b 133
aniruddhv 144:4c20fcc105ce 134 #define P_BCN_TX_MAIN(tm_ptr) {\
aniruddhv 144:4c20fcc105ce 135 Base_tc *bcn_tx_main_ptr = new Short_tc;\
aniruddhv 144:4c20fcc105ce 136 bcn_tx_main_ptr->next_TC = NULL;\
aniruddhv 144:4c20fcc105ce 137 PUTshort_or_long(bcn_tx_main_ptr,SHORT_TC_CODE);\
aniruddhv 144:4c20fcc105ce 138 PUTcrc_pass(bcn_tx_main_ptr,0x1);\
aniruddhv 144:4c20fcc105ce 139 PUTexec_status(bcn_tx_main_ptr,0);\
aniruddhv 144:4c20fcc105ce 140 bcn_tx_main_ptr->TC_string[0] = 0x01;\
aniruddhv 144:4c20fcc105ce 141 bcn_tx_main_ptr->TC_string[1] = 0x41;\
aniruddhv 144:4c20fcc105ce 142 bcn_tx_main_ptr->TC_string[2] = 0x81;\
aniruddhv 144:4c20fcc105ce 143 bcn_tx_main_ptr->TC_string[3] = 0x07;\
aniruddhv 144:4c20fcc105ce 144 bcn_tx_main_ptr->TC_string[4] = 0;\
aniruddhv 144:4c20fcc105ce 145 bcn_tx_main_ptr->TC_string[5] = 0;\
aniruddhv 144:4c20fcc105ce 146 bcn_tx_main_ptr->TC_string[6] = 0;\
aniruddhv 144:4c20fcc105ce 147 bcn_tx_main_ptr->TC_string[7] = 0;\
aniruddhv 144:4c20fcc105ce 148 bcn_tx_main_ptr->TC_string[8] = 0;\
aniruddhv 144:4c20fcc105ce 149 uint16_t crc16 = crc16_gen(bcn_tx_main_ptr->TC_string, 9);\
aniruddhv 144:4c20fcc105ce 150 bcn_tx_main_ptr->TC_string[9] = (crc16 & 0xFF00)>>8;\
aniruddhv 144:4c20fcc105ce 151 bcn_tx_main_ptr->TC_string[10] = (crc16 & 0x00FF);\
aniruddhv 144:4c20fcc105ce 152 /*PENDING*/\
aniruddhv 144:4c20fcc105ce 153 /*tm_ptr = FCTN_CDMS_RLY_TMTC(bcn_tx_main_ptr);*/\
aniruddhv 144:4c20fcc105ce 154 }
aniruddhv 144:4c20fcc105ce 155
aniruddhv 144:4c20fcc105ce 156 void COM_POWER_ON_TX() {
aniruddhv 144:4c20fcc105ce 157 if (DEBUG)
aniruddhv 144:4c20fcc105ce 158 gPC.puts("Inside COM_POWER_ON_TX\r\n");
aniruddhv 144:4c20fcc105ce 159 if( !(gFLAGS & COM_TX_FLAG) ){
aniruddhv 144:4c20fcc105ce 160 gFLAGS = gFLAGS | COM_TX_FLAG;
aniruddhv 144:4c20fcc105ce 161 if( gFLAGS & BAE_SW_EN_FLAG ){
aniruddhv 144:4c20fcc105ce 162 /*WARNING: INFINITE WHILE LOOP POSSIBLE: if standby ack received and bcn tx main status = 0*/
aniruddhv 144:4c20fcc105ce 163 bool retryFlag = true;
aniruddhv 144:4c20fcc105ce 164 while( retryFlag == true ){
aniruddhv 144:4c20fcc105ce 165 Base_tm *tm_ptr = new Short_tm;
aniruddhv 144:4c20fcc105ce 166 SET_BCN_STANDBY(tm_ptr);
aniruddhv 144:4c20fcc105ce 167 uint8_t standbyAck = 0;
aniruddhv 144:4c20fcc105ce 168 uint16_t crc = crc16_gen(tm_ptr->TM_string, TM_SHORT_SIZE-2);
aniruddhv 144:4c20fcc105ce 169 if( (tm_ptr->TM_string[11] == ((crc & 0xFF00) >> 8)) && (tm_ptr->TM_string[12] == (crc & 0x00FF)))
aniruddhv 144:4c20fcc105ce 170 standbyAck = 1;
aniruddhv 144:4c20fcc105ce 171 if( standbyAck ){
aniruddhv 144:4c20fcc105ce 172 /*ACK RECCEIVED*/
aniruddhv 144:4c20fcc105ce 173 uint8_t bcn_main_status = (tm_ptr->TM_string[2] & 0xEF);
aniruddhv 144:4c20fcc105ce 174 if( bcn_main_status == 0xE0 ){
aniruddhv 144:4c20fcc105ce 175 retryFlag = false;
aniruddhv 144:4c20fcc105ce 176 RF_SW_CNTRL_TX = 1;
aniruddhv 144:4c20fcc105ce 177 Thread::wait(25);
aniruddhv 144:4c20fcc105ce 178 RF_SW_CNTRL_TX = 0;
aniruddhv 144:4c20fcc105ce 179 gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);
aniruddhv 144:4c20fcc105ce 180 }
aniruddhv 144:4c20fcc105ce 181 else{
aniruddhv 144:4c20fcc105ce 182 Thread::wait(5000);
aniruddhv 144:4c20fcc105ce 183 }
aniruddhv 144:4c20fcc105ce 184 }
aniruddhv 144:4c20fcc105ce 185 else{
aniruddhv 144:4c20fcc105ce 186 reset_bae;
aniruddhv 144:4c20fcc105ce 187 Base_tm *tm_ptr2 = new Short_tm;
aniruddhv 144:4c20fcc105ce 188 SET_BCN_STANDBY(tm_ptr2);
aniruddhv 144:4c20fcc105ce 189 uint8_t standbyAck2 = 0;
aniruddhv 144:4c20fcc105ce 190 uint16_t crc2 = crc16_gen(tm_ptr2->TM_string, TM_SHORT_SIZE-2);
aniruddhv 144:4c20fcc105ce 191 if( (tm_ptr2->TM_string[11] == ((crc2 & 0xFF00) >> 8)) && (tm_ptr2->TM_string[12] == (crc2 & 0x00FF)))
aniruddhv 144:4c20fcc105ce 192 standbyAck2 = 1;
aniruddhv 144:4c20fcc105ce 193 if( standbyAck2 ){
aniruddhv 144:4c20fcc105ce 194 uint8_t bcn_main_status2 = (tm_ptr2->TM_string[2] & 0xEF);
aniruddhv 144:4c20fcc105ce 195 if( bcn_main_status2 == 0xE0 ){
aniruddhv 144:4c20fcc105ce 196 retryFlag = false;
aniruddhv 144:4c20fcc105ce 197 RF_SW_CNTRL_TX = 1;
aniruddhv 144:4c20fcc105ce 198 Thread::wait(25);
aniruddhv 144:4c20fcc105ce 199 RF_SW_CNTRL_TX = 0;
aniruddhv 144:4c20fcc105ce 200 gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);
aniruddhv 144:4c20fcc105ce 201 }
aniruddhv 144:4c20fcc105ce 202 else{
aniruddhv 144:4c20fcc105ce 203 Thread::wait(5000);
aniruddhv 144:4c20fcc105ce 204 }\
aniruddhv 144:4c20fcc105ce 205 }
aniruddhv 144:4c20fcc105ce 206 else{
aniruddhv 144:4c20fcc105ce 207 retryFlag = false;
aniruddhv 144:4c20fcc105ce 208 power_off_bae;
aniruddhv 144:4c20fcc105ce 209 gFLAGS = gFLAGS | COM_AUTO_POWER_OFF_BAE_FLAG;
aniruddhv 144:4c20fcc105ce 210 gFLAGS = gFLAGS & (~BAE_SW_EN_FLAG);
aniruddhv 144:4c20fcc105ce 211 RF_SW_CNTRL_TX = 1;
aniruddhv 144:4c20fcc105ce 212 Thread::wait(25);
aniruddhv 144:4c20fcc105ce 213 RF_SW_CNTRL_TX = 0;
aniruddhv 144:4c20fcc105ce 214 gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);
aniruddhv 144:4c20fcc105ce 215 }
aniruddhv 144:4c20fcc105ce 216 /*DELETE THE TM AFTER USE*/
aniruddhv 144:4c20fcc105ce 217 Base_tm *del_tm = tm_ptr2;
aniruddhv 144:4c20fcc105ce 218 int overCount = 0;
aniruddhv 144:4c20fcc105ce 219 while( del_tm != NULL ){
aniruddhv 144:4c20fcc105ce 220 if( (overCount < TM_OVERFLOW_CONSTANT) ){
aniruddhv 144:4c20fcc105ce 221 Base_tm *temp = del_tm->next_TM;
aniruddhv 144:4c20fcc105ce 222 delete del_tm;
aniruddhv 144:4c20fcc105ce 223 del_tm = temp;
aniruddhv 144:4c20fcc105ce 224 ++overCount;
aniruddhv 144:4c20fcc105ce 225 }
aniruddhv 144:4c20fcc105ce 226 else{
aniruddhv 144:4c20fcc105ce 227 /*PENDING: RESET CDMS: MEMORY LEAK FOUND*/
aniruddhv 144:4c20fcc105ce 228 break;
aniruddhv 144:4c20fcc105ce 229 }
aniruddhv 144:4c20fcc105ce 230 }
aniruddhv 144:4c20fcc105ce 231 }
aniruddhv 144:4c20fcc105ce 232 /*DELETE THE TM AFTER USE*/
aniruddhv 144:4c20fcc105ce 233 Base_tm *del_tm = tm_ptr;
aniruddhv 144:4c20fcc105ce 234 int overCount = 0;
aniruddhv 144:4c20fcc105ce 235 while( del_tm != NULL ){
aniruddhv 144:4c20fcc105ce 236 if( (overCount < TM_OVERFLOW_CONSTANT) ){
aniruddhv 144:4c20fcc105ce 237 Base_tm *temp = del_tm->next_TM;
aniruddhv 144:4c20fcc105ce 238 delete del_tm;
aniruddhv 144:4c20fcc105ce 239 del_tm = temp;
aniruddhv 144:4c20fcc105ce 240 ++overCount;
aniruddhv 144:4c20fcc105ce 241 }
aniruddhv 144:4c20fcc105ce 242 else{
aniruddhv 144:4c20fcc105ce 243 /*PENDING: RESET CDMS: MEMORY LEAK FOUND*/
aniruddhv 144:4c20fcc105ce 244 break;
aniruddhv 144:4c20fcc105ce 245 }
aniruddhv 144:4c20fcc105ce 246 }
aniruddhv 144:4c20fcc105ce 247 }
aniruddhv 144:4c20fcc105ce 248 }
aniruddhv 144:4c20fcc105ce 249 else{
aniruddhv 144:4c20fcc105ce 250 power_off_bae;
aniruddhv 144:4c20fcc105ce 251 gFLAGS = gFLAGS & (~BAE_SW_EN_FLAG);
aniruddhv 144:4c20fcc105ce 252 RF_SW_CNTRL_TX = 1;
aniruddhv 144:4c20fcc105ce 253 Thread::wait(25);
aniruddhv 144:4c20fcc105ce 254 RF_SW_CNTRL_TX = 0;
aniruddhv 144:4c20fcc105ce 255 gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);
aniruddhv 144:4c20fcc105ce 256 }
aniruddhv 144:4c20fcc105ce 257 }
aniruddhv 144:4c20fcc105ce 258 /*PENDING: POWER ON COM_TX*/
aniruddhv 144:4c20fcc105ce 259 /*power_on_com_tx_pin = 1;*/
aniruddhv 144:4c20fcc105ce 260 uint8_t adfConfigPass = 0xFF;
aniruddhv 144:4c20fcc105ce 261 for( int i = 0 ; i < COM_TX_CONFIG_LIMIT ; ++i ){
aniruddhv 144:4c20fcc105ce 262 /*PENDING: CONFIGURE ADF*/
aniruddhv 144:4c20fcc105ce 263 if( adfConfigPass == 0xFF ){
aniruddhv 144:4c20fcc105ce 264 break;
aniruddhv 144:4c20fcc105ce 265 }
aniruddhv 144:4c20fcc105ce 266 }
aniruddhv 144:4c20fcc105ce 267 if( adfConfigPass == 0xFF ){
aniruddhv 144:4c20fcc105ce 268 /*adf successfully configured*/
aniruddhv 144:4c20fcc105ce 269 /*CALL SIGN*/
aniruddhv 144:4c20fcc105ce 270 Base_tm *power_on_tm = NULL;
aniruddhv 144:4c20fcc105ce 271 Base_tm *power_on_tm_head = NULL;
aniruddhv 144:4c20fcc105ce 272 get_call_sign( power_on_tm_head );
aniruddhv 144:4c20fcc105ce 273 power_on_tm = power_on_tm_head;
aniruddhv 144:4c20fcc105ce 274 /*ACK L1*/
aniruddhv 144:4c20fcc105ce 275 get_ack_l1(power_on_tm->next_TM);
aniruddhv 144:4c20fcc105ce 276 int overFlowCountADF = 0;
aniruddhv 144:4c20fcc105ce 277 while( power_on_tm->next_TM != NULL ){
aniruddhv 144:4c20fcc105ce 278 if( overFlowCountADF < TM_OVERFLOW_CONSTANT ){
aniruddhv 144:4c20fcc105ce 279 power_on_tm = power_on_tm->next_TM;
aniruddhv 144:4c20fcc105ce 280 ++overFlowCountADF;
aniruddhv 144:4c20fcc105ce 281 }
aniruddhv 144:4c20fcc105ce 282 else{
aniruddhv 144:4c20fcc105ce 283 /*PENDING: RESET CDMS*/
aniruddhv 144:4c20fcc105ce 284 break;
aniruddhv 144:4c20fcc105ce 285 }
aniruddhv 144:4c20fcc105ce 286 }
aniruddhv 144:4c20fcc105ce 287 get_tc_list(power_on_tm->next_TM, 0x00);
aniruddhv 144:4c20fcc105ce 288 /*Call Sign, ACK_L1, TC_LIST*/
aniruddhv 144:4c20fcc105ce 289 /*snd_tm.head_pointer(power_on_tm_head);*/
aniruddhv 144:4c20fcc105ce 290 /*transmit_adf;*/
aniruddhv 144:4c20fcc105ce 291 /*deleting the telemetry*/
aniruddhv 144:4c20fcc105ce 292 power_on_tm = power_on_tm_head;
aniruddhv 144:4c20fcc105ce 293 overFlowCountADF = 0;
aniruddhv 144:4c20fcc105ce 294 while( power_on_tm != NULL ){
aniruddhv 144:4c20fcc105ce 295 if( overFlowCountADF < TM_OVERFLOW_CONSTANT ){
aniruddhv 144:4c20fcc105ce 296 Base_tm *temp = power_on_tm->next_TM;
aniruddhv 144:4c20fcc105ce 297 delete power_on_tm;
aniruddhv 144:4c20fcc105ce 298 power_on_tm = temp;
aniruddhv 144:4c20fcc105ce 299 ++overFlowCountADF;
aniruddhv 144:4c20fcc105ce 300 }
aniruddhv 144:4c20fcc105ce 301 else{
aniruddhv 144:4c20fcc105ce 302 /*PENDING: RESET CDMS*/
aniruddhv 144:4c20fcc105ce 303 break;
aniruddhv 144:4c20fcc105ce 304 }
aniruddhv 144:4c20fcc105ce 305 }
aniruddhv 144:4c20fcc105ce 306 if( true /*NOT Transmitted succesfully*/){
aniruddhv 144:4c20fcc105ce 307 COM_POWER_OFF_TX;
aniruddhv 144:4c20fcc105ce 308 P_CDMS_HK_MAIN;
aniruddhv 144:4c20fcc105ce 309 uint8_t ackReceived = 0x00;
aniruddhv 144:4c20fcc105ce 310 Base_tm *tm_ptr;
aniruddhv 144:4c20fcc105ce 311 P_BCN_TX_MAIN(tm_ptr);
aniruddhv 144:4c20fcc105ce 312 if( ackReceived == 0xFF ){
aniruddhv 144:4c20fcc105ce 313 Thread::wait(5000);
aniruddhv 144:4c20fcc105ce 314 /*PENDING: RESET CDMS*/
aniruddhv 144:4c20fcc105ce 315 }
aniruddhv 144:4c20fcc105ce 316 else{
aniruddhv 144:4c20fcc105ce 317 /*PENDING: RESET CDMS*/
aniruddhv 144:4c20fcc105ce 318 }
aniruddhv 144:4c20fcc105ce 319 /*DELETE THE TM AFTER USE*/
aniruddhv 144:4c20fcc105ce 320 Base_tm *del_tm = tm_ptr;
aniruddhv 144:4c20fcc105ce 321 int overCount = 0;
aniruddhv 144:4c20fcc105ce 322 while( del_tm != NULL ){
aniruddhv 144:4c20fcc105ce 323 if( (overCount < TM_OVERFLOW_CONSTANT) ){
aniruddhv 144:4c20fcc105ce 324 Base_tm *temp = del_tm->next_TM;
aniruddhv 144:4c20fcc105ce 325 delete del_tm;
aniruddhv 144:4c20fcc105ce 326 del_tm = temp;
aniruddhv 144:4c20fcc105ce 327 ++overCount;
aniruddhv 144:4c20fcc105ce 328 }
aniruddhv 144:4c20fcc105ce 329 else{
aniruddhv 144:4c20fcc105ce 330 /*PENDING: RESET CDMS: MEMORY LEAK FOUND*/
aniruddhv 144:4c20fcc105ce 331 break;
aniruddhv 144:4c20fcc105ce 332 }
aniruddhv 144:4c20fcc105ce 333 }
aniruddhv 144:4c20fcc105ce 334 }
aniruddhv 144:4c20fcc105ce 335 }
aniruddhv 144:4c20fcc105ce 336 else{
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 144:4c20fcc105ce 344 /*PENDING: RESET CDMS*/
aniruddhv 144:4c20fcc105ce 345 }
aniruddhv 144:4c20fcc105ce 346 else{
aniruddhv 144:4c20fcc105ce 347 /*PENDING: 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 144:4c20fcc105ce 360 /*PENDING: RESET CDMS: MEMORY LEAK FOUND*/
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 }