CDMS code for testing sbc

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Revision:
213:3d13a06bcd3a
Parent:
122:b99f8be0a51a
Child:
216:570251b23c7b
--- a/common_functions.h	Sat Jun 18 09:07:28 2016 +0000
+++ b/common_functions.h	Sun Jul 03 05:37:25 2016 +0000
@@ -77,7 +77,7 @@
                     }\
                 }\
                 else{\
-                    /*PENDING: reset cdms*/\
+                    RESET_CDMS;\
                     break;\
                 }\
             }\
@@ -99,18 +99,24 @@
             /*Attach this new node at the end*/\
         }\
         else{\
-            /*PENDING: reset CDMS*/\
+            RESET_CDMS;\
             break;\
         }\
     }\
 }
 
 #define put_crc_l1_ack(tm_ptr) {\
-    tm_ptr->TM_string[2] = gTOTAL_CRC_FAIL_TC & 0xFF;\
     /*TC LIST STATUS*/\
-    tm_ptr->TM_string[3] |= (gMASTER_STATE << 5) & 0xE0;\
+    tm_ptr->TM_string[3] |= (gMASTER_STATE << 6) & 0xC0;\
     /*PA HOT*/\
     if( gFLAGS & COM_PA_HOT_FLAG ){\
+        tm_ptr->TM_string[3] |= (1 << 5);\
+    }\
+    else{\
+        tm_ptr->TM_string[3] &= ~(1 << 5);\
+    }\
+    /*PA OC*/\
+    if( gFLAGS & COM_PA_OC_FLAG ){\
         tm_ptr->TM_string[3] |= (1 << 4);\
     }\
     else{\
@@ -124,16 +130,39 @@
 #define fill_l1_ack(tm_ptr) {\
     tm_ptr->next_TM = NULL;\
     tm_ptr->TM_string[0] = TMID_ACK_L1 << 4;\
-    /*PENDING: PA TEMPERATURE*/\
     tm_ptr->TM_string[1] = gTOTAL_INCORRECT_SIZE_TC & 0xFF;\
     tm_ptr->TM_string[2] = gTOTAL_CRC_FAIL_TC & 0xFF;\
 }
 
+#define P_COM_HK{\
+    uint8_t returnHere;\
+    isPAhot(returnHere);\
+    if (returnHere == 0xFF)\
+        gFLAGS = gFLAGS & ~(COM_PA_HOT_FLAG);\
+    else\
+        gFLAGS = gFLAGS | COM_PA_HOT_FLAG;\
+    if (gFLAGS & COM_PA_OC_FLAG){\
+        COM_TX_CNTRL = 1;\
+        wait_ms(5);\
+    }\
+    isPAoc(returnHere);\
+    if (returnHere == 0xFF)\
+        gFLAGS = gFLAGS & ~(COM_PA_OC_FLAG);\
+    else\
+        gFLAGS = gFLAGS | COM_PA_OC_FLAG;\
+    /*P_CDMS_HANDLE_HW_FAULTS*/\
+}
+
 #define isPAhot(returnHere){\
     /*PENDING : COMPLETE THIS FUNCTION*/\
     returnHere = 0xFF;\
 }
 
+#define isPAoc(returnHere){\
+    /*PENDING : COMPLETE THIS FUNCTION*/\
+    returnHere = 0xFF;\
+}
+
 #define get_call_sign(tm_ptr) {\
     Base_tm* call_sign_tm = new Short_tm;\
     call_sign_tm->next_TM = NULL;\
@@ -156,7 +185,6 @@
             /*IF CRC PASS*/\
             if( (GETcrc_pass(current_TC) == 1) ){\
                 if(TC_count > 4){\
-                    /*PENDING: FILL TC_EXEC_CODE, APPEND CRC TO THE TM*/\
                     put_crc_l1_ack( l1_ack );\
                     /*extend the TM linked list*/\
                     TC_count = 0;\
@@ -189,7 +217,7 @@
             ++overflowCountL1;\
         }\
         else{\
-            /*PENDING: RESET CDMS*/\
+            RESET_CDMS;\
             break;\
         }\
     }\