DMA issue to be tested

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Committer:
shreeshas95
Date:
Thu Dec 31 06:43:13 2015 +0000
Revision:
6:79d422d1ed42
Parent:
5:ab276a17ca07
Child:
12:ffdb29353058
After testing on 30 Dec 2015

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shreeshas95 0:f016e9e8d48b 1 // UART ISR
shreeshas95 0:f016e9e8d48b 2 void rx_read(){
shreeshas95 2:2caf2a9a13aa 3 gRX_CURRENT_DATA_NODE->values[gRX_COUNT] = RX1M.getc();
shreeshas95 2:2caf2a9a13aa 4 gFLAGS = gFLAGS | UART_INT_FLAG;
shreeshas95 0:f016e9e8d48b 5 gCOM_MNG_TMTC_THREAD->signal_set(COM_MNG_TMTC_SIGNAL_UART_INT);
shreeshas95 0:f016e9e8d48b 6 }
shreeshas95 0:f016e9e8d48b 7
shreeshas95 0:f016e9e8d48b 8 // RX_TIMEOUT ISR
shreeshas95 0:f016e9e8d48b 9 void after_receive(){
shreeshas95 0:f016e9e8d48b 10 gRX_TIMEOUT.detach();
shreeshas95 2:2caf2a9a13aa 11 gFLAGS = gFLAGS | NEW_TC_RECEIVED;
shreeshas95 0:f016e9e8d48b 12 gCOM_MNG_TMTC_THREAD->signal_set(COM_MNG_TMTC_SIGNAL_UART_INT);
shreeshas95 0:f016e9e8d48b 13 }
shreeshas95 0:f016e9e8d48b 14
shreeshas95 0:f016e9e8d48b 15 // SESSION_TIMOUT ISR
shreeshas95 0:f016e9e8d48b 16 void after_session(){
shreeshas95 0:f016e9e8d48b 17 gSESSION_TIMEOUT.detach();
shreeshas95 6:79d422d1ed42 18 gFLAGS = gFLAGS | COM_SESSION_TIMEOUT_FLAG;
shreeshas95 6:79d422d1ed42 19 if( gMASTER_STATE != TCL_STATE_EXECUTING ){
shreeshas95 6:79d422d1ed42 20 gCOM_MNG_TMTC_THREAD->signal_set(COM_MNG_TMTC_SIGNAL_UART_INT);
shreeshas95 6:79d422d1ed42 21 }
shreeshas95 0:f016e9e8d48b 22 }
shreeshas95 0:f016e9e8d48b 23
shreeshas95 0:f016e9e8d48b 24 #define reset_all {\
shreeshas95 0:f016e9e8d48b 25 Base_tc *tcp = gHEAD_NODE_TCL;\
shreeshas95 5:ab276a17ca07 26 gPC.puts("inside reset\r\n");\
shreeshas95 5:ab276a17ca07 27 gFLAGS = 0x0000;\
shreeshas95 0:f016e9e8d48b 28 while(tcp != NULL){\
shreeshas95 0:f016e9e8d48b 29 Base_tc *temp = tcp->next_TC;\
shreeshas95 0:f016e9e8d48b 30 delete tcp;\
shreeshas95 0:f016e9e8d48b 31 tcp = temp;\
shreeshas95 0:f016e9e8d48b 32 }\
shreeshas95 5:ab276a17ca07 33 gHEAD_NODE_TCL = NULL;\
shreeshas95 5:ab276a17ca07 34 gLAST_NODE_TCL = NULL;\
shreeshas95 5:ab276a17ca07 35 gMASTER_STATE = TCL_STATE_INCOMPLETE;\
shreeshas95 0:f016e9e8d48b 36 gTOTAL_INCORRECT_SIZE_TC = 0;\
shreeshas95 0:f016e9e8d48b 37 gTOTAL_CRC_FAIL_TC = 0;\
shreeshas95 2:2caf2a9a13aa 38 gTOTAL_REPEATED_TC = 0;\
shreeshas95 5:ab276a17ca07 39 gTOTAL_VALID_TC = 0;\
shreeshas95 5:ab276a17ca07 40 for(int i = 0 ; i < TM_LONG_SIZE ; ++i){\
shreeshas95 5:ab276a17ca07 41 gLAST_TM[i] = 0x00;\
shreeshas95 5:ab276a17ca07 42 }\
shreeshas95 5:ab276a17ca07 43 gLAST_TM_SHORT_OR_LONG = SHORT_TM_CODE;\
shreeshas95 0:f016e9e8d48b 44 COM_RX_DATA_NODE *dataptr = gRX_HEAD_DATA_NODE;\
shreeshas95 0:f016e9e8d48b 45 while( dataptr != NULL ){\
shreeshas95 0:f016e9e8d48b 46 COM_RX_DATA_NODE *temp = dataptr->next_node;\
shreeshas95 0:f016e9e8d48b 47 delete dataptr;\
shreeshas95 0:f016e9e8d48b 48 dataptr = temp;\
shreeshas95 0:f016e9e8d48b 49 }\
shreeshas95 0:f016e9e8d48b 50 gRX_HEAD_DATA_NODE = new COM_RX_DATA_NODE;\
shreeshas95 0:f016e9e8d48b 51 gRX_HEAD_DATA_NODE->next_node = NULL;\
shreeshas95 0:f016e9e8d48b 52 gRX_CURRENT_DATA_NODE = gRX_HEAD_DATA_NODE;\
shreeshas95 0:f016e9e8d48b 53 gRX_COUNT = 0;\
shreeshas95 2:2caf2a9a13aa 54 /*PENDING : ALL GLOBAL VAARIABLES AND FLAGS*/\
shreeshas95 5:ab276a17ca07 55 gPC.puts("finished reset all\r\n");\
shreeshas95 2:2caf2a9a13aa 56 }
shreeshas95 2:2caf2a9a13aa 57
shreeshas95 2:2caf2a9a13aa 58 #define PUT_RAW_BYTE {\
shreeshas95 2:2caf2a9a13aa 59 if( gRX_COUNT < (RX_BUFFER_LENGTH-1) ){\
shreeshas95 2:2caf2a9a13aa 60 ++gRX_COUNT;\
shreeshas95 2:2caf2a9a13aa 61 }\
shreeshas95 2:2caf2a9a13aa 62 else{\
shreeshas95 2:2caf2a9a13aa 63 gRX_COUNT = 0;\
shreeshas95 2:2caf2a9a13aa 64 gRX_CURRENT_DATA_NODE->next_node = new COM_RX_DATA_NODE;\
shreeshas95 2:2caf2a9a13aa 65 gRX_CURRENT_DATA_NODE = gRX_CURRENT_DATA_NODE->next_node;\
shreeshas95 2:2caf2a9a13aa 66 gRX_CURRENT_DATA_NODE->next_node = NULL;\
shreeshas95 2:2caf2a9a13aa 67 }\
shreeshas95 2:2caf2a9a13aa 68 gRX_TIMEOUT.attach(&after_receive, RX_TIMEOUT_LIMIT);\
shreeshas95 0:f016e9e8d48b 69 }
shreeshas95 0:f016e9e8d48b 70
shreeshas95 0:f016e9e8d48b 71 void COM_MNG_TMTC_FUN(void const *args){
shreeshas95 4:104dd82c99b8 72 if( !(gFLAGS & COM_SESSION_FLAG) ){
shreeshas95 4:104dd82c99b8 73 gLEDR = 1;
shreeshas95 4:104dd82c99b8 74 gLEDG = 1;
shreeshas95 4:104dd82c99b8 75 }
shreeshas95 0:f016e9e8d48b 76 while(true){
shreeshas95 0:f016e9e8d48b 77 Thread::signal_wait( COM_MNG_TMTC_SIGNAL_UART_INT );
shreeshas95 0:f016e9e8d48b 78 if( gFLAGS & UART_INT_FLAG ){
shreeshas95 0:f016e9e8d48b 79 gFLAGS = gFLAGS & (~UART_INT_FLAG);
shreeshas95 2:2caf2a9a13aa 80 if( !(gFLAGS & COM_SESSION_FLAG) ){
shreeshas95 2:2caf2a9a13aa 81 // PENDING : DISABLE THREADS
shreeshas95 2:2caf2a9a13aa 82 gFLAGS = gFLAGS | COM_SESSION_FLAG;
shreeshas95 2:2caf2a9a13aa 83 gSESSION_TIMEOUT.attach(&after_session, SESSION_TIME_LIMIT);
shreeshas95 2:2caf2a9a13aa 84 gFLAGS = gFLAGS | COM_RX_FLAG;
shreeshas95 2:2caf2a9a13aa 85 PUT_RAW_BYTE;
shreeshas95 2:2caf2a9a13aa 86 // PENDING : MEASURE RSSI
shreeshas95 4:104dd82c99b8 87 if( gFLAGS & COM_SESSION_FLAG ){
shreeshas95 4:104dd82c99b8 88 gLEDR = 0;
shreeshas95 4:104dd82c99b8 89 gLEDG = 0;
shreeshas95 4:104dd82c99b8 90 }
shreeshas95 2:2caf2a9a13aa 91 }
shreeshas95 2:2caf2a9a13aa 92 else if( gFLAGS & COM_RX_FLAG ){
shreeshas95 4:104dd82c99b8 93 gLEDR = 0;
shreeshas95 4:104dd82c99b8 94 gLEDG = 1;
shreeshas95 2:2caf2a9a13aa 95 PUT_RAW_BYTE;
shreeshas95 0:f016e9e8d48b 96 }
shreeshas95 0:f016e9e8d48b 97 else{
shreeshas95 4:104dd82c99b8 98 gLEDR = 1;
shreeshas95 4:104dd82c99b8 99 gLEDG = 0;
shreeshas95 2:2caf2a9a13aa 100 gFLAGS = gFLAGS | COM_RX_FLAG;
shreeshas95 2:2caf2a9a13aa 101 PUT_RAW_BYTE;
shreeshas95 0:f016e9e8d48b 102 }
shreeshas95 0:f016e9e8d48b 103 }
shreeshas95 4:104dd82c99b8 104 else if( gFLAGS & NEW_TC_RECEIVED ){
shreeshas95 4:104dd82c99b8 105 gPC.puts("NEW TC RECEIVED\r\n");
shreeshas95 0:f016e9e8d48b 106 gFLAGS = gFLAGS & (~NEW_TC_RECEIVED);
shreeshas95 4:104dd82c99b8 107 gFLAGS = gFLAGS | COM_MNG_TMTC_RUNNING_FLAG;
shreeshas95 2:2caf2a9a13aa 108
shreeshas95 0:f016e9e8d48b 109 // DISABLE THE RX1M INTERRUPT
shreeshas95 0:f016e9e8d48b 110 RX1M.attach(NULL);
shreeshas95 0:f016e9e8d48b 111
shreeshas95 4:104dd82c99b8 112 // VERIFY CRC, REPEATED PSC AND UPDATE TOTAL_VALID_TC, INCORRECT SIZE TC, CRC FAIL TC
shreeshas95 2:2caf2a9a13aa 113 while(gRX_COUNT < (RX_BUFFER_LENGTH)){
shreeshas95 2:2caf2a9a13aa 114 gRX_CURRENT_DATA_NODE->values[gRX_COUNT] = 0x00;
shreeshas95 0:f016e9e8d48b 115 ++gRX_COUNT;
shreeshas95 0:f016e9e8d48b 116 }
shreeshas95 0:f016e9e8d48b 117 gRX_COUNT = 0;
shreeshas95 4:104dd82c99b8 118 raw_data_to_tc();
shreeshas95 6:79d422d1ed42 119 gFLAGS = gFLAGS & (~COM_RX_FLAG);
shreeshas95 2:2caf2a9a13aa 120
shreeshas95 2:2caf2a9a13aa 121 if( gTOTAL_VALID_TC > 0 ){
shreeshas95 4:104dd82c99b8 122 gPC.printf("valid TC rx: %u\r\n", gTOTAL_VALID_TC);
shreeshas95 4:104dd82c99b8 123 if( gTOTAL_VALID_TC < COM_MAX_TC_LIMIT ){
shreeshas95 4:104dd82c99b8 124 // CHECK WEATHER TC LIST HAS MISSING TC OR WEATHER LAST FRAME BIT IS HIGH IN THE LAST PSC-TC
shreeshas95 4:104dd82c99b8 125 gPC.puts("checking for tc list complete\r\n");
shreeshas95 4:104dd82c99b8 126 uint8_t tempContinue = 0xFF;
shreeshas95 4:104dd82c99b8 127 continueToExecute(tempContinue);
shreeshas95 4:104dd82c99b8 128 if(tempContinue == 0x00){
shreeshas95 4:104dd82c99b8 129 gPC.puts("tc list is complete\r\n");
shreeshas95 4:104dd82c99b8 130 // CHECK WEATHER GS VERIFICATION CODE MATCHES
shreeshas95 4:104dd82c99b8 131 uint8_t tempGSver = 0x00;
shreeshas95 4:104dd82c99b8 132 GScodeVerification(tempGSver);
shreeshas95 5:ab276a17ca07 133 /*PENDING: INCLUDE GS VERIFICATION CODE*/
shreeshas95 5:ab276a17ca07 134 if( true ){
shreeshas95 4:104dd82c99b8 135 gPC.puts("GC code match !!\r\n");
shreeshas95 4:104dd82c99b8 136 gFLAGS = gFLAGS | COM_SESSION_VALIDITY;
shreeshas95 4:104dd82c99b8 137 COM_POWER_ON_TX;
shreeshas95 4:104dd82c99b8 138 // PENDING: PA HOT HANDLED IN EXECUTE_XXX FUNCTIONS
shreeshas95 4:104dd82c99b8 139 uint8_t tempPAHot = 0x00;
shreeshas95 4:104dd82c99b8 140 isPAhot(tempPAHot);
shreeshas95 4:104dd82c99b8 141 if( tempPAHot == 0xFF ){
shreeshas95 6:79d422d1ed42 142 gFLAGS = gFLAGS & ~(COM_PA_HOT_FLAG);
shreeshas95 6:79d422d1ed42 143 gCOM_PA_COOLING_TIMEOUT.detach();
shreeshas95 4:104dd82c99b8 144 gPC.puts("EXECUTING TELECOMMANDS\r\n");
shreeshas95 4:104dd82c99b8 145 EXECUTE_OBOSC_ONLY;
shreeshas95 4:104dd82c99b8 146 EXECUTE_TC;
shreeshas95 4:104dd82c99b8 147 gPC.puts("COMPLETED EXECUTION\r\n");
shreeshas95 4:104dd82c99b8 148 }
shreeshas95 4:104dd82c99b8 149 else{
shreeshas95 4:104dd82c99b8 150 gFLAGS = gFLAGS | COM_PA_HOT_FLAG;
shreeshas95 6:79d422d1ed42 151 // PENDING: power off transmitter only
shreeshas95 6:79d422d1ed42 152 gCOM_PA_COOLING_TIMEOUT.attach(&after_cooling_pa, COM_PA_COOLING_TIME_LIMIT);
shreeshas95 6:79d422d1ed42 153 gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);
shreeshas95 4:104dd82c99b8 154 RX1M.attach(&rx_read, Serial::RxIrq);
shreeshas95 4:104dd82c99b8 155 }
shreeshas95 4:104dd82c99b8 156 }
shreeshas95 4:104dd82c99b8 157 else{
shreeshas95 4:104dd82c99b8 158 gPC.puts("GS code mismatch !!\r\n");
shreeshas95 6:79d422d1ed42 159 RX1M.attach(&rx_read, Serial::RxIrq);
shreeshas95 4:104dd82c99b8 160 reset_all;
shreeshas95 4:104dd82c99b8 161 gFLAGS = gFLAGS & (~COM_SESSION_VALIDITY);
shreeshas95 4:104dd82c99b8 162 // PENDING : ENABLE THREADS
shreeshas95 4:104dd82c99b8 163 gSESSION_TIMEOUT.detach();
shreeshas95 4:104dd82c99b8 164 gFLAGS = gFLAGS & (~COM_SESSION_FLAG);
shreeshas95 4:104dd82c99b8 165 // WARNING: clear COM_MNG_TMTC ?
shreeshas95 4:104dd82c99b8 166 }
shreeshas95 0:f016e9e8d48b 167 }
shreeshas95 2:2caf2a9a13aa 168 else{
shreeshas95 5:ab276a17ca07 169 gPC.puts("tc list is not complete\r\n");
shreeshas95 5:ab276a17ca07 170 if(tempContinue & 0x01){
shreeshas95 5:ab276a17ca07 171 gPC.puts("last packet bit not found\r\n");
shreeshas95 5:ab276a17ca07 172 }
shreeshas95 5:ab276a17ca07 173 if( tempContinue & 0x02 ){
shreeshas95 5:ab276a17ca07 174 gPC.puts("missing psc found\r\n");
shreeshas95 5:ab276a17ca07 175 }
shreeshas95 5:ab276a17ca07 176 gPC.printf("crc fail tc = %u\r\n", gTOTAL_CRC_FAIL_TC);
shreeshas95 5:ab276a17ca07 177 gPC.printf("incorrect size tc = %u\r\n", gTOTAL_INCORRECT_SIZE_TC);
shreeshas95 5:ab276a17ca07 178 gPC.printf("repeated psc = %u\r\n", gTOTAL_REPEATED_TC);
shreeshas95 5:ab276a17ca07 179 Base_tc *test_tc = gHEAD_NODE_TCL;
shreeshas95 5:ab276a17ca07 180 while( test_tc != NULL ){
shreeshas95 5:ab276a17ca07 181 int length = 0;
shreeshas95 5:ab276a17ca07 182 if( GETshort_or_long_tc(test_tc) == SHORT_TC_CODE ){
shreeshas95 5:ab276a17ca07 183 length = TC_SHORT_SIZE;
shreeshas95 5:ab276a17ca07 184 }
shreeshas95 5:ab276a17ca07 185 else{
shreeshas95 5:ab276a17ca07 186 length = TC_LONG_SIZE;
shreeshas95 5:ab276a17ca07 187 }
shreeshas95 5:ab276a17ca07 188 for(int i = 0 ; i < length ; ++i ){
shreeshas95 5:ab276a17ca07 189 gPC.printf("%x ", test_tc->TC_string[i]);
shreeshas95 5:ab276a17ca07 190 }
shreeshas95 5:ab276a17ca07 191 gPC.puts("\r\n");
shreeshas95 5:ab276a17ca07 192 test_tc = test_tc->next_TC;
shreeshas95 5:ab276a17ca07 193 }
shreeshas95 5:ab276a17ca07 194 gPC.puts("\r\n");
shreeshas95 4:104dd82c99b8 195 COM_POWER_ON_TX;
shreeshas95 4:104dd82c99b8 196 // PENDING : POWER OFF TX
shreeshas95 4:104dd82c99b8 197 RX1M.attach(&rx_read, Serial::RxIrq);
shreeshas95 4:104dd82c99b8 198 gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);
shreeshas95 2:2caf2a9a13aa 199 }
shreeshas95 0:f016e9e8d48b 200 }
shreeshas95 0:f016e9e8d48b 201 else{
shreeshas95 4:104dd82c99b8 202 COM_POWER_ON_TX;
shreeshas95 6:79d422d1ed42 203 // POWER OFF TX transmitter only
shreeshas95 4:104dd82c99b8 204 // WARNING: reset_all ? clear com_session ?
shreeshas95 2:2caf2a9a13aa 205 RX1M.attach(&rx_read, Serial::RxIrq);
shreeshas95 4:104dd82c99b8 206 gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);
shreeshas95 0:f016e9e8d48b 207 }
shreeshas95 2:2caf2a9a13aa 208 }
shreeshas95 4:104dd82c99b8 209 else{
shreeshas95 6:79d422d1ed42 210 gPC.puts("No valid TC received\r\n");
shreeshas95 2:2caf2a9a13aa 211 RX1M.attach(&rx_read, Serial::RxIrq);
shreeshas95 4:104dd82c99b8 212 gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);
shreeshas95 6:79d422d1ed42 213 reset_all;
shreeshas95 6:79d422d1ed42 214 // PENDING : ENABLE THREADS
shreeshas95 6:79d422d1ed42 215 gSESSION_TIMEOUT.detach();
shreeshas95 6:79d422d1ed42 216 gFLAGS = gFLAGS & (~COM_SESSION_FLAG);
shreeshas95 2:2caf2a9a13aa 217 }
shreeshas95 2:2caf2a9a13aa 218 }
shreeshas95 2:2caf2a9a13aa 219 else if( gFLAGS & COM_PA_HOT_FLAG ){
shreeshas95 6:79d422d1ed42 220 gPC.puts("checking for PA hot in main\r\n");
shreeshas95 6:79d422d1ed42 221 if( gFLAGS & COM_RX_FLAG ){
shreeshas95 6:79d422d1ed42 222 uint8_t tempPA = 0xFF;
shreeshas95 6:79d422d1ed42 223 isPAhot(tempPA);
shreeshas95 6:79d422d1ed42 224 if( tempPA == 0x00 ){
shreeshas95 6:79d422d1ed42 225 gCOM_PA_COOLING_TIMEOUT.attach(&after_cooling_pa, COM_PA_COOLING_TIME_LIMIT);
shreeshas95 6:79d422d1ed42 226 }
shreeshas95 6:79d422d1ed42 227 else{
shreeshas95 6:79d422d1ed42 228 gFLAGS = gFLAGS & ~(COM_PA_HOT_FLAG);
shreeshas95 6:79d422d1ed42 229 gCOM_PA_COOLING_TIMEOUT.detach();
shreeshas95 6:79d422d1ed42 230 }
shreeshas95 0:f016e9e8d48b 231 }
shreeshas95 0:f016e9e8d48b 232 else{
shreeshas95 6:79d422d1ed42 233 uint8_t tempPA = 0xFF;
shreeshas95 6:79d422d1ed42 234 isPAhot(tempPA);
shreeshas95 6:79d422d1ed42 235 if( tempPA == 0x00 ){
shreeshas95 6:79d422d1ed42 236 gCOM_PA_COOLING_TIMEOUT.attach(&after_cooling_pa, COM_PA_COOLING_TIME_LIMIT);
shreeshas95 6:79d422d1ed42 237 }
shreeshas95 6:79d422d1ed42 238 else{
shreeshas95 6:79d422d1ed42 239 gPC.puts("PA IS COOLED DOWN\r\n");
shreeshas95 6:79d422d1ed42 240 gFLAGS = gFLAGS & (~COM_PA_HOT_FLAG);
shreeshas95 6:79d422d1ed42 241 gFLAGS = gFLAGS | COM_MNG_TMTC_RUNNING_FLAG;
shreeshas95 6:79d422d1ed42 242 RX1M.attach(NULL);
shreeshas95 6:79d422d1ed42 243 gCOM_PA_COOLING_TIMEOUT.detach();
shreeshas95 6:79d422d1ed42 244 COM_POWER_ON_TX;
shreeshas95 6:79d422d1ed42 245 EXECUTE_OBOSC_ONLY;
shreeshas95 6:79d422d1ed42 246 EXECUTE_TC;
shreeshas95 6:79d422d1ed42 247 }
shreeshas95 0:f016e9e8d48b 248 }
shreeshas95 2:2caf2a9a13aa 249 }
shreeshas95 6:79d422d1ed42 250 else if( gFLAGS & COM_SESSION_TIMEOUT_FLAG ){
shreeshas95 6:79d422d1ed42 251 gPC.puts("session timeout: resetting in main\r\n");
shreeshas95 6:79d422d1ed42 252 COM_POWER_OFF_TX;
shreeshas95 6:79d422d1ed42 253 /*PENDING : ENABLE THREADS*/
shreeshas95 6:79d422d1ed42 254 gSESSION_TIMEOUT.detach();
shreeshas95 6:79d422d1ed42 255 gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);
shreeshas95 6:79d422d1ed42 256 gFLAGS = gFLAGS & (~COM_SESSION_FLAG);
shreeshas95 6:79d422d1ed42 257 reset_all;
shreeshas95 6:79d422d1ed42 258 }
shreeshas95 2:2caf2a9a13aa 259 else{
shreeshas95 6:79d422d1ed42 260 gPC.puts("INVALID SIGNAL RECEIVED IN MAIN\r\n");
shreeshas95 2:2caf2a9a13aa 261 // SOME INVALID SIGNAL RECEIVED
shreeshas95 4:104dd82c99b8 262 COM_POWER_OFF_TX;
shreeshas95 2:2caf2a9a13aa 263 reset_all;
shreeshas95 2:2caf2a9a13aa 264 // PENDING : ENABLE THREADS
shreeshas95 2:2caf2a9a13aa 265 gSESSION_TIMEOUT.detach();
shreeshas95 2:2caf2a9a13aa 266 gFLAGS = gFLAGS & (~COM_SESSION_FLAG);
shreeshas95 0:f016e9e8d48b 267 }
shreeshas95 0:f016e9e8d48b 268 }
shreeshas95 3:6c81fc8834e2 269 }
shreeshas95 3:6c81fc8834e2 270
shreeshas95 4:104dd82c99b8 271 //void SCIENCE_FUN(void const *args){
shreeshas95 4:104dd82c99b8 272 //// SPIpayload.format(8,0);
shreeshas95 4:104dd82c99b8 273 //// SPIpayload.frequency(1000000);
shreeshas95 4:104dd82c99b8 274 // for ( int i = 0 ; i < PAYLOAD_BUFFER_LENGTH ; i++ ){
shreeshas95 4:104dd82c99b8 275 // gPAYLOAD_BUFFER[i] = 1;
shreeshas95 4:104dd82c99b8 276 // }
shreeshas95 4:104dd82c99b8 277 //
shreeshas95 4:104dd82c99b8 278 // // initialise the buffer for dma
shreeshas95 4:104dd82c99b8 279 // // SPIpayload.bulkRead_init(VAR_SPACE::payload_dma_buffer, PAYLOAD_DMA_SIZE, &payload_interrupt_fun);
shreeshas95 4:104dd82c99b8 280 // // start dma read
shreeshas95 4:104dd82c99b8 281 // // SPIpayload.bulkRead_start();
shreeshas95 4:104dd82c99b8 282 //
shreeshas95 4:104dd82c99b8 283 // // attach DMA interrupt
shreeshas95 4:104dd82c99b8 284 // while(true){
shreeshas95 4:104dd82c99b8 285 // gSCIENCE_THREAD->signal_wait(0x01);
shreeshas95 4:104dd82c99b8 286 //
shreeshas95 4:104dd82c99b8 287 ////*********************************************************THE TEST
shreeshas95 4:104dd82c99b8 288 //
shreeshas95 4:104dd82c99b8 289 // //read rtc time later
shreeshas95 4:104dd82c99b8 290 // uint64_t RTC_time = 0;
shreeshas95 4:104dd82c99b8 291 // Science_Data_Compression::complete_compression( gPAYLOAD_BUFFER , RTC_time);
shreeshas95 4:104dd82c99b8 292 //// SPI_mutex.lock();
shreeshas95 4:104dd82c99b8 293 //// disk_write(SDcard_lastWritten , 5);
shreeshas95 4:104dd82c99b8 294 //// SPI_mutex.unlock();
shreeshas95 4:104dd82c99b8 295 //
shreeshas95 4:104dd82c99b8 296 ////**********************************************THE TEST
shreeshas95 4:104dd82c99b8 297 //
shreeshas95 4:104dd82c99b8 298 //// counter_for_payload++;
shreeshas95 4:104dd82c99b8 299 //// if(counter_for_payload == 10){
shreeshas95 4:104dd82c99b8 300 //// payload_ticker.detach();
shreeshas95 4:104dd82c99b8 301 //// ledg = 0;
shreeshas95 4:104dd82c99b8 302 //// PC.puts("its over\r\n");
shreeshas95 4:104dd82c99b8 303 //// }
shreeshas95 4:104dd82c99b8 304 //
shreeshas95 4:104dd82c99b8 305 //// SPIpayload.bulkRead_start();
shreeshas95 4:104dd82c99b8 306 //
shreeshas95 4:104dd82c99b8 307 // }
shreeshas95 4:104dd82c99b8 308 //}