Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: common_functions.h
- Revision:
- 116:8f431a8bbe82
--- /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
