FM
Dependencies: SimpleDMA eeprom mbed-rtos mbed FreescaleIAP
Fork of CDMS_CODE by
Diff: OBSRS.h
- Revision:
- 168:087d16523507
- Parent:
- 154:9aec89c8cdc7
diff -r 9aec89c8cdc7 -r 087d16523507 OBSRS.h --- a/OBSRS.h Mon Apr 11 16:04:55 2016 +0000 +++ b/OBSRS.h Wed Apr 20 13:33:34 2016 +0000 @@ -92,7 +92,19 @@ } void restart_adf(){ - + /*go to phy off and and py on then phy TX again */ + gCS_ADF = 0; + spi.write(0xB1);/*phy_on */ + gCS_ADF = 1; + gCS_ADF = 0; + spi.write(0xB0);/*phy_off */ + gCS_ADF = 1; + gCS_ADF = 0; + spi.write(0xB1);/*phy_on */ + gCS_ADF = 1; + gCS_ADF = 0; + spi.write(0xB5);/*start transmission*/ + gCS_ADF = 1; } int diff_prev; @@ -107,7 +119,8 @@ } #define check_PA_temp {\ -/* return 0 or 1*/\ +/* pending temperature check function*/\ +/* return 0 or 1*/\ PA_HOT=0;\ } @@ -247,6 +260,7 @@ enable_ackandcallsign = false;\ stop =true;\ last_buffer = true;\ + send_EoS_and_stop = false;\ }\ }\ else if(adf_limit){\ @@ -426,6 +440,9 @@ enable_read_block = false; enable_T_frame = false; enable_ackandcallsign = true; + /*putting execution status */ + uint8_t temp2 = TC_STATE_SUCCESSFULLY_EXECUTED; + PUTexec_status(current_obsrs_tc, temp2); create_Ack_andcallsign = true; if(T_frames_sent == T_frames_in_segment){ if(segments_sent + 1>= max_segments){ @@ -500,16 +517,13 @@ if(create_Ack_andcallsign){ /* gPC.printf("cr ack\r\n");*/ enable_SCH = true; - uint8_t temp2 = TC_STATE_SUCCESSFULLY_EXECUTED; // see all the possible cases - PUTexec_status(current_obsrs_tc, temp2); + if( (GETexec_status(current_obsrs_tc) == TC_STATE_EXECUTION_FAILED) && (GETabort_on_nack(current_obsrs_tc) == 1) ){ gMASTER_STATE = TCL_STATE_ABORTED; } else if( GETpacket_seq_count(current_obsrs_tc) == (gTOTAL_VALID_TC-1) ){ gMASTER_STATE = TCL_STATE_COMPLETED; } - - create_Ack_andcallsign = false; Base_tm *ack_and_callsign = NULL; Base_tm *ack_head = NULL; @@ -544,6 +558,14 @@ /* gPC.printf("ex cr ack\r\n");*/ } send_Ack_andcallsign; + if(last_buffer){ + // delete ack_head; +// while(ack_and_callsign != NULL){ +// Base_tm *temp = ack_and_callsign->next_TM; +// delete ack_and_callsign; +// ack_and_callsign = temp; + } + } else if(last_buffer){ // delete ack_head; @@ -613,6 +635,8 @@ } } if((PA_HOT || (!valid_SID)|| (gFLAGS & COM_SESSION_TIMEOUT_FLAG) ||(read_success != 0))&&(!enable_ackandcallsign)){ + uint8_t temp2 = TC_STATE_EXECUTION_FAILED; + PUTexec_status(current_obsrs_tc, temp2); enable_ackandcallsign = true; create_Ack_andcallsign = true; enable_T_frame = false;