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:
- 119:2b5632bc78ab
- Parent:
- 117:bfdc807f3d3c
- Child:
- 122:b99f8be0a51a
diff -r 60c5de4cb8ad -r 2b5632bc78ab common_functions.h
--- a/common_functions.h Sat Feb 06 10:48:07 2016 +0000
+++ b/common_functions.h Sat Feb 06 18:57:41 2016 +0000
@@ -112,4 +112,77 @@
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
