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