lkdsnf;

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE_PL_Working by Siva ram

Revision:
51:da85d84768e2
Parent:
45:4c10559cd886
Child:
52:0bd68655c651
--- a/COM_MNG_TMTC.h	Sat Jan 09 14:32:17 2016 +0000
+++ b/COM_MNG_TMTC.h	Tue Jan 12 15:08:29 2016 +0000
@@ -404,7 +404,7 @@
 // CDMS TEAM CODE END
 
 // EXECUTE OBOSC
-#define execute_obosc_core(tc_ptr, tm_ptr) {\
+#define execute_obosc_core(tc_ptr, tm_ptr, reset_flag) {\
     uint8_t service_subtype = (tc_ptr->TC_string[2]) & 0x0F;\
     uint8_t temp8 = 0x00;\
     Base_tc *modify_this = gHEAD_NODE_TCL;\
@@ -514,7 +514,8 @@
         get_tc_list(ackl234new->next_TM, GETpacket_seq_count(tc_ptr));\
     }\
     else if( service_subtype == OBOSC_SUB_RESET ){\
-        reset_all;\
+        /*reset_all;*/\
+        reset_flag = 1;\
         /*PENDING: VERIFY reset_all, RESET CDMS*/\
     }\
     else if( (service_subtype != OBOSC_SUB_DISABLE) && (service_subtype != OBOSC_SUB_RETRY) ){\
@@ -539,6 +540,7 @@
 }
 
 #define EXECUTE_OBOSC_ONLY {\
+    int reset_flag = 0;\
     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;\
@@ -559,7 +561,7 @@
                             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);\
+                            execute_obosc_core(current_TC, obosc_tm_core, reset_flag);\
                             uint16_t temp16 = TC_STATE_SUCCESSFULLY_EXECUTED;\
                             PUTexec_status(current_TC, temp16);\
                             Base_tm *obosc_tm_current = obosc_tm_head;\
@@ -607,6 +609,9 @@
                                     break;\
                                 }\
                             }\
+                            if ( reset_flag ==1 ){\
+                                reset_all;\
+                            }\
                         }\
                     }\
                 }\
@@ -661,6 +666,21 @@
                             tm_ptr = tm_ptr->next_TM;\
                         }\
                         /*snd_tm.head_pointer(tm_ptr_head);*/\
+                        /*DELETE THE TM AFTER USE*/\
+                        tm_ptr = tm_ptr_head;\
+                        int overflowCountExecute = 0;\
+                        while(tm_ptr != NULL){\
+                            if( overflowCountExecute < TM_OVERFLOW_CONSTANT ){\
+                                Base_tm *temp = tm_ptr->next_TM;\
+                                delete tm_ptr;\
+                                tm_ptr = temp;\
+                                ++overflowCountExecute;\
+                            }\
+                            else{\
+                                /*PENDING: RESET CDMS*/\
+                                break;\
+                            }\
+                        }\
                         break;\
                     }\
                     else if( (current_exec_status == TC_STATE_UNEXECUTED) || (current_exec_status == TC_STATE_MARKED_RETRY) ){\
@@ -832,6 +852,21 @@
                                     gMASTER_STATE = TCL_STATE_COMPLETED;\
                                 }\
                             }\
+                            /*update last executed L1_ack*/\
+                            if( put_tm_here != NULL ){\
+                                if( GETshort_or_long_tm(put_tm_here->fields) == SHORT_TM_CODE ){\
+                                    for(int i = 0 ; i < TM_SHORT_SIZE ; ++i){\
+                                        gLAST_TM[i] = put_tm_here->TM_string[i];\
+                                        gLAST_TM_SHORT_OR_LONG = SHORT_TM_CODE;\
+                                    }\
+                                }\
+                                else{\
+                                    for( int i = 0 ; i < TM_LONG_SIZE ; ++i ){\
+                                        gLAST_TM[i] = put_tm_here->TM_string[i];\
+                                        gLAST_TM_SHORT_OR_LONG = LONG_TM_CODE;\
+                                    }\
+                                }\
+                            }\
                             /*PENDING: APPEND ACK L1*/\
                             Base_tm *tm_ptr = tm_ptr_head;\
                             get_ack_l1(tm_ptr->next_TM);\