samp Srinivasan / Mbed 2 deprecated CDMS_CODE_FM_28JAN2017

Dependencies:   SimpleDMA eeprom mbed-rtos mbed FreescaleIAP

Fork of CDMS_CODE by shubham c

Files at this revision

API Documentation at this revision

Comitter:
krishanprajapat
Date:
Sat Feb 06 10:27:11 2016 +0000
Parent:
111:daa937e649f5
Commit message:
added common_functions.h file

Changed in this revision

COM_MNG_TMTC.h Show annotated file Show diff for this revision Revisions of this file
OBSRS.h Show annotated file Show diff for this revision Revisions of this file
common_functions.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/COM_MNG_TMTC.h	Fri Feb 05 18:29:16 2016 +0000
+++ b/COM_MNG_TMTC.h	Sat Feb 06 10:27:11 2016 +0000
@@ -221,78 +221,7 @@
 @return:    none
 */
 /*tm_ptr is the next_TM of a linked list, and should have the value NULL, i.e. tm_ptr should be the next_TM pointer of thte last node */
-#define get_ack_l1( tm_ptr ){\
-    Base_tc *current_TC = gHEAD_NODE_TCL;\
-    Base_tm *l1_ack = new Short_tm;\
-    /*APPEND TO THE tm_ptr HERE*/\
-    tm_ptr = l1_ack;\
-    fill_l1_ack(l1_ack);\
-    int TC_count = 0;\
-    int overflowCountL1 = 0;\
-    while(current_TC != NULL){\
-        if( overflowCountL1 < TCL_OVERFLOW_CONSTANT ){\
-            /*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;\
-                    l1_ack->next_TM = new Short_tm;\
-                    l1_ack = l1_ack->next_TM;\
-                    fill_l1_ack(l1_ack);\
-                }\
-                /*PSC starts from 7th byte*/\
-                l1_ack->TM_string[6+TC_count] = GETpacket_seq_count(current_TC);\
-                /*TC exec status*/\
-                switch(TC_count){\
-                    case 0:\
-                        l1_ack->TM_string[3] = (GETexec_status(current_TC)) & 0x0F;\
-                        break;\
-                    case 1:\
-                        l1_ack->TM_string[4] = (GETexec_status(current_TC) << 4) & 0xF0;\
-                        break;\
-                    case 2:\
-                        l1_ack->TM_string[4] |= (GETexec_status(current_TC)) & 0x0F;\
-                        break;\
-                    case 3:\
-                        l1_ack->TM_string[5] = (GETexec_status(current_TC) << 4) & 0xF0;\
-                        break;\
-                    case 4:\
-                        l1_ack->TM_string[5] |= (GETexec_status(current_TC)) & 0x0F;\
-                }\
-                ++TC_count;\
-            }\
-            current_TC = current_TC->next_TC;\
-            ++overflowCountL1;\
-        }\
-        else{\
-            /*PENDING: RESET CDMS*/\
-            break;\
-        }\
-    }\
-    /*FILL UP THE REMAINING FIELDS WITH 0x00 as PSC, AND 0xF as tc exec status*/\
-    if( (TC_count < 5) && (TC_count != 0) ){\
-        while(TC_count < 5){\
-            l1_ack->TM_string[6+TC_count] = 0x00;\
-            switch(TC_count){\
-                case 1:\
-                    l1_ack->TM_string[4] = 0xF0;\
-                    break;\
-                case 2:\
-                    l1_ack->TM_string[4] |= 0x0F;\
-                    break;\
-                case 3:\
-                    l1_ack->TM_string[5] = 0xF0;\
-                    break;\
-                case 4:\
-                    l1_ack->TM_string[5] |= 0x0F;\
-            }\
-            ++TC_count;\
-        }\
-    }\
-    put_crc_l1_ack(l1_ack);\
-}
+
 
 /*tm_ptr is the next_TM of a linked list, and should have the value NULL, i.e. tm_ptr should be the next_TM pointer of thte last node */
 #define get_tc_list(tm_ptr, thePSC){\
@@ -1162,18 +1091,7 @@
 }
 
 /*tm_ptr is the next_TM of a linked list, and should have the value NULL, i.e. tm_ptr should be the next_TM pointer of thte last node */
-#define get_call_sign(tm_ptr) {\
-    Base_tm* call_sign_tm = new Short_tm;\
-    call_sign_tm->next_TM = NULL;\
-    tm_ptr = call_sign_tm;\
-    uint8_t temp8 = TMID_CALL_SIGN;\
-    PUTtmid(call_sign_tm->fields, temp8);\
-    temp8 = SHORT_TM_CODE;\
-    PUTshort_or_long_tm(call_sign_tm->fields, temp8);\
-    for( int i = 0 ; i < TM_SHORT_SIZE ; ++i ){\
-        call_sign_tm->TM_string[i] = gCALL_SIGN_STRING[i];\
-    }\
-}
+
 
 #define EXECUTE_OBOSC_ONLY {\
     int reset_flag = 0;\
