
Repository for CDMS code
Dependencies: SimpleDMA mbed-rtos mbed eeprom
Fork of COM_MNG_TMTC_SIMPLE by
Revision 180:ccc21cc163f8, committed 2016-05-25
- Comitter:
- aniruddhv
- Date:
- Wed May 25 15:28:32 2016 +0000
- Parent:
- 179:67588115bca3
- Child:
- 187:2c7263530c57
- Child:
- 211:77bee0cbebfe
- Commit message:
- minor changes
Changed in this revision
--- a/COM_MNG_TMTC.h Fri Apr 22 19:43:13 2016 +0000 +++ b/COM_MNG_TMTC.h Wed May 25 15:28:32 2016 +0000 @@ -152,7 +152,7 @@ }\ }\ else{\ - if( (gMASTER_STATE == TCL_STATE_INCOMPLETE) || (gMASTER_STATE == TCL_STATE_COMPLETED) ){\ + if( (gMASTER_STATE == TCL_STATE_INCOMPLETE) || (gMASTER_STATE == TCL_STATE_COMPLETED) || (gMASTER_STATE == TCL_STATE_ABORTED) ){\ gMASTER_STATE = TCL_STATE_INCOMPLETE;\ }\ }\ @@ -945,6 +945,8 @@ int reset_flag = 0;\ if (DEBUG)\ gPC.puts("iNSIDE EXECUTE_OBOSC_ONLY\r\n");\ + Base_tm *obosc_tm_core = NULL;\ + Base_tm *obosc_tm = obosc_tm_core;\ for(uint8_t execute_psc = PSC_START_VALUE ; execute_psc < gTOTAL_VALID_TC ; ++execute_psc){\ Base_tc* current_TC = gHEAD_NODE_TCL;\ int overCount = 0;\ @@ -963,27 +965,13 @@ gPC.printf("It is obosc: %u\r\n", execute_psc);\ /*EXECUTION OF OBOSC TC*/\ /*WARNING: LARGE MEMORY UTILIZATION FOR TC-LIST-REPORT */\ - Base_tm *obosc_tm_head = NULL;\ - get_call_sign(obosc_tm_head);\ - Base_tm *obosc_tm_core = NULL;\ execute_obosc_core(current_TC, obosc_tm_core, reset_flag);\ + Base_tm *obosc_tm_current = obosc_tm_core;\ + while(obosc_tm_core != NULL){\ + obosc_tm_core = obosc_tm_core->next_TM;\ + }\ uint16_t temp16 = TC_STATE_SUCCESSFULLY_EXECUTED;\ PUTexec_status(current_TC, temp16);\ - Base_tm *obosc_tm_current = obosc_tm_head;\ - get_ack_l1(obosc_tm_current->next_TM);\ - int overflowCountOBONLY = 0;\ - while( obosc_tm_current->next_TM != NULL ){\ - if( overflowCountOBONLY < TM_OVERFLOW_CONSTANT ){\ - obosc_tm_current = obosc_tm_current->next_TM;\ - ++overflowCountOBONLY;\ - }\ - else{\ - RESET_CDMS;\ - break;\ - }\ - }\ - obosc_tm_current->next_TM = obosc_tm_core;\ - obosc_tm_current = obosc_tm_head;\ while( obosc_tm_current != NULL ){\ int length = TM_SHORT_SIZE;\ if( GETshort_or_long_tm(obosc_tm_current) == SHORT_TM_CODE ){\ @@ -997,24 +985,6 @@ }\ obosc_tm_current = obosc_tm_current->next_TM;\ }\ - /*Sending OBOSC TM to GS*/\ - /*snd_tm.head_pointer(obosc_tm_head);*/\ - /*transmit_adf;*/\ - /*DELETE THE TM AFTER USE*/\ - obosc_tm_current = obosc_tm_head;\ - int overCount = 0;\ - while( obosc_tm_current != NULL ){\ - if( (overCount < TM_OVERFLOW_CONSTANT) ){\ - Base_tm *temp = obosc_tm_current->next_TM;\ - delete obosc_tm_current;\ - obosc_tm_current = temp;\ - ++overCount;\ - }\ - else{\ - RESET_CDMS;\ - break;\ - }\ - }\ if ( reset_flag ==1 ){\ reset_all;\ }\ @@ -1030,6 +1000,42 @@ }\ }\ }\ + if(obosc_tm_core != NULL){\ + Base_tm *obosc_tm_head = NULL;\ + get_call_sign(obosc_tm_head);\ + Base_tm *obosc_tm_current = obosc_tm_head;\ + get_ack_l1(obosc_tm_current->next_TM);\ + int overflowCountOBONLY = 0;\ + while( obosc_tm_current->next_TM != NULL ){\ + if( overflowCountOBONLY < TM_OVERFLOW_CONSTANT ){\ + obosc_tm_current = obosc_tm_current->next_TM;\ + ++overflowCountOBONLY;\ + }\ + else{\ + RESET_CDMS;\ + break;\ + }\ + }\ + obosc_tm_current->next_TM = obosc_tm;\ + /*Sending OBOSC TM to GS*/\ + /*snd_tm.head_pointer(obosc_tm_head);*/\ + /*transmit_adf;*/\ + /*DELETE THE TM AFTER USE*/\ + obosc_tm_current = obosc_tm_head;\ + int overCount = 0;\ + while( obosc_tm_current != NULL ){\ + if( (overCount < TM_OVERFLOW_CONSTANT) ){\ + Base_tm *temp = obosc_tm_current->next_TM;\ + delete obosc_tm_current;\ + obosc_tm_current = temp;\ + ++overCount;\ + }\ + else{\ + RESET_CDMS;\ + break;\ + }\ + }\ + }\ } #define EXECUTE_TC {\ @@ -1050,6 +1056,10 @@ uint8_t current_exec_status = GETexec_status(current_TC);\ if( (current_exec_status == TC_STATE_SUCCESSFULLY_EXECUTED) || (current_exec_status == TC_STATE_DISABLED) ){\ /*gPC.printf("disabled or completed at %u\n", execute_psc);*/\ + if( execute_psc == (gTOTAL_VALID_TC-1) ){\ + /*LAST TC IS EXECUTED*/\ + gMASTER_STATE = TCL_STATE_COMPLETED;\ + }\ break;\ }\ else if( (current_exec_status == TC_STATE_EXECUTION_FAILED) && (GETabort_on_nack(current_TC) == 1) ){\ @@ -1141,25 +1151,6 @@ /*LAST TC IS EXECUTED*/\ gMASTER_STATE = TCL_STATE_COMPLETED;\ }\ - else{\ - uint8_t check1 = 1;\ - for( uint8_t test_psc = execute_psc+1 ; test_psc < gTOTAL_VALID_TC ; ++test_psc ){\ - Base_tc* test_TC = gHEAD_NODE_TCL;\ - while(test_TC != NULL){\ - if( GETpacket_seq_count(test_TC) == test_psc ){\ - uint8_t checkval;\ - isit_obosc(test_TC, checkval);\ - if( checkval == 0 ){\ - check1 = 0;\ - }\ - }\ - test_TC = test_TC->next_TC;\ - }\ - }\ - if( check1 == 0x01 ){\ - gMASTER_STATE = TCL_STATE_COMPLETED;\ - }\ - }\ /*update last executed L1_ack*/\ if( put_tm_here != NULL ){\ if( GETshort_or_long_tm(put_tm_here) == SHORT_TM_CODE ){\ @@ -1360,7 +1351,7 @@ if (DEBUG)\ gPC.puts("ABORTING DUE TO ABORT ON NACK\r\n");\ /*EXITED DUE TO ABORT ON NACK:*/\ - /*PENDING : POWER OFF COM TX*/\ + /*COM_TX_CNTRL = 0;*/\ RX1M.attach(&rx_read, Serial::RxIrq);\ gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\ break;\ @@ -1368,7 +1359,7 @@ else if( gFLAGS & COM_PA_HOT_FLAG ){\ /*PA HOT: WAIT FOR TIMEOUT*/\ gCOM_PA_COOLING_TIMEOUT.attach(&after_cooling_pa, COM_PA_COOLING_TIME_LIMIT);\ - /*PENDING : POWER OFF COMM TX*/\ + /*COM_TX_CNTRL = 0;*/\ RX1M.attach(&rx_read, Serial::RxIrq);\ gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\ break;\
--- a/Structures.h Fri Apr 22 19:43:13 2016 +0000 +++ b/Structures.h Wed May 25 15:28:32 2016 +0000 @@ -33,6 +33,7 @@ #define TC_STATE_UNEXECUTED 0x00 #define TC_STATE_SUCCESSFULLY_EXECUTED 0x01 #define TC_STATE_EXECUTION_FAILED 0x02 +#define TC_STATE_EXECUTION_UNKNOWN 0x03 #define TC_STATE_DISABLED 0x04 #define TC_STATE_MARKED_RETRY 0x05
--- a/ThreadsAndFunctions.h Fri Apr 22 19:43:13 2016 +0000 +++ b/ThreadsAndFunctions.h Wed May 25 15:28:32 2016 +0000 @@ -93,13 +93,13 @@ }\ gHEAD_NODE_TCL = NULL;\ gLAST_NODE_TCL = NULL;\ - gMASTER_STATE = TCL_STATE_INCOMPLETE;\ + gMASTER_STATE = TCL_STATE_COMPLETED;\ gTOTAL_INCORRECT_SIZE_TC = 0;\ gTOTAL_CRC_FAIL_TC = 0;\ gTOTAL_REPEATED_TC = 0;\ gTOTAL_VALID_TC = 0;\ for(int i = 0 ; i < TM_LONG_SIZE ; ++i){\ - gLAST_TM[i] = 0x00;\ + /*gLAST_TM[i] = 0x00;*/\ }\ gLAST_TM_SHORT_OR_LONG = SHORT_TM_CODE;\ COM_RX_DATA_NODE *dataptr = gRX_HEAD_DATA_NODE;\ @@ -229,7 +229,7 @@ } else{ gFLAGS = gFLAGS | COM_PA_HOT_FLAG; - // PENDING: power off transmitter only + // COM_TX_CNTRL = 0; gCOM_PA_COOLING_TIMEOUT.attach(&after_cooling_pa, COM_PA_COOLING_TIME_LIMIT); gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG); RX1M.attach(&rx_read, Serial::RxIrq); @@ -275,15 +275,16 @@ } //gPC.puts("\r\n"); COM_POWER_ON_TX; - // PENDING : POWER OFF TX + // COM_TX_CNTRL = 0; RX1M.attach(&rx_read, Serial::RxIrq); gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG); } } else{ COM_POWER_ON_TX; - // POWER OFF TX transmitter only - // WARNING: reset_all ? clear com_session ? + // COM_TX_CNTRL = 0; + reset_all; + gFLAGS = gFLAGS & (~COM_SESSION_FLAG); RX1M.attach(&rx_read, Serial::RxIrq); gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG); }