for frequency correction testing

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Committer:
ee12b079
Date:
Sun Apr 10 06:40:40 2016 +0000
Revision:
153:6b0e79b2bb54
Parent:
142:83f48d1a1bc5
Corrected FMS MMS TC, OBSRS TM to be checked.

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