lkdsnf;

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE_PL_Working by Siva ram

Committer:
krishanprajapat
Date:
Fri Jan 01 08:55:38 2016 +0000
Revision:
19:27e5f2edaf26
Parent:
16:538de1b20b3a
Child:
25:60964ad4f13b
Not_working.. to be debugged; For further testings, use previous revision

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shreeshas95 0:f016e9e8d48b 1 // 8 Jul
shreeshas95 0:f016e9e8d48b 2 // did flowchart of states
shreeshas95 0:f016e9e8d48b 3
shreeshas95 0:f016e9e8d48b 4 // handle sd card with cdms team
shreeshas95 0:f016e9e8d48b 5
shreeshas95 0:f016e9e8d48b 6 // Jun 6
shreeshas95 0:f016e9e8d48b 7 // WHAT IS TC exec code in L1 ack ?
shreeshas95 0:f016e9e8d48b 8
shreeshas95 0:f016e9e8d48b 9 #define delete_TC(tc_ptr) {\
shreeshas95 0:f016e9e8d48b 10 if(tc_ptr == gHEAD_NODE_TCL){\
shreeshas95 0:f016e9e8d48b 11 gHEAD_NODE_TCL = tc_ptr->next_TC;\
shreeshas95 0:f016e9e8d48b 12 }\
shreeshas95 0:f016e9e8d48b 13 delete tc_ptr;\
shreeshas95 0:f016e9e8d48b 14 }
shreeshas95 0:f016e9e8d48b 15
shreeshas95 0:f016e9e8d48b 16 // typeof tm_ptr: Base_tm
shreeshas95 0:f016e9e8d48b 17 // typeof tc_ptr: Base_tc
shreeshas95 0:f016e9e8d48b 18 // typeof temp_xxxx: uint8_t
shreeshas95 0:f016e9e8d48b 19 #define fill_l1_ack(tm_ptr) {\
shreeshas95 0:f016e9e8d48b 20 uint8_t temp8;\
shreeshas95 0:f016e9e8d48b 21 tm_ptr->next_TM = NULL;\
shreeshas95 4:104dd82c99b8 22 temp8 = TMID_ACK_L1;\
shreeshas95 0:f016e9e8d48b 23 PUTtmid(tm_ptr->fields, temp8);\
shreeshas95 4:104dd82c99b8 24 temp8 = SHORT_TM_CODE;\
shreeshas95 0:f016e9e8d48b 25 PUTshort_or_long_tm(tm_ptr->fields, temp8);\
shreeshas95 0:f016e9e8d48b 26 tm_ptr->TM_string[0] = TMID_ACK_L1 << 4;\
shreeshas95 4:104dd82c99b8 27 /*PENDING: PA TEMPERATURE*/\
shreeshas95 0:f016e9e8d48b 28 tm_ptr->TM_string[1] = gTOTAL_INCORRECT_SIZE_TC & 0xFF;\
shreeshas95 0:f016e9e8d48b 29 tm_ptr->TM_string[2] = gTOTAL_CRC_FAIL_TC & 0xFF;\
shreeshas95 0:f016e9e8d48b 30 }
shreeshas95 0:f016e9e8d48b 31
shreeshas95 4:104dd82c99b8 32 #define put_crc_l1_ack(tm_ptr) {\
shreeshas95 4:104dd82c99b8 33 tm_ptr->TM_string[2] = gTOTAL_CRC_FAIL_TC & 0xFF;\
shreeshas95 4:104dd82c99b8 34 /*TC LIST STATUS*/\
shreeshas95 4:104dd82c99b8 35 tm_ptr->TM_string[3] |= (gMASTER_STATE << 5) & 0xE0;\
shreeshas95 4:104dd82c99b8 36 /*PA HOT*/\
shreeshas95 4:104dd82c99b8 37 if( gFLAGS & COM_PA_HOT_FLAG ){\
shreeshas95 4:104dd82c99b8 38 tm_ptr->TM_string[3] |= (1 << 4);\
shreeshas95 4:104dd82c99b8 39 }\
shreeshas95 4:104dd82c99b8 40 else{\
shreeshas95 4:104dd82c99b8 41 tm_ptr->TM_string[3] &= ~(1 << 4);\
shreeshas95 4:104dd82c99b8 42 }\
shreeshas95 4:104dd82c99b8 43 uint16_t crc_checksum = crc16_gen(tm_ptr->TM_string, TM_SHORT_SIZE-2);\
shreeshas95 0:f016e9e8d48b 44 tm_ptr->TM_string[TM_SHORT_SIZE-2] = (crc_checksum >> 8) & 0xFF;\
shreeshas95 0:f016e9e8d48b 45 tm_ptr->TM_string[TM_SHORT_SIZE-1] = crc_checksum & 0xFF;\
shreeshas95 0:f016e9e8d48b 46 }
shreeshas95 0:f016e9e8d48b 47
shreeshas95 4:104dd82c99b8 48 #define detect_ack(tm_ptr, temp_ack, tc_psc) {\
shreeshas95 5:ab276a17ca07 49 if( tm_ptr != NULL ){\
aniruddhv 14:08c2c887ea09 50 int length = TM_SHORT_SIZE;\
aniruddhv 14:08c2c887ea09 51 if( GETshort_or_long_tm(tm_ptr->fields) == SHORT_TM_CODE ){\
aniruddhv 14:08c2c887ea09 52 length = TM_SHORT_SIZE;\
aniruddhv 14:08c2c887ea09 53 }\
aniruddhv 14:08c2c887ea09 54 else{\
aniruddhv 14:08c2c887ea09 55 length = TM_LONG_SIZE;\
aniruddhv 14:08c2c887ea09 56 }\
aniruddhv 14:08c2c887ea09 57 uint16_t crc = crc16_gen(tm_ptr->TM_string, length-2);\
shreeshas95 5:ab276a17ca07 58 if( (((crc & 0xFF00) >> 8) == tm_ptr->TM_string[length-2]) && ( (crc & 0x00FF) == tm_ptr->TM_string[length-1] ) ){\
shreeshas95 4:104dd82c99b8 59 uint8_t temp8;\
shreeshas95 4:104dd82c99b8 60 temp8 = tm_ptr->TM_string[TM_ACK_CODE_INDEX];\
shreeshas95 4:104dd82c99b8 61 temp8 = temp8 & 0xE0;\
shreeshas95 4:104dd82c99b8 62 if( (temp8 == 0xC0) || (temp8 == 0xA0) )\
shreeshas95 4:104dd82c99b8 63 temp_ack = 0x01;\
shreeshas95 4:104dd82c99b8 64 else{\
shreeshas95 4:104dd82c99b8 65 temp_ack = 0x00;\
shreeshas95 4:104dd82c99b8 66 /*CHECK FOR NACK CODE: CRC FAIL NACK*/\
shreeshas95 4:104dd82c99b8 67 temp8 = tm_ptr->TM_string[TM_ACK_CODE_INDEX];\
shreeshas95 4:104dd82c99b8 68 temp8 = temp8 & 0x0F;\
shreeshas95 5:ab276a17ca07 69 if( temp8 == CRC_FAIL_NACK_CODE ){\
shreeshas95 4:104dd82c99b8 70 tm_ptr->TM_string[2] = tc_psc;\
shreeshas95 4:104dd82c99b8 71 }\
shreeshas95 4:104dd82c99b8 72 }\
shreeshas95 4:104dd82c99b8 73 }\
shreeshas95 0:f016e9e8d48b 74 else\
shreeshas95 0:f016e9e8d48b 75 temp_ack = 0x00;\
shreeshas95 0:f016e9e8d48b 76 }\
shreeshas95 4:104dd82c99b8 77 else{\
shreeshas95 0:f016e9e8d48b 78 temp_ack = 0x00;\
shreeshas95 4:104dd82c99b8 79 }\
shreeshas95 0:f016e9e8d48b 80 }
shreeshas95 0:f016e9e8d48b 81
shreeshas95 0:f016e9e8d48b 82 #define isit_obosc(tc_ptr, temp_obosc) {\
shreeshas95 0:f016e9e8d48b 83 temp_obosc = 0x00;\
shreeshas95 0:f016e9e8d48b 84 if( GETapid(tc_ptr) == 2 ){\
shreeshas95 0:f016e9e8d48b 85 if( ((tc_ptr->TC_string[2]) >> 4) == 0xB ){\
shreeshas95 0:f016e9e8d48b 86 switch( (tc_ptr->TC_string[2]) & 0xf ){\
shreeshas95 0:f016e9e8d48b 87 case 1:\
shreeshas95 0:f016e9e8d48b 88 case 2:\
shreeshas95 0:f016e9e8d48b 89 case 5:\
shreeshas95 0:f016e9e8d48b 90 case 6:\
shreeshas95 0:f016e9e8d48b 91 case 15:\
shreeshas95 0:f016e9e8d48b 92 temp_obosc = 0x01;\
shreeshas95 0:f016e9e8d48b 93 }\
shreeshas95 0:f016e9e8d48b 94 }\
shreeshas95 0:f016e9e8d48b 95 }\
shreeshas95 0:f016e9e8d48b 96 }
shreeshas95 0:f016e9e8d48b 97
shreeshas95 0:f016e9e8d48b 98 #define isit_sdcard(tc_ptr, temp_sdcard) {\
shreeshas95 0:f016e9e8d48b 99 temp_sdcard = 0x00;\
shreeshas95 0:f016e9e8d48b 100 if( GETapid(tc_ptr) == 2 ){\
shreeshas95 0:f016e9e8d48b 101 if( ( (tc_ptr->TC_string[2]) >> 4) == 0xF ){\
shreeshas95 0:f016e9e8d48b 102 switch( (tc_ptr->TC_string[2]) & 0xf ){\
shreeshas95 0:f016e9e8d48b 103 case 0:\
shreeshas95 0:f016e9e8d48b 104 case 1:\
shreeshas95 0:f016e9e8d48b 105 case 2:\
shreeshas95 0:f016e9e8d48b 106 case 3:\
shreeshas95 0:f016e9e8d48b 107 case 4:\
shreeshas95 0:f016e9e8d48b 108 temp_sdcard = 0x01;\
shreeshas95 0:f016e9e8d48b 109 }\
shreeshas95 0:f016e9e8d48b 110 }\
shreeshas95 0:f016e9e8d48b 111 }\
shreeshas95 0:f016e9e8d48b 112 }
shreeshas95 0:f016e9e8d48b 113
shreeshas95 2:2caf2a9a13aa 114 #define isPAhot(returnHere){\
shreeshas95 2:2caf2a9a13aa 115 /*PENDING : COMPLETE THIS FUNCTION*/\
shreeshas95 2:2caf2a9a13aa 116 returnHere = 0xFF;\
shreeshas95 2:2caf2a9a13aa 117 }
shreeshas95 2:2caf2a9a13aa 118
shreeshas95 2:2caf2a9a13aa 119 void after_cooling_pa(){
shreeshas95 2:2caf2a9a13aa 120 gCOM_MNG_TMTC_THREAD->signal_set(COM_MNG_TMTC_SIGNAL_UART_INT);
shreeshas95 2:2caf2a9a13aa 121 }
shreeshas95 2:2caf2a9a13aa 122
shreeshas95 0:f016e9e8d48b 123 /*
shreeshas95 0:f016e9e8d48b 124 @brief: check for missing tc, also check crc, i.e.
shreeshas95 0:f016e9e8d48b 125 if true execution can be started else have to wait
shreeshas95 0:f016e9e8d48b 126 decide the next state
shreeshas95 0:f016e9e8d48b 127 @param: none
shreeshas95 0:f016e9e8d48b 128 @return: bool indicating whether there are missing tc
shreeshas95 0:f016e9e8d48b 129 */
shreeshas95 0:f016e9e8d48b 130 // PENDING: LAST FRAME BIT
shreeshas95 0:f016e9e8d48b 131 /*
shreeshas95 0:f016e9e8d48b 132 for loop: check for missing tc
shreeshas95 0:f016e9e8d48b 133 if: check for incorrect sized tc
shreeshas95 0:f016e9e8d48b 134 if: check for last frame bit
shreeshas95 0:f016e9e8d48b 135 */
shreeshas95 0:f016e9e8d48b 136 #define continueToExecute(returnHere) {\
shreeshas95 0:f016e9e8d48b 137 uint8_t tempReturn = 0x00;\
shreeshas95 5:ab276a17ca07 138 /*search for missing psc*/\
shreeshas95 15:1c1ca992b43b 139 for(uint8_t p = 0x00 ; p < (gTOTAL_VALID_TC) ; ++p){\
shreeshas95 0:f016e9e8d48b 140 bool flag = false;\
shreeshas95 0:f016e9e8d48b 141 Base_tc *node_ptr = gHEAD_NODE_TCL;\
shreeshas95 0:f016e9e8d48b 142 while(node_ptr != NULL){\
shreeshas95 0:f016e9e8d48b 143 if( (GETpacket_seq_count(node_ptr) == p) && (GETcrc_pass(node_ptr) == 1) ){\
shreeshas95 0:f016e9e8d48b 144 flag = true;\
shreeshas95 0:f016e9e8d48b 145 break;\
shreeshas95 0:f016e9e8d48b 146 }\
shreeshas95 0:f016e9e8d48b 147 else{\
shreeshas95 0:f016e9e8d48b 148 node_ptr = node_ptr->next_TC;\
shreeshas95 0:f016e9e8d48b 149 }\
shreeshas95 0:f016e9e8d48b 150 }\
shreeshas95 0:f016e9e8d48b 151 if(flag == false){\
shreeshas95 0:f016e9e8d48b 152 tempReturn = 0x02;\
shreeshas95 0:f016e9e8d48b 153 break;\
shreeshas95 0:f016e9e8d48b 154 }\
shreeshas95 0:f016e9e8d48b 155 }\
shreeshas95 5:ab276a17ca07 156 /*search for last packet bit*/\
shreeshas95 5:ab276a17ca07 157 tempReturn = tempReturn + 0x01;\
shreeshas95 0:f016e9e8d48b 158 Base_tc *tcp = gHEAD_NODE_TCL;\
shreeshas95 0:f016e9e8d48b 159 while(tcp != NULL){\
rohit3342 16:538de1b20b3a 160 if(GETpacket_seq_count(tcp) == (gTOTAL_VALID_TC - 1)){\
shreeshas95 5:ab276a17ca07 161 if( ( (tcp->TC_string[1]) & 0x20 ) == 0x20 ){\
shreeshas95 5:ab276a17ca07 162 tempReturn = tempReturn - 0x01;\
shreeshas95 0:f016e9e8d48b 163 }\
shreeshas95 0:f016e9e8d48b 164 break;\
shreeshas95 0:f016e9e8d48b 165 }\
shreeshas95 0:f016e9e8d48b 166 tcp = tcp->next_TC;\
shreeshas95 0:f016e9e8d48b 167 }\
shreeshas95 0:f016e9e8d48b 168 returnHere = tempReturn;\
shreeshas95 5:ab276a17ca07 169 /*UPDATE gMASTER STATE*/\
shreeshas95 5:ab276a17ca07 170 if( (returnHere == 0x00) ){\
shreeshas95 5:ab276a17ca07 171 if( (gMASTER_STATE == TCL_STATE_INCOMPLETE) || (gMASTER_STATE == TCL_STATE_COMPLETED) ){\
shreeshas95 5:ab276a17ca07 172 gMASTER_STATE = TCL_STATE_COMPLETED;\
shreeshas95 5:ab276a17ca07 173 }\
shreeshas95 5:ab276a17ca07 174 }\
shreeshas95 5:ab276a17ca07 175 else{\
shreeshas95 5:ab276a17ca07 176 if( (gMASTER_STATE == TCL_STATE_INCOMPLETE) || (gMASTER_STATE == TCL_STATE_COMPLETED) ){\
shreeshas95 5:ab276a17ca07 177 gMASTER_STATE = TCL_STATE_INCOMPLETE;\
shreeshas95 5:ab276a17ca07 178 }\
shreeshas95 5:ab276a17ca07 179 }\
shreeshas95 0:f016e9e8d48b 180 }
shreeshas95 0:f016e9e8d48b 181
shreeshas95 0:f016e9e8d48b 182 /*
shreeshas95 2:2caf2a9a13aa 183 return 1 if code match
shreeshas95 2:2caf2a9a13aa 184 return 0 if code mismatch
shreeshas95 2:2caf2a9a13aa 185 */
shreeshas95 2:2caf2a9a13aa 186 #define GScodeVerification(returnHere){\
shreeshas95 2:2caf2a9a13aa 187 Base_tc *testTC = gHEAD_NODE_TCL;\
shreeshas95 2:2caf2a9a13aa 188 uint16_t overflowCount = 0;\
shreeshas95 15:1c1ca992b43b 189 returnHere = 0xFF;\
shreeshas95 2:2caf2a9a13aa 190 while( (overflowCount < TCL_OVERFLOW_CONSTANT) && (testTC != NULL) ){\
shreeshas95 2:2caf2a9a13aa 191 if( (GETpacket_seq_count(testTC) == PSC_CALLSIGN) && (GETapid(testTC) == APID_CALLSIGN) ){\
shreeshas95 2:2caf2a9a13aa 192 uint8_t temp8 = testTC->TC_string[1];\
shreeshas95 2:2caf2a9a13aa 193 if( temp8 & 0x04 ){\
shreeshas95 2:2caf2a9a13aa 194 for( int i = 2 ; i <= 8 ; ++i ){\
shreeshas95 2:2caf2a9a13aa 195 if( testTC->TC_string[i] != gGSCODE[i-2] ){\
shreeshas95 2:2caf2a9a13aa 196 returnHere = 0;\
shreeshas95 2:2caf2a9a13aa 197 break;\
shreeshas95 2:2caf2a9a13aa 198 }\
shreeshas95 2:2caf2a9a13aa 199 }\
shreeshas95 2:2caf2a9a13aa 200 }\
shreeshas95 2:2caf2a9a13aa 201 break;\
shreeshas95 2:2caf2a9a13aa 202 }\
shreeshas95 2:2caf2a9a13aa 203 testTC = testTC->next_TC;\
shreeshas95 2:2caf2a9a13aa 204 ++overflowCount;\
shreeshas95 2:2caf2a9a13aa 205 }\
shreeshas95 2:2caf2a9a13aa 206 }
shreeshas95 2:2caf2a9a13aa 207
shreeshas95 2:2caf2a9a13aa 208 /*
shreeshas95 0:f016e9e8d48b 209 @brief: DELETE THE CRC FAILED TC FROM THE LIST TO FREE-UP MEMORY AND UPDATE
shreeshas95 0:f016e9e8d48b 210 THE TOTAL VALID TC AND GENERATE L1_ACK_TM
shreeshas95 0:f016e9e8d48b 211 @param: none
shreeshas95 0:f016e9e8d48b 212 @return: none
shreeshas95 0:f016e9e8d48b 213 */
shreeshas95 4:104dd82c99b8 214 /*tm_ptr is the next_TM of a linked list, and should have the value NULL, i.e. tm_ptr should be the next_TM pointer of thte last node */
shreeshas95 4:104dd82c99b8 215 #define get_ack_l1( tm_ptr ){\
shreeshas95 0:f016e9e8d48b 216 Base_tc *current_TC = gHEAD_NODE_TCL;\
shreeshas95 0:f016e9e8d48b 217 Base_tm *l1_ack = new Short_tm;\
shreeshas95 4:104dd82c99b8 218 /*APPEND TO THE tm_ptr HERE*/\
shreeshas95 4:104dd82c99b8 219 tm_ptr = l1_ack;\
shreeshas95 0:f016e9e8d48b 220 fill_l1_ack(l1_ack);\
shreeshas95 0:f016e9e8d48b 221 int TC_count = 0;\
shreeshas95 4:104dd82c99b8 222 int overflowCountL1 = 0;\
shreeshas95 0:f016e9e8d48b 223 while(current_TC != NULL){\
shreeshas95 4:104dd82c99b8 224 if( overflowCountL1 < TCL_OVERFLOW_CONSTANT ){\
shreeshas95 4:104dd82c99b8 225 /*IF CRC PASS*/\
shreeshas95 4:104dd82c99b8 226 if( (GETcrc_pass(current_TC) == 1) ){\
shreeshas95 4:104dd82c99b8 227 if(TC_count > 4){\
shreeshas95 5:ab276a17ca07 228 /*PENDING: FILL TC_EXEC_CODE, APPEND CRC TO THE TM*/\
shreeshas95 5:ab276a17ca07 229 put_crc_l1_ack( l1_ack );\
shreeshas95 4:104dd82c99b8 230 /*extend the TM linked list*/\
shreeshas95 4:104dd82c99b8 231 TC_count = 0;\
shreeshas95 4:104dd82c99b8 232 l1_ack->next_TM = new Short_tm;\
shreeshas95 4:104dd82c99b8 233 l1_ack = l1_ack->next_TM;\
shreeshas95 4:104dd82c99b8 234 fill_l1_ack(l1_ack);\
shreeshas95 4:104dd82c99b8 235 }\
shreeshas95 4:104dd82c99b8 236 /*PSC starts from 7th byte*/\
shreeshas95 4:104dd82c99b8 237 l1_ack->TM_string[6+TC_count] = GETpacket_seq_count(current_TC);\
shreeshas95 4:104dd82c99b8 238 /*TC exec status*/\
shreeshas95 4:104dd82c99b8 239 switch(TC_count){\
shreeshas95 4:104dd82c99b8 240 case 0:\
shreeshas95 4:104dd82c99b8 241 l1_ack->TM_string[3] = (GETexec_status(current_TC)) & 0x0F;\
shreeshas95 4:104dd82c99b8 242 break;\
shreeshas95 4:104dd82c99b8 243 case 1:\
shreeshas95 4:104dd82c99b8 244 l1_ack->TM_string[4] = (GETexec_status(current_TC) << 4) & 0xF0;\
shreeshas95 4:104dd82c99b8 245 break;\
shreeshas95 4:104dd82c99b8 246 case 2:\
shreeshas95 4:104dd82c99b8 247 l1_ack->TM_string[4] |= (GETexec_status(current_TC)) & 0x0F;\
shreeshas95 4:104dd82c99b8 248 break;\
shreeshas95 4:104dd82c99b8 249 case 3:\
shreeshas95 4:104dd82c99b8 250 l1_ack->TM_string[5] = (GETexec_status(current_TC) << 4) & 0xF0;\
shreeshas95 4:104dd82c99b8 251 break;\
shreeshas95 4:104dd82c99b8 252 case 4:\
shreeshas95 4:104dd82c99b8 253 l1_ack->TM_string[5] |= (GETexec_status(current_TC)) & 0x0F;\
shreeshas95 4:104dd82c99b8 254 }\
shreeshas95 4:104dd82c99b8 255 ++TC_count;\
shreeshas95 0:f016e9e8d48b 256 }\
shreeshas95 4:104dd82c99b8 257 current_TC = current_TC->next_TC;\
shreeshas95 4:104dd82c99b8 258 ++overflowCountL1;\
shreeshas95 4:104dd82c99b8 259 }\
shreeshas95 4:104dd82c99b8 260 else{\
shreeshas95 4:104dd82c99b8 261 /*PENDING: RESET CDMS*/\
shreeshas95 4:104dd82c99b8 262 break;\
shreeshas95 4:104dd82c99b8 263 }\
shreeshas95 4:104dd82c99b8 264 }\
shreeshas95 4:104dd82c99b8 265 /*FILL UP THE REMAINING FIELDS WITH 0x00 as PSC, AND 0xF as tc exec status*/\
shreeshas95 4:104dd82c99b8 266 if( (TC_count < 5) && (TC_count != 0) ){\
shreeshas95 4:104dd82c99b8 267 while(TC_count < 5){\
shreeshas95 4:104dd82c99b8 268 l1_ack->TM_string[6+TC_count] = 0x00;\
shreeshas95 0:f016e9e8d48b 269 switch(TC_count){\
shreeshas95 0:f016e9e8d48b 270 case 1:\
shreeshas95 4:104dd82c99b8 271 l1_ack->TM_string[4] = 0xF0;\
shreeshas95 0:f016e9e8d48b 272 break;\
shreeshas95 0:f016e9e8d48b 273 case 2:\
shreeshas95 4:104dd82c99b8 274 l1_ack->TM_string[4] |= 0x0F;\
shreeshas95 0:f016e9e8d48b 275 break;\
shreeshas95 0:f016e9e8d48b 276 case 3:\
shreeshas95 4:104dd82c99b8 277 l1_ack->TM_string[5] = 0xF0;\
shreeshas95 0:f016e9e8d48b 278 break;\
shreeshas95 0:f016e9e8d48b 279 case 4:\
shreeshas95 4:104dd82c99b8 280 l1_ack->TM_string[5] |= 0x0F;\
shreeshas95 0:f016e9e8d48b 281 }\
shreeshas95 0:f016e9e8d48b 282 ++TC_count;\
shreeshas95 0:f016e9e8d48b 283 }\
shreeshas95 0:f016e9e8d48b 284 }\
shreeshas95 5:ab276a17ca07 285 put_crc_l1_ack(l1_ack);\
shreeshas95 4:104dd82c99b8 286 }
shreeshas95 4:104dd82c99b8 287
shreeshas95 4:104dd82c99b8 288 /*tm_ptr is the next_TM of a linked list, and should have the value NULL, i.e. tm_ptr should be the next_TM pointer of thte last node */
shreeshas95 4:104dd82c99b8 289 #define get_tc_list(tm_ptr, thePSC){\
shreeshas95 5:ab276a17ca07 290 uint8_t TM_PSC = 0xFF;\
shreeshas95 4:104dd82c99b8 291 uint8_t TC_PSC = thePSC;\
shreeshas95 4:104dd82c99b8 292 int overflowCount = 0;\
shreeshas95 4:104dd82c99b8 293 uint8_t TC_LIST_TAG = 0x00;\
shreeshas95 4:104dd82c99b8 294 Base_tc *temp_tc = gHEAD_NODE_TCL;\
shreeshas95 4:104dd82c99b8 295 bool first_time = true;\
shreeshas95 5:ab276a17ca07 296 Base_tm *current_tm = NULL;\
shreeshas95 4:104dd82c99b8 297 while( temp_tc != NULL ){\
shreeshas95 4:104dd82c99b8 298 if( overflowCount < TCL_OVERFLOW_CONSTANT ){\
shreeshas95 4:104dd82c99b8 299 TM_PSC = TM_PSC + 1;\
shreeshas95 4:104dd82c99b8 300 /*Increment TM_PSC for every new TM pointer created*/\
shreeshas95 4:104dd82c99b8 301 Base_tm *temp_tm = new Long_tm;\
shreeshas95 4:104dd82c99b8 302 temp_tm->next_TM = NULL;\
shreeshas95 4:104dd82c99b8 303 uint8_t temp8 = LONG_TM_CODE;\
shreeshas95 4:104dd82c99b8 304 PUTshort_or_long_tm(temp_tm->fields, temp8);\
shreeshas95 4:104dd82c99b8 305 temp8 = TMID_TCL;\
shreeshas95 4:104dd82c99b8 306 PUTtmid((temp_tm->fields), temp8);\
shreeshas95 4:104dd82c99b8 307 temp_tm->TM_string[0] = 0x38;\
shreeshas95 4:104dd82c99b8 308 /*Frame type(1) = 0; TMID = 0111; Spare = 000*/\
shreeshas95 4:104dd82c99b8 309 temp_tm->TM_string[1] = TC_PSC;\
shreeshas95 4:104dd82c99b8 310 temp_tm->TM_string[3] = TM_PSC;\
shreeshas95 5:ab276a17ca07 311 int indexCustom = 4, num_of_short_tc = 0;\
shreeshas95 4:104dd82c99b8 312 while(temp_tc != NULL){\
shreeshas95 4:104dd82c99b8 313 if( overflowCount < TCL_OVERFLOW_CONSTANT ){\
shreeshas95 4:104dd82c99b8 314 if( GETshort_or_long_tc(temp_tc) == SHORT_TC_CODE ){\
shreeshas95 4:104dd82c99b8 315 for( int i = 0 ; i < TC_SHORT_SIZE ; ++i ){\
shreeshas95 5:ab276a17ca07 316 temp_tm->TM_string[indexCustom + i] = temp_tc->TC_string[i];\
shreeshas95 4:104dd82c99b8 317 }\
shreeshas95 5:ab276a17ca07 318 indexCustom = indexCustom + TC_SHORT_SIZE;\
shreeshas95 4:104dd82c99b8 319 ++overflowCount;\
shreeshas95 4:104dd82c99b8 320 /*INCREMENT STUFF*/\
shreeshas95 4:104dd82c99b8 321 temp_tc = temp_tc->next_TC;\
shreeshas95 4:104dd82c99b8 322 num_of_short_tc = num_of_short_tc + 1;\
shreeshas95 4:104dd82c99b8 323 if (temp_tc == NULL){\
shreeshas95 5:ab276a17ca07 324 for (int i = indexCustom ; i < TM_LONG_SIZE-2 ; ++i){\
shreeshas95 4:104dd82c99b8 325 temp_tm->TM_string[i] = 0;\
shreeshas95 4:104dd82c99b8 326 /*Fill remaining values with 0*/\
shreeshas95 4:104dd82c99b8 327 }\
shreeshas95 4:104dd82c99b8 328 TC_LIST_TAG = num_of_short_tc;\
shreeshas95 4:104dd82c99b8 329 break;\
shreeshas95 4:104dd82c99b8 330 }\
shreeshas95 4:104dd82c99b8 331 if( (GETshort_or_long_tc(temp_tc) == LONG_TC_CODE) || (num_of_short_tc == OBOSC_TCL_MAX_SHORT_SIZE) ){\
shreeshas95 4:104dd82c99b8 332 /*Next TC is long or memory is filled*/\
shreeshas95 5:ab276a17ca07 333 for(int i = indexCustom; i < TM_LONG_SIZE-2 ; ++i){\
shreeshas95 4:104dd82c99b8 334 temp_tm->TM_string[i] = 0;\
shreeshas95 4:104dd82c99b8 335 /*Fill remaining values with 0*/\
shreeshas95 4:104dd82c99b8 336 }\
shreeshas95 4:104dd82c99b8 337 TC_LIST_TAG = num_of_short_tc;\
shreeshas95 4:104dd82c99b8 338 break;\
shreeshas95 4:104dd82c99b8 339 }\
shreeshas95 4:104dd82c99b8 340 }\
shreeshas95 4:104dd82c99b8 341 else if (TC_LIST_TAG == OBOSC_TCL_TAG_LONG_FIRST_HALF){\
shreeshas95 4:104dd82c99b8 342 /*Long TC, 2nd half*/\
shreeshas95 4:104dd82c99b8 343 for (int i = 0; i < OBOSC_LONG_TC_SECOND_HALF_SIZE ; ++i){\
shreeshas95 5:ab276a17ca07 344 temp_tm->TM_string[indexCustom + i] = temp_tc->TC_string[OBOSC_LONG_TC_FIRST_HALF_SIZE + i];\
shreeshas95 4:104dd82c99b8 345 /*Fill the TM with TC_values*/\
shreeshas95 4:104dd82c99b8 346 }\
shreeshas95 5:ab276a17ca07 347 for (int i = OBOSC_LONG_TC_SECOND_HALF_SIZE + indexCustom ; i < TM_LONG_SIZE-2 ; ++i ){\
shreeshas95 4:104dd82c99b8 348 temp_tm->TM_string[i] = 0;\
shreeshas95 4:104dd82c99b8 349 /*Fill remaining values with 0*/\
shreeshas95 4:104dd82c99b8 350 }\
shreeshas95 4:104dd82c99b8 351 temp_tc = temp_tc->next_TC;\
shreeshas95 4:104dd82c99b8 352 TC_LIST_TAG = OBOSC_TCL_TAG_LONG_SECOND_HALF;\
shreeshas95 4:104dd82c99b8 353 ++overflowCount;\
shreeshas95 4:104dd82c99b8 354 break;\
shreeshas95 4:104dd82c99b8 355 }\
shreeshas95 4:104dd82c99b8 356 else{\
shreeshas95 4:104dd82c99b8 357 /*Long TC, 1st half */\
shreeshas95 4:104dd82c99b8 358 for (int i = 0; i < OBOSC_LONG_TC_FIRST_HALF_SIZE; ++i){\
shreeshas95 5:ab276a17ca07 359 /*gPC.printf("indexCustom = %d\r\n", indexCustom);*/\
shreeshas95 5:ab276a17ca07 360 temp_tm->TM_string[indexCustom + i] = temp_tc->TC_string[i];\
shreeshas95 4:104dd82c99b8 361 /*Fill the TM with TC_values*/\
shreeshas95 4:104dd82c99b8 362 }\
shreeshas95 5:ab276a17ca07 363 for (int i = OBOSC_LONG_TC_FIRST_HALF_SIZE + indexCustom ; i < TM_LONG_SIZE-2 ; ++i ){\
shreeshas95 5:ab276a17ca07 364 temp_tm->TM_string[i] = 0;\
shreeshas95 4:104dd82c99b8 365 /*Fill remaining values with 0*/\
shreeshas95 4:104dd82c99b8 366 }\
shreeshas95 4:104dd82c99b8 367 TC_LIST_TAG = OBOSC_TCL_TAG_LONG_FIRST_HALF;\
shreeshas95 4:104dd82c99b8 368 break;\
shreeshas95 4:104dd82c99b8 369 }\
shreeshas95 4:104dd82c99b8 370 }\
shreeshas95 4:104dd82c99b8 371 else{\
shreeshas95 4:104dd82c99b8 372 /*PENDING: reset cdms*/\
shreeshas95 0:f016e9e8d48b 373 break;\
shreeshas95 4:104dd82c99b8 374 }\
shreeshas95 0:f016e9e8d48b 375 }\
shreeshas95 4:104dd82c99b8 376 temp_tm->TM_string[2] = TC_LIST_TAG;\
shreeshas95 4:104dd82c99b8 377 /*TC_LIST_TAG as is updated in the inner while loop*/\
shreeshas95 4:104dd82c99b8 378 uint16_t crc16 = crc16_gen(temp_tm->TM_string, TM_LONG_SIZE-2);\
shreeshas95 4:104dd82c99b8 379 temp_tm->TM_string[TM_LONG_SIZE-2] = (crc16 & 0xFF00) >> 8 ;\
shreeshas95 4:104dd82c99b8 380 temp_tm->TM_string[TM_LONG_SIZE-1] = crc16 & 0x00FF;\
shreeshas95 4:104dd82c99b8 381 /*Attach this new node to the TM linked list*/\
shreeshas95 5:ab276a17ca07 382 if( first_time ){\
shreeshas95 5:ab276a17ca07 383 first_time = false;\
shreeshas95 5:ab276a17ca07 384 tm_ptr = temp_tm;\
shreeshas95 5:ab276a17ca07 385 current_tm = temp_tm;\
shreeshas95 5:ab276a17ca07 386 }\
shreeshas95 5:ab276a17ca07 387 else{\
shreeshas95 5:ab276a17ca07 388 current_tm->next_TM = temp_tm;\
shreeshas95 5:ab276a17ca07 389 current_tm = current_tm->next_TM;\
shreeshas95 5:ab276a17ca07 390 }\
shreeshas95 4:104dd82c99b8 391 /*Attach this new node at the end*/\
shreeshas95 0:f016e9e8d48b 392 }\
shreeshas95 4:104dd82c99b8 393 else{\
shreeshas95 4:104dd82c99b8 394 /*PENDING: reset CDMS*/\
shreeshas95 4:104dd82c99b8 395 break;\
shreeshas95 4:104dd82c99b8 396 }\
shreeshas95 0:f016e9e8d48b 397 }\
shreeshas95 0:f016e9e8d48b 398 }
shreeshas95 0:f016e9e8d48b 399
shreeshas95 0:f016e9e8d48b 400 // CDMS TEAM CODE START
shreeshas95 0:f016e9e8d48b 401 #define CDMS_RLY_TMTC(tc_ptr, tm_ptr){\
shreeshas95 0:f016e9e8d48b 402 tm_ptr = NULL;\
shreeshas95 0:f016e9e8d48b 403 }\
shreeshas95 0:f016e9e8d48b 404 // CDMS TEAM CODE END
shreeshas95 0:f016e9e8d48b 405
shreeshas95 0:f016e9e8d48b 406 // EXECUTE OBOSC
shreeshas95 0:f016e9e8d48b 407 #define execute_obosc_core(tc_ptr, tm_ptr) {\
shreeshas95 0:f016e9e8d48b 408 uint8_t service_subtype = (tc_ptr->TC_string[2]) & 0x0F;\
shreeshas95 4:104dd82c99b8 409 uint8_t temp8 = 0x00;\
shreeshas95 4:104dd82c99b8 410 Base_tc *modify_this = gHEAD_NODE_TCL;\
shreeshas95 4:104dd82c99b8 411 int modify_overflow = 0x00;\
shreeshas95 4:104dd82c99b8 412 switch( service_subtype ){\
shreeshas95 4:104dd82c99b8 413 case OBOSC_SUB_DISABLE:\
aniruddhv 12:ffdb29353058 414 /*gPC.puts("target psc are ");*/\
shreeshas95 5:ab276a17ca07 415 for(int i = 3 ; i < 9 ; ++i){\
aniruddhv 12:ffdb29353058 416 /*gPC.printf("%u ", tc_ptr->TC_string[i]);*/\
shreeshas95 5:ab276a17ca07 417 }\
aniruddhv 12:ffdb29353058 418 /*gPC.puts("\r\n");*/\
shreeshas95 5:ab276a17ca07 419 /*gPC.puts("disable type obosc\r\n");*/\
shreeshas95 4:104dd82c99b8 420 while( modify_this != NULL ){\
shreeshas95 4:104dd82c99b8 421 if( modify_overflow < TCL_OVERFLOW_CONSTANT ){\
shreeshas95 5:ab276a17ca07 422 uint8_t modify_psc = GETpacket_seq_count(modify_this);\
shreeshas95 5:ab276a17ca07 423 /*gPC.printf("mosify_psc = %u\r\n", modify_psc);*/\
shreeshas95 4:104dd82c99b8 424 for( int i = 3 ; i < 9 ; ++i ){\
shreeshas95 5:ab276a17ca07 425 uint8_t target_psc = tc_ptr->TC_string[i];\
shreeshas95 5:ab276a17ca07 426 if( (target_psc == modify_psc) && (target_psc != 0) ){\
shreeshas95 4:104dd82c99b8 427 uint16_t tempExec = TC_STATE_DISABLED;\
shreeshas95 4:104dd82c99b8 428 PUTexec_status( modify_this, tempExec );\
shreeshas95 4:104dd82c99b8 429 break;\
shreeshas95 4:104dd82c99b8 430 }\
shreeshas95 4:104dd82c99b8 431 }\
shreeshas95 4:104dd82c99b8 432 modify_this = modify_this->next_TC;\
shreeshas95 4:104dd82c99b8 433 ++modify_overflow;\
shreeshas95 4:104dd82c99b8 434 }\
shreeshas95 4:104dd82c99b8 435 else{\
shreeshas95 4:104dd82c99b8 436 /*PENDING: RESET CDMS*/\
shreeshas95 4:104dd82c99b8 437 break;\
shreeshas95 4:104dd82c99b8 438 }\
shreeshas95 4:104dd82c99b8 439 }\
shreeshas95 4:104dd82c99b8 440 break;\
shreeshas95 4:104dd82c99b8 441 case OBOSC_SUB_RETRY:\
aniruddhv 12:ffdb29353058 442 /*gPC.puts("retry type obosc\r\n");*/\
shreeshas95 4:104dd82c99b8 443 while( modify_this != NULL ){\
shreeshas95 4:104dd82c99b8 444 if( modify_overflow < TCL_OVERFLOW_CONSTANT ){\
shreeshas95 5:ab276a17ca07 445 uint8_t modify_psc = GETpacket_seq_count(modify_this);\
shreeshas95 4:104dd82c99b8 446 for( int i = 3 ; i < 9 ; ++i ){\
shreeshas95 5:ab276a17ca07 447 uint8_t target_psc = tc_ptr->TC_string[i];\
shreeshas95 5:ab276a17ca07 448 if( (target_psc == modify_psc) && (target_psc != 0) ){\
shreeshas95 4:104dd82c99b8 449 uint16_t tempExec = TC_STATE_MARKED_RETRY;\
shreeshas95 4:104dd82c99b8 450 PUTexec_status( modify_this, tempExec );\
aniruddhv 12:ffdb29353058 451 /*gPC.puts("reqquired tc found: disable\r\n");*/\
shreeshas95 4:104dd82c99b8 452 break;\
shreeshas95 4:104dd82c99b8 453 }\
shreeshas95 4:104dd82c99b8 454 }\
shreeshas95 4:104dd82c99b8 455 modify_this = modify_this->next_TC;\
shreeshas95 4:104dd82c99b8 456 ++modify_overflow;\
shreeshas95 4:104dd82c99b8 457 }\
shreeshas95 4:104dd82c99b8 458 else{\
shreeshas95 4:104dd82c99b8 459 /*PENDING: RESET CDMS*/\
shreeshas95 4:104dd82c99b8 460 break;\
shreeshas95 4:104dd82c99b8 461 }\
shreeshas95 4:104dd82c99b8 462 }\
shreeshas95 4:104dd82c99b8 463 break;\
shreeshas95 4:104dd82c99b8 464 }\
shreeshas95 4:104dd82c99b8 465 Base_tm *ackl234new = new Short_tm;\
shreeshas95 4:104dd82c99b8 466 ackl234new->next_TM = NULL;\
shreeshas95 4:104dd82c99b8 467 /*return telemetry pointer here*/\
shreeshas95 4:104dd82c99b8 468 tm_ptr = ackl234new;\
shreeshas95 4:104dd82c99b8 469 temp8 = SHORT_TM_CODE;\
shreeshas95 4:104dd82c99b8 470 PUTshort_or_long_tm(ackl234new->fields, temp8);\
shreeshas95 4:104dd82c99b8 471 temp8 = TMID_ACK_L234;\
shreeshas95 4:104dd82c99b8 472 PUTtmid((ackl234new->fields), temp8);\
shreeshas95 4:104dd82c99b8 473 ackl234new->TM_string[0] = TMID_ACK_L234 << 4;\
shreeshas95 4:104dd82c99b8 474 ackl234new->TM_string[1] = GETpacket_seq_count(tc_ptr);\
shreeshas95 4:104dd82c99b8 475 ackl234new->TM_string[2] = 0xA0;\
shreeshas95 4:104dd82c99b8 476 for(int i = 3; i < 11; ++i){\
shreeshas95 4:104dd82c99b8 477 ackl234new->TM_string[i] = 0x00;\
shreeshas95 4:104dd82c99b8 478 }\
shreeshas95 4:104dd82c99b8 479 uint16_t crc = crc16_gen(ackl234new->TM_string, TM_SHORT_SIZE-2);\
shreeshas95 4:104dd82c99b8 480 ackl234new->TM_string[11] = (crc & 0xFF00) >> 8;\
shreeshas95 4:104dd82c99b8 481 ackl234new->TM_string[12] = crc & 0x00FF;\
shreeshas95 4:104dd82c99b8 482 /*ack l234 old*/\
shreeshas95 4:104dd82c99b8 483 if( service_subtype == OBOSC_SUB_REP_LE ){\
shreeshas95 4:104dd82c99b8 484 if( gLAST_TM_SHORT_OR_LONG == SHORT_TM_CODE ){\
shreeshas95 4:104dd82c99b8 485 Base_tm *ackl234old = new Short_tm;\
shreeshas95 4:104dd82c99b8 486 ackl234old->next_TM = NULL;\
shreeshas95 4:104dd82c99b8 487 /*APPEND TO ACK L234 NEW HERE*/\
shreeshas95 4:104dd82c99b8 488 ackl234new->next_TM = ackl234old;\
shreeshas95 4:104dd82c99b8 489 uint8_t temp82 = TM_SHORT_SIZE;\
shreeshas95 4:104dd82c99b8 490 PUTshort_or_long_tm(ackl234old->fields, temp82);\
shreeshas95 4:104dd82c99b8 491 /*TMID FOR SHORT TM*/\
shreeshas95 4:104dd82c99b8 492 uint8_t y = (gLAST_TM[0] & 0xF0) >> 4;\
shreeshas95 4:104dd82c99b8 493 PUTtmid((ackl234old->fields), y);\
shreeshas95 4:104dd82c99b8 494 for( int i = 0 ; i < TM_SHORT_SIZE ; ++i ){\
shreeshas95 4:104dd82c99b8 495 ackl234old->TM_string[i] = gLAST_TM[i];\
shreeshas95 4:104dd82c99b8 496 }\
shreeshas95 0:f016e9e8d48b 497 }\
shreeshas95 4:104dd82c99b8 498 else{\
shreeshas95 4:104dd82c99b8 499 Base_tm *tempLongTM = new Long_tm;\
shreeshas95 4:104dd82c99b8 500 tempLongTM->next_TM = NULL;\
shreeshas95 4:104dd82c99b8 501 /*APPEND TO ACK L234 NEW HERE*/\
shreeshas95 4:104dd82c99b8 502 ackl234new->next_TM = tempLongTM;\
shreeshas95 4:104dd82c99b8 503 uint8_t temp82 = TM_LONG_SIZE;\
shreeshas95 4:104dd82c99b8 504 PUTshort_or_long_tm(tempLongTM->fields, temp82);\
shreeshas95 4:104dd82c99b8 505 /*TMID FOR LONG TM*/\
shreeshas95 4:104dd82c99b8 506 uint8_t y = (gLAST_TM[0] & 0x78) >> 3;\
shreeshas95 4:104dd82c99b8 507 PUTtmid((tempLongTM->fields), y);\
shreeshas95 4:104dd82c99b8 508 for( int i = 0 ; i < TM_LONG_SIZE ; ++i ){\
shreeshas95 4:104dd82c99b8 509 tempLongTM->TM_string[i] = gLAST_TM[i];\
shreeshas95 4:104dd82c99b8 510 }\
shreeshas95 4:104dd82c99b8 511 }\
shreeshas95 4:104dd82c99b8 512 }\
shreeshas95 4:104dd82c99b8 513 else if( service_subtype == OBOSC_SUB_REP_TCLD ){\
shreeshas95 4:104dd82c99b8 514 get_tc_list(ackl234new->next_TM, GETpacket_seq_count(tc_ptr));\
shreeshas95 4:104dd82c99b8 515 }\
shreeshas95 4:104dd82c99b8 516 else if( service_subtype == OBOSC_SUB_RESET ){\
shreeshas95 4:104dd82c99b8 517 reset_all;\
shreeshas95 4:104dd82c99b8 518 /*PENDING: VERIFY reset_all, RESET CDMS*/\
shreeshas95 0:f016e9e8d48b 519 }\
shreeshas95 5:ab276a17ca07 520 else if( (service_subtype != OBOSC_SUB_DISABLE) && (service_subtype != OBOSC_SUB_RETRY) ){\
shreeshas95 4:104dd82c99b8 521 /*CHANGE THE ACK CODE TO INVALID TC*/\
shreeshas95 4:104dd82c99b8 522 ackl234new->TM_string[2] = 0xA2;\
shreeshas95 0:f016e9e8d48b 523 }\
aniruddhv 12:ffdb29353058 524 /*gPC.puts("completed obosc\r\n");*/\
shreeshas95 4:104dd82c99b8 525 }
shreeshas95 4:104dd82c99b8 526
shreeshas95 4:104dd82c99b8 527 /*tm_ptr is the next_TM of a linked list, and should have the value NULL, i.e. tm_ptr should be the next_TM pointer of thte last node */
shreeshas95 4:104dd82c99b8 528 #define get_call_sign(tm_ptr) {\
shreeshas95 4:104dd82c99b8 529 Base_tm* call_sign_tm = new Short_tm;\
shreeshas95 4:104dd82c99b8 530 call_sign_tm->next_TM = NULL;\
shreeshas95 4:104dd82c99b8 531 tm_ptr = call_sign_tm;\
shreeshas95 4:104dd82c99b8 532 uint8_t temp8 = TMID_CALL_SIGN;\
shreeshas95 4:104dd82c99b8 533 PUTtmid(call_sign_tm->fields, temp8);\
shreeshas95 4:104dd82c99b8 534 temp8 = SHORT_TM_CODE;\
shreeshas95 4:104dd82c99b8 535 PUTshort_or_long_tm(call_sign_tm->fields, temp8);\
shreeshas95 4:104dd82c99b8 536 for( int i = 0 ; i < TM_SHORT_SIZE ; ++i ){\
shreeshas95 4:104dd82c99b8 537 call_sign_tm->TM_string[i] = gCALL_SIGN_STRING[i];\
shreeshas95 4:104dd82c99b8 538 }\
shreeshas95 0:f016e9e8d48b 539 }
shreeshas95 0:f016e9e8d48b 540
shreeshas95 0:f016e9e8d48b 541 #define EXECUTE_OBOSC_ONLY {\
shreeshas95 4:104dd82c99b8 542 Base_tm *obosc_tm_head = NULL;\
shreeshas95 4:104dd82c99b8 543 get_call_sign(obosc_tm_head);\
shreeshas95 4:104dd82c99b8 544 Base_tm *obosc_tm_current = obosc_tm_head;\
shreeshas95 4:104dd82c99b8 545 get_ack_l1(obosc_tm_current->next_TM);\
shreeshas95 4:104dd82c99b8 546 int overflowCountOBONLY = 0;\
shreeshas95 4:104dd82c99b8 547 while( obosc_tm_current->next_TM != NULL ){\
shreeshas95 4:104dd82c99b8 548 if( overflowCountOBONLY < TM_OVERFLOW_CONSTANT ){\
shreeshas95 4:104dd82c99b8 549 obosc_tm_current = obosc_tm_current->next_TM;\
shreeshas95 4:104dd82c99b8 550 ++overflowCountOBONLY;\
shreeshas95 4:104dd82c99b8 551 }\
shreeshas95 4:104dd82c99b8 552 else{\
shreeshas95 4:104dd82c99b8 553 /*PENDING: RESET CDMS*/\
shreeshas95 4:104dd82c99b8 554 break;\
shreeshas95 4:104dd82c99b8 555 }\
shreeshas95 4:104dd82c99b8 556 }\
shreeshas95 15:1c1ca992b43b 557 for(uint8_t execute_psc = PSC_START_VALUE ; execute_psc < gTOTAL_VALID_TC ; ++execute_psc){\
shreeshas95 4:104dd82c99b8 558 Base_tc* current_TC = gHEAD_NODE_TCL;\
shreeshas95 4:104dd82c99b8 559 int overCount = 0;\
shreeshas95 0:f016e9e8d48b 560 while( current_TC != NULL ){\
shreeshas95 4:104dd82c99b8 561 if( overCount < TCL_OVERFLOW_CONSTANT ){\
shreeshas95 4:104dd82c99b8 562 if( (GETcrc_pass(current_TC) == 1) && (GETpacket_seq_count(current_TC) == execute_psc) ){\
shreeshas95 4:104dd82c99b8 563 /*CHECK FOR OBOSC*/\
shreeshas95 0:f016e9e8d48b 564 uint8_t temp82 = 0x00;\
shreeshas95 0:f016e9e8d48b 565 isit_obosc(current_TC, temp82);\
shreeshas95 0:f016e9e8d48b 566 if(temp82 == 0x01){\
shreeshas95 4:104dd82c99b8 567 uint16_t current_exec_status = GETexec_status(current_TC);\
shreeshas95 4:104dd82c99b8 568 if( (current_exec_status == TC_STATE_SUCCESSFULLY_EXECUTED) || (current_exec_status == TC_STATE_DISABLED) )\
shreeshas95 4:104dd82c99b8 569 break;\
shreeshas95 4:104dd82c99b8 570 else if( (current_exec_status == TC_STATE_UNEXECUTED) || (current_exec_status == TC_STATE_MARKED_RETRY) ){\
aniruddhv 12:ffdb29353058 571 /*gPC.printf("It is obosc: %u\r\n", execute_psc);*/\
shreeshas95 4:104dd82c99b8 572 /*EXECUTION OF OBOSC TC*/\
shreeshas95 4:104dd82c99b8 573 /*WARNING: LARGE MEMORY UTILIZATION FOR TC-LIST-REPORT */\
shreeshas95 4:104dd82c99b8 574 execute_obosc_core(current_TC, obosc_tm_current->next_TM);\
shreeshas95 4:104dd82c99b8 575 /*INCREMENT POINTER TO THE LAST NODE*/\
shreeshas95 4:104dd82c99b8 576 int overflowCountOBinside = 0;\
shreeshas95 4:104dd82c99b8 577 while( obosc_tm_current->next_TM != NULL ){\
shreeshas95 4:104dd82c99b8 578 if( overflowCountOBinside < TM_OVERFLOW_CONSTANT ){\
shreeshas95 4:104dd82c99b8 579 obosc_tm_current = obosc_tm_current->next_TM;\
shreeshas95 4:104dd82c99b8 580 ++overflowCountOBinside;\
shreeshas95 4:104dd82c99b8 581 }\
shreeshas95 4:104dd82c99b8 582 else{\
shreeshas95 4:104dd82c99b8 583 /*PENDING: RESET CDMS*/\
shreeshas95 4:104dd82c99b8 584 break;\
shreeshas95 4:104dd82c99b8 585 }\
shreeshas95 4:104dd82c99b8 586 }\
shreeshas95 4:104dd82c99b8 587 uint16_t temp16 = TC_STATE_SUCCESSFULLY_EXECUTED;\
shreeshas95 4:104dd82c99b8 588 PUTexec_status(current_TC, temp16);\
shreeshas95 0:f016e9e8d48b 589 }\
shreeshas95 0:f016e9e8d48b 590 }\
shreeshas95 0:f016e9e8d48b 591 }\
shreeshas95 4:104dd82c99b8 592 current_TC = current_TC->next_TC;\
shreeshas95 4:104dd82c99b8 593 ++overCount;\
shreeshas95 0:f016e9e8d48b 594 }\
shreeshas95 4:104dd82c99b8 595 else{\
shreeshas95 4:104dd82c99b8 596 /*PENDING: REST CDMS: MEMORY LEAK FOUND*/\
shreeshas95 4:104dd82c99b8 597 break;\
shreeshas95 4:104dd82c99b8 598 }\
shreeshas95 4:104dd82c99b8 599 }\
shreeshas95 4:104dd82c99b8 600 }\
shreeshas95 15:1c1ca992b43b 601 obosc_tm_current = obosc_tm_head;\
shreeshas95 15:1c1ca992b43b 602 while( obosc_tm_current != NULL ){\
shreeshas95 15:1c1ca992b43b 603 int length = TM_SHORT_SIZE;\
shreeshas95 15:1c1ca992b43b 604 if( GETshort_or_long_tm(obosc_tm_current->fields) == SHORT_TM_CODE ){\
shreeshas95 15:1c1ca992b43b 605 length = TM_SHORT_SIZE;\
shreeshas95 15:1c1ca992b43b 606 }\
shreeshas95 15:1c1ca992b43b 607 else{\
shreeshas95 15:1c1ca992b43b 608 length = TM_LONG_SIZE;\
shreeshas95 15:1c1ca992b43b 609 }\
shreeshas95 15:1c1ca992b43b 610 for(int i = 0 ; i < length ; ++i){\
shreeshas95 15:1c1ca992b43b 611 gPC.putc(obosc_tm_current->TM_string[i]);\
shreeshas95 15:1c1ca992b43b 612 }\
shreeshas95 15:1c1ca992b43b 613 obosc_tm_current = obosc_tm_current->next_TM;\
shreeshas95 15:1c1ca992b43b 614 }\
krishanprajapat 19:27e5f2edaf26 615 snd_tm.head_pointer(obosc_tm_head);\
krishanprajapat 19:27e5f2edaf26 616 adf_not_SDcard;\
shreeshas95 4:104dd82c99b8 617 /*DELETE THE TM AFTER USE*/\
shreeshas95 4:104dd82c99b8 618 obosc_tm_current = obosc_tm_head;\
shreeshas95 4:104dd82c99b8 619 int overCount = 0;\
shreeshas95 4:104dd82c99b8 620 while( obosc_tm_current != NULL ){\
shreeshas95 4:104dd82c99b8 621 if( (overCount < TM_OVERFLOW_CONSTANT) ){\
shreeshas95 4:104dd82c99b8 622 Base_tm *temp = obosc_tm_current->next_TM;\
shreeshas95 4:104dd82c99b8 623 delete obosc_tm_current;\
shreeshas95 4:104dd82c99b8 624 obosc_tm_current = temp;\
shreeshas95 5:ab276a17ca07 625 ++overCount;\
shreeshas95 4:104dd82c99b8 626 }\
shreeshas95 4:104dd82c99b8 627 else{\
shreeshas95 4:104dd82c99b8 628 /*PENDING: RESET CDMS: MEMORY LEAK FOUND*/\
shreeshas95 4:104dd82c99b8 629 break;\
shreeshas95 0:f016e9e8d48b 630 }\
shreeshas95 0:f016e9e8d48b 631 }\
shreeshas95 0:f016e9e8d48b 632 }
shreeshas95 0:f016e9e8d48b 633
shreeshas95 0:f016e9e8d48b 634 #define EXECUTE_TC {\
shreeshas95 5:ab276a17ca07 635 gMASTER_STATE = TCL_STATE_EXECUTING;\
rohit3342 16:538de1b20b3a 636 for(uint8_t execute_psc = PSC_START_VALUE ; execute_psc < gTOTAL_VALID_TC ; ++execute_psc ){\
rohit3342 16:538de1b20b3a 637 gPC.printf("executing normal %u\r\n", execute_psc);\
shreeshas95 2:2caf2a9a13aa 638 /*gLEDG = !gLEDG;*/\
shreeshas95 2:2caf2a9a13aa 639 /*gLEDR = !gLEDR;*/\
shreeshas95 0:f016e9e8d48b 640 Base_tc* current_TC = gHEAD_NODE_TCL;\
shreeshas95 4:104dd82c99b8 641 int overflowCount = 0;\
shreeshas95 0:f016e9e8d48b 642 while(current_TC != NULL){\
shreeshas95 4:104dd82c99b8 643 if( overflowCount < TCL_OVERFLOW_CONSTANT ){\
shreeshas95 4:104dd82c99b8 644 if( (GETcrc_pass(current_TC) == 1) && (GETpacket_seq_count(current_TC) == execute_psc) ){\
shreeshas95 4:104dd82c99b8 645 uint8_t current_exec_status = GETexec_status(current_TC);\
shreeshas95 5:ab276a17ca07 646 if( (current_exec_status == TC_STATE_SUCCESSFULLY_EXECUTED) || (current_exec_status == TC_STATE_DISABLED) ){\
aniruddhv 12:ffdb29353058 647 /*gPC.printf("disabled or completed at %u\n", execute_psc);*/\
shreeshas95 4:104dd82c99b8 648 break;\
shreeshas95 5:ab276a17ca07 649 }\
shreeshas95 4:104dd82c99b8 650 else if( (current_exec_status == TC_STATE_EXECUTION_FAILED) && (GETabort_on_nack(current_TC) == 1) ){\
aniruddhv 12:ffdb29353058 651 /*gPC.printf("abort on nack at %u psc\r\n", execute_psc);*/\
shreeshas95 4:104dd82c99b8 652 gMASTER_STATE = TCL_STATE_ABORTED;\
shreeshas95 4:104dd82c99b8 653 break;\
shreeshas95 4:104dd82c99b8 654 }\
shreeshas95 4:104dd82c99b8 655 else if( (current_exec_status == TC_STATE_UNEXECUTED) || (current_exec_status == TC_STATE_MARKED_RETRY) ){\
shreeshas95 4:104dd82c99b8 656 /*EXECUTION OF TC START*/\
shreeshas95 4:104dd82c99b8 657 uint8_t temp81 = 0x00;\
shreeshas95 4:104dd82c99b8 658 isit_sdcard(current_TC, temp81);\
shreeshas95 4:104dd82c99b8 659 if( temp81 == 0x00 ){\
aniruddhv 12:ffdb29353058 660 /*gPC.printf("non sd card at %u\r\n", execute_psc);*/\
shreeshas95 4:104dd82c99b8 661 /*EXECUTION OF NON SD-CARD (BOTH OBOSC and CDMS functions)*/\
shreeshas95 4:104dd82c99b8 662 Base_tm *tm_ptr_head = NULL;\
shreeshas95 4:104dd82c99b8 663 get_call_sign(tm_ptr_head);\
shreeshas95 4:104dd82c99b8 664 Base_tm *put_tm_here = NULL;\
shreeshas95 4:104dd82c99b8 665 uint8_t temp82 = 0x00;\
shreeshas95 4:104dd82c99b8 666 uint8_t tempPAhot = 0x00;\
shreeshas95 4:104dd82c99b8 667 isit_obosc(current_TC, temp82);\
shreeshas95 4:104dd82c99b8 668 if(temp82 == 0x01){\
aniruddhv 12:ffdb29353058 669 /*gPC.printf("obosc tc inside normal tc at %u\r\n", execute_psc);*/\
shreeshas95 4:104dd82c99b8 670 /*EXECUTION OF OBOSC TC*/\
shreeshas95 4:104dd82c99b8 671 /*SKIP EXECUTION OF OBOSC HERE*/\
shreeshas95 4:104dd82c99b8 672 }\
shreeshas95 4:104dd82c99b8 673 else{\
aniruddhv 12:ffdb29353058 674 /*gPC.printf("cdms relay tmtc at %u\r\n", execute_psc);*/\
shreeshas95 4:104dd82c99b8 675 /*call CDMS_RLY_TMTC*/\
shreeshas95 4:104dd82c99b8 676 /*CDMS_RLY_TMTC(current_TC, put_tm_here);*/\
shreeshas95 4:104dd82c99b8 677 }\
shreeshas95 4:104dd82c99b8 678 /*DETECT ACK OR NACK*/\
shreeshas95 4:104dd82c99b8 679 uint8_t temp83 = 0x00;\
shreeshas95 4:104dd82c99b8 680 uint8_t temp84 = GETpacket_seq_count(current_TC);\
shreeshas95 4:104dd82c99b8 681 detect_ack(put_tm_here, temp83, temp84);\
shreeshas95 4:104dd82c99b8 682 if( temp83 == 0x01){\
shreeshas95 4:104dd82c99b8 683 uint16_t temp16 = TC_STATE_SUCCESSFULLY_EXECUTED;\
shreeshas95 4:104dd82c99b8 684 PUTexec_status(current_TC, temp16);\
shreeshas95 4:104dd82c99b8 685 }\
shreeshas95 4:104dd82c99b8 686 else{\
shreeshas95 4:104dd82c99b8 687 uint16_t temp16 = TC_STATE_EXECUTION_FAILED;\
shreeshas95 4:104dd82c99b8 688 PUTexec_status(current_TC, temp16);\
shreeshas95 4:104dd82c99b8 689 }\
shreeshas95 4:104dd82c99b8 690 /*ABORT ON NACK AND TC LIST COMPLETED: UPDATE IN gMASTERSTATE*/\
shreeshas95 4:104dd82c99b8 691 if( (GETexec_status(current_TC) == TC_STATE_EXECUTION_FAILED) && (GETabort_on_nack(current_TC) == 1) ){\
shreeshas95 4:104dd82c99b8 692 gMASTER_STATE = TCL_STATE_ABORTED;\
shreeshas95 4:104dd82c99b8 693 }\
shreeshas95 15:1c1ca992b43b 694 else if( execute_psc == (gTOTAL_VALID_TC-1) ){\
shreeshas95 4:104dd82c99b8 695 /*LAST TC IS EXECUTED*/\
shreeshas95 4:104dd82c99b8 696 gMASTER_STATE = TCL_STATE_COMPLETED;\
shreeshas95 4:104dd82c99b8 697 }\
shreeshas95 4:104dd82c99b8 698 /*update last executed L1_ack*/\
shreeshas95 4:104dd82c99b8 699 if( put_tm_here != NULL ){\
shreeshas95 4:104dd82c99b8 700 if( GETshort_or_long_tm(put_tm_here->fields) == SHORT_TM_CODE ){\
shreeshas95 4:104dd82c99b8 701 for(int i = 0 ; i < TM_SHORT_SIZE ; ++i){\
shreeshas95 4:104dd82c99b8 702 gLAST_TM[i] = put_tm_here->TM_string[i];\
shreeshas95 4:104dd82c99b8 703 gLAST_TM_SHORT_OR_LONG = SHORT_TM_CODE;\
shreeshas95 4:104dd82c99b8 704 }\
shreeshas95 4:104dd82c99b8 705 }\
shreeshas95 4:104dd82c99b8 706 else{\
shreeshas95 4:104dd82c99b8 707 for( int i = 0 ; i < TM_LONG_SIZE ; ++i ){\
shreeshas95 4:104dd82c99b8 708 gLAST_TM[i] = put_tm_here->TM_string[i];\
shreeshas95 4:104dd82c99b8 709 gLAST_TM_SHORT_OR_LONG = LONG_TM_CODE;\
shreeshas95 4:104dd82c99b8 710 }\
shreeshas95 4:104dd82c99b8 711 }\
shreeshas95 4:104dd82c99b8 712 }\
shreeshas95 4:104dd82c99b8 713 /*PENDING: APPEND ACK L1*/\
shreeshas95 4:104dd82c99b8 714 Base_tm *tm_ptr = tm_ptr_head;\
shreeshas95 4:104dd82c99b8 715 get_ack_l1(tm_ptr->next_TM);\
shreeshas95 4:104dd82c99b8 716 int overflowCountExecute = 0;\
shreeshas95 4:104dd82c99b8 717 while( tm_ptr->next_TM != NULL ){\
shreeshas95 4:104dd82c99b8 718 if( overflowCountExecute < TM_OVERFLOW_CONSTANT ){\
shreeshas95 4:104dd82c99b8 719 tm_ptr = tm_ptr->next_TM;\
shreeshas95 4:104dd82c99b8 720 ++overflowCountExecute;\
shreeshas95 4:104dd82c99b8 721 }\
shreeshas95 4:104dd82c99b8 722 else{\
shreeshas95 4:104dd82c99b8 723 /*PENDING: RESET CDMS*/\
shreeshas95 4:104dd82c99b8 724 break;\
shreeshas95 4:104dd82c99b8 725 }\
shreeshas95 4:104dd82c99b8 726 }\
shreeshas95 4:104dd82c99b8 727 tm_ptr->next_TM = put_tm_here;\
shreeshas95 4:104dd82c99b8 728 /*CHECK FOR HOT PA*/\
shreeshas95 4:104dd82c99b8 729 isPAhot(tempPAhot);\
shreeshas95 4:104dd82c99b8 730 if( tempPAhot == 0x00 ){\
shreeshas95 4:104dd82c99b8 731 gFLAGS = gFLAGS | COM_PA_HOT_FLAG;\
shreeshas95 4:104dd82c99b8 732 }\
shreeshas95 15:1c1ca992b43b 733 tm_ptr = tm_ptr_head;\
shreeshas95 15:1c1ca992b43b 734 while( tm_ptr != NULL ){\
shreeshas95 15:1c1ca992b43b 735 int length = TM_SHORT_SIZE;\
shreeshas95 15:1c1ca992b43b 736 if( GETshort_or_long_tm(tm_ptr->fields) == SHORT_TM_CODE ){\
shreeshas95 15:1c1ca992b43b 737 length = TM_SHORT_SIZE;\
shreeshas95 15:1c1ca992b43b 738 }\
shreeshas95 15:1c1ca992b43b 739 else{\
shreeshas95 15:1c1ca992b43b 740 length = TM_LONG_SIZE;\
shreeshas95 15:1c1ca992b43b 741 }\
shreeshas95 15:1c1ca992b43b 742 for(int i = 0 ; i < length ; ++i){\
shreeshas95 15:1c1ca992b43b 743 gPC.putc(tm_ptr->TM_string[i]);\
shreeshas95 15:1c1ca992b43b 744 }\
shreeshas95 15:1c1ca992b43b 745 tm_ptr = tm_ptr->next_TM;\
shreeshas95 15:1c1ca992b43b 746 }\
shreeshas95 4:104dd82c99b8 747 /*SEND DATA TO GS*/\
krishanprajapat 19:27e5f2edaf26 748 snd_tm.head_pointer(tm_ptr_head);\
krishanprajapat 19:27e5f2edaf26 749 adf_not_SDcard;\
shreeshas95 4:104dd82c99b8 750 /*DELETE THE TM AFTER USE*/\
shreeshas95 4:104dd82c99b8 751 tm_ptr = tm_ptr_head;\
shreeshas95 4:104dd82c99b8 752 overflowCountExecute = 0;\
shreeshas95 4:104dd82c99b8 753 while(tm_ptr != NULL){\
shreeshas95 4:104dd82c99b8 754 if( overflowCountExecute < TM_OVERFLOW_CONSTANT ){\
shreeshas95 4:104dd82c99b8 755 Base_tm *temp = tm_ptr->next_TM;\
shreeshas95 4:104dd82c99b8 756 delete tm_ptr;\
shreeshas95 4:104dd82c99b8 757 tm_ptr = temp;\
shreeshas95 4:104dd82c99b8 758 ++overflowCountExecute;\
shreeshas95 4:104dd82c99b8 759 }\
shreeshas95 4:104dd82c99b8 760 else{\
shreeshas95 4:104dd82c99b8 761 /*PENDING: RESET CDMS*/\
shreeshas95 4:104dd82c99b8 762 break;\
shreeshas95 4:104dd82c99b8 763 }\
shreeshas95 4:104dd82c99b8 764 }\
shreeshas95 0:f016e9e8d48b 765 }\
shreeshas95 0:f016e9e8d48b 766 else{\
aniruddhv 12:ffdb29353058 767 /*gPC.printf("sd card at %u\r\n", execute_psc);*/\
shreeshas95 4:104dd82c99b8 768 /*EXECUTION OF SD-CARD DATA SENDING (OBSRS)*/\
shreeshas95 4:104dd82c99b8 769 /*CHECK FOR HOT PA*/\
shreeshas95 4:104dd82c99b8 770 uint8_t tempPAhot = 0x00;\
shreeshas95 4:104dd82c99b8 771 isPAhot(tempPAhot);\
shreeshas95 4:104dd82c99b8 772 if( tempPAhot == 0x00 ){\
shreeshas95 4:104dd82c99b8 773 gFLAGS = gFLAGS | COM_PA_HOT_FLAG;\
shreeshas95 4:104dd82c99b8 774 }\
shreeshas95 4:104dd82c99b8 775 /*read_TC(current_TC);*/\
shreeshas95 6:79d422d1ed42 776 uint8_t tempExec = TC_STATE_SUCCESSFULLY_EXECUTED;\
shreeshas95 6:79d422d1ed42 777 PUTexec_status(current_TC, tempExec);\
shreeshas95 6:79d422d1ed42 778 /*PENDING: ABORT ON NACK CHECK, gMASTER_STATE VERIFICATION WITH SD CARD, session timeout, last executed ack l234*/\
shreeshas95 4:104dd82c99b8 779 if( (GETexec_status(current_TC) == TC_STATE_EXECUTION_FAILED) && (GETabort_on_nack(current_TC) == 1) ){\
shreeshas95 4:104dd82c99b8 780 gMASTER_STATE = TCL_STATE_ABORTED;\
shreeshas95 0:f016e9e8d48b 781 }\
shreeshas95 15:1c1ca992b43b 782 else if( execute_psc == (gTOTAL_VALID_TC-1) ){\
shreeshas95 6:79d422d1ed42 783 gMASTER_STATE = TCL_STATE_COMPLETED;\
shreeshas95 6:79d422d1ed42 784 }\
shreeshas95 0:f016e9e8d48b 785 }\
shreeshas95 0:f016e9e8d48b 786 }\
shreeshas95 4:104dd82c99b8 787 break;\
shreeshas95 0:f016e9e8d48b 788 }\
shreeshas95 4:104dd82c99b8 789 current_TC = current_TC->next_TC;\
shreeshas95 4:104dd82c99b8 790 ++overflowCount;\
shreeshas95 0:f016e9e8d48b 791 }\
shreeshas95 4:104dd82c99b8 792 else{\
shreeshas95 4:104dd82c99b8 793 /*PENDING: RESET CDMS*/\
shreeshas95 2:2caf2a9a13aa 794 break;\
shreeshas95 2:2caf2a9a13aa 795 }\
shreeshas95 2:2caf2a9a13aa 796 }\
shreeshas95 6:79d422d1ed42 797 if( gFLAGS & COM_SESSION_TIMEOUT_FLAG ){\
shreeshas95 6:79d422d1ed42 798 break;\
shreeshas95 6:79d422d1ed42 799 }\
shreeshas95 6:79d422d1ed42 800 else if( gMASTER_STATE == TCL_STATE_ABORTED ){\
aniruddhv 12:ffdb29353058 801 /*gPC.puts("ABORTING DUE TO ABORT ON NACK\r\n");*/\
shreeshas95 4:104dd82c99b8 802 /*EXITED DUE TO ABORT ON NACK:*/\
shreeshas95 2:2caf2a9a13aa 803 /*PENDING : POWER OFF COM TX*/\
shreeshas95 2:2caf2a9a13aa 804 RX1M.attach(&rx_read, Serial::RxIrq);\
shreeshas95 2:2caf2a9a13aa 805 gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\
shreeshas95 0:f016e9e8d48b 806 break;\
shreeshas95 2:2caf2a9a13aa 807 }\
shreeshas95 4:104dd82c99b8 808 else if( gFLAGS & COM_PA_HOT_FLAG ){\
shreeshas95 4:104dd82c99b8 809 /*PA HOT: WAIT FOR TIMEOUT*/\
shreeshas95 4:104dd82c99b8 810 gCOM_PA_COOLING_TIMEOUT.attach(&after_cooling_pa, COM_PA_COOLING_TIME_LIMIT);\
shreeshas95 4:104dd82c99b8 811 /*PENDING : POWER OFF COMM TX*/\
shreeshas95 4:104dd82c99b8 812 RX1M.attach(&rx_read, Serial::RxIrq);\
shreeshas95 4:104dd82c99b8 813 gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\
shreeshas95 2:2caf2a9a13aa 814 break;\
shreeshas95 2:2caf2a9a13aa 815 }\
aniruddhv 12:ffdb29353058 816 /*gPC.printf("successflly executed %u tc\r\n", execute_psc);*/\
shreeshas95 0:f016e9e8d48b 817 }\
shreeshas95 6:79d422d1ed42 818 if( (gMASTER_STATE == TCL_STATE_COMPLETED) || (gFLAGS & COM_SESSION_TIMEOUT_FLAG) ){\
aniruddhv 12:ffdb29353058 819 /*gPC.printf("completed or session timed out: %x\r\n", gMASTER_STATE);*/\
shreeshas95 5:ab276a17ca07 820 /*COMPLETED EXECUTION OF TC*/\
shreeshas95 5:ab276a17ca07 821 gMASTER_STATE = TCL_STATE_COMPLETED;\
shreeshas95 5:ab276a17ca07 822 COM_POWER_OFF_TX;\
shreeshas95 5:ab276a17ca07 823 reset_all;\
shreeshas95 5:ab276a17ca07 824 /*PENDING : ENABLE THREADS*/\
shreeshas95 5:ab276a17ca07 825 gSESSION_TIMEOUT.detach();\
shreeshas95 5:ab276a17ca07 826 gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\
shreeshas95 5:ab276a17ca07 827 gFLAGS = gFLAGS & (~COM_SESSION_FLAG);\
shreeshas95 5:ab276a17ca07 828 }\
shreeshas95 0:f016e9e8d48b 829 }