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