for frequency correction testing
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
common_functions.h@321:42bdefc37270, 2016-12-10 (annotated)
- Committer:
- ee12b079
- Date:
- Sat Dec 10 11:49:13 2016 +0000
- Revision:
- 321:42bdefc37270
- Parent:
- 318:978d72f191f9
Flags corrected, to be tested
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ee12b079 | 321:42bdefc37270 | 1 | |
ee12b079 | 321:42bdefc37270 | 2 | #define RESET_CDMS NVIC_SystemReset() |
krishanprajapat | 117:bfdc807f3d3c | 3 | #define get_tc_list(tm_ptr, thePSC){\ |
krishanprajapat | 117:bfdc807f3d3c | 4 | uint8_t TM_PSC = 0xFF;\ |
krishanprajapat | 117:bfdc807f3d3c | 5 | uint8_t TC_PSC = thePSC;\ |
krishanprajapat | 117:bfdc807f3d3c | 6 | int overflowCount = 0;\ |
krishanprajapat | 117:bfdc807f3d3c | 7 | uint8_t TC_LIST_TAG = 0x00;\ |
krishanprajapat | 117:bfdc807f3d3c | 8 | Base_tc *temp_tc = gHEAD_NODE_TCL;\ |
krishanprajapat | 117:bfdc807f3d3c | 9 | bool first_time = true;\ |
krishanprajapat | 117:bfdc807f3d3c | 10 | Base_tm *current_tm = NULL;\ |
krishanprajapat | 117:bfdc807f3d3c | 11 | while( temp_tc != NULL ){\ |
krishanprajapat | 117:bfdc807f3d3c | 12 | if( overflowCount < TCL_OVERFLOW_CONSTANT ){\ |
krishanprajapat | 117:bfdc807f3d3c | 13 | TM_PSC = TM_PSC + 1;\ |
krishanprajapat | 117:bfdc807f3d3c | 14 | /*Increment TM_PSC for every new TM pointer created*/\ |
krishanprajapat | 117:bfdc807f3d3c | 15 | Base_tm *temp_tm = new Long_tm;\ |
krishanprajapat | 117:bfdc807f3d3c | 16 | temp_tm->next_TM = NULL;\ |
krishanprajapat | 117:bfdc807f3d3c | 17 | temp_tm->TM_string[0] = 0x38;\ |
krishanprajapat | 117:bfdc807f3d3c | 18 | /*Frame type(1) = 0; TMID = 0111; Spare = 000*/\ |
krishanprajapat | 117:bfdc807f3d3c | 19 | temp_tm->TM_string[1] = TC_PSC;\ |
krishanprajapat | 117:bfdc807f3d3c | 20 | temp_tm->TM_string[3] = TM_PSC;\ |
krishanprajapat | 117:bfdc807f3d3c | 21 | int indexCustom = 4, num_of_short_tc = 0;\ |
krishanprajapat | 117:bfdc807f3d3c | 22 | while(temp_tc != NULL){\ |
krishanprajapat | 117:bfdc807f3d3c | 23 | if( overflowCount < TCL_OVERFLOW_CONSTANT ){\ |
krishanprajapat | 117:bfdc807f3d3c | 24 | if( GETshort_or_long_tc(temp_tc) == SHORT_TC_CODE ){\ |
krishanprajapat | 117:bfdc807f3d3c | 25 | for( int i = 0 ; i < TC_SHORT_SIZE ; ++i ){\ |
krishanprajapat | 117:bfdc807f3d3c | 26 | temp_tm->TM_string[indexCustom + i] = temp_tc->TC_string[i];\ |
krishanprajapat | 117:bfdc807f3d3c | 27 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 28 | indexCustom = indexCustom + TC_SHORT_SIZE;\ |
krishanprajapat | 117:bfdc807f3d3c | 29 | ++overflowCount;\ |
krishanprajapat | 117:bfdc807f3d3c | 30 | /*INCREMENT STUFF*/\ |
krishanprajapat | 117:bfdc807f3d3c | 31 | temp_tc = temp_tc->next_TC;\ |
krishanprajapat | 117:bfdc807f3d3c | 32 | num_of_short_tc = num_of_short_tc + 1;\ |
krishanprajapat | 117:bfdc807f3d3c | 33 | if (temp_tc == NULL){\ |
krishanprajapat | 117:bfdc807f3d3c | 34 | for (int i = indexCustom ; i < TM_LONG_SIZE-2 ; ++i){\ |
krishanprajapat | 117:bfdc807f3d3c | 35 | temp_tm->TM_string[i] = 0;\ |
krishanprajapat | 117:bfdc807f3d3c | 36 | /*Fill remaining values with 0*/\ |
krishanprajapat | 117:bfdc807f3d3c | 37 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 38 | TC_LIST_TAG = num_of_short_tc;\ |
krishanprajapat | 117:bfdc807f3d3c | 39 | break;\ |
krishanprajapat | 117:bfdc807f3d3c | 40 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 41 | if( (GETshort_or_long_tc(temp_tc) == LONG_TC_CODE) || (num_of_short_tc == OBOSC_TCL_MAX_SHORT_SIZE) ){\ |
krishanprajapat | 117:bfdc807f3d3c | 42 | /*Next TC is long or memory is filled*/\ |
krishanprajapat | 117:bfdc807f3d3c | 43 | for(int i = indexCustom; i < TM_LONG_SIZE-2 ; ++i){\ |
krishanprajapat | 117:bfdc807f3d3c | 44 | temp_tm->TM_string[i] = 0;\ |
krishanprajapat | 117:bfdc807f3d3c | 45 | /*Fill remaining values with 0*/\ |
krishanprajapat | 117:bfdc807f3d3c | 46 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 47 | TC_LIST_TAG = num_of_short_tc;\ |
krishanprajapat | 117:bfdc807f3d3c | 48 | break;\ |
krishanprajapat | 117:bfdc807f3d3c | 49 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 50 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 51 | else if (TC_LIST_TAG == OBOSC_TCL_TAG_LONG_FIRST_HALF){\ |
krishanprajapat | 117:bfdc807f3d3c | 52 | /*Long TC, 2nd half*/\ |
krishanprajapat | 117:bfdc807f3d3c | 53 | for (int i = 0; i < OBOSC_LONG_TC_SECOND_HALF_SIZE ; ++i){\ |
krishanprajapat | 117:bfdc807f3d3c | 54 | temp_tm->TM_string[indexCustom + i] = temp_tc->TC_string[OBOSC_LONG_TC_FIRST_HALF_SIZE + i];\ |
krishanprajapat | 117:bfdc807f3d3c | 55 | /*Fill the TM with TC_values*/\ |
krishanprajapat | 117:bfdc807f3d3c | 56 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 57 | for (int i = OBOSC_LONG_TC_SECOND_HALF_SIZE + indexCustom ; i < TM_LONG_SIZE-2 ; ++i ){\ |
krishanprajapat | 117:bfdc807f3d3c | 58 | temp_tm->TM_string[i] = 0;\ |
krishanprajapat | 117:bfdc807f3d3c | 59 | /*Fill remaining values with 0*/\ |
krishanprajapat | 117:bfdc807f3d3c | 60 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 61 | temp_tc = temp_tc->next_TC;\ |
krishanprajapat | 117:bfdc807f3d3c | 62 | TC_LIST_TAG = OBOSC_TCL_TAG_LONG_SECOND_HALF;\ |
krishanprajapat | 117:bfdc807f3d3c | 63 | ++overflowCount;\ |
krishanprajapat | 117:bfdc807f3d3c | 64 | break;\ |
krishanprajapat | 117:bfdc807f3d3c | 65 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 66 | else{\ |
krishanprajapat | 117:bfdc807f3d3c | 67 | /*Long TC, 1st half */\ |
krishanprajapat | 117:bfdc807f3d3c | 68 | for (int i = 0; i < OBOSC_LONG_TC_FIRST_HALF_SIZE; ++i){\ |
krishanprajapat | 117:bfdc807f3d3c | 69 | /*gPC.printf("indexCustom = %d\r\n", indexCustom);*/\ |
krishanprajapat | 117:bfdc807f3d3c | 70 | temp_tm->TM_string[indexCustom + i] = temp_tc->TC_string[i];\ |
krishanprajapat | 117:bfdc807f3d3c | 71 | /*Fill the TM with TC_values*/\ |
krishanprajapat | 117:bfdc807f3d3c | 72 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 73 | for (int i = OBOSC_LONG_TC_FIRST_HALF_SIZE + indexCustom ; i < TM_LONG_SIZE-2 ; ++i ){\ |
krishanprajapat | 117:bfdc807f3d3c | 74 | temp_tm->TM_string[i] = 0;\ |
krishanprajapat | 117:bfdc807f3d3c | 75 | /*Fill remaining values with 0*/\ |
krishanprajapat | 117:bfdc807f3d3c | 76 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 77 | TC_LIST_TAG = OBOSC_TCL_TAG_LONG_FIRST_HALF;\ |
krishanprajapat | 117:bfdc807f3d3c | 78 | break;\ |
krishanprajapat | 117:bfdc807f3d3c | 79 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 80 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 81 | else{\ |
aniruddhv | 262:752c8689944a | 82 | RESET_CDMS;\ |
krishanprajapat | 117:bfdc807f3d3c | 83 | break;\ |
krishanprajapat | 117:bfdc807f3d3c | 84 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 85 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 86 | temp_tm->TM_string[2] = TC_LIST_TAG;\ |
krishanprajapat | 117:bfdc807f3d3c | 87 | /*TC_LIST_TAG as is updated in the inner while loop*/\ |
krishanprajapat | 117:bfdc807f3d3c | 88 | uint16_t crc16 = crc16_gen(temp_tm->TM_string, TM_LONG_SIZE-2);\ |
krishanprajapat | 117:bfdc807f3d3c | 89 | temp_tm->TM_string[TM_LONG_SIZE-2] = (crc16 & 0xFF00) >> 8 ;\ |
krishanprajapat | 117:bfdc807f3d3c | 90 | temp_tm->TM_string[TM_LONG_SIZE-1] = crc16 & 0x00FF;\ |
krishanprajapat | 117:bfdc807f3d3c | 91 | /*Attach this new node to the TM linked list*/\ |
krishanprajapat | 117:bfdc807f3d3c | 92 | if( first_time ){\ |
krishanprajapat | 117:bfdc807f3d3c | 93 | first_time = false;\ |
krishanprajapat | 117:bfdc807f3d3c | 94 | tm_ptr = temp_tm;\ |
krishanprajapat | 117:bfdc807f3d3c | 95 | current_tm = temp_tm;\ |
krishanprajapat | 117:bfdc807f3d3c | 96 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 97 | else{\ |
krishanprajapat | 117:bfdc807f3d3c | 98 | current_tm->next_TM = temp_tm;\ |
krishanprajapat | 117:bfdc807f3d3c | 99 | current_tm = current_tm->next_TM;\ |
krishanprajapat | 117:bfdc807f3d3c | 100 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 101 | /*Attach this new node at the end*/\ |
krishanprajapat | 117:bfdc807f3d3c | 102 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 103 | else{\ |
aniruddhv | 262:752c8689944a | 104 | RESET_CDMS;\ |
krishanprajapat | 117:bfdc807f3d3c | 105 | break;\ |
krishanprajapat | 117:bfdc807f3d3c | 106 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 107 | }\ |
krishanprajapat | 117:bfdc807f3d3c | 108 | } |
krishanprajapat | 117:bfdc807f3d3c | 109 | |
krishanprajapat | 122:b99f8be0a51a | 110 | #define put_crc_l1_ack(tm_ptr) {\ |
krishanprajapat | 122:b99f8be0a51a | 111 | /*TC LIST STATUS*/\ |
aniruddhv | 262:752c8689944a | 112 | tm_ptr->TM_string[3] |= (gMASTER_STATE << 6) & 0xC0;\ |
krishanprajapat | 122:b99f8be0a51a | 113 | /*PA HOT*/\ |
krishanprajapat | 122:b99f8be0a51a | 114 | if( gFLAGS & COM_PA_HOT_FLAG ){\ |
aniruddhv | 262:752c8689944a | 115 | tm_ptr->TM_string[3] |= (1 << 5);\ |
aniruddhv | 262:752c8689944a | 116 | }\ |
aniruddhv | 262:752c8689944a | 117 | else{\ |
aniruddhv | 262:752c8689944a | 118 | tm_ptr->TM_string[3] &= ~(1 << 5);\ |
aniruddhv | 262:752c8689944a | 119 | }\ |
aniruddhv | 262:752c8689944a | 120 | /*PA OC*/\ |
aniruddhv | 262:752c8689944a | 121 | if( gFLAGS & COM_PA_OC_FLAG ){\ |
krishanprajapat | 122:b99f8be0a51a | 122 | tm_ptr->TM_string[3] |= (1 << 4);\ |
krishanprajapat | 122:b99f8be0a51a | 123 | }\ |
krishanprajapat | 122:b99f8be0a51a | 124 | else{\ |
krishanprajapat | 122:b99f8be0a51a | 125 | tm_ptr->TM_string[3] &= ~(1 << 4);\ |
krishanprajapat | 122:b99f8be0a51a | 126 | }\ |
krishanprajapat | 122:b99f8be0a51a | 127 | uint16_t crc_checksum = crc16_gen(tm_ptr->TM_string, TM_SHORT_SIZE-2);\ |
krishanprajapat | 122:b99f8be0a51a | 128 | tm_ptr->TM_string[TM_SHORT_SIZE-2] = (crc_checksum >> 8) & 0xFF;\ |
krishanprajapat | 122:b99f8be0a51a | 129 | tm_ptr->TM_string[TM_SHORT_SIZE-1] = crc_checksum & 0xFF;\ |
krishanprajapat | 122:b99f8be0a51a | 130 | } |
krishanprajapat | 122:b99f8be0a51a | 131 | |
krishanprajapat | 122:b99f8be0a51a | 132 | #define fill_l1_ack(tm_ptr) {\ |
krishanprajapat | 122:b99f8be0a51a | 133 | tm_ptr->next_TM = NULL;\ |
krishanprajapat | 122:b99f8be0a51a | 134 | tm_ptr->TM_string[0] = TMID_ACK_L1 << 4;\ |
krishanprajapat | 122:b99f8be0a51a | 135 | tm_ptr->TM_string[1] = gTOTAL_INCORRECT_SIZE_TC & 0xFF;\ |
krishanprajapat | 122:b99f8be0a51a | 136 | tm_ptr->TM_string[2] = gTOTAL_CRC_FAIL_TC & 0xFF;\ |
krishanprajapat | 122:b99f8be0a51a | 137 | } |
krishanprajapat | 122:b99f8be0a51a | 138 | |
aniruddhv | 262:752c8689944a | 139 | #define P_COM_HK{\ |
aniruddhv | 262:752c8689944a | 140 | uint8_t returnHere;\ |
aniruddhv | 262:752c8689944a | 141 | isPAhot(returnHere);\ |
aniruddhv | 262:752c8689944a | 142 | if (returnHere == 0xFF)\ |
aniruddhv | 264:f7d8f9f361e3 | 143 | gFLAGS = gFLAGS | COM_PA_HOT_FLAG;\ |
aniruddhv | 262:752c8689944a | 144 | else\ |
aniruddhv | 264:f7d8f9f361e3 | 145 | gFLAGS = gFLAGS & ~(COM_PA_HOT_FLAG);\ |
aniruddhv | 262:752c8689944a | 146 | if (gFLAGS & COM_PA_OC_FLAG){\ |
aniruddhv | 262:752c8689944a | 147 | COM_TX_CNTRL = 1;\ |
aniruddhv | 262:752c8689944a | 148 | wait_ms(5);\ |
aniruddhv | 262:752c8689944a | 149 | }\ |
aniruddhv | 262:752c8689944a | 150 | isPAoc(returnHere);\ |
aniruddhv | 262:752c8689944a | 151 | if (returnHere == 0xFF)\ |
aniruddhv | 264:f7d8f9f361e3 | 152 | gFLAGS = gFLAGS | COM_PA_OC_FLAG;\ |
aniruddhv | 262:752c8689944a | 153 | else\ |
aniruddhv | 264:f7d8f9f361e3 | 154 | gFLAGS = gFLAGS & ~(COM_PA_OC_FLAG);\ |
aniruddhv | 262:752c8689944a | 155 | /*P_CDMS_HANDLE_HW_FAULTS*/\ |
aniruddhv | 262:752c8689944a | 156 | } |
aniruddhv | 262:752c8689944a | 157 | |
krishanprajapat | 122:b99f8be0a51a | 158 | #define isPAhot(returnHere){\ |
aniruddhv | 262:752c8689944a | 159 | uint8_t pa_temp = 0;\ |
aniruddhv | 262:752c8689944a | 160 | SelectLinec0=0;\ |
aniruddhv | 262:752c8689944a | 161 | SelectLinec1=0;\ |
aniruddhv | 262:752c8689944a | 162 | SelectLinec2=0;\ |
aniruddhv | 262:752c8689944a | 163 | SelectLinec3=1;\ |
aniruddhv | 262:752c8689944a | 164 | pa_temp = TempInput.read();\ |
aniruddhv | 262:752c8689944a | 165 | pa_temp = pa_temp * 3.3;\ |
ee12b079 | 318:978d72f191f9 | 166 | float resistance;\ |
aniruddhv | 262:752c8689944a | 167 | resistance = 24000 * pa_temp/(3.3 - pa_temp);\ |
aniruddhv | 262:752c8689944a | 168 | if(pa_temp > 1.47) {\ |
aniruddhv | 262:752c8689944a | 169 | pa_temp = 3694/log(24.032242*resistance);\ |
aniruddhv | 262:752c8689944a | 170 | }\ |
aniruddhv | 262:752c8689944a | 171 | else{\ |
aniruddhv | 262:752c8689944a | 172 | pa_temp = 3365.4/log(7.60573*resistance);\ |
aniruddhv | 262:752c8689944a | 173 | }\ |
ee12b079 | 318:978d72f191f9 | 174 | COM_PA_IC_TMP = quantiz(tstart_thermistor,tstep_thermistor,pa_temp);\ |
ee12b079 | 318:978d72f191f9 | 175 | /*comment this ater*/\ |
ee12b079 | 318:978d72f191f9 | 176 | COM_PA_IC_TMP = 0;\ |
ee12b079 | 318:978d72f191f9 | 177 | /*COM_PA_TMP_HIGH to be found*/\ |
ee12b079 | 318:978d72f191f9 | 178 | if (COM_PA_IC_TMP > COM_PA_TMP_HIGH){\ |
aniruddhv | 264:f7d8f9f361e3 | 179 | returnHere = 0xFF;\ |
aniruddhv | 264:f7d8f9f361e3 | 180 | gPC.puts("PA is measured HOT\r\n");\ |
aniruddhv | 262:752c8689944a | 181 | }\ |
aniruddhv | 262:752c8689944a | 182 | else{\ |
aniruddhv | 264:f7d8f9f361e3 | 183 | returnHere = 0;\ |
aniruddhv | 264:f7d8f9f361e3 | 184 | gPC.puts("PA is measured not HOT\r\n");\ |
aniruddhv | 262:752c8689944a | 185 | }\ |
aniruddhv | 262:752c8689944a | 186 | } |
aniruddhv | 262:752c8689944a | 187 | |
aniruddhv | 262:752c8689944a | 188 | #define isPAoc(returnHere){\ |
aniruddhv | 264:f7d8f9f361e3 | 189 | if (COM_TX_OC_FAULT){\ |
aniruddhv | 264:f7d8f9f361e3 | 190 | returnHere = 0xFF;\ |
aniruddhv | 264:f7d8f9f361e3 | 191 | }\ |
aniruddhv | 264:f7d8f9f361e3 | 192 | else{\ |
aniruddhv | 262:752c8689944a | 193 | returnHere = 0;\ |
aniruddhv | 264:f7d8f9f361e3 | 194 | }\ |
aniruddhv | 264:f7d8f9f361e3 | 195 | returnHere = 0;\ |
krishanprajapat | 122:b99f8be0a51a | 196 | } |
krishanprajapat | 122:b99f8be0a51a | 197 | |
krishanprajapat | 117:bfdc807f3d3c | 198 | #define get_call_sign(tm_ptr) {\ |
krishanprajapat | 117:bfdc807f3d3c | 199 | Base_tm* call_sign_tm = new Short_tm;\ |
krishanprajapat | 117:bfdc807f3d3c | 200 | call_sign_tm->next_TM = NULL;\ |
krishanprajapat | 117:bfdc807f3d3c | 201 | tm_ptr = call_sign_tm;\ |
krishanprajapat | 117:bfdc807f3d3c | 202 | for( int i = 0 ; i < TM_SHORT_SIZE ; ++i ){\ |
krishanprajapat | 117:bfdc807f3d3c | 203 | call_sign_tm->TM_string[i] = gCALL_SIGN_STRING[i];\ |
krishanprajapat | 117:bfdc807f3d3c | 204 | }\ |
krishanprajapat | 119:2b5632bc78ab | 205 | } |
krishanprajapat | 119:2b5632bc78ab | 206 | |
krishanprajapat | 119:2b5632bc78ab | 207 | #define get_ack_l1( tm_ptr ){\ |
krishanprajapat | 119:2b5632bc78ab | 208 | Base_tc *current_TC = gHEAD_NODE_TCL;\ |
krishanprajapat | 119:2b5632bc78ab | 209 | Base_tm *l1_ack = new Short_tm;\ |
krishanprajapat | 119:2b5632bc78ab | 210 | /*APPEND TO THE tm_ptr HERE*/\ |
krishanprajapat | 119:2b5632bc78ab | 211 | tm_ptr = l1_ack;\ |
krishanprajapat | 119:2b5632bc78ab | 212 | fill_l1_ack(l1_ack);\ |
krishanprajapat | 119:2b5632bc78ab | 213 | int TC_count = 0;\ |
krishanprajapat | 119:2b5632bc78ab | 214 | int overflowCountL1 = 0;\ |
krishanprajapat | 119:2b5632bc78ab | 215 | while(current_TC != NULL){\ |
krishanprajapat | 119:2b5632bc78ab | 216 | if( overflowCountL1 < TCL_OVERFLOW_CONSTANT ){\ |
krishanprajapat | 119:2b5632bc78ab | 217 | /*IF CRC PASS*/\ |
krishanprajapat | 119:2b5632bc78ab | 218 | if( (GETcrc_pass(current_TC) == 1) ){\ |
krishanprajapat | 119:2b5632bc78ab | 219 | if(TC_count > 4){\ |
krishanprajapat | 119:2b5632bc78ab | 220 | put_crc_l1_ack( l1_ack );\ |
krishanprajapat | 119:2b5632bc78ab | 221 | /*extend the TM linked list*/\ |
krishanprajapat | 119:2b5632bc78ab | 222 | TC_count = 0;\ |
krishanprajapat | 119:2b5632bc78ab | 223 | l1_ack->next_TM = new Short_tm;\ |
krishanprajapat | 119:2b5632bc78ab | 224 | l1_ack = l1_ack->next_TM;\ |
krishanprajapat | 119:2b5632bc78ab | 225 | fill_l1_ack(l1_ack);\ |
krishanprajapat | 119:2b5632bc78ab | 226 | }\ |
krishanprajapat | 119:2b5632bc78ab | 227 | /*PSC starts from 7th byte*/\ |
krishanprajapat | 119:2b5632bc78ab | 228 | l1_ack->TM_string[6+TC_count] = GETpacket_seq_count(current_TC);\ |
krishanprajapat | 119:2b5632bc78ab | 229 | /*TC exec status*/\ |
krishanprajapat | 119:2b5632bc78ab | 230 | switch(TC_count){\ |
krishanprajapat | 119:2b5632bc78ab | 231 | case 0:\ |
krishanprajapat | 119:2b5632bc78ab | 232 | l1_ack->TM_string[3] = (GETexec_status(current_TC)) & 0x0F;\ |
krishanprajapat | 119:2b5632bc78ab | 233 | break;\ |
krishanprajapat | 119:2b5632bc78ab | 234 | case 1:\ |
krishanprajapat | 119:2b5632bc78ab | 235 | l1_ack->TM_string[4] = (GETexec_status(current_TC) << 4) & 0xF0;\ |
krishanprajapat | 119:2b5632bc78ab | 236 | break;\ |
krishanprajapat | 119:2b5632bc78ab | 237 | case 2:\ |
krishanprajapat | 119:2b5632bc78ab | 238 | l1_ack->TM_string[4] |= (GETexec_status(current_TC)) & 0x0F;\ |
krishanprajapat | 119:2b5632bc78ab | 239 | break;\ |
krishanprajapat | 119:2b5632bc78ab | 240 | case 3:\ |
krishanprajapat | 119:2b5632bc78ab | 241 | l1_ack->TM_string[5] = (GETexec_status(current_TC) << 4) & 0xF0;\ |
krishanprajapat | 119:2b5632bc78ab | 242 | break;\ |
krishanprajapat | 119:2b5632bc78ab | 243 | case 4:\ |
krishanprajapat | 119:2b5632bc78ab | 244 | l1_ack->TM_string[5] |= (GETexec_status(current_TC)) & 0x0F;\ |
krishanprajapat | 119:2b5632bc78ab | 245 | }\ |
krishanprajapat | 119:2b5632bc78ab | 246 | ++TC_count;\ |
krishanprajapat | 119:2b5632bc78ab | 247 | }\ |
krishanprajapat | 119:2b5632bc78ab | 248 | current_TC = current_TC->next_TC;\ |
krishanprajapat | 119:2b5632bc78ab | 249 | ++overflowCountL1;\ |
krishanprajapat | 119:2b5632bc78ab | 250 | }\ |
krishanprajapat | 119:2b5632bc78ab | 251 | else{\ |
aniruddhv | 262:752c8689944a | 252 | RESET_CDMS;\ |
krishanprajapat | 119:2b5632bc78ab | 253 | break;\ |
krishanprajapat | 119:2b5632bc78ab | 254 | }\ |
krishanprajapat | 119:2b5632bc78ab | 255 | }\ |
krishanprajapat | 119:2b5632bc78ab | 256 | /*FILL UP THE REMAINING FIELDS WITH 0x00 as PSC, AND 0xF as tc exec status*/\ |
krishanprajapat | 119:2b5632bc78ab | 257 | if( (TC_count < 5) && (TC_count != 0) ){\ |
krishanprajapat | 119:2b5632bc78ab | 258 | while(TC_count < 5){\ |
krishanprajapat | 119:2b5632bc78ab | 259 | l1_ack->TM_string[6+TC_count] = 0x00;\ |
krishanprajapat | 119:2b5632bc78ab | 260 | switch(TC_count){\ |
krishanprajapat | 119:2b5632bc78ab | 261 | case 1:\ |
krishanprajapat | 119:2b5632bc78ab | 262 | l1_ack->TM_string[4] = 0xF0;\ |
krishanprajapat | 119:2b5632bc78ab | 263 | break;\ |
krishanprajapat | 119:2b5632bc78ab | 264 | case 2:\ |
krishanprajapat | 119:2b5632bc78ab | 265 | l1_ack->TM_string[4] |= 0x0F;\ |
krishanprajapat | 119:2b5632bc78ab | 266 | break;\ |
krishanprajapat | 119:2b5632bc78ab | 267 | case 3:\ |
krishanprajapat | 119:2b5632bc78ab | 268 | l1_ack->TM_string[5] = 0xF0;\ |
krishanprajapat | 119:2b5632bc78ab | 269 | break;\ |
krishanprajapat | 119:2b5632bc78ab | 270 | case 4:\ |
krishanprajapat | 119:2b5632bc78ab | 271 | l1_ack->TM_string[5] |= 0x0F;\ |
krishanprajapat | 119:2b5632bc78ab | 272 | }\ |
krishanprajapat | 119:2b5632bc78ab | 273 | ++TC_count;\ |
krishanprajapat | 119:2b5632bc78ab | 274 | }\ |
krishanprajapat | 119:2b5632bc78ab | 275 | }\ |
krishanprajapat | 119:2b5632bc78ab | 276 | put_crc_l1_ack(l1_ack);\ |
krishanprajapat | 117:bfdc807f3d3c | 277 | } |