CDMS code for testing sbc
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: ThreadsAndFunctions.h
- Revision:
- 5:ab276a17ca07
- Parent:
- 4:104dd82c99b8
- Child:
- 6:79d422d1ed42
diff -r 104dd82c99b8 -r ab276a17ca07 ThreadsAndFunctions.h --- a/ThreadsAndFunctions.h Tue Dec 29 06:50:19 2015 +0000 +++ b/ThreadsAndFunctions.h Wed Dec 30 06:36:38 2015 +0000 @@ -21,16 +21,24 @@ #define reset_all {\ Base_tc *tcp = gHEAD_NODE_TCL;\ + gPC.puts("inside reset\r\n");\ + gFLAGS = 0x0000;\ while(tcp != NULL){\ Base_tc *temp = tcp->next_TC;\ delete tcp;\ tcp = temp;\ }\ - rx_tc_frames = 0;\ - rx_tc_frames = 0;\ + gHEAD_NODE_TCL = NULL;\ + gLAST_NODE_TCL = NULL;\ + gMASTER_STATE = TCL_STATE_INCOMPLETE;\ gTOTAL_INCORRECT_SIZE_TC = 0;\ gTOTAL_CRC_FAIL_TC = 0;\ gTOTAL_REPEATED_TC = 0;\ + gTOTAL_VALID_TC = 0;\ + for(int i = 0 ; i < TM_LONG_SIZE ; ++i){\ + gLAST_TM[i] = 0x00;\ + }\ + gLAST_TM_SHORT_OR_LONG = SHORT_TM_CODE;\ COM_RX_DATA_NODE *dataptr = gRX_HEAD_DATA_NODE;\ while( dataptr != NULL ){\ COM_RX_DATA_NODE *temp = dataptr->next_node;\ @@ -42,6 +50,7 @@ gRX_CURRENT_DATA_NODE = gRX_HEAD_DATA_NODE;\ gRX_COUNT = 0;\ /*PENDING : ALL GLOBAL VAARIABLES AND FLAGS*/\ + gPC.puts("finished reset all\r\n");\ } #define PUT_RAW_BYTE {\ @@ -59,7 +68,6 @@ void COM_MNG_TMTC_FUN(void const *args){ if( !(gFLAGS & COM_SESSION_FLAG) ){ - gPC.puts("com session is flase\r\n"); gLEDR = 1; gLEDG = 1; } @@ -120,7 +128,8 @@ // CHECK WEATHER GS VERIFICATION CODE MATCHES uint8_t tempGSver = 0x00; GScodeVerification(tempGSver); - if( tempGSver ){ + /*PENDING: INCLUDE GS VERIFICATION CODE*/ + if( true ){ gPC.puts("GC code match !!\r\n"); gFLAGS = gFLAGS | COM_SESSION_VALIDITY; COM_POWER_ON_TX; @@ -151,6 +160,32 @@ } } else{ + gPC.puts("tc list is not complete\r\n"); + if(tempContinue & 0x01){ + gPC.puts("last packet bit not found\r\n"); + } + if( tempContinue & 0x02 ){ + gPC.puts("missing psc found\r\n"); + } + gPC.printf("crc fail tc = %u\r\n", gTOTAL_CRC_FAIL_TC); + gPC.printf("incorrect size tc = %u\r\n", gTOTAL_INCORRECT_SIZE_TC); + gPC.printf("repeated psc = %u\r\n", gTOTAL_REPEATED_TC); + Base_tc *test_tc = gHEAD_NODE_TCL; + while( test_tc != NULL ){ + int length = 0; + if( GETshort_or_long_tc(test_tc) == SHORT_TC_CODE ){ + length = TC_SHORT_SIZE; + } + else{ + length = TC_LONG_SIZE; + } + for(int i = 0 ; i < length ; ++i ){ + gPC.printf("%x ", test_tc->TC_string[i]); + } + gPC.puts("\r\n"); + test_tc = test_tc->next_TC; + } + gPC.puts("\r\n"); COM_POWER_ON_TX; // PENDING : POWER OFF TX RX1M.attach(&rx_read, Serial::RxIrq);