CDMS code for testing sbc

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Revision:
122:b99f8be0a51a
Parent:
119:2b5632bc78ab
Child:
213:3d13a06bcd3a
Child:
262:752c8689944a
--- a/common_functions.h	Sat Feb 06 20:06:25 2016 +0000
+++ b/common_functions.h	Sun Feb 07 05:28:56 2016 +0000
@@ -105,6 +105,35 @@
     }\
 }
 
+#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;\
+    /*PA HOT*/\
+    if( gFLAGS & COM_PA_HOT_FLAG ){\
+        tm_ptr->TM_string[3] |= (1 << 4);\
+    }\
+    else{\
+        tm_ptr->TM_string[3] &= ~(1 << 4);\
+    }\
+    uint16_t crc_checksum = crc16_gen(tm_ptr->TM_string, TM_SHORT_SIZE-2);\
+    tm_ptr->TM_string[TM_SHORT_SIZE-2] = (crc_checksum >> 8) & 0xFF;\
+    tm_ptr->TM_string[TM_SHORT_SIZE-1] = crc_checksum & 0xFF;\
+}
+
+#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 isPAhot(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;\