sd 32 update

Dependencies:   FreescaleIAP mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Revision:
17:6eb9387f1fb8
Parent:
16:538de1b20b3a
--- a/COM_MNG_TMTC.h	Thu Dec 31 18:35:59 2015 +0000
+++ b/COM_MNG_TMTC.h	Fri Jan 01 06:36:18 2016 +0000
@@ -81,32 +81,21 @@
 
 #define isit_obosc(tc_ptr, temp_obosc) {\
     temp_obosc = 0x00;\
-    if( GETapid(tc_ptr) == 2 ){\
-        if( ((tc_ptr->TC_string[2]) >> 4) == 0xB ){\
-            switch( (tc_ptr->TC_string[2]) & 0xf ){\
-                case 1:\
-                case 2:\
-                case 5:\
-                case 6:\
-                case 15:\
-                    temp_obosc = 0x01;\
-            }\
+    if( GETapid(tc_ptr) == APID_COM ){\
+        /*CHECK FOR SERVICE TYPE*/\
+        if( ((tc_ptr->TC_string[2]) >> 4) == SERVICE_OBOSC ){\
+            /*IRRESPECTIVE OF SERVICE SUBTYPE*/\
+            temp_obosc = 0x01;\
         }\
     }\
 }
 
 #define isit_sdcard(tc_ptr, temp_sdcard) {\
     temp_sdcard = 0x00;\
-    if( GETapid(tc_ptr) == 2 ){\
-        if( ( (tc_ptr->TC_string[2]) >> 4) == 0xF ){\
-            switch( (tc_ptr->TC_string[2]) & 0xf ){\
-                case 0:\
-                case 1:\
-                case 2:\
-                case 3:\
-                case 4:\
-                    temp_sdcard = 0x01;\
-            }\
+    if( GETapid(tc_ptr) == APID_COM ){\
+        if( ( (tc_ptr->TC_string[2]) >> 4) == SERVICE_OBSRS ){\
+            /*IRRESPECTIVE OF SERVICE SUBTYPE*/\
+            temp_sdcard = 0x01;\
         }\
     }\
 }
@@ -188,7 +177,7 @@
     uint16_t overflowCount = 0;\
     returnHere = 0xFF;\
     while( (overflowCount < TCL_OVERFLOW_CONSTANT) && (testTC != NULL) ){\
-        if( (GETpacket_seq_count(testTC) == PSC_CALLSIGN) && (GETapid(testTC) == APID_CALLSIGN) ){\
+        if( (GETpacket_seq_count(testTC) == PSC_CALLSIGN) && (GETapid(testTC) == APID_COM) ){\
             uint8_t temp8 = testTC->TC_string[1];\
             if( temp8 & 0x04 ){\
                 for( int i = 2 ; i <= 8 ; ++i ){\
@@ -554,6 +543,7 @@
             break;\
         }\
     }\
+    uint8_t obosc_executed_count = 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;\
@@ -572,6 +562,7 @@
                             /*EXECUTION OF OBOSC TC*/\
                             /*WARNING: LARGE MEMORY UTILIZATION FOR TC-LIST-REPORT */\
                             execute_obosc_core(current_TC, obosc_tm_current->next_TM);\
+                            ++obosc_executed_count;\
                             /*INCREMENT POINTER TO THE LAST NODE*/\
                             int overflowCountOBinside = 0;\
                             while( obosc_tm_current->next_TM != NULL ){\
@@ -598,22 +589,24 @@
             }\
         }\
     }\
-    obosc_tm_current = obosc_tm_head;\
-    while( obosc_tm_current != NULL ){\
-        int length = TM_SHORT_SIZE;\
-        if( GETshort_or_long_tm(obosc_tm_current->fields) == SHORT_TM_CODE ){\
-            length = TM_SHORT_SIZE;\
+    if( obosc_executed_count != 0 ){\
+        obosc_tm_current = obosc_tm_head;\
+        while( obosc_tm_current != NULL ){\
+            int length = TM_SHORT_SIZE;\
+            if( GETshort_or_long_tm(obosc_tm_current->fields) == SHORT_TM_CODE ){\
+                length = TM_SHORT_SIZE;\
+            }\
+            else{\
+                length = TM_LONG_SIZE;\
+            }\
+            for(int i = 0 ; i < length ; ++i){\
+                gPC.putc(obosc_tm_current->TM_string[i]);\
+            }\
+            obosc_tm_current = obosc_tm_current->next_TM;\
         }\
-        else{\
-            length = TM_LONG_SIZE;\
-        }\
-        for(int i = 0 ; i < length ; ++i){\
-            gPC.putc(obosc_tm_current->TM_string[i]);\
-        }\
-        obosc_tm_current = obosc_tm_current->next_TM;\
+        /*snd_tm.head_pointer(obosc_tm_head);*/\
+        /*adf_not_SDcard();*/\
     }\
-    /*snd_tm.head_pointer(obosc_tm_head);*/\
-    /*adf_not_SDcard();*/\
     /*DELETE THE TM AFTER USE*/\
     obosc_tm_current = obosc_tm_head;\
     int overCount = 0;\
@@ -647,7 +640,7 @@
                         /*gPC.printf("disabled or completed at %u\n", execute_psc);*/\
                         break;\
                     }\
-                    else if( (current_exec_status == TC_STATE_EXECUTION_FAILED) && (GETabort_on_nack(current_TC) == 1) ){\
+                    else if( ((current_exec_status == TC_STATE_EXECUTION_FAILED) || (current_exec_status == TC_STATE_EXECUTION_UNKNOWN)) && (GETabort_on_nack(current_TC) == 1) ){\
                         /*gPC.printf("abort on nack at %u psc\r\n", execute_psc);*/\
                         gMASTER_STATE = TCL_STATE_ABORTED;\
                         break;\