--- a/OBSRS.h	Fri Feb 05 18:29:16 2016 +0000
+++ b/OBSRS.h	Sat Feb 06 10:27:11 2016 +0000
@@ -230,7 +230,7 @@
             new_session =false;\
             /*cout<<"call_sign_sent"<<" ";*/\
             T_frames_sent = T_frames_sent+2;\
-            if(SID==0x0 || SID==0x2 || SID==0x3 || SID==0x4 || SID==0x5){\
+            if(SID==0x1 || SID==0x2 || SID==0x3 || SID==0x4 || SID==0x5){\
                 valid_SID=true;\
                 /*cout<<"valid SID"<<ENDL;*/\
             }\
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common_functions.h	Sat Feb 06 10:27:11 2016 +0000
@@ -0,0 +1,85 @@
+#define get_call_sign(tm_ptr) {\
+    Base_tm* call_sign_tm = new Short_tm;\
+    call_sign_tm->next_TM = NULL;\
+    tm_ptr = call_sign_tm;\
+    uint8_t temp8 = TMID_CALL_SIGN;\
+    PUTtmid(call_sign_tm->fields, temp8);\
+    temp8 = SHORT_TM_CODE;\
+    PUTshort_or_long_tm(call_sign_tm->fields, temp8);\
+    for( int i = 0 ; i < TM_SHORT_SIZE ; ++i ){\
+        call_sign_tm->TM_string[i] = gCALL_SIGN_STRING[i];\
+    }\
+}
+
+#define get_ack_l1( tm_ptr ){\
+    Base_tc *current_TC = gHEAD_NODE_TCL;\
+    Base_tm *l1_ack = new Short_tm;\
+    /*APPEND TO THE tm_ptr HERE*/\
+    tm_ptr = l1_ack;\
+    fill_l1_ack(l1_ack);\
+    int TC_count = 0;\
+    int overflowCountL1 = 0;\
+    while(current_TC != NULL){\
+        if( overflowCountL1 < TCL_OVERFLOW_CONSTANT ){\
+            /*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;\
+                    l1_ack->next_TM = new Short_tm;\
+                    l1_ack = l1_ack->next_TM;\
+                    fill_l1_ack(l1_ack);\
+                }\
+                /*PSC starts from 7th byte*/\
+                l1_ack->TM_string[6+TC_count] = GETpacket_seq_count(current_TC);\
+                /*TC exec status*/\
+                switch(TC_count){\
+                    case 0:\
+                        l1_ack->TM_string[3] = (GETexec_status(current_TC)) & 0x0F;\
+                        break;\
+                    case 1:\
+                        l1_ack->TM_string[4] = (GETexec_status(current_TC) << 4) & 0xF0;\
+                        break;\
+                    case 2:\
+                        l1_ack->TM_string[4] |= (GETexec_status(current_TC)) & 0x0F;\
+                        break;\
+                    case 3:\
+                        l1_ack->TM_string[5] = (GETexec_status(current_TC) << 4) & 0xF0;\
+                        break;\
+                    case 4:\
+                        l1_ack->TM_string[5] |= (GETexec_status(current_TC)) & 0x0F;\
+                }\
+                ++TC_count;\
+            }\
+            current_TC = current_TC->next_TC;\
+            ++overflowCountL1;\
+        }\
+        else{\
+            /*PENDING: RESET CDMS*/\
+            break;\
+        }\
+    }\
+    /*FILL UP THE REMAINING FIELDS WITH 0x00 as PSC, AND 0xF as tc exec status*/\
+    if( (TC_count < 5) && (TC_count != 0) ){\
+        while(TC_count < 5){\
+            l1_ack->TM_string[6+TC_count] = 0x00;\
+            switch(TC_count){\
+                case 1:\
+                    l1_ack->TM_string[4] = 0xF0;\
+                    break;\
+                case 2:\
+                    l1_ack->TM_string[4] |= 0x0F;\
+                    break;\
+                case 3:\
+                    l1_ack->TM_string[5] = 0xF0;\
+                    break;\
+                case 4:\
+                    l1_ack->TM_string[5] |= 0x0F;\
+            }\
+            ++TC_count;\
+        }\
+    }\
+    put_crc_l1_ack(l1_ack);\
+}
\ No newline at end of file
--- a/main.cpp	Fri Feb 05 18:29:16 2016 +0000
+++ b/main.cpp	Sat Feb 06 10:27:11 2016 +0000
@@ -13,6 +13,7 @@
 #include "COM_SND_TM_functions.h"
 #include "COM_SND_TM.h"
 #include "cdms_sd.h"
+#include "common_functions.h"
 #include "OBSRS.h"
 #include "adf.h"
 #include "COM_RCV_TC.h"