publishing to check changes in cdms code

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE_samp_23SEP_DMA_flag by samp Srinivasan

Committer:
chaithanyarss
Date:
Mon Jul 04 14:48:16 2016 +0000
Revision:
225:e6a3ffe4a530
Parent:
210:f4acf895b598
Child:
229:42624b9a08b4
Child:
245:da9d1bd999da
Testing BAE TCs

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ee12b079 210:f4acf895b598 1 int pl_next_index=-1;
ee12b079 210:f4acf895b598 2 uint8_t pl_main_flag=0;
ee12b079 210:f4acf895b598 3 uint8_t PL_PREV_STATE=0x00;
ee12b079 210:f4acf895b598 4 uint8_t POWER_LEVEL = 3; //Would be present in HK data extracted
ee12b079 210:f4acf895b598 5 uint32_t pl_block[192]={0};
ee12b079 210:f4acf895b598 6 uint32_t pl_time;
ee12b079 210:f4acf895b598 7 uint32_t TIME_LATEST_PL=0;
ee12b079 210:f4acf895b598 8 uint8_t i;
ee12b079 210:f4acf895b598 9 uint8_t PL_BEE_SW_STATUS=0;
ee12b079 210:f4acf895b598 10
ee12b079 210:f4acf895b598 11 //Serial pc(USBTX,USBRX);
ee12b079 210:f4acf895b598 12
ee12b079 210:f4acf895b598 13 #define PL_MAIN_STATUS 0x01
ee12b079 210:f4acf895b598 14 #define PL_LOW_POWER 0x02
ee12b079 210:f4acf895b598 15 #define STATE_OFF 0x00
ee12b079 210:f4acf895b598 16 #define STATE_STANDBY 0x04
ee12b079 210:f4acf895b598 17 #define STATE_HIBERNATE 0x08
ee12b079 210:f4acf895b598 18 #define STATE_SCIENCE 0x0C //also used as mask for PL_STATE
ee12b079 210:f4acf895b598 19 #define PL_OFF 0x00
ee12b079 210:f4acf895b598 20 #define PL_STANDBY 0x10
ee12b079 210:f4acf895b598 21 #define PL_HIBERNATE 0x20
ee12b079 210:f4acf895b598 22 #define PL_SCIENCE 0x30
ee12b079 210:f4acf895b598 23 #define PL_SUCCESS_I2C 0x40
ee12b079 210:f4acf895b598 24 #define PL_ERR_I2C 0x50
ee12b079 210:f4acf895b598 25 #define PL_INVALID_STATE 0x60
ee12b079 210:f4acf895b598 26 #define PL_DISABLED 0x70 //also used as mask for PL_STATUS
ee12b079 210:f4acf895b598 27 #define EXECUTED 0x00000001
ee12b079 210:f4acf895b598 28 #define RETRY 0x00000002
ee12b079 210:f4acf895b598 29 #define UNEXECUTED 0x00000003 //also used as mask for EXEC_STATUS
ee12b079 210:f4acf895b598 30
ee12b079 210:f4acf895b598 31
ee12b079 210:f4acf895b598 32 DigitalOut PYLD_DFF(PIN73);
ee12b079 210:f4acf895b598 33 DigitalOut PYLD_DFF_CLK(PIN65);
ee12b079 210:f4acf895b598 34 DigitalOut PYLD_EPS_DFF_PWR(PIN64);
ee12b079 210:f4acf895b598 35 DigitalOut PYLD_EPS_DFF_PWR_CLK(PIN40);
ee12b079 210:f4acf895b598 36 Base_tm* FCTN_CDMS_RLY_TMTC(Base_tc *tc_ptr);
ee12b079 210:f4acf895b598 37
ee12b079 210:f4acf895b598 38 // waiting 1us for setup time,hold time and propagation delay
ee12b079 210:f4acf895b598 39 #define SET_PL_BEE_OFF {\
ee12b079 210:f4acf895b598 40 PYLD_DFF_CLK = 0;\
ee12b079 210:f4acf895b598 41 PYLD_DFF = 0;\
ee12b079 210:f4acf895b598 42 wait_us(1);\
ee12b079 210:f4acf895b598 43 PYLD_DFF_CLK = 1;\
ee12b079 210:f4acf895b598 44 wait_us(1);\
ee12b079 210:f4acf895b598 45 PYLD_DFF_CLK = 0;\
ee12b079 210:f4acf895b598 46 wait_us(1);\
ee12b079 210:f4acf895b598 47 }
ee12b079 210:f4acf895b598 48 #define SET_PL_BEE_ON {\
ee12b079 210:f4acf895b598 49 PYLD_DFF_CLK = 0;\
ee12b079 210:f4acf895b598 50 PYLD_DFF = 1;\
ee12b079 210:f4acf895b598 51 wait_us(1);\
ee12b079 210:f4acf895b598 52 PYLD_DFF_CLK = 1;\
ee12b079 210:f4acf895b598 53 wait_us(1);\
ee12b079 210:f4acf895b598 54 PYLD_DFF_CLK = 0;\
ee12b079 210:f4acf895b598 55 wait_us(1);\
ee12b079 210:f4acf895b598 56 }
ee12b079 210:f4acf895b598 57
ee12b079 210:f4acf895b598 58 //TC_string[0] should not be 0x00
ee12b079 210:f4acf895b598 59
ee12b079 210:f4acf895b598 60 #define SET_PL_BEE_STANDBY(tm_ptr_standby) {\
ee12b079 210:f4acf895b598 61 Base_tc *pl_tc_standby = new Short_tc;\
ee12b079 210:f4acf895b598 62 pl_tc_standby->next_TC = NULL;\
ee12b079 210:f4acf895b598 63 PUTshort_or_long(pl_tc_standby,0);\
ee12b079 210:f4acf895b598 64 PUTcrc_pass(pl_tc_standby,0x1);\
ee12b079 210:f4acf895b598 65 PUTexec_status(pl_tc_standby,0);\
ee12b079 210:f4acf895b598 66 pl_tc_standby->TC_string[0] = 0x01;\
ee12b079 210:f4acf895b598 67 pl_tc_standby->TC_string[1] = 0xE1;\
ee12b079 210:f4acf895b598 68 pl_tc_standby->TC_string[2] = 0x81;\
ee12b079 210:f4acf895b598 69 pl_tc_standby->TC_string[3] = 0x02;\
ee12b079 210:f4acf895b598 70 pl_tc_standby->TC_string[4] = 0;\
ee12b079 210:f4acf895b598 71 pl_tc_standby->TC_string[5] = 0;\
ee12b079 210:f4acf895b598 72 pl_tc_standby->TC_string[6] = 0;\
ee12b079 210:f4acf895b598 73 pl_tc_standby->TC_string[7] = 0;\
ee12b079 210:f4acf895b598 74 pl_tc_standby->TC_string[8] = 0;\
ee12b079 210:f4acf895b598 75 uint16_t crc16 = crc16_gen(pl_tc_standby->TC_string, 9);\
ee12b079 210:f4acf895b598 76 pl_tc_standby->TC_string[9] = (uint8_t)(crc16 & 0xFF00)>>8;\
ee12b079 210:f4acf895b598 77 pl_tc_standby->TC_string[10] = (uint8_t)(crc16 & 0x00FF);\
ee12b079 210:f4acf895b598 78 tm_ptr_standby = FCTN_CDMS_RLY_TMTC(pl_tc_standby);\
ee12b079 210:f4acf895b598 79 VERIFY_TM(tm_ptr_standby);\
chaithanyarss 225:e6a3ffe4a530 80 delete pl_tc_standby;\
chaithanyarss 225:e6a3ffe4a530 81 delete tm_ptr_standby;\
ee12b079 210:f4acf895b598 82 }
ee12b079 210:f4acf895b598 83
ee12b079 210:f4acf895b598 84 //TC_string[0] should not be 0x00
ee12b079 210:f4acf895b598 85
ee12b079 210:f4acf895b598 86 #define SET_PL_BEE_HIBERNATE(tm_ptr_hibernate) {\
ee12b079 210:f4acf895b598 87 Base_tc *pl_tc_hibernate = new Short_tc;\
ee12b079 210:f4acf895b598 88 pl_tc_hibernate->next_TC = NULL;\
ee12b079 210:f4acf895b598 89 PUTshort_or_long(pl_tc_hibernate,0);\
ee12b079 210:f4acf895b598 90 PUTcrc_pass(pl_tc_hibernate,0x1);\
ee12b079 210:f4acf895b598 91 PUTexec_status(pl_tc_hibernate,0);\
ee12b079 210:f4acf895b598 92 pl_tc_hibernate->TC_string[0] = 0x01;\
ee12b079 210:f4acf895b598 93 pl_tc_hibernate->TC_string[1] = 0xE1;\
ee12b079 210:f4acf895b598 94 pl_tc_hibernate->TC_string[2] = 0x81;\
ee12b079 210:f4acf895b598 95 pl_tc_hibernate->TC_string[3] = 0x03;\
ee12b079 210:f4acf895b598 96 pl_tc_hibernate->TC_string[4] = 0;\
ee12b079 210:f4acf895b598 97 pl_tc_hibernate->TC_string[5] = 0;\
ee12b079 210:f4acf895b598 98 pl_tc_hibernate->TC_string[6] = 0;\
ee12b079 210:f4acf895b598 99 pl_tc_hibernate->TC_string[7] = 0;\
ee12b079 210:f4acf895b598 100 pl_tc_hibernate->TC_string[8] = 0;\
ee12b079 210:f4acf895b598 101 uint16_t crc16 = crc16_gen(pl_tc_hibernate->TC_string, 9);\
ee12b079 210:f4acf895b598 102 pl_tc_hibernate->TC_string[9] = (uint8_t)(crc16 & 0xFF00)>>8;\
ee12b079 210:f4acf895b598 103 pl_tc_hibernate->TC_string[10] = (uint8_t)(crc16 & 0x00FF);\
ee12b079 210:f4acf895b598 104 tm_ptr_hibernate = FCTN_CDMS_RLY_TMTC(pl_tc_hibernate);\
ee12b079 210:f4acf895b598 105 VERIFY_TM(tm_ptr_hibernate);\
chaithanyarss 225:e6a3ffe4a530 106 delete pl_tc_hibernate;\
chaithanyarss 225:e6a3ffe4a530 107 delete tm_ptr_hibernate;\
ee12b079 210:f4acf895b598 108 }
ee12b079 210:f4acf895b598 109
ee12b079 210:f4acf895b598 110 //TC_string[0] should not be 0x00
ee12b079 210:f4acf895b598 111 /*
ee12b079 210:f4acf895b598 112 PUTshort_or_long(pl_tc_science,0);\
ee12b079 210:f4acf895b598 113 PUTcrc_pass(pl_tc_science,0x1);\
ee12b079 210:f4acf895b598 114 PUTexec_status(pl_tc_science,0);\*/
ee12b079 210:f4acf895b598 115
ee12b079 210:f4acf895b598 116 #define SET_PL_BEE_SCIENCE(tm_ptr_science) {\
ee12b079 210:f4acf895b598 117 Base_tc *pl_tc_science = new Short_tc;\
ee12b079 210:f4acf895b598 118 pl_tc_science->next_TC = NULL;\
ee12b079 210:f4acf895b598 119 pl_tc_science->TC_string[0] = 0x01;\
ee12b079 210:f4acf895b598 120 pl_tc_science->TC_string[1] = 0xE1;\
ee12b079 210:f4acf895b598 121 pl_tc_science->TC_string[2] = 0x81;\
ee12b079 210:f4acf895b598 122 pl_tc_science->TC_string[3] = 0x04;\
ee12b079 210:f4acf895b598 123 pl_tc_science->TC_string[4] = 0;\
ee12b079 210:f4acf895b598 124 pl_tc_science->TC_string[5] = 0;\
ee12b079 210:f4acf895b598 125 pl_tc_science->TC_string[6] = 0;\
ee12b079 210:f4acf895b598 126 pl_tc_science->TC_string[7] = 0;\
ee12b079 210:f4acf895b598 127 pl_tc_science->TC_string[8] = 0;\
ee12b079 210:f4acf895b598 128 uint16_t crc16 = crc16_gen(pl_tc_science->TC_string, 9);\
ee12b079 210:f4acf895b598 129 pl_tc_science->TC_string[9] = (uint8_t)(crc16 & 0xFF00)>>8;\
ee12b079 210:f4acf895b598 130 pl_tc_science->TC_string[10] = (uint8_t)(crc16 & 0x00FF);\
ee12b079 210:f4acf895b598 131 tm_ptr_science = FCTN_CDMS_RLY_TMTC(pl_tc_science);\
ee12b079 210:f4acf895b598 132 VERIFY_TM(tm_ptr_science);\
chaithanyarss 225:e6a3ffe4a530 133 delete pl_tc_science;\
chaithanyarss 225:e6a3ffe4a530 134 delete tm_ptr_science;\
ee12b079 210:f4acf895b598 135 }
ee12b079 210:f4acf895b598 136 void print_processed_block(uint8_t index)
ee12b079 210:f4acf895b598 137 {
ee12b079 210:f4acf895b598 138 gPC.printf("\n\n\rBlock after processing:");
ee12b079 210:f4acf895b598 139 gPC.printf("\n\rTime of block:");
ee12b079 210:f4acf895b598 140 gPC.printf("\n\rYear :%d",((((pl_block[index]&0xFFFFFFF0)>>4) & 0x0C000000)>>26)+2016);
ee12b079 210:f4acf895b598 141 gPC.printf("\tMonth :%d",((((pl_block[index]&0xFFFFFFF0)>>4) & 0x03C00000)>>22));
ee12b079 210:f4acf895b598 142 gPC.printf("\tDay :%d",((((pl_block[index]&0xFFFFFFF0)>>4) & 0x003E0000)>>17));
ee12b079 210:f4acf895b598 143 gPC.printf("\n\rHours :%d",((((pl_block[index]&0xFFFFFFF0)>>4) & 0x0001F000)>>12));
ee12b079 210:f4acf895b598 144 gPC.printf("\tMin :%d",((((pl_block[index]&0xFFFFFFF0)>>4) & 0x00000FC0)>>6));
ee12b079 210:f4acf895b598 145 gPC.printf("\tSec :%d",(((pl_block[index]&0xFFFFFFF0)>>4) & 0x0000003F));
ee12b079 210:f4acf895b598 146 gPC.printf("\n\rSID :%d",(pl_block[index] & 0x0000000C)>>2);
ee12b079 210:f4acf895b598 147 gPC.printf("\tExecution Status :%d",pl_block[index] & UNEXECUTED);
ee12b079 210:f4acf895b598 148 }
ee12b079 210:f4acf895b598 149 void print_exit(uint8_t* temp)
ee12b079 210:f4acf895b598 150 {
ee12b079 210:f4acf895b598 151 uint8_t temp2[3];
ee12b079 210:f4acf895b598 152 temp2[0] = (pl_main_flag&STATE_SCIENCE)>>2;
ee12b079 210:f4acf895b598 153 temp2[1] = (pl_main_flag&PL_DISABLED)>>4;
ee12b079 210:f4acf895b598 154 temp2[2] = (PL_PREV_STATE & STATE_SCIENCE)>>2;
ee12b079 210:f4acf895b598 155 gPC.printf("\n\rAt exit");
ee12b079 210:f4acf895b598 156 char state[][17] = {"STATE_OFF","STATE_STANDBY","STATE_HIBERNATE","STATE_SCIENCE"};
ee12b079 210:f4acf895b598 157 char status[][17] = {"PL_OFF","PL_STANDBY","PL_HIBERNATE","PL_SCIENCE","PL_SUCCESS_I2C","PL_ERR_I2C","PL_INVALID_STATE","PL_DISABLED"};
ee12b079 210:f4acf895b598 158 gPC.printf("\n\rPL_state:%s -> %s",state[(uint8_t)temp[0]],state[(uint8_t)temp2[0]]);
ee12b079 210:f4acf895b598 159 gPC.printf("\n\rPL_status:%s -> %s",status[(uint8_t)temp[1]],status[(uint8_t)temp2[1]]);
ee12b079 210:f4acf895b598 160 gPC.printf("\n\rPL_PREV_state:%s -> %s",state[(uint8_t)temp[2]],state[(uint8_t)temp2[2]]);
ee12b079 210:f4acf895b598 161 }
ee12b079 210:f4acf895b598 162 void VERIFY_TM(Base_tm *tm_ptr)
ee12b079 210:f4acf895b598 163 {
ee12b079 210:f4acf895b598 164 uint8_t temp = tm_ptr->TM_string[2]; //Obatining ACK_CODE
ee12b079 210:f4acf895b598 165 if(GETshort_or_long_tm(tm_ptr)==1) //short TM
ee12b079 210:f4acf895b598 166 {
ee12b079 210:f4acf895b598 167 gPC.printf("\n\rSHORT TM received");
ee12b079 210:f4acf895b598 168 uint16_t crc16 = crc16_gen(tm_ptr->TM_string, 11);
ee12b079 210:f4acf895b598 169 if(tm_ptr->TM_string[12]==((uint8_t)(crc16 & 0x00FF)) && tm_ptr->TM_string[11]==((uint8_t)((crc16 & 0xFF00)>>8)))
ee12b079 210:f4acf895b598 170 {
ee12b079 210:f4acf895b598 171 if(temp!=0x00 && temp!=0x01 && temp!=0x02 && temp!=0x03 && temp!=0x84 && temp!=0x85)
ee12b079 210:f4acf895b598 172 {
ee12b079 210:f4acf895b598 173 gPC.printf("\n\rTime_Latest_PL Updated");
ee12b079 210:f4acf895b598 174 TIME_LATEST_PL = pl_time; //update latest time when I2C communication was successful
ee12b079 210:f4acf895b598 175 }
ee12b079 210:f4acf895b598 176 if(temp==0xA0 || temp==0xC0)
ee12b079 210:f4acf895b598 177 {
ee12b079 210:f4acf895b598 178 gPC.printf("\n\rACK_CODE Success");
ee12b079 210:f4acf895b598 179 if(temp==0xA0)
ee12b079 210:f4acf895b598 180 gPC.printf("\n\rACK_CODE = 0x%02X",temp);
ee12b079 210:f4acf895b598 181 else
ee12b079 210:f4acf895b598 182 gPC.printf("\n\rACK_CODE = 0x%02X",temp);
ee12b079 210:f4acf895b598 183 pl_main_flag = pl_main_flag & (~PL_DISABLED);
ee12b079 210:f4acf895b598 184 pl_main_flag |= PL_SUCCESS_I2C;
ee12b079 210:f4acf895b598 185 pl_block[pl_next_index-1] &= (~UNEXECUTED); //changing exec_status
ee12b079 210:f4acf895b598 186 pl_block[pl_next_index-1] |= EXECUTED;
ee12b079 210:f4acf895b598 187 }
ee12b079 210:f4acf895b598 188 else
ee12b079 210:f4acf895b598 189 {
ee12b079 210:f4acf895b598 190 gPC.printf("\n\rACK_CODE failure (0x%02X)",temp);
ee12b079 210:f4acf895b598 191 //gPC.printf("\n\rACK_CODE = 0x%02X",temp);
ee12b079 210:f4acf895b598 192 pl_main_flag = pl_main_flag & (~PL_DISABLED);
ee12b079 210:f4acf895b598 193 pl_main_flag |= PL_ERR_I2C;
ee12b079 210:f4acf895b598 194 pl_block[pl_next_index-1] &= (~UNEXECUTED); //changing exec_status
ee12b079 210:f4acf895b598 195 pl_block[pl_next_index-1] |= RETRY;
ee12b079 210:f4acf895b598 196 }
ee12b079 210:f4acf895b598 197 }
ee12b079 210:f4acf895b598 198 else
ee12b079 210:f4acf895b598 199 {
ee12b079 210:f4acf895b598 200 gPC.printf("\n\rShort_TM CRC failed");
ee12b079 210:f4acf895b598 201 pl_main_flag = pl_main_flag & (~PL_DISABLED);
ee12b079 210:f4acf895b598 202 pl_main_flag |= PL_ERR_I2C;
ee12b079 210:f4acf895b598 203 pl_block[pl_next_index-1] &= (~UNEXECUTED); //changing exec_status
ee12b079 210:f4acf895b598 204 pl_block[pl_next_index-1] |= RETRY;
ee12b079 210:f4acf895b598 205 }
ee12b079 210:f4acf895b598 206 }
ee12b079 210:f4acf895b598 207 else if(GETshort_or_long_tm(tm_ptr)==0) //LONG TM
ee12b079 210:f4acf895b598 208 {
ee12b079 210:f4acf895b598 209 gPC.printf("\n\rLONG TM received");
ee12b079 210:f4acf895b598 210 uint16_t crc16 = crc16_gen(tm_ptr->TM_string,132);
ee12b079 210:f4acf895b598 211 if(tm_ptr->TM_string[133]==((uint8_t)(crc16 & 0x00FF)) && tm_ptr->TM_string[132]==((uint8_t)((crc16 & 0xFF00)>>8)))
ee12b079 210:f4acf895b598 212 {
ee12b079 210:f4acf895b598 213 if(temp!=0x00 && temp!=0x01 && temp!=0x02 && temp!=0x03 && temp!=0x84 && temp!=0x85)
ee12b079 210:f4acf895b598 214 {
ee12b079 210:f4acf895b598 215 gPC.printf("\n\rTime_Latest_PL Updated");
ee12b079 210:f4acf895b598 216 TIME_LATEST_PL = pl_time; //update latest time when I2C communication was successful
ee12b079 210:f4acf895b598 217 }
ee12b079 210:f4acf895b598 218 if(temp==0xA0 || temp==0xC0)
ee12b079 210:f4acf895b598 219 {
ee12b079 210:f4acf895b598 220 gPC.printf("\n\rACK_CODE Success");
ee12b079 210:f4acf895b598 221 if(temp==0xA0)
ee12b079 210:f4acf895b598 222 gPC.printf("\n\rACK_CODE = 0x%02X",temp);
ee12b079 210:f4acf895b598 223 else
ee12b079 210:f4acf895b598 224 gPC.printf("\n\rACK_CODE = 0x%02X",temp);
ee12b079 210:f4acf895b598 225 pl_main_flag = pl_main_flag & (~PL_DISABLED);
ee12b079 210:f4acf895b598 226 pl_main_flag |= PL_SUCCESS_I2C;
ee12b079 210:f4acf895b598 227 pl_block[pl_next_index-1] &= (~UNEXECUTED); //changing exec_status
ee12b079 210:f4acf895b598 228 pl_block[pl_next_index-1] |= EXECUTED;
ee12b079 210:f4acf895b598 229 }
ee12b079 210:f4acf895b598 230 else
ee12b079 210:f4acf895b598 231 {
ee12b079 210:f4acf895b598 232 gPC.printf("\n\rACK_CODE failure (0x%02X)",temp);
ee12b079 210:f4acf895b598 233 pl_main_flag = pl_main_flag & (~PL_DISABLED);
ee12b079 210:f4acf895b598 234 pl_main_flag |= PL_ERR_I2C;
ee12b079 210:f4acf895b598 235 pl_block[pl_next_index-1] &= (~UNEXECUTED); //changing exec_status
ee12b079 210:f4acf895b598 236 pl_block[pl_next_index-1] |= RETRY;
ee12b079 210:f4acf895b598 237 }
ee12b079 210:f4acf895b598 238 }
ee12b079 210:f4acf895b598 239 else
ee12b079 210:f4acf895b598 240 {
ee12b079 210:f4acf895b598 241 gPC.printf("\n\rLong_TM CRC failed");
ee12b079 210:f4acf895b598 242 pl_main_flag = pl_main_flag & (~PL_DISABLED);
ee12b079 210:f4acf895b598 243 pl_main_flag |= PL_ERR_I2C;
ee12b079 210:f4acf895b598 244 pl_block[pl_next_index-1] &= (~UNEXECUTED); //changing exec_status
ee12b079 210:f4acf895b598 245 pl_block[pl_next_index-1] |= RETRY;
ee12b079 210:f4acf895b598 246 }
ee12b079 210:f4acf895b598 247 }
ee12b079 210:f4acf895b598 248 }
ee12b079 210:f4acf895b598 249 void test1(uint8_t t)
ee12b079 210:f4acf895b598 250 {
ee12b079 210:f4acf895b598 251 //Output should be PL_STATUS = PL_DISABLED
ee12b079 210:f4acf895b598 252 if(t!=0)
ee12b079 210:f4acf895b598 253 {
ee12b079 210:f4acf895b598 254 gPC.printf("\n\rTesting OC protection");
ee12b079 210:f4acf895b598 255 PL_BEE_SW_STATUS = 2; //OC protection
ee12b079 210:f4acf895b598 256 }
ee12b079 210:f4acf895b598 257 }
ee12b079 210:f4acf895b598 258 void test2(uint8_t t)
ee12b079 210:f4acf895b598 259 {
ee12b079 210:f4acf895b598 260 //output should be same as test1()
ee12b079 210:f4acf895b598 261 if(t!=0)
ee12b079 210:f4acf895b598 262 {
ee12b079 210:f4acf895b598 263 gPC.printf("\n\rTesting Deviced Disabled case");
ee12b079 210:f4acf895b598 264 PL_BEE_SW_STATUS = 3; //Device DISABLED
ee12b079 210:f4acf895b598 265 }
ee12b079 210:f4acf895b598 266 }
ee12b079 210:f4acf895b598 267 void test3(uint8_t t)
ee12b079 210:f4acf895b598 268 {
ee12b079 210:f4acf895b598 269 if(t!=0)
ee12b079 210:f4acf895b598 270 {
ee12b079 210:f4acf895b598 271 gPC.printf("\n\rTesting RTC failed case");
ee12b079 210:f4acf895b598 272 pl_time = 0; //RTC failed
ee12b079 210:f4acf895b598 273 }
ee12b079 210:f4acf895b598 274 }
ee12b079 210:f4acf895b598 275 /*void test4(uint8_t t)
ee12b079 210:f4acf895b598 276 {
ee12b079 210:f4acf895b598 277 if(t!=0)
ee12b079 210:f4acf895b598 278 {
ee12b079 210:f4acf895b598 279 gPC.printf("\n\rTesting No future blocks available");
ee12b079 210:f4acf895b598 280 schedule1[0] = {0,0,0,0,0,0,0,0};
ee12b079 210:f4acf895b598 281 }
ee12b079 210:f4acf895b598 282 }*/
ee12b079 210:f4acf895b598 283 void FCTN_CDMS_PL_MAIN(void const *args)
ee12b079 210:f4acf895b598 284 {
ee12b079 210:f4acf895b598 285 uint8_t temp[3];
ee12b079 210:f4acf895b598 286 pl_main_flag|=PL_MAIN_STATUS; //Setting PL_MAIN_STATUS
ee12b079 210:f4acf895b598 287 PL_MAIN_COUNTER++;
ee12b079 210:f4acf895b598 288 pl_main_flag&=~(PL_LOW_POWER); //Clearing PL_LOW_POWER
ee12b079 210:f4acf895b598 289 temp[0] = (pl_main_flag&STATE_SCIENCE)>>2;
ee12b079 210:f4acf895b598 290 temp[1] = (pl_main_flag&PL_DISABLED)>>4;
ee12b079 210:f4acf895b598 291 temp[2] = (PL_PREV_STATE & STATE_SCIENCE)>>2;
ee12b079 210:f4acf895b598 292 //test2(1);
ee12b079 210:f4acf895b598 293
ee12b079 210:f4acf895b598 294 if(PL_BEE_SW_STATUS==2 || PL_BEE_SW_STATUS==3)
ee12b079 210:f4acf895b598 295 {
ee12b079 210:f4acf895b598 296 gPC.printf("\n\rDevice Disabled or OC Fault");
ee12b079 210:f4acf895b598 297 pl_main_flag = pl_main_flag & (~PL_DISABLED);
ee12b079 210:f4acf895b598 298 pl_main_flag |= PL_DISABLED; //setting PL_STATUS as PL_DISABLED
ee12b079 210:f4acf895b598 299 pl_main_flag = pl_main_flag & (~PL_MAIN_STATUS); //Clearing pl_main status
ee12b079 210:f4acf895b598 300 print_exit(temp);
ee12b079 210:f4acf895b598 301 return;
ee12b079 210:f4acf895b598 302 }
ee12b079 210:f4acf895b598 303 PL_PREV_STATE = (pl_main_flag & STATE_SCIENCE); //saving current pl_state
ee12b079 210:f4acf895b598 304 uint64_t temp_time;
ee12b079 210:f4acf895b598 305 temp_time=FCTN_CDMS_RD_RTC();
ee12b079 210:f4acf895b598 306 pl_time = (uint32_t)((temp_time>>7) & 0x000000000FFFFFFF);
ee12b079 210:f4acf895b598 307
ee12b079 210:f4acf895b598 308 //call test3() here
ee12b079 210:f4acf895b598 309 //test3(1);
ee12b079 210:f4acf895b598 310
ee12b079 210:f4acf895b598 311 //gPC.printf("\n\rprev_state :%d",(PL_PREV_STATE)>>4);
ee12b079 210:f4acf895b598 312 gPC.printf("\n\n\rtTime_RTC:");
ee12b079 210:f4acf895b598 313 gPC.printf("\n\rYear :%d\t",((pl_time & 0x0C000000)>>26)+2016);
ee12b079 210:f4acf895b598 314 gPC.printf("Month :%d\t",((pl_time & 0x03C00000)>>22));
ee12b079 210:f4acf895b598 315 gPC.printf("Day :%d",((pl_time & 0x003E0000)>>17));
ee12b079 210:f4acf895b598 316 gPC.printf("\n\rHours :%d",((pl_time & 0x0001F000)>>12));
ee12b079 210:f4acf895b598 317 gPC.printf("\tMin :%d",((pl_time & 0x00000FC0)>>6));
ee12b079 210:f4acf895b598 318 gPC.printf("\t\tSec :%d",(pl_time & 0x0000003F));
ee12b079 210:f4acf895b598 319 if(pl_time!=0) //RTC read successful
ee12b079 210:f4acf895b598 320 {
ee12b079 210:f4acf895b598 321 // run the loop until end of schedule is reached or month and day are both zeros or future block is found
ee12b079 210:f4acf895b598 322 gPC.printf("\n\rRTC read success");
ee12b079 210:f4acf895b598 323 for(i=0;(i<192)&&(((uint16_t)((pl_block[i] & 0x3FE00000)>>21))!=0);i++)
ee12b079 210:f4acf895b598 324 {
ee12b079 210:f4acf895b598 325 if(((pl_block[i]>>4) & 0x0FFFFFFF)>pl_time) //Checking for future blocks
ee12b079 210:f4acf895b598 326 {
ee12b079 210:f4acf895b598 327 pl_next_index=i;
ee12b079 210:f4acf895b598 328 gPC.printf("\n\rFuture block found at index = %d",pl_next_index);
ee12b079 210:f4acf895b598 329 break;
ee12b079 210:f4acf895b598 330 }
ee12b079 210:f4acf895b598 331 }
ee12b079 210:f4acf895b598 332 }
ee12b079 210:f4acf895b598 333 if((pl_next_index==-1) || pl_time==0) //RTC read failed or Future block not found
ee12b079 210:f4acf895b598 334 {
ee12b079 210:f4acf895b598 335 if(PL_PREV_STATE==STATE_SCIENCE)
ee12b079 210:f4acf895b598 336 {
ee12b079 210:f4acf895b598 337 pl_main_flag = pl_main_flag & (~STATE_SCIENCE);
ee12b079 210:f4acf895b598 338 pl_main_flag |= STATE_HIBERNATE;
ee12b079 210:f4acf895b598 339 }
ee12b079 210:f4acf895b598 340 else
ee12b079 210:f4acf895b598 341 {
ee12b079 210:f4acf895b598 342 pl_main_flag = pl_main_flag & (~STATE_SCIENCE);
ee12b079 210:f4acf895b598 343 pl_main_flag |= PL_PREV_STATE;
ee12b079 210:f4acf895b598 344 }
ee12b079 210:f4acf895b598 345 if(pl_time==0)
ee12b079 210:f4acf895b598 346 {
ee12b079 210:f4acf895b598 347 gPC.printf("\n\rRTC read failed");
ee12b079 210:f4acf895b598 348 }
ee12b079 210:f4acf895b598 349 if(pl_next_index==-1)
ee12b079 210:f4acf895b598 350 {
ee12b079 210:f4acf895b598 351 gPC.printf("\n\rFuture block not found");
ee12b079 210:f4acf895b598 352 gPC.printf("\n\rpl_next_index = %d",pl_next_index);
ee12b079 210:f4acf895b598 353 }
ee12b079 210:f4acf895b598 354 gPC.printf("\n\rNew pl_state = %d",(pl_main_flag&(~STATE_SCIENCE))>>2);
ee12b079 210:f4acf895b598 355 }
ee12b079 210:f4acf895b598 356
ee12b079 210:f4acf895b598 357 //Processing the PL schedule
ee12b079 210:f4acf895b598 358 if(((pl_block[pl_next_index-1] & UNEXECUTED)==3)||((pl_block[pl_next_index-1] & UNEXECUTED)==2))
ee12b079 210:f4acf895b598 359 {
ee12b079 210:f4acf895b598 360 if(((pl_block[pl_next_index-1] & UNEXECUTED)==3))
ee12b079 210:f4acf895b598 361 gPC.printf("\n\rElapsed blocked not executed");
ee12b079 210:f4acf895b598 362 else
ee12b079 210:f4acf895b598 363 gPC.printf("\n\rElapsed block marked for retry");
ee12b079 210:f4acf895b598 364
ee12b079 210:f4acf895b598 365 gPC.printf("\n\r Retrieving pl_state from schedule");
ee12b079 210:f4acf895b598 366 if((pl_block[pl_next_index-1] & 0x0000000C)==0)
ee12b079 210:f4acf895b598 367 {
ee12b079 210:f4acf895b598 368 pl_main_flag = pl_main_flag & (~STATE_SCIENCE);
ee12b079 210:f4acf895b598 369 pl_main_flag |= STATE_OFF;
ee12b079 210:f4acf895b598 370 }
ee12b079 210:f4acf895b598 371 if((pl_block[pl_next_index-1] & 0x0000000C)==4)
ee12b079 210:f4acf895b598 372 {
ee12b079 210:f4acf895b598 373 pl_main_flag = pl_main_flag & (~STATE_SCIENCE);
ee12b079 210:f4acf895b598 374 pl_main_flag |= STATE_STANDBY;
ee12b079 210:f4acf895b598 375 }
ee12b079 210:f4acf895b598 376 if((pl_block[pl_next_index-1] & 0x0000000C)==8)
ee12b079 210:f4acf895b598 377 {
ee12b079 210:f4acf895b598 378 pl_main_flag = pl_main_flag & (~STATE_SCIENCE);
ee12b079 210:f4acf895b598 379 pl_main_flag |= STATE_HIBERNATE;
ee12b079 210:f4acf895b598 380 }
ee12b079 210:f4acf895b598 381 if((pl_block[pl_next_index-1] & 0x0000000C)==12)
ee12b079 210:f4acf895b598 382 {
ee12b079 210:f4acf895b598 383 pl_main_flag = pl_main_flag & (~STATE_SCIENCE);
ee12b079 210:f4acf895b598 384 pl_main_flag |= STATE_SCIENCE;
ee12b079 210:f4acf895b598 385 }
ee12b079 210:f4acf895b598 386 }
ee12b079 210:f4acf895b598 387 else if((pl_block[pl_next_index-1] & UNEXECUTED)==1)
ee12b079 210:f4acf895b598 388 {
ee12b079 210:f4acf895b598 389 gPC.printf("\n\rElapsed block is executed");
ee12b079 210:f4acf895b598 390 pl_main_flag = pl_main_flag & (~PL_MAIN_STATUS); //Clearing pl_main status
ee12b079 210:f4acf895b598 391 print_exit(temp);
ee12b079 210:f4acf895b598 392 return;
ee12b079 210:f4acf895b598 393 }
ee12b079 210:f4acf895b598 394 else if((pl_block[pl_next_index-1] & UNEXECUTED)==0)
ee12b079 210:f4acf895b598 395 {
ee12b079 210:f4acf895b598 396 gPC.printf("\n\rEmpty Schedule Block");
ee12b079 210:f4acf895b598 397 pl_main_flag = pl_main_flag & (~PL_MAIN_STATUS); //Clearing pl_main status
ee12b079 210:f4acf895b598 398 print_exit(temp);
ee12b079 210:f4acf895b598 399 return;
ee12b079 210:f4acf895b598 400 }
ee12b079 210:f4acf895b598 401 switch(pl_main_flag & STATE_SCIENCE) //Checking PL_STATE
ee12b079 210:f4acf895b598 402 {
ee12b079 210:f4acf895b598 403 case STATE_OFF:
ee12b079 210:f4acf895b598 404 {
ee12b079 210:f4acf895b598 405 gPC.printf("\n\rEntered PL_OFF case");
ee12b079 210:f4acf895b598 406 if(PL_BEE_SW_STATUS!=0)
ee12b079 210:f4acf895b598 407 {
ee12b079 210:f4acf895b598 408 gPC.printf("\n\rCommanding PL_BEE to go to Standby State");
ee12b079 210:f4acf895b598 409 Base_tm *tm_ptr_standby;
ee12b079 210:f4acf895b598 410 SET_PL_BEE_STANDBY(tm_ptr_standby); //No ack needed now
ee12b079 210:f4acf895b598 411 gPC.printf("\n\rPowering OFF PL_BEE");
ee12b079 210:f4acf895b598 412 SET_PL_BEE_OFF;
ee12b079 210:f4acf895b598 413 PL_BEE_SW_STATUS=0;
ee12b079 210:f4acf895b598 414 }
ee12b079 210:f4acf895b598 415 pl_main_flag = pl_main_flag & (~PL_DISABLED);
ee12b079 210:f4acf895b598 416 pl_main_flag |= PL_OFF;
ee12b079 210:f4acf895b598 417 pl_block[pl_next_index-1] &= (~UNEXECUTED); //changing exec_status
ee12b079 210:f4acf895b598 418 pl_block[pl_next_index-1] |= EXECUTED;
ee12b079 210:f4acf895b598 419 pl_main_flag = pl_main_flag & (~PL_MAIN_STATUS); //Clearing PL_MAIN_STATUS
ee12b079 210:f4acf895b598 420 print_processed_block(pl_next_index-1);
ee12b079 210:f4acf895b598 421 print_exit(temp);
ee12b079 210:f4acf895b598 422 return;
ee12b079 210:f4acf895b598 423 }
ee12b079 210:f4acf895b598 424 case STATE_STANDBY:
ee12b079 210:f4acf895b598 425 {
ee12b079 210:f4acf895b598 426 gPC.printf("\n\rEntered PL_STANDBY case");
ee12b079 210:f4acf895b598 427 if(PL_BEE_SW_STATUS==0)
ee12b079 210:f4acf895b598 428 {
ee12b079 210:f4acf895b598 429 gPC.printf("\n\rPowering on PL_BEE");
ee12b079 210:f4acf895b598 430 SET_PL_BEE_ON;
ee12b079 210:f4acf895b598 431 PL_BEE_SW_STATUS=1;
ee12b079 210:f4acf895b598 432 }
ee12b079 210:f4acf895b598 433 gPC.printf("\n\rCommanding PL_BEE to go to Standby State");
ee12b079 210:f4acf895b598 434 Base_tm *tm_ptr_standby;
ee12b079 210:f4acf895b598 435 SET_PL_BEE_STANDBY(tm_ptr_standby);
ee12b079 210:f4acf895b598 436 if((pl_main_flag & PL_DISABLED)==PL_SUCCESS_I2C)
ee12b079 210:f4acf895b598 437 {
ee12b079 210:f4acf895b598 438 pl_main_flag = pl_main_flag & (~PL_DISABLED);
ee12b079 210:f4acf895b598 439 pl_main_flag |= PL_STANDBY;
ee12b079 210:f4acf895b598 440 }
ee12b079 210:f4acf895b598 441 pl_main_flag = pl_main_flag & (~PL_MAIN_STATUS); //Clearing PL_MAIN_STATUS
ee12b079 210:f4acf895b598 442 print_processed_block(pl_next_index-1);
ee12b079 210:f4acf895b598 443 print_exit(temp);
ee12b079 210:f4acf895b598 444 return;
ee12b079 210:f4acf895b598 445 //////DELETE THE TM AND TC LATER
ee12b079 210:f4acf895b598 446 }
ee12b079 210:f4acf895b598 447 case STATE_HIBERNATE:
ee12b079 210:f4acf895b598 448 {
ee12b079 210:f4acf895b598 449 gPC.printf("\n\rEntered PL_HIBERNATE case");
ee12b079 210:f4acf895b598 450 if(POWER_LEVEL==2 || POWER_LEVEL==3 || POWER_LEVEL==0)
ee12b079 210:f4acf895b598 451 {
ee12b079 210:f4acf895b598 452 if(PL_BEE_SW_STATUS==0)
ee12b079 210:f4acf895b598 453 {
ee12b079 210:f4acf895b598 454 gPC.printf("Powering on PL_BEE\r\n");
ee12b079 210:f4acf895b598 455 SET_PL_BEE_ON;
ee12b079 210:f4acf895b598 456 PL_BEE_SW_STATUS=1;
ee12b079 210:f4acf895b598 457 }
ee12b079 210:f4acf895b598 458 gPC.printf("\n\rCommanding PL_BEE to go to Hibernate State");
ee12b079 210:f4acf895b598 459 Base_tm *tm_ptr_hibernate;
ee12b079 210:f4acf895b598 460 SET_PL_BEE_HIBERNATE(tm_ptr_hibernate);
ee12b079 210:f4acf895b598 461 if((pl_main_flag & PL_DISABLED)==PL_SUCCESS_I2C)
ee12b079 210:f4acf895b598 462 {
ee12b079 210:f4acf895b598 463 pl_main_flag = pl_main_flag & (~PL_DISABLED);
ee12b079 210:f4acf895b598 464 pl_main_flag |= PL_HIBERNATE;
ee12b079 210:f4acf895b598 465 }
ee12b079 210:f4acf895b598 466 }
ee12b079 210:f4acf895b598 467 else
ee12b079 210:f4acf895b598 468 {
ee12b079 210:f4acf895b598 469 pl_main_flag |= PL_LOW_POWER;
ee12b079 210:f4acf895b598 470 if(PL_BEE_SW_STATUS==0)
ee12b079 210:f4acf895b598 471 {
ee12b079 210:f4acf895b598 472 gPC.printf("\n\rPowering on PL_BEE");
ee12b079 210:f4acf895b598 473 SET_PL_BEE_ON;
ee12b079 210:f4acf895b598 474 PL_BEE_SW_STATUS=1;
ee12b079 210:f4acf895b598 475 }
ee12b079 210:f4acf895b598 476 gPC.printf("\n\rCommanding PL_BEE to go to Standby State");
ee12b079 210:f4acf895b598 477 Base_tm *tm_ptr_standby;
ee12b079 210:f4acf895b598 478 SET_PL_BEE_STANDBY(tm_ptr_standby);
ee12b079 210:f4acf895b598 479 if((pl_main_flag & PL_DISABLED)==PL_SUCCESS_I2C)
ee12b079 210:f4acf895b598 480 {
ee12b079 210:f4acf895b598 481 pl_main_flag = pl_main_flag & (~PL_DISABLED);
ee12b079 210:f4acf895b598 482 pl_main_flag |= PL_STANDBY;
ee12b079 210:f4acf895b598 483 }
ee12b079 210:f4acf895b598 484 pl_main_flag = pl_main_flag & (~PL_MAIN_STATUS); //Clearing PL_MAIN_STATUS
ee12b079 210:f4acf895b598 485 print_processed_block(pl_next_index-1);
ee12b079 210:f4acf895b598 486 print_exit(temp);
ee12b079 210:f4acf895b598 487 return;
ee12b079 210:f4acf895b598 488 //////DELETE THE TM AND TC LATER
ee12b079 210:f4acf895b598 489 }
ee12b079 210:f4acf895b598 490 pl_main_flag = pl_main_flag & (~PL_MAIN_STATUS); //Clearing PL_MAIN_STATUS
ee12b079 210:f4acf895b598 491 print_processed_block(pl_next_index-1);
ee12b079 210:f4acf895b598 492 print_exit(temp);
ee12b079 210:f4acf895b598 493 return;
ee12b079 210:f4acf895b598 494 //////DELETE THE TM LATER
ee12b079 210:f4acf895b598 495 }
ee12b079 210:f4acf895b598 496 case STATE_SCIENCE:
ee12b079 210:f4acf895b598 497 {
ee12b079 210:f4acf895b598 498 gPC.printf("\n\rEntered PL_SCIENCE case");
ee12b079 210:f4acf895b598 499 if(POWER_LEVEL==3 || POWER_LEVEL==0) //POWER_LEVEL = 0 = NA
ee12b079 210:f4acf895b598 500 {
ee12b079 210:f4acf895b598 501 gPC.printf("\n\rPOWER_LEVEL = 3 or NA");
ee12b079 210:f4acf895b598 502 if(PL_BEE_SW_STATUS==0)
ee12b079 210:f4acf895b598 503 {
ee12b079 210:f4acf895b598 504 gPC.printf("\n\rPowering on PL_BEE");
ee12b079 210:f4acf895b598 505 SET_PL_BEE_ON;
ee12b079 210:f4acf895b598 506 PL_BEE_SW_STATUS=1;
ee12b079 210:f4acf895b598 507 }
ee12b079 210:f4acf895b598 508 gPC.printf("\n\rCommanding PL_BEE to go to Science State");
ee12b079 210:f4acf895b598 509 Base_tm *tm_ptr_science;
ee12b079 210:f4acf895b598 510 SET_PL_BEE_SCIENCE(tm_ptr_science);
ee12b079 210:f4acf895b598 511 if((pl_main_flag & PL_DISABLED)==PL_SUCCESS_I2C)
ee12b079 210:f4acf895b598 512 {
ee12b079 210:f4acf895b598 513 pl_main_flag = pl_main_flag & (~PL_DISABLED);
ee12b079 210:f4acf895b598 514 pl_main_flag |= PL_SCIENCE;
ee12b079 210:f4acf895b598 515 }
ee12b079 210:f4acf895b598 516 pl_main_flag = pl_main_flag & (~PL_MAIN_STATUS); //Clearing PL_MAIN_STATUS
ee12b079 210:f4acf895b598 517 print_processed_block(pl_next_index-1);
ee12b079 210:f4acf895b598 518 print_exit(temp);
ee12b079 210:f4acf895b598 519 return;
ee12b079 210:f4acf895b598 520 }
ee12b079 210:f4acf895b598 521 else
ee12b079 210:f4acf895b598 522 {
ee12b079 210:f4acf895b598 523 gPC.printf("\n\rPower level = 2,3 or NA");
ee12b079 210:f4acf895b598 524 pl_main_flag |= PL_LOW_POWER;
ee12b079 210:f4acf895b598 525 if(POWER_LEVEL==2 || POWER_LEVEL==3 || POWER_LEVEL==0)
ee12b079 210:f4acf895b598 526 {
ee12b079 210:f4acf895b598 527 if(PL_BEE_SW_STATUS==0)
ee12b079 210:f4acf895b598 528 {
ee12b079 210:f4acf895b598 529 gPC.printf("\n\rPowering on PL_BEE");
ee12b079 210:f4acf895b598 530 SET_PL_BEE_ON;
ee12b079 210:f4acf895b598 531 PL_BEE_SW_STATUS=1;
ee12b079 210:f4acf895b598 532 }
ee12b079 210:f4acf895b598 533 gPC.printf("\n\rCommanding PL_BEE to go to Hibernate State");
ee12b079 210:f4acf895b598 534 Base_tm *tm_ptr_hibernate;
ee12b079 210:f4acf895b598 535 SET_PL_BEE_HIBERNATE(tm_ptr_hibernate);
ee12b079 210:f4acf895b598 536 if((pl_main_flag & PL_DISABLED)==PL_SUCCESS_I2C)
ee12b079 210:f4acf895b598 537 {
ee12b079 210:f4acf895b598 538 pl_main_flag = pl_main_flag & (~PL_DISABLED);
ee12b079 210:f4acf895b598 539 pl_main_flag |= PL_HIBERNATE;
ee12b079 210:f4acf895b598 540 }
ee12b079 210:f4acf895b598 541 }
ee12b079 210:f4acf895b598 542 else
ee12b079 210:f4acf895b598 543 {
ee12b079 210:f4acf895b598 544 pl_main_flag |= PL_LOW_POWER;
ee12b079 210:f4acf895b598 545 if(PL_BEE_SW_STATUS==0)
ee12b079 210:f4acf895b598 546 {
ee12b079 210:f4acf895b598 547 gPC.printf("\n\rPowering on PL_BEE");
ee12b079 210:f4acf895b598 548 SET_PL_BEE_ON;
ee12b079 210:f4acf895b598 549 PL_BEE_SW_STATUS=1;
ee12b079 210:f4acf895b598 550 }
ee12b079 210:f4acf895b598 551 gPC.printf("\n\rCommanding PL_BEE to go to Standby State");
ee12b079 210:f4acf895b598 552 Base_tm *tm_ptr_standby;
ee12b079 210:f4acf895b598 553 SET_PL_BEE_STANDBY(tm_ptr_standby);
ee12b079 210:f4acf895b598 554 if((pl_main_flag & PL_DISABLED)==PL_SUCCESS_I2C)
ee12b079 210:f4acf895b598 555 {
ee12b079 210:f4acf895b598 556 pl_main_flag = pl_main_flag & (~PL_DISABLED);
ee12b079 210:f4acf895b598 557 pl_main_flag |= PL_STANDBY;
ee12b079 210:f4acf895b598 558 }
ee12b079 210:f4acf895b598 559 pl_main_flag = pl_main_flag & (~PL_MAIN_STATUS); //Clearing PL_MAIN_STATUS
ee12b079 210:f4acf895b598 560 print_processed_block(pl_next_index-1);
ee12b079 210:f4acf895b598 561 print_exit(temp);
ee12b079 210:f4acf895b598 562 return;
ee12b079 210:f4acf895b598 563 //////DELETE THE TM AND TC LATER
ee12b079 210:f4acf895b598 564 }
ee12b079 210:f4acf895b598 565 pl_main_flag = pl_main_flag & (~PL_MAIN_STATUS); //Clearing PL_MAIN_STATUS
ee12b079 210:f4acf895b598 566 print_processed_block(pl_next_index-1);
ee12b079 210:f4acf895b598 567 print_exit(temp);
ee12b079 210:f4acf895b598 568 return;
ee12b079 210:f4acf895b598 569 //////DELETE THE TM LATER
ee12b079 210:f4acf895b598 570 }
ee12b079 210:f4acf895b598 571 }
ee12b079 210:f4acf895b598 572 default:
ee12b079 210:f4acf895b598 573 {
ee12b079 210:f4acf895b598 574 gPC.printf("\n\rInvalid PL_STATE in block at index = %d",pl_next_index-1);
ee12b079 210:f4acf895b598 575 pl_main_flag = pl_main_flag & (~PL_DISABLED);
ee12b079 210:f4acf895b598 576 pl_main_flag |= PL_INVALID_STATE;
ee12b079 210:f4acf895b598 577 pl_block[pl_next_index-1] &= (~UNEXECUTED); //changing exec_status
ee12b079 210:f4acf895b598 578 pl_block[pl_next_index-1] |= EXECUTED;
ee12b079 210:f4acf895b598 579 pl_main_flag = pl_main_flag & (~PL_MAIN_STATUS); //Clearing PL_MAIN_STATUS
ee12b079 210:f4acf895b598 580 print_processed_block(pl_next_index-1);
ee12b079 210:f4acf895b598 581 print_exit(temp);
ee12b079 210:f4acf895b598 582 return;
ee12b079 210:f4acf895b598 583 }
ee12b079 210:f4acf895b598 584 }
ee12b079 210:f4acf895b598 585 }