Hi Shubham I am just using this to test PYLD code
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of COM_MNG_TMTC_SIMPLE by
common_functions.h
- Committer:
- krishanprajapat
- Date:
- 2016-02-06
- Revision:
- 117:bfdc807f3d3c
- Child:
- 119:2b5632bc78ab
File content as of revision 117:bfdc807f3d3c:
#define get_tc_list(tm_ptr, thePSC){\ uint8_t TM_PSC = 0xFF;\ uint8_t TC_PSC = thePSC;\ int overflowCount = 0;\ uint8_t TC_LIST_TAG = 0x00;\ Base_tc *temp_tc = gHEAD_NODE_TCL;\ bool first_time = true;\ Base_tm *current_tm = NULL;\ while( temp_tc != NULL ){\ if( overflowCount < TCL_OVERFLOW_CONSTANT ){\ TM_PSC = TM_PSC + 1;\ /*Increment TM_PSC for every new TM pointer created*/\ Base_tm *temp_tm = new Long_tm;\ temp_tm->next_TM = NULL;\ temp_tm->TM_string[0] = 0x38;\ /*Frame type(1) = 0; TMID = 0111; Spare = 000*/\ temp_tm->TM_string[1] = TC_PSC;\ temp_tm->TM_string[3] = TM_PSC;\ int indexCustom = 4, num_of_short_tc = 0;\ while(temp_tc != NULL){\ if( overflowCount < TCL_OVERFLOW_CONSTANT ){\ if( GETshort_or_long_tc(temp_tc) == SHORT_TC_CODE ){\ for( int i = 0 ; i < TC_SHORT_SIZE ; ++i ){\ temp_tm->TM_string[indexCustom + i] = temp_tc->TC_string[i];\ }\ indexCustom = indexCustom + TC_SHORT_SIZE;\ ++overflowCount;\ /*INCREMENT STUFF*/\ temp_tc = temp_tc->next_TC;\ num_of_short_tc = num_of_short_tc + 1;\ if (temp_tc == NULL){\ for (int i = indexCustom ; i < TM_LONG_SIZE-2 ; ++i){\ temp_tm->TM_string[i] = 0;\ /*Fill remaining values with 0*/\ }\ TC_LIST_TAG = num_of_short_tc;\ break;\ }\ if( (GETshort_or_long_tc(temp_tc) == LONG_TC_CODE) || (num_of_short_tc == OBOSC_TCL_MAX_SHORT_SIZE) ){\ /*Next TC is long or memory is filled*/\ for(int i = indexCustom; i < TM_LONG_SIZE-2 ; ++i){\ temp_tm->TM_string[i] = 0;\ /*Fill remaining values with 0*/\ }\ TC_LIST_TAG = num_of_short_tc;\ break;\ }\ }\ else if (TC_LIST_TAG == OBOSC_TCL_TAG_LONG_FIRST_HALF){\ /*Long TC, 2nd half*/\ for (int i = 0; i < OBOSC_LONG_TC_SECOND_HALF_SIZE ; ++i){\ temp_tm->TM_string[indexCustom + i] = temp_tc->TC_string[OBOSC_LONG_TC_FIRST_HALF_SIZE + i];\ /*Fill the TM with TC_values*/\ }\ for (int i = OBOSC_LONG_TC_SECOND_HALF_SIZE + indexCustom ; i < TM_LONG_SIZE-2 ; ++i ){\ temp_tm->TM_string[i] = 0;\ /*Fill remaining values with 0*/\ }\ temp_tc = temp_tc->next_TC;\ TC_LIST_TAG = OBOSC_TCL_TAG_LONG_SECOND_HALF;\ ++overflowCount;\ break;\ }\ else{\ /*Long TC, 1st half */\ for (int i = 0; i < OBOSC_LONG_TC_FIRST_HALF_SIZE; ++i){\ /*gPC.printf("indexCustom = %d\r\n", indexCustom);*/\ temp_tm->TM_string[indexCustom + i] = temp_tc->TC_string[i];\ /*Fill the TM with TC_values*/\ }\ for (int i = OBOSC_LONG_TC_FIRST_HALF_SIZE + indexCustom ; i < TM_LONG_SIZE-2 ; ++i ){\ temp_tm->TM_string[i] = 0;\ /*Fill remaining values with 0*/\ }\ TC_LIST_TAG = OBOSC_TCL_TAG_LONG_FIRST_HALF;\ break;\ }\ }\ else{\ /*PENDING: reset cdms*/\ break;\ }\ }\ temp_tm->TM_string[2] = TC_LIST_TAG;\ /*TC_LIST_TAG as is updated in the inner while loop*/\ uint16_t crc16 = crc16_gen(temp_tm->TM_string, TM_LONG_SIZE-2);\ temp_tm->TM_string[TM_LONG_SIZE-2] = (crc16 & 0xFF00) >> 8 ;\ temp_tm->TM_string[TM_LONG_SIZE-1] = crc16 & 0x00FF;\ /*Attach this new node to the TM linked list*/\ if( first_time ){\ first_time = false;\ tm_ptr = temp_tm;\ current_tm = temp_tm;\ }\ else{\ current_tm->next_TM = temp_tm;\ current_tm = current_tm->next_TM;\ }\ /*Attach this new node at the end*/\ }\ else{\ /*PENDING: reset CDMS*/\ break;\ }\ }\ } #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;\ for( int i = 0 ; i < TM_SHORT_SIZE ; ++i ){\ call_sign_tm->TM_string[i] = gCALL_SIGN_STRING[i];\ }\ }