lkdsnf;

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE_PL_Working by Siva ram

Revision:
6:79d422d1ed42
Parent:
5:ab276a17ca07
Child:
12:ffdb29353058
--- a/COM_MNG_TMTC.h	Wed Dec 30 06:36:38 2015 +0000
+++ b/COM_MNG_TMTC.h	Thu Dec 31 06:43:13 2015 +0000
@@ -744,10 +744,15 @@
                                 gFLAGS = gFLAGS | COM_PA_HOT_FLAG;\
                             }\
                             /*read_TC(current_TC);*/\
-                            /*PENDING: ABORT ON NACK CHECK WITH SD CARD*/\
+                            uint8_t tempExec = TC_STATE_SUCCESSFULLY_EXECUTED;\
+                            PUTexec_status(current_TC, tempExec);\
+                            /*PENDING: ABORT ON NACK CHECK, gMASTER_STATE VERIFICATION WITH SD CARD, session timeout, last executed ack l234*/\
                             if( (GETexec_status(current_TC) == TC_STATE_EXECUTION_FAILED) && (GETabort_on_nack(current_TC) == 1) ){\
                                 gMASTER_STATE = TCL_STATE_ABORTED;\
                             }\
+                            else if( execute_psc == (gTOTAL_VALID_TC+PSC_START_VALUE-1) ){\
+                                gMASTER_STATE = TCL_STATE_COMPLETED;\
+                            }\
                         }\
                     }\
                     break;\
@@ -760,7 +765,10 @@
                 break;\
             }\
         }\
-        if( gMASTER_STATE == TCL_STATE_ABORTED ){\
+        if( gFLAGS & COM_SESSION_TIMEOUT_FLAG ){\
+            break;\
+        }\
+        else if( gMASTER_STATE == TCL_STATE_ABORTED ){\
             gPC.puts("ABORTING DUE TO ABORT ON NACK\r\n");\
             /*EXITED DUE TO ABORT ON NACK:*/\
             /*PENDING : POWER OFF COM TX*/\
@@ -778,7 +786,8 @@
         }\
         gPC.printf("successflly executed %u tc\r\n", execute_psc);\
     }\
-    if( gMASTER_STATE != TCL_STATE_ABORTED ){\
+    if( (gMASTER_STATE == TCL_STATE_COMPLETED) || (gFLAGS & COM_SESSION_TIMEOUT_FLAG) ){\
+        gPC.printf("completed or session timed out: %x\r\n", gMASTER_STATE);\
         /*COMPLETED EXECUTION OF TC*/\
         gMASTER_STATE = TCL_STATE_COMPLETED;\
         COM_POWER_OFF_TX;\