CDMS code for testing sbc

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Committer:
krishanprajapat
Date:
Sat Feb 06 19:26:01 2016 +0000
Revision:
120:d79297a4f89d
Parent:
117:bfdc807f3d3c
Child:
122:b99f8be0a51a
updated

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
aniruddhv 52:0bd68655c651 9 //Jan 7
aniruddhv 52:0bd68655c651 10 //added RLY_TMTC function
aniruddhv 52:0bd68655c651 11 //added included related files
aniruddhv 52:0bd68655c651 12
ee12b079 94:611c066467a1 13 //#include "Flash.h"
aniruddhv 52:0bd68655c651 14 #include "cdms_rtc.h"
aniruddhv 52:0bd68655c651 15
aniruddhv 52:0bd68655c651 16 DigitalIn tm_status_4m_slv(PIN39); //I2C interrupt to CDMS from BAE
aniruddhv 52:0bd68655c651 17 //DigitalIn tm_status_4m_pl(PIN61); //I2C interrupt to CDMS from PL
aniruddhv 52:0bd68655c651 18
aniruddhv 52:0bd68655c651 19 uint8_t received = 0;
aniruddhv 52:0bd68655c651 20 uint16_t mid1;
aniruddhv 52:0bd68655c651 21 uint16_t mid2;
aniruddhv 52:0bd68655c651 22 uint16_t Nbytes;
aniruddhv 52:0bd68655c651 23 uint32_t Data[2];
aniruddhv 52:0bd68655c651 24 uint16_t nbytes;
aniruddhv 52:0bd68655c651 25 uint8_t flash_counter = 0;
aniruddhv 52:0bd68655c651 26 uint16_t crc16;
aniruddhv 52:0bd68655c651 27 uint16_t mid;
aniruddhv 52:0bd68655c651 28 uint32_t block;
aniruddhv 52:0bd68655c651 29
shreeshas95 0:f016e9e8d48b 30 #define delete_TC(tc_ptr) {\
shreeshas95 0:f016e9e8d48b 31 if(tc_ptr == gHEAD_NODE_TCL){\
shreeshas95 0:f016e9e8d48b 32 gHEAD_NODE_TCL = tc_ptr->next_TC;\
shreeshas95 0:f016e9e8d48b 33 }\
shreeshas95 0:f016e9e8d48b 34 delete tc_ptr;\
shreeshas95 0:f016e9e8d48b 35 }
shreeshas95 0:f016e9e8d48b 36
shreeshas95 0:f016e9e8d48b 37 // typeof tm_ptr: Base_tm
shreeshas95 0:f016e9e8d48b 38 // typeof tc_ptr: Base_tc
shreeshas95 0:f016e9e8d48b 39 // typeof temp_xxxx: uint8_t
shreeshas95 0:f016e9e8d48b 40 #define fill_l1_ack(tm_ptr) {\
shreeshas95 0:f016e9e8d48b 41 tm_ptr->next_TM = NULL;\
shreeshas95 0:f016e9e8d48b 42 tm_ptr->TM_string[0] = TMID_ACK_L1 << 4;\
shreeshas95 4:104dd82c99b8 43 /*PENDING: PA TEMPERATURE*/\
shreeshas95 0:f016e9e8d48b 44 tm_ptr->TM_string[1] = gTOTAL_INCORRECT_SIZE_TC & 0xFF;\
shreeshas95 0:f016e9e8d48b 45 tm_ptr->TM_string[2] = gTOTAL_CRC_FAIL_TC & 0xFF;\
shreeshas95 0:f016e9e8d48b 46 }
shreeshas95 0:f016e9e8d48b 47
shreeshas95 4:104dd82c99b8 48 #define put_crc_l1_ack(tm_ptr) {\
shreeshas95 4:104dd82c99b8 49 tm_ptr->TM_string[2] = gTOTAL_CRC_FAIL_TC & 0xFF;\
shreeshas95 4:104dd82c99b8 50 /*TC LIST STATUS*/\
shreeshas95 4:104dd82c99b8 51 tm_ptr->TM_string[3] |= (gMASTER_STATE << 5) & 0xE0;\
shreeshas95 4:104dd82c99b8 52 /*PA HOT*/\
shreeshas95 4:104dd82c99b8 53 if( gFLAGS & COM_PA_HOT_FLAG ){\
shreeshas95 4:104dd82c99b8 54 tm_ptr->TM_string[3] |= (1 << 4);\
shreeshas95 4:104dd82c99b8 55 }\
shreeshas95 4:104dd82c99b8 56 else{\
shreeshas95 4:104dd82c99b8 57 tm_ptr->TM_string[3] &= ~(1 << 4);\
shreeshas95 4:104dd82c99b8 58 }\
shreeshas95 4:104dd82c99b8 59 uint16_t crc_checksum = crc16_gen(tm_ptr->TM_string, TM_SHORT_SIZE-2);\
shreeshas95 0:f016e9e8d48b 60 tm_ptr->TM_string[TM_SHORT_SIZE-2] = (crc_checksum >> 8) & 0xFF;\
shreeshas95 0:f016e9e8d48b 61 tm_ptr->TM_string[TM_SHORT_SIZE-1] = crc_checksum & 0xFF;\
shreeshas95 0:f016e9e8d48b 62 }
shreeshas95 0:f016e9e8d48b 63
shreeshas95 4:104dd82c99b8 64 #define detect_ack(tm_ptr, temp_ack, tc_psc) {\
shreeshas95 5:ab276a17ca07 65 if( tm_ptr != NULL ){\
aniruddhv 14:08c2c887ea09 66 int length = TM_SHORT_SIZE;\
shreeshas95 102:80c911a6e736 67 if( GETshort_or_long_tm(tm_ptr) == SHORT_TM_CODE ){\
aniruddhv 14:08c2c887ea09 68 length = TM_SHORT_SIZE;\
aniruddhv 14:08c2c887ea09 69 }\
aniruddhv 14:08c2c887ea09 70 else{\
aniruddhv 14:08c2c887ea09 71 length = TM_LONG_SIZE;\
aniruddhv 14:08c2c887ea09 72 }\
aniruddhv 14:08c2c887ea09 73 uint16_t crc = crc16_gen(tm_ptr->TM_string, length-2);\
shreeshas95 5:ab276a17ca07 74 if( (((crc & 0xFF00) >> 8) == tm_ptr->TM_string[length-2]) && ( (crc & 0x00FF) == tm_ptr->TM_string[length-1] ) ){\
shreeshas95 4:104dd82c99b8 75 uint8_t temp8;\
shreeshas95 4:104dd82c99b8 76 temp8 = tm_ptr->TM_string[TM_ACK_CODE_INDEX];\
shreeshas95 4:104dd82c99b8 77 temp8 = temp8 & 0xE0;\
shreeshas95 4:104dd82c99b8 78 if( (temp8 == 0xC0) || (temp8 == 0xA0) )\
shreeshas95 4:104dd82c99b8 79 temp_ack = 0x01;\
shreeshas95 4:104dd82c99b8 80 else{\
shreeshas95 4:104dd82c99b8 81 temp_ack = 0x00;\
shreeshas95 4:104dd82c99b8 82 /*CHECK FOR NACK CODE: CRC FAIL NACK*/\
shreeshas95 4:104dd82c99b8 83 temp8 = tm_ptr->TM_string[TM_ACK_CODE_INDEX];\
shreeshas95 4:104dd82c99b8 84 temp8 = temp8 & 0x0F;\
shreeshas95 5:ab276a17ca07 85 if( temp8 == CRC_FAIL_NACK_CODE ){\
shreeshas95 4:104dd82c99b8 86 tm_ptr->TM_string[2] = tc_psc;\
shreeshas95 4:104dd82c99b8 87 }\
shreeshas95 4:104dd82c99b8 88 }\
shreeshas95 4:104dd82c99b8 89 }\
shreeshas95 0:f016e9e8d48b 90 else\
shreeshas95 0:f016e9e8d48b 91 temp_ack = 0x00;\
shreeshas95 0:f016e9e8d48b 92 }\
shreeshas95 4:104dd82c99b8 93 else{\
shreeshas95 0:f016e9e8d48b 94 temp_ack = 0x00;\
shreeshas95 4:104dd82c99b8 95 }\
shreeshas95 0:f016e9e8d48b 96 }
shreeshas95 0:f016e9e8d48b 97
shreeshas95 0:f016e9e8d48b 98 #define isit_obosc(tc_ptr, temp_obosc) {\
shreeshas95 0:f016e9e8d48b 99 temp_obosc = 0x00;\
aniruddhv 52:0bd68655c651 100 if( GETapid(tc_ptr) == APID_COM ){\
aniruddhv 52:0bd68655c651 101 if( ((tc_ptr->TC_string[2]) >> 4) == SERVICE_OBOSC ){\
aniruddhv 52:0bd68655c651 102 temp_obosc = 0x01;\
shreeshas95 0:f016e9e8d48b 103 }\
shreeshas95 0:f016e9e8d48b 104 }\
shreeshas95 0:f016e9e8d48b 105 }
shreeshas95 0:f016e9e8d48b 106
shreeshas95 0:f016e9e8d48b 107 #define isit_sdcard(tc_ptr, temp_sdcard) {\
shreeshas95 0:f016e9e8d48b 108 temp_sdcard = 0x00;\
aniruddhv 52:0bd68655c651 109 if( GETapid(tc_ptr) == APID_COM ){\
aniruddhv 52:0bd68655c651 110 if( ( (tc_ptr->TC_string[2]) >> 4) == SERVICE_OBSRS ){\
aniruddhv 52:0bd68655c651 111 temp_sdcard = 0x01;\
shreeshas95 0:f016e9e8d48b 112 }\
shreeshas95 0:f016e9e8d48b 113 }\
shreeshas95 0:f016e9e8d48b 114 }
shreeshas95 0:f016e9e8d48b 115
shreeshas95 2:2caf2a9a13aa 116 #define isPAhot(returnHere){\
shreeshas95 2:2caf2a9a13aa 117 /*PENDING : COMPLETE THIS FUNCTION*/\
shreeshas95 2:2caf2a9a13aa 118 returnHere = 0xFF;\
shreeshas95 2:2caf2a9a13aa 119 }
shreeshas95 2:2caf2a9a13aa 120
shreeshas95 2:2caf2a9a13aa 121 void after_cooling_pa(){
shreeshas95 2:2caf2a9a13aa 122 gCOM_MNG_TMTC_THREAD->signal_set(COM_MNG_TMTC_SIGNAL_UART_INT);
shreeshas95 2:2caf2a9a13aa 123 }
shreeshas95 2:2caf2a9a13aa 124
shreeshas95 0:f016e9e8d48b 125 /*
shreeshas95 0:f016e9e8d48b 126 @brief: check for missing tc, also check crc, i.e.
shreeshas95 0:f016e9e8d48b 127 if true execution can be started else have to wait
shreeshas95 0:f016e9e8d48b 128 decide the next state
shreeshas95 0:f016e9e8d48b 129 @param: none
shreeshas95 0:f016e9e8d48b 130 @return: bool indicating whether there are missing tc
shreeshas95 0:f016e9e8d48b 131 */
shreeshas95 0:f016e9e8d48b 132 // PENDING: LAST FRAME BIT
shreeshas95 0:f016e9e8d48b 133 /*
shreeshas95 0:f016e9e8d48b 134 for loop: check for missing tc
shreeshas95 0:f016e9e8d48b 135 if: check for incorrect sized tc
shreeshas95 0:f016e9e8d48b 136 if: check for last frame bit
shreeshas95 0:f016e9e8d48b 137 */
shreeshas95 0:f016e9e8d48b 138 #define continueToExecute(returnHere) {\
shreeshas95 0:f016e9e8d48b 139 uint8_t tempReturn = 0x00;\
shreeshas95 5:ab276a17ca07 140 /*search for missing psc*/\
shreeshas95 15:1c1ca992b43b 141 for(uint8_t p = 0x00 ; p < (gTOTAL_VALID_TC) ; ++p){\
shreeshas95 0:f016e9e8d48b 142 bool flag = false;\
shreeshas95 0:f016e9e8d48b 143 Base_tc *node_ptr = gHEAD_NODE_TCL;\
shreeshas95 0:f016e9e8d48b 144 while(node_ptr != NULL){\
shreeshas95 0:f016e9e8d48b 145 if( (GETpacket_seq_count(node_ptr) == p) && (GETcrc_pass(node_ptr) == 1) ){\
shreeshas95 0:f016e9e8d48b 146 flag = true;\
shreeshas95 0:f016e9e8d48b 147 break;\
shreeshas95 0:f016e9e8d48b 148 }\
shreeshas95 0:f016e9e8d48b 149 else{\
shreeshas95 0:f016e9e8d48b 150 node_ptr = node_ptr->next_TC;\
shreeshas95 0:f016e9e8d48b 151 }\
shreeshas95 0:f016e9e8d48b 152 }\
shreeshas95 0:f016e9e8d48b 153 if(flag == false){\
shreeshas95 0:f016e9e8d48b 154 tempReturn = 0x02;\
shreeshas95 0:f016e9e8d48b 155 break;\
shreeshas95 0:f016e9e8d48b 156 }\
shreeshas95 0:f016e9e8d48b 157 }\
shreeshas95 5:ab276a17ca07 158 /*search for last packet bit*/\
shreeshas95 5:ab276a17ca07 159 tempReturn = tempReturn + 0x01;\
shreeshas95 0:f016e9e8d48b 160 Base_tc *tcp = gHEAD_NODE_TCL;\
shreeshas95 0:f016e9e8d48b 161 while(tcp != NULL){\
rohit3342 16:538de1b20b3a 162 if(GETpacket_seq_count(tcp) == (gTOTAL_VALID_TC - 1)){\
shreeshas95 5:ab276a17ca07 163 if( ( (tcp->TC_string[1]) & 0x20 ) == 0x20 ){\
shreeshas95 5:ab276a17ca07 164 tempReturn = tempReturn - 0x01;\
shreeshas95 0:f016e9e8d48b 165 }\
shreeshas95 0:f016e9e8d48b 166 break;\
shreeshas95 0:f016e9e8d48b 167 }\
shreeshas95 0:f016e9e8d48b 168 tcp = tcp->next_TC;\
shreeshas95 0:f016e9e8d48b 169 }\
shreeshas95 0:f016e9e8d48b 170 returnHere = tempReturn;\
shreeshas95 5:ab276a17ca07 171 /*UPDATE gMASTER STATE*/\
shreeshas95 5:ab276a17ca07 172 if( (returnHere == 0x00) ){\
aniruddhv 37:c9a739750806 173 if( (gMASTER_STATE == TCL_STATE_INCOMPLETE) || (gMASTER_STATE == TCL_STATE_COMPLETED) || (gMASTER_STATE == TCL_STATE_ABORTED) ){\
aniruddhv 37:c9a739750806 174 gMASTER_STATE = TCL_STATE_EXECUTING;\
shreeshas95 5:ab276a17ca07 175 }\
shreeshas95 5:ab276a17ca07 176 }\
shreeshas95 5:ab276a17ca07 177 else{\
shreeshas95 5:ab276a17ca07 178 if( (gMASTER_STATE == TCL_STATE_INCOMPLETE) || (gMASTER_STATE == TCL_STATE_COMPLETED) ){\
shreeshas95 5:ab276a17ca07 179 gMASTER_STATE = TCL_STATE_INCOMPLETE;\
shreeshas95 5:ab276a17ca07 180 }\
shreeshas95 5:ab276a17ca07 181 }\
shreeshas95 0:f016e9e8d48b 182 }
shreeshas95 0:f016e9e8d48b 183
shreeshas95 0:f016e9e8d48b 184 /*
shreeshas95 2:2caf2a9a13aa 185 return 1 if code match
shreeshas95 2:2caf2a9a13aa 186 return 0 if code mismatch
shreeshas95 2:2caf2a9a13aa 187 */
shreeshas95 2:2caf2a9a13aa 188 #define GScodeVerification(returnHere){\
shreeshas95 2:2caf2a9a13aa 189 Base_tc *testTC = gHEAD_NODE_TCL;\
shreeshas95 2:2caf2a9a13aa 190 uint16_t overflowCount = 0;\
shreeshas95 15:1c1ca992b43b 191 returnHere = 0xFF;\
shreeshas95 2:2caf2a9a13aa 192 while( (overflowCount < TCL_OVERFLOW_CONSTANT) && (testTC != NULL) ){\
shreeshas95 2:2caf2a9a13aa 193 if( (GETpacket_seq_count(testTC) == PSC_CALLSIGN) && (GETapid(testTC) == APID_CALLSIGN) ){\
aniruddhv 37:c9a739750806 194 /*uint8_t temp8 = testTC->TC_string[1];*/\
aniruddhv 37:c9a739750806 195 if( true ){\
shreeshas95 2:2caf2a9a13aa 196 for( int i = 2 ; i <= 8 ; ++i ){\
shreeshas95 2:2caf2a9a13aa 197 if( testTC->TC_string[i] != gGSCODE[i-2] ){\
shreeshas95 2:2caf2a9a13aa 198 returnHere = 0;\
shreeshas95 2:2caf2a9a13aa 199 break;\
shreeshas95 2:2caf2a9a13aa 200 }\
shreeshas95 2:2caf2a9a13aa 201 }\
shreeshas95 2:2caf2a9a13aa 202 }\
shreeshas95 2:2caf2a9a13aa 203 break;\
shreeshas95 2:2caf2a9a13aa 204 }\
shreeshas95 2:2caf2a9a13aa 205 testTC = testTC->next_TC;\
shreeshas95 2:2caf2a9a13aa 206 ++overflowCount;\
shreeshas95 2:2caf2a9a13aa 207 }\
shreeshas95 2:2caf2a9a13aa 208 }
shreeshas95 2:2caf2a9a13aa 209
shreeshas95 2:2caf2a9a13aa 210 /*
shreeshas95 0:f016e9e8d48b 211 @brief: DELETE THE CRC FAILED TC FROM THE LIST TO FREE-UP MEMORY AND UPDATE
shreeshas95 0:f016e9e8d48b 212 THE TOTAL VALID TC AND GENERATE L1_ACK_TM
shreeshas95 0:f016e9e8d48b 213 @param: none
shreeshas95 0:f016e9e8d48b 214 @return: none
shreeshas95 0:f016e9e8d48b 215 */
shreeshas95 4:104dd82c99b8 216 /*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 217
shreeshas95 4:104dd82c99b8 218 /*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 0:f016e9e8d48b 219
shreeshas95 0:f016e9e8d48b 220 // CDMS TEAM CODE START
aniruddhv 52:0bd68655c651 221 inline Base_tm* FCTN_CDMS_RLY_TMTC(Base_tc *tc_ptr){
aniruddhv 52:0bd68655c651 222 uint8_t ACKCODE = 0x00;
ee12b079 73:6c99294b7802 223 //printf("\rTC execution in progress\r\n");
aniruddhv 52:0bd68655c651 224 Base_tm *tm_pointer = new Long_tm;
aniruddhv 52:0bd68655c651 225 Base_tm *tm_ptr = tm_pointer;
aniruddhv 52:0bd68655c651 226 received = 0;
aniruddhv 52:0bd68655c651 227 switch(GETapid(tc_ptr))
aniruddhv 52:0bd68655c651 228 {
aniruddhv 52:0bd68655c651 229 case 1: //apid=01 implies it corresponds to bae
aniruddhv 52:0bd68655c651 230 {
ee12b079 73:6c99294b7802 231 //printf("Telecommand is for BAE\r\n");
ee12b079 73:6c99294b7802 232 //printf("Sending TC to BAE...\r\n"); //interrupt to be sent to the bae
aniruddhv 52:0bd68655c651 233 FCTN_I2C_WRITE((char*)tc_ptr->TC_string);
aniruddhv 52:0bd68655c651 234 while(1)
aniruddhv 52:0bd68655c651 235 {
aniruddhv 52:0bd68655c651 236 wait(1); //TimeOut instead of wait
aniruddhv 52:0bd68655c651 237 if(tm_status_4m_slv == 1)
aniruddhv 52:0bd68655c651 238 {
ee12b079 73:6c99294b7802 239 //printf("receiving...\r\n");
shreeshas95 103:b55559925dc1 240 FCTN_I2C_READ((char*)tm_pointer->TM_string,134);
ee12b079 73:6c99294b7802 241 //printf("%s", tm_pointer->TM_string);
aniruddhv 52:0bd68655c651 242 received+=1;
aniruddhv 52:0bd68655c651 243 tm_pointer = tm_pointer->next_TM;
aniruddhv 52:0bd68655c651 244 break; //only for testing purpose
aniruddhv 52:0bd68655c651 245 }
aniruddhv 52:0bd68655c651 246 else
aniruddhv 52:0bd68655c651 247 {
aniruddhv 52:0bd68655c651 248 break;
aniruddhv 52:0bd68655c651 249 }
aniruddhv 52:0bd68655c651 250 }
aniruddhv 52:0bd68655c651 251 if(received >= 1 )
aniruddhv 52:0bd68655c651 252 {
ee12b079 73:6c99294b7802 253 //printf("Telemetry is received from BAE\r\n");
aniruddhv 52:0bd68655c651 254 Base_tm *tm_print = tm_ptr;
aniruddhv 52:0bd68655c651 255 for(uint8_t i=0;i<received;i++)
aniruddhv 52:0bd68655c651 256 {
ee12b079 73:6c99294b7802 257 //printf("%s", tm_print->TM_string);
aniruddhv 52:0bd68655c651 258 tm_print = tm_print->next_TM; //for check
aniruddhv 52:0bd68655c651 259 }
aniruddhv 52:0bd68655c651 260 received = 0;
ee12b079 53:18db568f1098 261 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 262 }
aniruddhv 52:0bd68655c651 263 else
aniruddhv 52:0bd68655c651 264 {
ee12b079 73:6c99294b7802 265 //printf("Telemetry is not received from BAE\r\n");
aniruddhv 52:0bd68655c651 266 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 267 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 268 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 269 tm_pointer->TM_string[2] = 0x01;
aniruddhv 52:0bd68655c651 270 tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided
aniruddhv 52:0bd68655c651 271 tm_pointer->TM_string[4] = 0x01;
aniruddhv 52:0bd68655c651 272 for(uint8_t i=0;i<6;i++)
aniruddhv 52:0bd68655c651 273 {
aniruddhv 52:0bd68655c651 274 tm_pointer->TM_string[i+5] = 0;
aniruddhv 52:0bd68655c651 275 }
aniruddhv 52:0bd68655c651 276 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 277 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 278 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 279 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 280 }
aniruddhv 52:0bd68655c651 281 break;
aniruddhv 52:0bd68655c651 282 }
aniruddhv 52:0bd68655c651 283 case 2:
aniruddhv 52:0bd68655c651 284 {
ee12b079 88:b9beee1a7a3e 285 //gPC.printf("Telecommand is for CDMS\r\n"); //apid = 10 corresponds to cdms
aniruddhv 52:0bd68655c651 286 switch(GETservice_type(tc_ptr))
aniruddhv 52:0bd68655c651 287 {
aniruddhv 52:0bd68655c651 288 case 0x60:
aniruddhv 52:0bd68655c651 289 {
aniruddhv 69:20f09a0c3fd2 290 //gPC.printf("service:MMS\r\n");
aniruddhv 52:0bd68655c651 291 switch(GETservice_subtype(tc_ptr))
aniruddhv 52:0bd68655c651 292 {
aniruddhv 52:0bd68655c651 293 case 0x1:
aniruddhv 52:0bd68655c651 294 {
ee12b079 73:6c99294b7802 295 //printf("sub_service:Read from RAM_Memory\r\n");
aniruddhv 52:0bd68655c651 296 mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]);
aniruddhv 52:0bd68655c651 297
ee12b079 94:611c066467a1 298 //Data[0] = FCTN_CDMS_RD_FLASH(0);
ee12b079 94:611c066467a1 299 //Data[1] = FCTN_CDMS_RD_FLASH(1);
aniruddhv 52:0bd68655c651 300 //tm_pointer = new Long_tm;
aniruddhv 52:0bd68655c651 301 tm_pointer->TM_string[0] = 0x30;
aniruddhv 52:0bd68655c651 302 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 303 tm_pointer->TM_string[2] = (uint8_t)(flash_counter);
aniruddhv 52:0bd68655c651 304 for(uint8_t i=0;i<4;i++)
aniruddhv 52:0bd68655c651 305 {
aniruddhv 52:0bd68655c651 306 tm_pointer->TM_string[3+i] = (uint8_t)((Data[0]>>(8*i))&0x00FF);
aniruddhv 52:0bd68655c651 307 }
aniruddhv 52:0bd68655c651 308 for(uint8_t i=4;i<8;i++)
aniruddhv 52:0bd68655c651 309 {
aniruddhv 52:0bd68655c651 310 tm_pointer->TM_string[3+i] = (uint8_t)((Data[1]>>(8*i))&0x00FF);
aniruddhv 52:0bd68655c651 311 }
aniruddhv 52:0bd68655c651 312 crc16 = crc16_gen(tm_ptr->TM_string,9);
aniruddhv 52:0bd68655c651 313 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 314 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 315 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 316 }
aniruddhv 52:0bd68655c651 317 case 0x2:
aniruddhv 52:0bd68655c651 318 {
ee12b079 73:6c99294b7802 319 //printf("sub_service:Read from Flash_Memory\r\n");
aniruddhv 52:0bd68655c651 320 mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]);
aniruddhv 52:0bd68655c651 321
ee12b079 94:611c066467a1 322 //Data[0] = FCTN_CDMS_RD_FLASH(0);
ee12b079 94:611c066467a1 323 //Data[1] = FCTN_CDMS_RD_FLASH(1);
aniruddhv 52:0bd68655c651 324 //tm_pointer = new Long_tm;
aniruddhv 52:0bd68655c651 325 tm_pointer->TM_string[0] = 0x30;
aniruddhv 52:0bd68655c651 326 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 327 tm_pointer->TM_string[2] = (uint8_t)(flash_counter);
aniruddhv 52:0bd68655c651 328 for(uint8_t i=0;i<4;i++)
aniruddhv 52:0bd68655c651 329 {
aniruddhv 52:0bd68655c651 330 tm_pointer->TM_string[3+i] = (uint8_t)((Data[0]>>(8*i))&0x00FF);
aniruddhv 52:0bd68655c651 331 }
aniruddhv 52:0bd68655c651 332 for(uint8_t i=4;i<8;i++)
aniruddhv 52:0bd68655c651 333 {
aniruddhv 52:0bd68655c651 334 tm_pointer->TM_string[3+i] = (uint8_t)((Data[1]>>(8*i))&0x00FF);
aniruddhv 52:0bd68655c651 335 }
aniruddhv 52:0bd68655c651 336 crc16 = crc16_gen(tm_ptr->TM_string,9);
aniruddhv 52:0bd68655c651 337 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 338 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 339 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 340 }
aniruddhv 52:0bd68655c651 341 case 0x5:
aniruddhv 52:0bd68655c651 342 {
ee12b079 73:6c99294b7802 343 //printf("WRITE ON FLASH_MEMORY\r\n");
aniruddhv 52:0bd68655c651 344 mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]);
aniruddhv 52:0bd68655c651 345 block = (((uint32_t)(tc_ptr->TC_string[5])<<24)|((uint32_t)(tc_ptr->TC_string[5])<<16)|((uint32_t)(tc_ptr->TC_string[5])<<8)|((uint32_t)(tc_ptr->TC_string[5])));
ee12b079 94:611c066467a1 346 //FCTN_CDMS_WR_FLASH(mid,block);
aniruddhv 52:0bd68655c651 347 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 348 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 349 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 350 tm_pointer->TM_string[2] = 0x01;
aniruddhv 52:0bd68655c651 351 tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided
aniruddhv 52:0bd68655c651 352 tm_pointer->TM_string[4] = 0x01;
aniruddhv 52:0bd68655c651 353 for(uint8_t i=0;i<6;i++)
aniruddhv 52:0bd68655c651 354 {
aniruddhv 52:0bd68655c651 355 tm_pointer->TM_string[i+5] = 0;
aniruddhv 52:0bd68655c651 356 }
aniruddhv 52:0bd68655c651 357 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 358 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 359 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 360 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 361 break;
aniruddhv 52:0bd68655c651 362 }
aniruddhv 52:0bd68655c651 363 default:
aniruddhv 52:0bd68655c651 364 {
ee12b079 73:6c99294b7802 365 //printf("INVALID TC\r\n"); //Send Invalid TC Telemetry
aniruddhv 52:0bd68655c651 366 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 367 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 368 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 369 tm_pointer->TM_string[2] = 0x01;
aniruddhv 52:0bd68655c651 370 tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided
aniruddhv 52:0bd68655c651 371 tm_pointer->TM_string[4] = 0x01;
aniruddhv 52:0bd68655c651 372 for(uint8_t i=0;i<6;i++)
aniruddhv 52:0bd68655c651 373 {
aniruddhv 52:0bd68655c651 374 tm_pointer->TM_string[i+5] = 0;
aniruddhv 52:0bd68655c651 375 }
aniruddhv 52:0bd68655c651 376 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 377 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 378 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 379 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 380 }
aniruddhv 52:0bd68655c651 381 break;
aniruddhv 52:0bd68655c651 382 }
aniruddhv 52:0bd68655c651 383 }
aniruddhv 52:0bd68655c651 384 case 0x8:
aniruddhv 52:0bd68655c651 385 {
ee12b079 73:6c99294b7802 386 //printf("service:FUNCTION MANAGEMENT SERVICE\r\n");
aniruddhv 52:0bd68655c651 387 if(GETservice_subtype(tc_ptr)==0x1)
aniruddhv 52:0bd68655c651 388 {
aniruddhv 52:0bd68655c651 389 if(GETpid(tc_ptr)==0x01)
aniruddhv 52:0bd68655c651 390 {
ee12b079 73:6c99294b7802 391 //printf("TC_PL_INIT\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 392 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 393 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 394 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 395 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 396 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 397 {
aniruddhv 52:0bd68655c651 398 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 399 }
aniruddhv 52:0bd68655c651 400 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 401 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 402 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 403 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 404 break;
aniruddhv 52:0bd68655c651 405 }
aniruddhv 52:0bd68655c651 406 else if(GETpid(tc_ptr)==0x02)
aniruddhv 52:0bd68655c651 407 {
ee12b079 73:6c99294b7802 408 //printf("TC_PL_MAIN\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 409 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 410 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 411 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 412 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 413 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 414 {
aniruddhv 52:0bd68655c651 415 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 416 }
aniruddhv 52:0bd68655c651 417 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 418 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 419 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 420 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 421 break;
aniruddhv 52:0bd68655c651 422 }
aniruddhv 52:0bd68655c651 423 else if(GETpid(tc_ptr)==0x03)
aniruddhv 52:0bd68655c651 424 {
ee12b079 73:6c99294b7802 425 //printf("TC_COM_INIT\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 426 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 427 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 428 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 429 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 430 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 431 {
aniruddhv 52:0bd68655c651 432 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 433 }
aniruddhv 52:0bd68655c651 434 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 435 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 436 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 437 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 438 break;
aniruddhv 52:0bd68655c651 439 }
aniruddhv 52:0bd68655c651 440 else if(GETpid(tc_ptr)==0x04)
aniruddhv 52:0bd68655c651 441 {
ee12b079 73:6c99294b7802 442 //printf("TC_CDMS_HK_MAIN\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 443 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 444 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 445 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 446 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 447 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 448 {
aniruddhv 52:0bd68655c651 449 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 450 }
aniruddhv 52:0bd68655c651 451 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 452 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 453 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 454 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 455 break;
aniruddhv 52:0bd68655c651 456 }
aniruddhv 52:0bd68655c651 457 else if(GETpid(tc_ptr)==0x11)
aniruddhv 52:0bd68655c651 458 {
ee12b079 73:6c99294b7802 459 //printf("TC_SW_ON_SD\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 460 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 461 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 462 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 463 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 464 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 465 {
aniruddhv 52:0bd68655c651 466 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 467 }
aniruddhv 52:0bd68655c651 468 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 469 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 470 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 471 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 472 break;
aniruddhv 52:0bd68655c651 473 }
aniruddhv 52:0bd68655c651 474 else if(GETpid(tc_ptr)==0x12)
aniruddhv 52:0bd68655c651 475 {
ee12b079 73:6c99294b7802 476 //printf("TC_SW_ON_RTC\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 477 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 478 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 479 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 480 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 481 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 482 {
aniruddhv 52:0bd68655c651 483 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 484 }
aniruddhv 52:0bd68655c651 485 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 486 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 487 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 488 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 489 break;
aniruddhv 52:0bd68655c651 490 }
aniruddhv 52:0bd68655c651 491 else if(GETpid(tc_ptr)==0x13)
aniruddhv 52:0bd68655c651 492 {
ee12b079 73:6c99294b7802 493 //printf("TC_SW_ON_BAE\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 494 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 495 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 496 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 497 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 498 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 499 {
aniruddhv 52:0bd68655c651 500 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 501 }
aniruddhv 52:0bd68655c651 502 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 503 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 504 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 505 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 506 break;
aniruddhv 52:0bd68655c651 507 }
aniruddhv 52:0bd68655c651 508 else if(GETpid(tc_ptr)==0x14)
aniruddhv 52:0bd68655c651 509 {
ee12b079 73:6c99294b7802 510 //printf("TC_SW_ON_PL_DL\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 511 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 512 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 513 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 514 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 515 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 516 {
aniruddhv 52:0bd68655c651 517 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 518 }
aniruddhv 52:0bd68655c651 519 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 520 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 521 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 522 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 523 break;
aniruddhv 52:0bd68655c651 524 }
aniruddhv 52:0bd68655c651 525 else if(GETpid(tc_ptr)==0x15)
aniruddhv 52:0bd68655c651 526 {
ee12b079 73:6c99294b7802 527 //printf("TC_SW_ON_PL_AG_HV\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 528 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 529 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 530 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 531 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 532 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 533 {
aniruddhv 52:0bd68655c651 534 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 535 }
aniruddhv 52:0bd68655c651 536 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 537 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 538 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 539 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 540 break;
aniruddhv 52:0bd68655c651 541 }
aniruddhv 52:0bd68655c651 542 else if(GETpid(tc_ptr)==0x16)
aniruddhv 52:0bd68655c651 543 {
ee12b079 73:6c99294b7802 544 //printf("TC_SW_ON_V_A_EN\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 545 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 546 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 547 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 548 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 549 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 550 {
aniruddhv 52:0bd68655c651 551 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 552 }
aniruddhv 52:0bd68655c651 553 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 554 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 555 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 556 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 557 break;
aniruddhv 52:0bd68655c651 558 }
aniruddhv 52:0bd68655c651 559 else if(GETpid(tc_ptr)==0x21)
aniruddhv 52:0bd68655c651 560 {
ee12b079 73:6c99294b7802 561 //printf("TC_SW_OFF_SD\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 562 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 563 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 564 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 565 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 566 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 567 {
aniruddhv 52:0bd68655c651 568 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 569 }
aniruddhv 52:0bd68655c651 570 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 571 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 572 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 573 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 574 break;
aniruddhv 52:0bd68655c651 575 }
aniruddhv 52:0bd68655c651 576 else if(GETpid(tc_ptr)==0x22)
aniruddhv 52:0bd68655c651 577 {
ee12b079 73:6c99294b7802 578 //printf("TC_SW_OFF_RTC\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 579 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 580 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 581 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 582 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 583 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 584 {
aniruddhv 52:0bd68655c651 585 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 586 }
aniruddhv 52:0bd68655c651 587 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 588 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 589 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 590 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 591 break;
aniruddhv 52:0bd68655c651 592 }
aniruddhv 52:0bd68655c651 593 else if(GETpid(tc_ptr)==0x23)
aniruddhv 52:0bd68655c651 594 {
ee12b079 73:6c99294b7802 595 //printf("TC_SW_OFF_BAE\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 596 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 597 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 598 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 599 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 600 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 601 {
aniruddhv 52:0bd68655c651 602 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 603 }
aniruddhv 52:0bd68655c651 604 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 605 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 606 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 607 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 608 break;
aniruddhv 52:0bd68655c651 609 }
aniruddhv 52:0bd68655c651 610 else if(GETpid(tc_ptr)==0x24)
aniruddhv 52:0bd68655c651 611 {
ee12b079 73:6c99294b7802 612 //printf("TC_SW_OFF_PL_DL\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 613 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 614 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 615 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 616 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 617 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 618 {
aniruddhv 52:0bd68655c651 619 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 620 }
aniruddhv 52:0bd68655c651 621 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 622 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 623 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 624 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 625 break;
aniruddhv 52:0bd68655c651 626 }
aniruddhv 52:0bd68655c651 627 else if(GETpid(tc_ptr)==0x25)
aniruddhv 52:0bd68655c651 628 {
ee12b079 73:6c99294b7802 629 //printf("TC_SW_OFF_PL_AG_HV\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 630 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 631 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 632 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 633 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 634 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 635 {
aniruddhv 52:0bd68655c651 636 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 637 }
aniruddhv 52:0bd68655c651 638 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 639 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 640 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 641 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 642 break;
aniruddhv 52:0bd68655c651 643 }
aniruddhv 52:0bd68655c651 644 else if(GETpid(tc_ptr)==0x26)
aniruddhv 52:0bd68655c651 645 {
ee12b079 73:6c99294b7802 646 //printf("TC_SW_OFF_V_A_EN\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 647 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 648 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 649 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 650 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 651 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 652 {
aniruddhv 52:0bd68655c651 653 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 654 }
aniruddhv 52:0bd68655c651 655 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 656 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 657 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 658 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 659 break;
aniruddhv 52:0bd68655c651 660 }
aniruddhv 52:0bd68655c651 661 else if(GETpid(tc_ptr)==0x31)
aniruddhv 52:0bd68655c651 662 {
ee12b079 73:6c99294b7802 663 //printf("TC_RST_SD\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 664 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 665 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 666 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 667 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 668 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 669 {
aniruddhv 52:0bd68655c651 670 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 671 }
aniruddhv 52:0bd68655c651 672 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 673 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 674 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 675 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 676 break;
aniruddhv 52:0bd68655c651 677 }
aniruddhv 52:0bd68655c651 678 else if(GETpid(tc_ptr)==0x32)
aniruddhv 52:0bd68655c651 679 {
ee12b079 73:6c99294b7802 680 //printf("TC_RST_RTC\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 681 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 682 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 683 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 684 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 685 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 686 {
aniruddhv 52:0bd68655c651 687 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 688 }
aniruddhv 52:0bd68655c651 689 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 690 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 691 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 692 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 693 break;
aniruddhv 52:0bd68655c651 694 }
aniruddhv 52:0bd68655c651 695 else if(GETpid(tc_ptr)==0x33)
aniruddhv 52:0bd68655c651 696 {
ee12b079 73:6c99294b7802 697 //printf("TC_RST_BAE\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 698 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 699 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 700 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 701 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 702 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 703 {
aniruddhv 52:0bd68655c651 704 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 705 }
aniruddhv 52:0bd68655c651 706 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 707 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 708 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 709 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 710 break;
aniruddhv 52:0bd68655c651 711 }
aniruddhv 52:0bd68655c651 712 else if(GETpid(tc_ptr)==0x34)
aniruddhv 52:0bd68655c651 713 {
ee12b079 73:6c99294b7802 714 //printf("TC_RST_PL_DL\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 715 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 716 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 717 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 718 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 719 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 720 {
aniruddhv 52:0bd68655c651 721 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 722 }
aniruddhv 52:0bd68655c651 723 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 724 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 725 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 726 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 727 break;
aniruddhv 52:0bd68655c651 728 break;
aniruddhv 52:0bd68655c651 729 }
aniruddhv 52:0bd68655c651 730 else if(GETpid(tc_ptr)==0xC1)
aniruddhv 52:0bd68655c651 731 {
ee12b079 73:6c99294b7802 732 //printf("RESET_HK_COUNTER\r\n"); // call PWR_SWCH_ON function
aniruddhv 52:0bd68655c651 733 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 734 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 735 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 736 tm_pointer->TM_string[2] = ACKCODE;
aniruddhv 52:0bd68655c651 737 for(uint8_t i=3;i<11;i++)
aniruddhv 52:0bd68655c651 738 {
aniruddhv 52:0bd68655c651 739 tm_pointer->TM_string[i] = 0;
aniruddhv 52:0bd68655c651 740 }
aniruddhv 52:0bd68655c651 741 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 742 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 743 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 744 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 745 break;
aniruddhv 52:0bd68655c651 746 }
aniruddhv 52:0bd68655c651 747 else if(GETpid(tc_ptr)==0xF1)
aniruddhv 52:0bd68655c651 748 {
ee12b079 73:6c99294b7802 749 //printf("RD_RTC\r\n"); //call RD_RTC
aniruddhv 52:0bd68655c651 750 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 751 tm_pointer->TM_string[0] = 0xD0;
aniruddhv 52:0bd68655c651 752 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 753 tm_pointer->TM_string[2] = 0x01;
aniruddhv 52:0bd68655c651 754 uint64_t time = FCTN_CDMS_RD_RTC();
aniruddhv 52:0bd68655c651 755 tm_pointer->TM_string[3] = (uint8_t)((time&0xFF00000000000000)>>56);
aniruddhv 52:0bd68655c651 756 tm_pointer->TM_string[4] = (uint8_t)((time&0x00FF000000000000)>>48);
aniruddhv 52:0bd68655c651 757 tm_pointer->TM_string[5] = (uint8_t)((time&0x0000FF0000000000)>>40);
aniruddhv 52:0bd68655c651 758 tm_pointer->TM_string[6] = (uint8_t)((time&0x000000FF00000000)>>32);
aniruddhv 52:0bd68655c651 759 tm_pointer->TM_string[7] = (uint8_t)((time&0x00000000FF000000)>>24);
aniruddhv 52:0bd68655c651 760 tm_pointer->TM_string[8] = (uint8_t)((time&0x0000000000FF0000)>>16);
aniruddhv 52:0bd68655c651 761 tm_pointer->TM_string[9] = (uint8_t)((time&0x000000000000FF00)>>8);
aniruddhv 52:0bd68655c651 762 tm_pointer->TM_string[10] = (uint8_t)(time&0x00000000000000FF);
aniruddhv 52:0bd68655c651 763 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 764 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 765 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 766 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 767 }
aniruddhv 52:0bd68655c651 768 else
aniruddhv 52:0bd68655c651 769 {
ee12b079 73:6c99294b7802 770 //printf("INVALID TC\r\n");
aniruddhv 52:0bd68655c651 771 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 772 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 773 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 774 tm_pointer->TM_string[2] = 0x01;
aniruddhv 52:0bd68655c651 775 tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided
aniruddhv 52:0bd68655c651 776 tm_pointer->TM_string[4] = 0x01;
aniruddhv 52:0bd68655c651 777 for(uint8_t i=0;i<6;i++)
aniruddhv 52:0bd68655c651 778 {
aniruddhv 52:0bd68655c651 779 tm_pointer->TM_string[i+5] = 0;
aniruddhv 52:0bd68655c651 780 }
aniruddhv 52:0bd68655c651 781 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 782 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 783 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 784 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 785 }
aniruddhv 52:0bd68655c651 786 }
aniruddhv 52:0bd68655c651 787
aniruddhv 52:0bd68655c651 788
aniruddhv 52:0bd68655c651 789 }
aniruddhv 52:0bd68655c651 790 default:
aniruddhv 52:0bd68655c651 791 {
ee12b079 73:6c99294b7802 792 //printf("INVALID TC"); //send invalid TC TM
aniruddhv 52:0bd68655c651 793 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 794 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 795 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 796 tm_pointer->TM_string[2] = 0x01;
aniruddhv 52:0bd68655c651 797 tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided
aniruddhv 52:0bd68655c651 798 tm_pointer->TM_string[4] = 0x01;
aniruddhv 52:0bd68655c651 799 for(uint8_t i=0;i<6;i++)
aniruddhv 52:0bd68655c651 800 {
aniruddhv 52:0bd68655c651 801 tm_pointer->TM_string[i+5] = 0;
aniruddhv 52:0bd68655c651 802 }
aniruddhv 52:0bd68655c651 803 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 804 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 805 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 806 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 807 break;
aniruddhv 52:0bd68655c651 808 }
aniruddhv 52:0bd68655c651 809 }
aniruddhv 52:0bd68655c651 810 }
aniruddhv 52:0bd68655c651 811 case 3:
aniruddhv 52:0bd68655c651 812 {
ee12b079 73:6c99294b7802 813 //printf("Telecommand is for PL\r\n");
ee12b079 73:6c99294b7802 814 // printf("Informing PL about TC using I2C\r\n"); //interrupt to be sent to the bae
aniruddhv 52:0bd68655c651 815 // FCTN_I2C_WRITE((char*)tc_ptr->TC_string);
ee12b079 73:6c99294b7802 816 // printf("sent the Telecommand to BAE\r\n"); //packet along with crc will be sent when bae is ready
aniruddhv 52:0bd68655c651 817 // wait(1); //wait time is to be optimised
aniruddhv 52:0bd68655c651 818 // if(tm_status_4m_slv == 1)
aniruddhv 52:0bd68655c651 819 // {
aniruddhv 52:0bd68655c651 820 // FCTN_I2C_READ((char*)tm_ptr->TM_string);
aniruddhv 52:0bd68655c651 821 // received = 1;
aniruddhv 52:0bd68655c651 822 // }
aniruddhv 52:0bd68655c651 823 // if(received == 1 )
aniruddhv 52:0bd68655c651 824 // {
ee12b079 73:6c99294b7802 825 // printf("Telemetry is received from BAE\r\n");
ee12b079 73:6c99294b7802 826 // printf("%s", tm_ptr->TM_string);
aniruddhv 52:0bd68655c651 827 // received = 0;
aniruddhv 52:0bd68655c651 828 // } // similar to BAE functions
aniruddhv 52:0bd68655c651 829 break;
aniruddhv 52:0bd68655c651 830 }
aniruddhv 52:0bd68655c651 831 default: //invalid TC
aniruddhv 52:0bd68655c651 832 {
ee12b079 73:6c99294b7802 833 //printf("INVALID TC\r\n");
aniruddhv 52:0bd68655c651 834 //tm_pointer = new Short_tm;
aniruddhv 52:0bd68655c651 835 tm_pointer->TM_string[0] = 0xB0;
aniruddhv 52:0bd68655c651 836 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
aniruddhv 52:0bd68655c651 837 tm_pointer->TM_string[2] = 0x01;
aniruddhv 52:0bd68655c651 838 tm_pointer->TM_string[3] = ACKCODE; //ackcode to be decided
aniruddhv 52:0bd68655c651 839 tm_pointer->TM_string[4] = 0x01;
aniruddhv 52:0bd68655c651 840 for(uint8_t i=0;i<6;i++)
aniruddhv 52:0bd68655c651 841 {
aniruddhv 52:0bd68655c651 842 tm_pointer->TM_string[i+5] = 0;
aniruddhv 52:0bd68655c651 843 }
aniruddhv 52:0bd68655c651 844 crc16 = crc16_gen(tm_ptr->TM_string,11);
aniruddhv 52:0bd68655c651 845 tm_pointer->TM_string[11] = (uint8_t)((crc16&0xFF00)>>8);
aniruddhv 52:0bd68655c651 846 tm_pointer->TM_string[12] = (uint8_t)(crc16&0x00FF);
ee12b079 53:18db568f1098 847 tm_pointer->next_TM = NULL; return tm_ptr;
aniruddhv 52:0bd68655c651 848 break;
aniruddhv 52:0bd68655c651 849 }
aniruddhv 52:0bd68655c651 850 }
aniruddhv 52:0bd68655c651 851 }
shreeshas95 0:f016e9e8d48b 852 // CDMS TEAM CODE END
shreeshas95 0:f016e9e8d48b 853 // EXECUTE OBOSC
aniruddhv 51:da85d84768e2 854 #define execute_obosc_core(tc_ptr, tm_ptr, reset_flag) {\
shreeshas95 0:f016e9e8d48b 855 uint8_t service_subtype = (tc_ptr->TC_string[2]) & 0x0F;\
shreeshas95 4:104dd82c99b8 856 uint8_t temp8 = 0x00;\
shreeshas95 4:104dd82c99b8 857 Base_tc *modify_this = gHEAD_NODE_TCL;\
shreeshas95 4:104dd82c99b8 858 int modify_overflow = 0x00;\
shreeshas95 4:104dd82c99b8 859 switch( service_subtype ){\
shreeshas95 4:104dd82c99b8 860 case OBOSC_SUB_DISABLE:\
aniruddhv 12:ffdb29353058 861 /*gPC.puts("target psc are ");*/\
shreeshas95 5:ab276a17ca07 862 for(int i = 3 ; i < 9 ; ++i){\
aniruddhv 12:ffdb29353058 863 /*gPC.printf("%u ", tc_ptr->TC_string[i]);*/\
shreeshas95 5:ab276a17ca07 864 }\
aniruddhv 12:ffdb29353058 865 /*gPC.puts("\r\n");*/\
shreeshas95 5:ab276a17ca07 866 /*gPC.puts("disable type obosc\r\n");*/\
shreeshas95 4:104dd82c99b8 867 while( modify_this != NULL ){\
shreeshas95 4:104dd82c99b8 868 if( modify_overflow < TCL_OVERFLOW_CONSTANT ){\
shreeshas95 5:ab276a17ca07 869 uint8_t modify_psc = GETpacket_seq_count(modify_this);\
shreeshas95 5:ab276a17ca07 870 /*gPC.printf("mosify_psc = %u\r\n", modify_psc);*/\
shreeshas95 4:104dd82c99b8 871 for( int i = 3 ; i < 9 ; ++i ){\
shreeshas95 5:ab276a17ca07 872 uint8_t target_psc = tc_ptr->TC_string[i];\
shreeshas95 5:ab276a17ca07 873 if( (target_psc == modify_psc) && (target_psc != 0) ){\
shreeshas95 4:104dd82c99b8 874 uint16_t tempExec = TC_STATE_DISABLED;\
shreeshas95 4:104dd82c99b8 875 PUTexec_status( modify_this, tempExec );\
shreeshas95 4:104dd82c99b8 876 break;\
shreeshas95 4:104dd82c99b8 877 }\
shreeshas95 4:104dd82c99b8 878 }\
shreeshas95 4:104dd82c99b8 879 modify_this = modify_this->next_TC;\
shreeshas95 4:104dd82c99b8 880 ++modify_overflow;\
shreeshas95 4:104dd82c99b8 881 }\
shreeshas95 4:104dd82c99b8 882 else{\
shreeshas95 4:104dd82c99b8 883 /*PENDING: RESET CDMS*/\
shreeshas95 4:104dd82c99b8 884 break;\
shreeshas95 4:104dd82c99b8 885 }\
shreeshas95 4:104dd82c99b8 886 }\
shreeshas95 4:104dd82c99b8 887 break;\
shreeshas95 4:104dd82c99b8 888 case OBOSC_SUB_RETRY:\
aniruddhv 12:ffdb29353058 889 /*gPC.puts("retry type obosc\r\n");*/\
shreeshas95 4:104dd82c99b8 890 while( modify_this != NULL ){\
shreeshas95 4:104dd82c99b8 891 if( modify_overflow < TCL_OVERFLOW_CONSTANT ){\
shreeshas95 5:ab276a17ca07 892 uint8_t modify_psc = GETpacket_seq_count(modify_this);\
shreeshas95 4:104dd82c99b8 893 for( int i = 3 ; i < 9 ; ++i ){\
shreeshas95 5:ab276a17ca07 894 uint8_t target_psc = tc_ptr->TC_string[i];\
shreeshas95 5:ab276a17ca07 895 if( (target_psc == modify_psc) && (target_psc != 0) ){\
shreeshas95 4:104dd82c99b8 896 uint16_t tempExec = TC_STATE_MARKED_RETRY;\
shreeshas95 4:104dd82c99b8 897 PUTexec_status( modify_this, tempExec );\
aniruddhv 12:ffdb29353058 898 /*gPC.puts("reqquired tc found: disable\r\n");*/\
shreeshas95 4:104dd82c99b8 899 break;\
shreeshas95 4:104dd82c99b8 900 }\
shreeshas95 4:104dd82c99b8 901 }\
shreeshas95 4:104dd82c99b8 902 modify_this = modify_this->next_TC;\
shreeshas95 4:104dd82c99b8 903 ++modify_overflow;\
shreeshas95 4:104dd82c99b8 904 }\
shreeshas95 4:104dd82c99b8 905 else{\
shreeshas95 4:104dd82c99b8 906 /*PENDING: RESET CDMS*/\
shreeshas95 4:104dd82c99b8 907 break;\
shreeshas95 4:104dd82c99b8 908 }\
shreeshas95 4:104dd82c99b8 909 }\
shreeshas95 4:104dd82c99b8 910 break;\
shreeshas95 4:104dd82c99b8 911 }\
shreeshas95 4:104dd82c99b8 912 Base_tm *ackl234new = new Short_tm;\
shreeshas95 4:104dd82c99b8 913 ackl234new->next_TM = NULL;\
shreeshas95 4:104dd82c99b8 914 /*return telemetry pointer here*/\
shreeshas95 4:104dd82c99b8 915 tm_ptr = ackl234new;\
shreeshas95 4:104dd82c99b8 916 ackl234new->TM_string[0] = TMID_ACK_L234 << 4;\
shreeshas95 4:104dd82c99b8 917 ackl234new->TM_string[1] = GETpacket_seq_count(tc_ptr);\
shreeshas95 4:104dd82c99b8 918 ackl234new->TM_string[2] = 0xA0;\
shreeshas95 4:104dd82c99b8 919 for(int i = 3; i < 11; ++i){\
shreeshas95 4:104dd82c99b8 920 ackl234new->TM_string[i] = 0x00;\
shreeshas95 4:104dd82c99b8 921 }\
shreeshas95 4:104dd82c99b8 922 uint16_t crc = crc16_gen(ackl234new->TM_string, TM_SHORT_SIZE-2);\
shreeshas95 4:104dd82c99b8 923 ackl234new->TM_string[11] = (crc & 0xFF00) >> 8;\
shreeshas95 4:104dd82c99b8 924 ackl234new->TM_string[12] = crc & 0x00FF;\
shreeshas95 4:104dd82c99b8 925 /*ack l234 old*/\
shreeshas95 4:104dd82c99b8 926 if( service_subtype == OBOSC_SUB_REP_LE ){\
shreeshas95 4:104dd82c99b8 927 if( gLAST_TM_SHORT_OR_LONG == SHORT_TM_CODE ){\
shreeshas95 4:104dd82c99b8 928 Base_tm *ackl234old = new Short_tm;\
shreeshas95 4:104dd82c99b8 929 ackl234old->next_TM = NULL;\
shreeshas95 4:104dd82c99b8 930 /*APPEND TO ACK L234 NEW HERE*/\
shreeshas95 4:104dd82c99b8 931 ackl234new->next_TM = ackl234old;\
shreeshas95 4:104dd82c99b8 932 for( int i = 0 ; i < TM_SHORT_SIZE ; ++i ){\
shreeshas95 4:104dd82c99b8 933 ackl234old->TM_string[i] = gLAST_TM[i];\
shreeshas95 4:104dd82c99b8 934 }\
shreeshas95 0:f016e9e8d48b 935 }\
shreeshas95 4:104dd82c99b8 936 else{\
shreeshas95 4:104dd82c99b8 937 Base_tm *tempLongTM = new Long_tm;\
shreeshas95 4:104dd82c99b8 938 tempLongTM->next_TM = NULL;\
shreeshas95 4:104dd82c99b8 939 /*APPEND TO ACK L234 NEW HERE*/\
shreeshas95 4:104dd82c99b8 940 ackl234new->next_TM = tempLongTM;\
shreeshas95 4:104dd82c99b8 941 for( int i = 0 ; i < TM_LONG_SIZE ; ++i ){\
shreeshas95 4:104dd82c99b8 942 tempLongTM->TM_string[i] = gLAST_TM[i];\
shreeshas95 4:104dd82c99b8 943 }\
shreeshas95 4:104dd82c99b8 944 }\
shreeshas95 4:104dd82c99b8 945 }\
shreeshas95 4:104dd82c99b8 946 else if( service_subtype == OBOSC_SUB_REP_TCLD ){\
shreeshas95 4:104dd82c99b8 947 get_tc_list(ackl234new->next_TM, GETpacket_seq_count(tc_ptr));\
shreeshas95 4:104dd82c99b8 948 }\
shreeshas95 4:104dd82c99b8 949 else if( service_subtype == OBOSC_SUB_RESET ){\
aniruddhv 51:da85d84768e2 950 /*reset_all;*/\
aniruddhv 51:da85d84768e2 951 reset_flag = 1;\
shreeshas95 4:104dd82c99b8 952 /*PENDING: VERIFY reset_all, RESET CDMS*/\
shreeshas95 0:f016e9e8d48b 953 }\
shreeshas95 5:ab276a17ca07 954 else if( (service_subtype != OBOSC_SUB_DISABLE) && (service_subtype != OBOSC_SUB_RETRY) ){\
shreeshas95 4:104dd82c99b8 955 /*CHANGE THE ACK CODE TO INVALID TC*/\
shreeshas95 4:104dd82c99b8 956 ackl234new->TM_string[2] = 0xA2;\
shreeshas95 0:f016e9e8d48b 957 }\
aniruddhv 12:ffdb29353058 958 /*gPC.puts("completed obosc\r\n");*/\
shreeshas95 4:104dd82c99b8 959 }
shreeshas95 4:104dd82c99b8 960
shreeshas95 4:104dd82c99b8 961 /*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 */
krishanprajapat 117:bfdc807f3d3c 962
shreeshas95 0:f016e9e8d48b 963
shreeshas95 0:f016e9e8d48b 964 #define EXECUTE_OBOSC_ONLY {\
aniruddhv 51:da85d84768e2 965 int reset_flag = 0;\
shreeshas95 15:1c1ca992b43b 966 for(uint8_t execute_psc = PSC_START_VALUE ; execute_psc < gTOTAL_VALID_TC ; ++execute_psc){\
shreeshas95 4:104dd82c99b8 967 Base_tc* current_TC = gHEAD_NODE_TCL;\
shreeshas95 4:104dd82c99b8 968 int overCount = 0;\
shreeshas95 0:f016e9e8d48b 969 while( current_TC != NULL ){\
shreeshas95 4:104dd82c99b8 970 if( overCount < TCL_OVERFLOW_CONSTANT ){\
shreeshas95 4:104dd82c99b8 971 if( (GETcrc_pass(current_TC) == 1) && (GETpacket_seq_count(current_TC) == execute_psc) ){\
shreeshas95 4:104dd82c99b8 972 /*CHECK FOR OBOSC*/\
shreeshas95 0:f016e9e8d48b 973 uint8_t temp82 = 0x00;\
shreeshas95 0:f016e9e8d48b 974 isit_obosc(current_TC, temp82);\
shreeshas95 0:f016e9e8d48b 975 if(temp82 == 0x01){\
shreeshas95 4:104dd82c99b8 976 uint16_t current_exec_status = GETexec_status(current_TC);\
shreeshas95 4:104dd82c99b8 977 if( (current_exec_status == TC_STATE_SUCCESSFULLY_EXECUTED) || (current_exec_status == TC_STATE_DISABLED) )\
shreeshas95 4:104dd82c99b8 978 break;\
shreeshas95 4:104dd82c99b8 979 else if( (current_exec_status == TC_STATE_UNEXECUTED) || (current_exec_status == TC_STATE_MARKED_RETRY) ){\
aniruddhv 12:ffdb29353058 980 /*gPC.printf("It is obosc: %u\r\n", execute_psc);*/\
shreeshas95 4:104dd82c99b8 981 /*EXECUTION OF OBOSC TC*/\
shreeshas95 4:104dd82c99b8 982 /*WARNING: LARGE MEMORY UTILIZATION FOR TC-LIST-REPORT */\
ee12b079 73:6c99294b7802 983 Base_tm *obosc_tm_head = NULL;\
ee12b079 73:6c99294b7802 984 get_call_sign(obosc_tm_head);\
ee12b079 73:6c99294b7802 985 Base_tm *obosc_tm_core = NULL;\
ee12b079 73:6c99294b7802 986 execute_obosc_core(current_TC, obosc_tm_core, reset_flag);\
ee12b079 73:6c99294b7802 987 uint16_t temp16 = TC_STATE_SUCCESSFULLY_EXECUTED;\
ee12b079 73:6c99294b7802 988 PUTexec_status(current_TC, temp16);\
ee12b079 73:6c99294b7802 989 Base_tm *obosc_tm_current = obosc_tm_head;\
ee12b079 73:6c99294b7802 990 get_ack_l1(obosc_tm_current->next_TM);\
ee12b079 73:6c99294b7802 991 int overflowCountOBONLY = 0;\
shreeshas95 4:104dd82c99b8 992 while( obosc_tm_current->next_TM != NULL ){\
ee12b079 73:6c99294b7802 993 if( overflowCountOBONLY < TM_OVERFLOW_CONSTANT ){\
shreeshas95 4:104dd82c99b8 994 obosc_tm_current = obosc_tm_current->next_TM;\
ee12b079 73:6c99294b7802 995 ++overflowCountOBONLY;\
shreeshas95 4:104dd82c99b8 996 }\
shreeshas95 4:104dd82c99b8 997 else{\
shreeshas95 4:104dd82c99b8 998 /*PENDING: RESET CDMS*/\
shreeshas95 4:104dd82c99b8 999 break;\
shreeshas95 4:104dd82c99b8 1000 }\
shreeshas95 4:104dd82c99b8 1001 }\
ee12b079 73:6c99294b7802 1002 obosc_tm_current->next_TM = obosc_tm_core;\
ee12b079 73:6c99294b7802 1003 obosc_tm_current = obosc_tm_head;\
ee12b079 73:6c99294b7802 1004 while( obosc_tm_current != NULL ){\
ee12b079 73:6c99294b7802 1005 int length = TM_SHORT_SIZE;\
shreeshas95 102:80c911a6e736 1006 if( GETshort_or_long_tm(obosc_tm_current) == SHORT_TM_CODE ){\
ee12b079 73:6c99294b7802 1007 length = TM_SHORT_SIZE;\
ee12b079 73:6c99294b7802 1008 }\
ee12b079 73:6c99294b7802 1009 else{\
ee12b079 73:6c99294b7802 1010 length = TM_LONG_SIZE;\
ee12b079 73:6c99294b7802 1011 }\
ee12b079 73:6c99294b7802 1012 for(int i = 0 ; i < length ; ++i){\
ee12b079 73:6c99294b7802 1013 /*gPC.putc(obosc_tm_current->TM_string[i]);*/\
ee12b079 73:6c99294b7802 1014 }\
ee12b079 73:6c99294b7802 1015 obosc_tm_current = obosc_tm_current->next_TM;\
ee12b079 73:6c99294b7802 1016 }\
ee12b079 80:b2155ba726c3 1017 /*Sending OBOSC TM to GS*/\
ee12b079 73:6c99294b7802 1018 /*snd_tm.head_pointer(obosc_tm_head);*/\
ee12b079 95:42d6747900cb 1019 /*transmit_adf;*/\
ee12b079 73:6c99294b7802 1020 /*DELETE THE TM AFTER USE*/\
ee12b079 73:6c99294b7802 1021 obosc_tm_current = obosc_tm_head;\
ee12b079 73:6c99294b7802 1022 int overCount = 0;\
ee12b079 73:6c99294b7802 1023 while( obosc_tm_current != NULL ){\
ee12b079 73:6c99294b7802 1024 if( (overCount < TM_OVERFLOW_CONSTANT) ){\
ee12b079 73:6c99294b7802 1025 Base_tm *temp = obosc_tm_current->next_TM;\
ee12b079 73:6c99294b7802 1026 delete obosc_tm_current;\
ee12b079 73:6c99294b7802 1027 obosc_tm_current = temp;\
ee12b079 73:6c99294b7802 1028 ++overCount;\
ee12b079 73:6c99294b7802 1029 }\
ee12b079 73:6c99294b7802 1030 else{\
ee12b079 73:6c99294b7802 1031 /*PENDING: RESET CDMS: MEMORY LEAK FOUND*/\
ee12b079 73:6c99294b7802 1032 break;\
ee12b079 73:6c99294b7802 1033 }\
ee12b079 73:6c99294b7802 1034 }\
ee12b079 73:6c99294b7802 1035 if ( reset_flag ==1 ){\
ee12b079 73:6c99294b7802 1036 reset_all;\
ee12b079 73:6c99294b7802 1037 }\
shreeshas95 0:f016e9e8d48b 1038 }\
shreeshas95 0:f016e9e8d48b 1039 }\
shreeshas95 0:f016e9e8d48b 1040 }\
shreeshas95 4:104dd82c99b8 1041 current_TC = current_TC->next_TC;\
shreeshas95 4:104dd82c99b8 1042 ++overCount;\
shreeshas95 0:f016e9e8d48b 1043 }\
shreeshas95 4:104dd82c99b8 1044 else{\
shreeshas95 4:104dd82c99b8 1045 /*PENDING: REST CDMS: MEMORY LEAK FOUND*/\
shreeshas95 4:104dd82c99b8 1046 break;\
shreeshas95 4:104dd82c99b8 1047 }\
shreeshas95 4:104dd82c99b8 1048 }\
aniruddhv 58:5c59f28620bc 1049 }\
shreeshas95 0:f016e9e8d48b 1050 }
shreeshas95 0:f016e9e8d48b 1051
shreeshas95 0:f016e9e8d48b 1052 #define EXECUTE_TC {\
shreeshas95 5:ab276a17ca07 1053 gMASTER_STATE = TCL_STATE_EXECUTING;\
rohit3342 23:c89376564196 1054 /*gPC.printf("%u\r\n", gTOTAL_VALID_TC);*/\
rohit3342 16:538de1b20b3a 1055 for(uint8_t execute_psc = PSC_START_VALUE ; execute_psc < gTOTAL_VALID_TC ; ++execute_psc ){\
rohit3342 23:c89376564196 1056 /*gPC.printf("executing normal %u\r\n", execute_psc);*/\
shreeshas95 2:2caf2a9a13aa 1057 /*gLEDG = !gLEDG;*/\
shreeshas95 2:2caf2a9a13aa 1058 /*gLEDR = !gLEDR;*/\
shreeshas95 0:f016e9e8d48b 1059 Base_tc* current_TC = gHEAD_NODE_TCL;\
shreeshas95 4:104dd82c99b8 1060 int overflowCount = 0;\
shreeshas95 0:f016e9e8d48b 1061 while(current_TC != NULL){\
shreeshas95 4:104dd82c99b8 1062 if( overflowCount < TCL_OVERFLOW_CONSTANT ){\
shreeshas95 4:104dd82c99b8 1063 if( (GETcrc_pass(current_TC) == 1) && (GETpacket_seq_count(current_TC) == execute_psc) ){\
shreeshas95 4:104dd82c99b8 1064 uint8_t current_exec_status = GETexec_status(current_TC);\
shreeshas95 5:ab276a17ca07 1065 if( (current_exec_status == TC_STATE_SUCCESSFULLY_EXECUTED) || (current_exec_status == TC_STATE_DISABLED) ){\
aniruddhv 12:ffdb29353058 1066 /*gPC.printf("disabled or completed at %u\n", execute_psc);*/\
shreeshas95 4:104dd82c99b8 1067 break;\
shreeshas95 5:ab276a17ca07 1068 }\
shreeshas95 4:104dd82c99b8 1069 else if( (current_exec_status == TC_STATE_EXECUTION_FAILED) && (GETabort_on_nack(current_TC) == 1) ){\
aniruddhv 12:ffdb29353058 1070 /*gPC.printf("abort on nack at %u psc\r\n", execute_psc);*/\
shreeshas95 4:104dd82c99b8 1071 gMASTER_STATE = TCL_STATE_ABORTED;\
rohit3342 44:b9b067d0559f 1072 Base_tm *tm_ptr_head = NULL;\
rohit3342 44:b9b067d0559f 1073 get_call_sign(tm_ptr_head);\
rohit3342 44:b9b067d0559f 1074 Base_tm *tm_ptr = tm_ptr_head;\
rohit3342 44:b9b067d0559f 1075 get_ack_l1(tm_ptr->next_TM);\
ee12b079 73:6c99294b7802 1076 tm_ptr = tm_ptr_head;\
ee12b079 73:6c99294b7802 1077 while( tm_ptr != NULL ){\
ee12b079 73:6c99294b7802 1078 int length = TM_SHORT_SIZE;\
shreeshas95 102:80c911a6e736 1079 if( GETshort_or_long_tm(tm_ptr) == SHORT_TM_CODE ){\
ee12b079 73:6c99294b7802 1080 length = TM_SHORT_SIZE;\
ee12b079 73:6c99294b7802 1081 }\
ee12b079 73:6c99294b7802 1082 else{\
ee12b079 73:6c99294b7802 1083 length = TM_LONG_SIZE;\
ee12b079 73:6c99294b7802 1084 }\
ee12b079 73:6c99294b7802 1085 /*gPC.puts("Printing Call Sign, ACK_L1, TM list");*/\
ee12b079 73:6c99294b7802 1086 for(int i = 0 ; i < length ; ++i){\
ee12b079 73:6c99294b7802 1087 /*gPC.putc(tm_ptr->TM_string[i]);*/\
ee12b079 73:6c99294b7802 1088 }\
ee12b079 73:6c99294b7802 1089 tm_ptr = tm_ptr->next_TM;\
ee12b079 80:b2155ba726c3 1090 }\
ee12b079 80:b2155ba726c3 1091 /*Send only call sign, ACK_L1 to GS*/\
ee12b079 73:6c99294b7802 1092 /*snd_tm.head_pointer(tm_ptr_head);*/\
ee12b079 95:42d6747900cb 1093 /*transmit_adf;*/\
ee12b079 73:6c99294b7802 1094 /*DELETE THE TM AFTER USE*/\
ee12b079 73:6c99294b7802 1095 tm_ptr = tm_ptr_head;\
ee12b079 73:6c99294b7802 1096 int overflowCountExecute = 0;\
ee12b079 73:6c99294b7802 1097 while(tm_ptr != NULL){\
ee12b079 73:6c99294b7802 1098 if( overflowCountExecute < TM_OVERFLOW_CONSTANT ){\
ee12b079 73:6c99294b7802 1099 Base_tm *temp = tm_ptr->next_TM;\
ee12b079 73:6c99294b7802 1100 delete tm_ptr;\
ee12b079 73:6c99294b7802 1101 tm_ptr = temp;\
ee12b079 73:6c99294b7802 1102 ++overflowCountExecute;\
ee12b079 73:6c99294b7802 1103 }\
ee12b079 73:6c99294b7802 1104 else{\
ee12b079 73:6c99294b7802 1105 /*PENDING: RESET CDMS*/\
ee12b079 73:6c99294b7802 1106 break;\
ee12b079 73:6c99294b7802 1107 }\
ee12b079 73:6c99294b7802 1108 }\
shreeshas95 4:104dd82c99b8 1109 break;\
shreeshas95 4:104dd82c99b8 1110 }\
shreeshas95 4:104dd82c99b8 1111 else if( (current_exec_status == TC_STATE_UNEXECUTED) || (current_exec_status == TC_STATE_MARKED_RETRY) ){\
shreeshas95 4:104dd82c99b8 1112 /*EXECUTION OF TC START*/\
shreeshas95 4:104dd82c99b8 1113 uint8_t temp81 = 0x00;\
shreeshas95 4:104dd82c99b8 1114 isit_sdcard(current_TC, temp81);\
shreeshas95 4:104dd82c99b8 1115 if( temp81 == 0x00 ){\
aniruddhv 12:ffdb29353058 1116 /*gPC.printf("non sd card at %u\r\n", execute_psc);*/\
shreeshas95 4:104dd82c99b8 1117 /*EXECUTION OF NON SD-CARD (BOTH OBOSC and CDMS functions)*/\
shreeshas95 4:104dd82c99b8 1118 Base_tm *tm_ptr_head = NULL;\
shreeshas95 4:104dd82c99b8 1119 get_call_sign(tm_ptr_head);\
shreeshas95 4:104dd82c99b8 1120 Base_tm *put_tm_here = NULL;\
shreeshas95 4:104dd82c99b8 1121 uint8_t temp82 = 0x00;\
shreeshas95 4:104dd82c99b8 1122 uint8_t tempPAhot = 0x00;\
shreeshas95 4:104dd82c99b8 1123 isit_obosc(current_TC, temp82);\
shreeshas95 4:104dd82c99b8 1124 if(temp82 == 0x01){\
aniruddhv 12:ffdb29353058 1125 /*gPC.printf("obosc tc inside normal tc at %u\r\n", execute_psc);*/\
shreeshas95 4:104dd82c99b8 1126 /*EXECUTION OF OBOSC TC*/\
shreeshas95 4:104dd82c99b8 1127 /*SKIP EXECUTION OF OBOSC HERE*/\
aniruddhv 37:c9a739750806 1128 break;\
shreeshas95 4:104dd82c99b8 1129 }\
shreeshas95 4:104dd82c99b8 1130 else{\
rohit3342 23:c89376564196 1131 /*gPC.printf("cdms relay tmtc at %u\r\n", execute_psc);*/\
shreeshas95 4:104dd82c99b8 1132 /*call CDMS_RLY_TMTC*/\
shreeshas95 4:104dd82c99b8 1133 /*CDMS_RLY_TMTC(current_TC, put_tm_here);*/\
aniruddhv 52:0bd68655c651 1134 put_tm_here = FCTN_CDMS_RLY_TMTC(current_TC);\
shreeshas95 4:104dd82c99b8 1135 }\
shreeshas95 4:104dd82c99b8 1136 /*DETECT ACK OR NACK*/\
shreeshas95 4:104dd82c99b8 1137 uint8_t temp83 = 0x00;\
shreeshas95 4:104dd82c99b8 1138 uint8_t temp84 = GETpacket_seq_count(current_TC);\
shreeshas95 4:104dd82c99b8 1139 detect_ack(put_tm_here, temp83, temp84);\
shreeshas95 4:104dd82c99b8 1140 if( temp83 == 0x01){\
shreeshas95 4:104dd82c99b8 1141 uint16_t temp16 = TC_STATE_SUCCESSFULLY_EXECUTED;\
shreeshas95 4:104dd82c99b8 1142 PUTexec_status(current_TC, temp16);\
shreeshas95 4:104dd82c99b8 1143 }\
shreeshas95 4:104dd82c99b8 1144 else{\
rohit3342 23:c89376564196 1145 /*gPC.puts("TC_STATE_EXECUTION_FAILED");*/\
shreeshas95 4:104dd82c99b8 1146 uint16_t temp16 = TC_STATE_EXECUTION_FAILED;\
shreeshas95 4:104dd82c99b8 1147 PUTexec_status(current_TC, temp16);\
shreeshas95 4:104dd82c99b8 1148 }\
shreeshas95 4:104dd82c99b8 1149 /*ABORT ON NACK AND TC LIST COMPLETED: UPDATE IN gMASTERSTATE*/\
shreeshas95 4:104dd82c99b8 1150 if( (GETexec_status(current_TC) == TC_STATE_EXECUTION_FAILED) && (GETabort_on_nack(current_TC) == 1) ){\
shreeshas95 4:104dd82c99b8 1151 gMASTER_STATE = TCL_STATE_ABORTED;\
shreeshas95 4:104dd82c99b8 1152 }\
shreeshas95 15:1c1ca992b43b 1153 else if( execute_psc == (gTOTAL_VALID_TC-1) ){\
shreeshas95 4:104dd82c99b8 1154 /*LAST TC IS EXECUTED*/\
shreeshas95 4:104dd82c99b8 1155 gMASTER_STATE = TCL_STATE_COMPLETED;\
shreeshas95 4:104dd82c99b8 1156 }\
ee12b079 73:6c99294b7802 1157 else{\
ee12b079 73:6c99294b7802 1158 uint8_t check1 = 1;\
ee12b079 73:6c99294b7802 1159 for( uint8_t test_psc = execute_psc+1 ; test_psc < gTOTAL_VALID_TC ; ++test_psc ){\
ee12b079 73:6c99294b7802 1160 Base_tc* test_TC = gHEAD_NODE_TCL;\
ee12b079 73:6c99294b7802 1161 while(test_TC != NULL){\
ee12b079 73:6c99294b7802 1162 if( GETpacket_seq_count(test_TC) == test_psc ){\
ee12b079 73:6c99294b7802 1163 uint8_t checkval;\
ee12b079 73:6c99294b7802 1164 isit_obosc(test_TC, checkval);\
ee12b079 73:6c99294b7802 1165 if( checkval == 0 ){\
ee12b079 73:6c99294b7802 1166 check1 = 0;\
ee12b079 73:6c99294b7802 1167 }\
ee12b079 73:6c99294b7802 1168 }\
ee12b079 73:6c99294b7802 1169 test_TC = test_TC->next_TC;\
ee12b079 73:6c99294b7802 1170 }\
ee12b079 73:6c99294b7802 1171 }\
ee12b079 73:6c99294b7802 1172 if( check1 == 0x01 ){\
ee12b079 73:6c99294b7802 1173 gMASTER_STATE = TCL_STATE_COMPLETED;\
ee12b079 73:6c99294b7802 1174 }\
ee12b079 73:6c99294b7802 1175 }\
shreeshas95 4:104dd82c99b8 1176 /*update last executed L1_ack*/\
shreeshas95 4:104dd82c99b8 1177 if( put_tm_here != NULL ){\
shreeshas95 102:80c911a6e736 1178 if( GETshort_or_long_tm(put_tm_here) == SHORT_TM_CODE ){\
shreeshas95 4:104dd82c99b8 1179 for(int i = 0 ; i < TM_SHORT_SIZE ; ++i){\
shreeshas95 4:104dd82c99b8 1180 gLAST_TM[i] = put_tm_here->TM_string[i];\
shreeshas95 4:104dd82c99b8 1181 gLAST_TM_SHORT_OR_LONG = SHORT_TM_CODE;\
shreeshas95 4:104dd82c99b8 1182 }\
shreeshas95 4:104dd82c99b8 1183 }\
shreeshas95 4:104dd82c99b8 1184 else{\
shreeshas95 4:104dd82c99b8 1185 for( int i = 0 ; i < TM_LONG_SIZE ; ++i ){\
shreeshas95 4:104dd82c99b8 1186 gLAST_TM[i] = put_tm_here->TM_string[i];\
shreeshas95 4:104dd82c99b8 1187 gLAST_TM_SHORT_OR_LONG = LONG_TM_CODE;\
shreeshas95 4:104dd82c99b8 1188 }\
shreeshas95 4:104dd82c99b8 1189 }\
shreeshas95 4:104dd82c99b8 1190 }\
shreeshas95 4:104dd82c99b8 1191 /*PENDING: APPEND ACK L1*/\
shreeshas95 4:104dd82c99b8 1192 Base_tm *tm_ptr = tm_ptr_head;\
shreeshas95 4:104dd82c99b8 1193 get_ack_l1(tm_ptr->next_TM);\
shreeshas95 4:104dd82c99b8 1194 int overflowCountExecute = 0;\
shreeshas95 4:104dd82c99b8 1195 while( tm_ptr->next_TM != NULL ){\
shreeshas95 4:104dd82c99b8 1196 if( overflowCountExecute < TM_OVERFLOW_CONSTANT ){\
shreeshas95 4:104dd82c99b8 1197 tm_ptr = tm_ptr->next_TM;\
shreeshas95 4:104dd82c99b8 1198 ++overflowCountExecute;\
shreeshas95 4:104dd82c99b8 1199 }\
shreeshas95 4:104dd82c99b8 1200 else{\
shreeshas95 4:104dd82c99b8 1201 /*PENDING: RESET CDMS*/\
shreeshas95 4:104dd82c99b8 1202 break;\
shreeshas95 4:104dd82c99b8 1203 }\
shreeshas95 4:104dd82c99b8 1204 }\
shreeshas95 4:104dd82c99b8 1205 tm_ptr->next_TM = put_tm_here;\
shreeshas95 4:104dd82c99b8 1206 /*CHECK FOR HOT PA*/\
shreeshas95 4:104dd82c99b8 1207 isPAhot(tempPAhot);\
shreeshas95 4:104dd82c99b8 1208 if( tempPAhot == 0x00 ){\
shreeshas95 4:104dd82c99b8 1209 gFLAGS = gFLAGS | COM_PA_HOT_FLAG;\
shreeshas95 4:104dd82c99b8 1210 }\
ee12b079 73:6c99294b7802 1211 tm_ptr = tm_ptr_head;\
ee12b079 73:6c99294b7802 1212 while( tm_ptr != NULL ){\
ee12b079 73:6c99294b7802 1213 int length = TM_SHORT_SIZE;\
shreeshas95 102:80c911a6e736 1214 if( GETshort_or_long_tm(tm_ptr) == SHORT_TM_CODE ){\
ee12b079 73:6c99294b7802 1215 length = TM_SHORT_SIZE;\
ee12b079 73:6c99294b7802 1216 }\
ee12b079 73:6c99294b7802 1217 else{\
ee12b079 73:6c99294b7802 1218 length = TM_LONG_SIZE;\
ee12b079 73:6c99294b7802 1219 }\
ee12b079 73:6c99294b7802 1220 /*gPC.puts("Printing Call Sign, ACK_L1, TM list");*/\
ee12b079 73:6c99294b7802 1221 for(int i = 0 ; i < length ; ++i){\
ee12b079 73:6c99294b7802 1222 /*gPC.putc(tm_ptr->TM_string[i]);*/\
ee12b079 73:6c99294b7802 1223 }\
ee12b079 73:6c99294b7802 1224 tm_ptr = tm_ptr->next_TM;\
ee12b079 73:6c99294b7802 1225 }\
ee12b079 80:b2155ba726c3 1226 /*SEND call sign, ACK_L1, NON OBSRS TM TO GS*/\
ee12b079 95:42d6747900cb 1227 snd_tm.head_pointer(tm_ptr_head);\
ee12b079 98:fd99ddc0e0a1 1228 gPC.puts("enter_adf\r\n");\
ee12b079 98:fd99ddc0e0a1 1229 transmit_adf;\
ee12b079 98:fd99ddc0e0a1 1230 gPC.puts("exit_adf\r\n");\
ee12b079 73:6c99294b7802 1231 /*DELETE THE TM AFTER USE*/\
ee12b079 73:6c99294b7802 1232 tm_ptr = tm_ptr_head;\
ee12b079 73:6c99294b7802 1233 overflowCountExecute = 0;\
ee12b079 73:6c99294b7802 1234 while(tm_ptr != NULL){\
ee12b079 73:6c99294b7802 1235 if( overflowCountExecute < TM_OVERFLOW_CONSTANT ){\
ee12b079 73:6c99294b7802 1236 Base_tm *temp = tm_ptr->next_TM;\
ee12b079 73:6c99294b7802 1237 delete tm_ptr;\
ee12b079 73:6c99294b7802 1238 tm_ptr = temp;\
ee12b079 73:6c99294b7802 1239 ++overflowCountExecute;\
ee12b079 73:6c99294b7802 1240 }\
ee12b079 73:6c99294b7802 1241 else{\
ee12b079 73:6c99294b7802 1242 /*PENDING: RESET CDMS*/\
ee12b079 73:6c99294b7802 1243 break;\
ee12b079 73:6c99294b7802 1244 }\
ee12b079 73:6c99294b7802 1245 }\
shreeshas95 0:f016e9e8d48b 1246 }\
shreeshas95 0:f016e9e8d48b 1247 else{\
aniruddhv 12:ffdb29353058 1248 /*gPC.printf("sd card at %u\r\n", execute_psc);*/\
shreeshas95 4:104dd82c99b8 1249 /*EXECUTION OF SD-CARD DATA SENDING (OBSRS)*/\
aniruddhv 37:c9a739750806 1250 Base_tm *tm_ptr_head = NULL;\
aniruddhv 37:c9a739750806 1251 get_call_sign(tm_ptr_head);\
aniruddhv 37:c9a739750806 1252 Base_tm *put_tm_here = NULL;\
aniruddhv 37:c9a739750806 1253 /*execute_obsrs(current_TC, put_tm_here)*/\
shreeshas95 4:104dd82c99b8 1254 /*read_TC(current_TC);*/\
ee12b079 87:6e154fd43531 1255 execute_OBSRS_TC(current_TC);\
ee12b079 96:4ca92f9775e0 1256 gPC.puts("en_adf");\
ee12b079 95:42d6747900cb 1257 transmit_adf;\
ee12b079 96:4ca92f9775e0 1258 gPC.puts("ex_adf");\
shreeshas95 6:79d422d1ed42 1259 uint8_t tempExec = TC_STATE_SUCCESSFULLY_EXECUTED;\
shreeshas95 6:79d422d1ed42 1260 PUTexec_status(current_TC, tempExec);\
ee12b079 73:6c99294b7802 1261 /*PENDING: ABORT ON NACK CHECK, gMASTER_STATE VERIFICATION WITH SD CARD, session timeout, last executed ack l234*/\
shreeshas95 4:104dd82c99b8 1262 if( (GETexec_status(current_TC) == TC_STATE_EXECUTION_FAILED) && (GETabort_on_nack(current_TC) == 1) ){\
shreeshas95 4:104dd82c99b8 1263 gMASTER_STATE = TCL_STATE_ABORTED;\
shreeshas95 0:f016e9e8d48b 1264 }\
shreeshas95 15:1c1ca992b43b 1265 else if( execute_psc == (gTOTAL_VALID_TC-1) ){\
shreeshas95 6:79d422d1ed42 1266 gMASTER_STATE = TCL_STATE_COMPLETED;\
shreeshas95 6:79d422d1ed42 1267 }\
ee12b079 73:6c99294b7802 1268 else{\
ee12b079 73:6c99294b7802 1269 uint8_t check1 = 1;\
ee12b079 73:6c99294b7802 1270 for( uint8_t test_psc = execute_psc+1 ; test_psc < gTOTAL_VALID_TC ; ++test_psc ){\
ee12b079 73:6c99294b7802 1271 Base_tc* test_TC = gHEAD_NODE_TCL;\
ee12b079 73:6c99294b7802 1272 while(test_TC != NULL){\
ee12b079 73:6c99294b7802 1273 if( GETpacket_seq_count(test_TC) == test_psc ){\
ee12b079 73:6c99294b7802 1274 uint8_t checkval;\
ee12b079 73:6c99294b7802 1275 isit_obosc(test_TC, checkval);\
ee12b079 73:6c99294b7802 1276 if( checkval == 0 ){\
ee12b079 73:6c99294b7802 1277 check1 = 0;\
ee12b079 73:6c99294b7802 1278 }\
ee12b079 73:6c99294b7802 1279 }\
ee12b079 73:6c99294b7802 1280 test_TC = test_TC->next_TC;\
ee12b079 73:6c99294b7802 1281 }\
ee12b079 73:6c99294b7802 1282 }\
ee12b079 73:6c99294b7802 1283 if( check1 == 0x01 ){\
ee12b079 73:6c99294b7802 1284 gMASTER_STATE = TCL_STATE_COMPLETED;\
ee12b079 73:6c99294b7802 1285 }\
ee12b079 73:6c99294b7802 1286 }\
ee12b079 73:6c99294b7802 1287 /*update last executed L1_ack*/\
ee12b079 73:6c99294b7802 1288 if( put_tm_here != NULL ){\
shreeshas95 102:80c911a6e736 1289 if( GETshort_or_long_tm(put_tm_here) == SHORT_TM_CODE ){\
ee12b079 73:6c99294b7802 1290 for(int i = 0 ; i < TM_SHORT_SIZE ; ++i){\
ee12b079 73:6c99294b7802 1291 gLAST_TM[i] = put_tm_here->TM_string[i];\
ee12b079 73:6c99294b7802 1292 gLAST_TM_SHORT_OR_LONG = SHORT_TM_CODE;\
ee12b079 73:6c99294b7802 1293 }\
ee12b079 73:6c99294b7802 1294 }\
ee12b079 73:6c99294b7802 1295 else{\
ee12b079 73:6c99294b7802 1296 for( int i = 0 ; i < TM_LONG_SIZE ; ++i ){\
ee12b079 73:6c99294b7802 1297 gLAST_TM[i] = put_tm_here->TM_string[i];\
ee12b079 73:6c99294b7802 1298 gLAST_TM_SHORT_OR_LONG = LONG_TM_CODE;\
ee12b079 73:6c99294b7802 1299 }\
ee12b079 73:6c99294b7802 1300 }\
ee12b079 73:6c99294b7802 1301 }\
rohit3342 44:b9b067d0559f 1302 /*PENDING: APPEND ACK L1*/\
rohit3342 44:b9b067d0559f 1303 Base_tm *tm_ptr = tm_ptr_head;\
rohit3342 44:b9b067d0559f 1304 get_ack_l1(tm_ptr->next_TM);\
rohit3342 44:b9b067d0559f 1305 int overflowCountExecute = 0;\
rohit3342 44:b9b067d0559f 1306 while( tm_ptr->next_TM != NULL ){\
rohit3342 44:b9b067d0559f 1307 if( overflowCountExecute < TM_OVERFLOW_CONSTANT ){\
rohit3342 44:b9b067d0559f 1308 tm_ptr = tm_ptr->next_TM;\
rohit3342 44:b9b067d0559f 1309 ++overflowCountExecute;\
rohit3342 44:b9b067d0559f 1310 }\
rohit3342 44:b9b067d0559f 1311 else{\
rohit3342 44:b9b067d0559f 1312 /*PENDING: RESET CDMS*/\
rohit3342 44:b9b067d0559f 1313 break;\
rohit3342 44:b9b067d0559f 1314 }\
rohit3342 44:b9b067d0559f 1315 }\
rohit3342 44:b9b067d0559f 1316 tm_ptr->next_TM = put_tm_here;\
rohit3342 44:b9b067d0559f 1317 /*CHECK FOR HOT PA*/\
rohit3342 44:b9b067d0559f 1318 uint8_t tempPAhot = 0x00;\
rohit3342 44:b9b067d0559f 1319 isPAhot(tempPAhot);\
rohit3342 44:b9b067d0559f 1320 if( tempPAhot == 0x00 ){\
rohit3342 44:b9b067d0559f 1321 gFLAGS = gFLAGS | COM_PA_HOT_FLAG;\
rohit3342 44:b9b067d0559f 1322 }\
ee12b079 73:6c99294b7802 1323 tm_ptr = tm_ptr_head;\
ee12b079 73:6c99294b7802 1324 while( tm_ptr != NULL ){\
ee12b079 73:6c99294b7802 1325 int length = TM_SHORT_SIZE;\
shreeshas95 102:80c911a6e736 1326 if( GETshort_or_long_tm(tm_ptr) == SHORT_TM_CODE ){\
ee12b079 73:6c99294b7802 1327 length = TM_SHORT_SIZE;\
ee12b079 73:6c99294b7802 1328 }\
ee12b079 73:6c99294b7802 1329 else{\
ee12b079 73:6c99294b7802 1330 length = TM_LONG_SIZE;\
ee12b079 73:6c99294b7802 1331 }\
ee12b079 73:6c99294b7802 1332 /*gPC.puts("Printing Call Sign, ACK_L1, TM list");*/\
ee12b079 73:6c99294b7802 1333 for(int i = 0 ; i < length ; ++i){\
ee12b079 73:6c99294b7802 1334 /*gPC.putc(tm_ptr->TM_string[i]);*/\
ee12b079 73:6c99294b7802 1335 }\
ee12b079 73:6c99294b7802 1336 tm_ptr = tm_ptr->next_TM;\
ee12b079 73:6c99294b7802 1337 }\
ee12b079 80:b2155ba726c3 1338 /*SEND call sign, ACK_L1, OBSRS TO GS*/\
ee12b079 73:6c99294b7802 1339 /*snd_tm.head_pointer(tm_ptr_head);*/\
ee12b079 73:6c99294b7802 1340 /*adf_SDcard();*/\
ee12b079 73:6c99294b7802 1341 /*DELETE THE TM AFTER USE*/\
ee12b079 73:6c99294b7802 1342 tm_ptr = tm_ptr_head;\
ee12b079 73:6c99294b7802 1343 overflowCountExecute = 0;\
ee12b079 73:6c99294b7802 1344 while(tm_ptr != NULL){\
ee12b079 73:6c99294b7802 1345 if( overflowCountExecute < TM_OVERFLOW_CONSTANT ){\
ee12b079 73:6c99294b7802 1346 Base_tm *temp = tm_ptr->next_TM;\
ee12b079 73:6c99294b7802 1347 delete tm_ptr;\
ee12b079 73:6c99294b7802 1348 tm_ptr = temp;\
ee12b079 73:6c99294b7802 1349 ++overflowCountExecute;\
ee12b079 73:6c99294b7802 1350 }\
ee12b079 73:6c99294b7802 1351 else{\
ee12b079 73:6c99294b7802 1352 /*PENDING: RESET CDMS*/\
ee12b079 73:6c99294b7802 1353 break;\
ee12b079 73:6c99294b7802 1354 }\
ee12b079 73:6c99294b7802 1355 }\
shreeshas95 0:f016e9e8d48b 1356 }\
shreeshas95 0:f016e9e8d48b 1357 }\
shreeshas95 4:104dd82c99b8 1358 break;\
shreeshas95 0:f016e9e8d48b 1359 }\
shreeshas95 4:104dd82c99b8 1360 current_TC = current_TC->next_TC;\
shreeshas95 4:104dd82c99b8 1361 ++overflowCount;\
shreeshas95 0:f016e9e8d48b 1362 }\
shreeshas95 4:104dd82c99b8 1363 else{\
shreeshas95 4:104dd82c99b8 1364 /*PENDING: RESET CDMS*/\
shreeshas95 2:2caf2a9a13aa 1365 break;\
shreeshas95 2:2caf2a9a13aa 1366 }\
shreeshas95 2:2caf2a9a13aa 1367 }\
shreeshas95 6:79d422d1ed42 1368 if( gFLAGS & COM_SESSION_TIMEOUT_FLAG ){\
shreeshas95 6:79d422d1ed42 1369 break;\
shreeshas95 6:79d422d1ed42 1370 }\
shreeshas95 6:79d422d1ed42 1371 else if( gMASTER_STATE == TCL_STATE_ABORTED ){\
aniruddhv 12:ffdb29353058 1372 /*gPC.puts("ABORTING DUE TO ABORT ON NACK\r\n");*/\
shreeshas95 4:104dd82c99b8 1373 /*EXITED DUE TO ABORT ON NACK:*/\
shreeshas95 2:2caf2a9a13aa 1374 /*PENDING : POWER OFF COM TX*/\
shreeshas95 2:2caf2a9a13aa 1375 RX1M.attach(&rx_read, Serial::RxIrq);\
shreeshas95 2:2caf2a9a13aa 1376 gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\
shreeshas95 0:f016e9e8d48b 1377 break;\
shreeshas95 2:2caf2a9a13aa 1378 }\
shreeshas95 4:104dd82c99b8 1379 else if( gFLAGS & COM_PA_HOT_FLAG ){\
shreeshas95 4:104dd82c99b8 1380 /*PA HOT: WAIT FOR TIMEOUT*/\
shreeshas95 4:104dd82c99b8 1381 gCOM_PA_COOLING_TIMEOUT.attach(&after_cooling_pa, COM_PA_COOLING_TIME_LIMIT);\
shreeshas95 4:104dd82c99b8 1382 /*PENDING : POWER OFF COMM TX*/\
shreeshas95 4:104dd82c99b8 1383 RX1M.attach(&rx_read, Serial::RxIrq);\
shreeshas95 4:104dd82c99b8 1384 gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\
shreeshas95 2:2caf2a9a13aa 1385 break;\
shreeshas95 2:2caf2a9a13aa 1386 }\
aniruddhv 12:ffdb29353058 1387 /*gPC.printf("successflly executed %u tc\r\n", execute_psc);*/\
shreeshas95 0:f016e9e8d48b 1388 }\
shreeshas95 6:79d422d1ed42 1389 if( (gMASTER_STATE == TCL_STATE_COMPLETED) || (gFLAGS & COM_SESSION_TIMEOUT_FLAG) ){\
aniruddhv 12:ffdb29353058 1390 /*gPC.printf("completed or session timed out: %x\r\n", gMASTER_STATE);*/\
shreeshas95 5:ab276a17ca07 1391 /*COMPLETED EXECUTION OF TC*/\
shreeshas95 5:ab276a17ca07 1392 gMASTER_STATE = TCL_STATE_COMPLETED;\
shreeshas95 5:ab276a17ca07 1393 COM_POWER_OFF_TX;\
shreeshas95 5:ab276a17ca07 1394 reset_all;\
shreeshas95 5:ab276a17ca07 1395 /*PENDING : ENABLE THREADS*/\
shreeshas95 5:ab276a17ca07 1396 gSESSION_TIMEOUT.detach();\
shreeshas95 5:ab276a17ca07 1397 gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\
shreeshas95 5:ab276a17ca07 1398 gFLAGS = gFLAGS & (~COM_SESSION_FLAG);\
shreeshas95 5:ab276a17ca07 1399 }\
shreeshas95 0:f016e9e8d48b 1400 }