publishing to check changes in cdms code
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE_samp_23SEP_DMA_flag by
Diff: common_functions.h
- Revision:
- 262:752c8689944a
- Parent:
- 122:b99f8be0a51a
- Child:
- 264:f7d8f9f361e3
diff -r 1e54415b34d3 -r 752c8689944a common_functions.h --- a/common_functions.h Thu Jul 14 13:07:30 2016 +0000 +++ b/common_functions.h Thu Jul 14 17:57:05 2016 +0000 @@ -77,7 +77,7 @@ }\ }\ else{\ - /*PENDING: reset cdms*/\ + RESET_CDMS;\ break;\ }\ }\ @@ -99,18 +99,24 @@ /*Attach this new node at the end*/\ }\ else{\ - /*PENDING: reset CDMS*/\ + RESET_CDMS;\ break;\ }\ }\ } #define put_crc_l1_ack(tm_ptr) {\ - tm_ptr->TM_string[2] = gTOTAL_CRC_FAIL_TC & 0xFF;\ /*TC LIST STATUS*/\ - tm_ptr->TM_string[3] |= (gMASTER_STATE << 5) & 0xE0;\ + tm_ptr->TM_string[3] |= (gMASTER_STATE << 6) & 0xC0;\ /*PA HOT*/\ if( gFLAGS & COM_PA_HOT_FLAG ){\ + tm_ptr->TM_string[3] |= (1 << 5);\ + }\ + else{\ + tm_ptr->TM_string[3] &= ~(1 << 5);\ + }\ + /*PA OC*/\ + if( gFLAGS & COM_PA_OC_FLAG ){\ tm_ptr->TM_string[3] |= (1 << 4);\ }\ else{\ @@ -124,14 +130,60 @@ #define fill_l1_ack(tm_ptr) {\ tm_ptr->next_TM = NULL;\ tm_ptr->TM_string[0] = TMID_ACK_L1 << 4;\ - /*PENDING: PA TEMPERATURE*/\ tm_ptr->TM_string[1] = gTOTAL_INCORRECT_SIZE_TC & 0xFF;\ tm_ptr->TM_string[2] = gTOTAL_CRC_FAIL_TC & 0xFF;\ } +#define P_COM_HK{\ + uint8_t returnHere;\ + isPAhot(returnHere);\ + if (returnHere == 0xFF)\ + gFLAGS = gFLAGS & ~(COM_PA_HOT_FLAG);\ + else\ + gFLAGS = gFLAGS | COM_PA_HOT_FLAG;\ + if (gFLAGS & COM_PA_OC_FLAG){\ + COM_TX_CNTRL = 1;\ + wait_ms(5);\ + }\ + isPAoc(returnHere);\ + if (returnHere == 0xFF)\ + gFLAGS = gFLAGS & ~(COM_PA_OC_FLAG);\ + else\ + gFLAGS = gFLAGS | COM_PA_OC_FLAG;\ + /*P_CDMS_HANDLE_HW_FAULTS*/\ +} + #define isPAhot(returnHere){\ - /*PENDING : COMPLETE THIS FUNCTION*/\ - returnHere = 0xFF;\ + uint8_t pa_temp = 0;\ + uint8_t pa_temp_quant = 0;\ + SelectLinec0=0;\ + SelectLinec1=0;\ + SelectLinec2=0;\ + SelectLinec3=1;\ + pa_temp = TempInput.read();\ + pa_temp = pa_temp * 3.3;\ + int resistance;\ + resistance = 24000 * pa_temp/(3.3 - pa_temp);\ + if(pa_temp > 1.47) {\ + pa_temp = 3694/log(24.032242*resistance);\ + }\ + else{\ + pa_temp = 3365.4/log(7.60573*resistance);\ + }\ + pa_temp_quant = quantiz(tstart_thermistor,tstep_thermistor,pa_temp);\ + if (pa_temp_quant > COM_PA_TMP_HIGH){\ + returnHere = 0;\ + }\ + else{\ + returnHere = 0xFF;\ + }\ +} + +#define isPAoc(returnHere){\ + if (COM_TX_OC_FAULT)\ + returnHere = 0;\ + else\ + returnHere = 0xFF;\ } #define get_call_sign(tm_ptr) {\ @@ -156,7 +208,6 @@ /*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;\ @@ -189,7 +240,7 @@ ++overflowCountL1;\ }\ else{\ - /*PENDING: RESET CDMS*/\ + RESET_CDMS;\ break;\ }\ }\