Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed mbed-rtos SimpleDMA FreescaleIAP eeprom
Fork of CDMS_CODE_FM_28JAN2017 by
Revision 127:8a7bee7b8e8b, committed 2016-02-26
- Comitter:
- krishanprajapat
- Date:
- Fri Feb 26 13:01:11 2016 +0000
- Parent:
- 124:7f0d823c5881
- Child:
- 133:56d37aa8a011
- Child:
- 139:1018e1dc82e9
- Commit message:
- complete code except restart function need to be tested;
Changed in this revision
| OBSRS.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/OBSRS.h Sun Feb 07 12:58:05 2016 +0000
+++ b/OBSRS.h Fri Feb 26 13:01:11 2016 +0000
@@ -7,13 +7,11 @@
// Invalid FSC Case 4 ackl234new->TM_string[2] = (100_0110) = 0x_6; spare = 0 10000110 = 0x86 Invalid FSC
// Illegal TC Case 3 ackl234new->TM_string[2] = (000_0010) = 0x_2; spare = 0 00000010 = 0x02 invalid SID
-
-
#define TMID_ACK_L234 0xB
#define T_frames_in_segment 40
using namespace std;
-
+Base_tc *current_obsrs_tc = NULL;
Base_tm *callsign = NULL;
bool send_EoS_and_stop = false;
bool adf_limit = false;
@@ -40,6 +38,7 @@
bool enable_FCCH = false;
bool enable_DS = false;
bool half_buffer = 0;
+//bool session_over = gFLAGS & COM_SESSION_TIMEOUT_FLAG;
uint8_t SID ;
unsigned char buffer_112[112];
@@ -75,14 +74,13 @@
//const unsigned char SCH40[] = {0x0a,0x3f,0x46,0xb4,0x00};
-
-
-#define create_Ack_L234 {\
+#define get_ack_l234( tm_ptr ) {\
Base_tm *ackl234new = new Short_tm;\
ackl234new->next_TM = NULL;\
+ tm_ptr = ackl234new;\
/*return telemetry pointer here*/\
ackl234new->TM_string[0] = TMID_ACK_L234 << 4;\
- ackl234new->TM_string[1] = 0x12;\
+ ackl234new->TM_string[1] = GETpacket_seq_count(current_obsrs_tc);\
ackl234new->TM_string[2] = ack_code; /* Ack code ....to be chnaged accordind to situation */\
for(int i = 3; i < 11; ++i){\
ackl234new->TM_string[i] = 0x00;\
@@ -268,10 +266,10 @@
/*cout<<"S_frame_sent"<<ENDL;*/\
if(new_OBSRS_TC){\
enable_call_sign = true;\
- new_OBSRS_TC = false;\
- callsign->next_TM =NULL;\
+ new_OBSRS_TC = false;\
get_call_sign(callsign);\
snd_tm.head_pointer(callsign);\
+ delete callsign;\
int temp = snd_tm.make_shor_tm();\
}\
else{\
@@ -482,17 +480,50 @@
}
else if(enable_ackandcallsign){
if(create_Ack_andcallsign){
- create_Ack_L234;
- Base_tm *ack_and_callsign = callsign;
- get_ack_l1(ack_and_callsign->next_TM);
- snd_tm.head_pointer(ack_and_callsign);
- T_frame_in_Ackandcallsign = 2*snd_tm.make_shor_tm();
enable_SCH = true;
create_Ack_andcallsign = false;
+ Base_tm *ack_and_callsign = NULL;
+ Base_tm *ack_head = NULL;
+ get_call_sign(ack_and_callsign);
+ ack_head = ack_and_callsign;
+ get_ack_l1(ack_and_callsign->next_TM);
+ while(ack_and_callsign->next_TM != NULL){
+ ack_and_callsign = ack_and_callsign->next_TM;
+ }
+ get_ack_l234(ack_and_callsign->next_TM);
+ snd_tm.head_pointer(ack_head);
+ T_frame_in_Ackandcallsign = 2*snd_tm.make_shor_tm();
+ Base_tm *ack_l234 = ack_and_callsign->next_TM;
+ 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;
+ }
+ if( GETshort_or_long_tm(ack_l234) == SHORT_TM_CODE ){
+ for(int i = 0 ; i < TM_SHORT_SIZE ; ++i){
+ gLAST_TM[i] = ack_l234->TM_string[i];
+ gLAST_TM_SHORT_OR_LONG = SHORT_TM_CODE;
+ }
+ }
+ else{
+ for( int i = 0 ; i < TM_LONG_SIZE ; ++i ){
+ gLAST_TM[i] = ack_l234->TM_string[i];
+ gLAST_TM_SHORT_OR_LONG = LONG_TM_CODE;
+ }
+ }
+ delete ack_head;
+ ack_and_callsign = ack_head;
+ while(ack_and_callsign != NULL){
+ Base_tm *temp = ack_and_callsign->next_TM;
+ delete ack_and_callsign;
+ ack_and_callsign = temp;
+ }
}
send_Ack_andcallsign;
}
-
else if(enable_EoS){
// send_EoS();
buffer_112[counter_buffer_112] = EoS[counter_EoS++];
@@ -520,12 +551,6 @@
//int write_success = SD_WRITE(write_buffer,FSC + block_counter,SID);
// wait_ms(8);
read_success = SD_READ(buffer_512, FSC + block_counter,SID);
-// wait_ms(8);
-// cout<<"read_success = "<<read_success<<ENDL<<"\r\n";
-// cout<<"write_success = "<<write_success<<ENDL;
-// for(int i=0;i<512;i++){
-// printf("0x%02X,",buffer_512[i]);
-// }
}
else{
read_success = SD_READ(buffer_512, list_of_FSC[block_counter],SID);
@@ -555,7 +580,7 @@
stop = true;
}
}
- if((PA_HOT || (!valid_SID)|| (read_success != 0))&&(!enable_ackandcallsign)){
+ if((PA_HOT || (!valid_SID)|| (gFLAGS & COM_SESSION_TIMEOUT_FLAG) ||(read_success != 0))&&(!enable_ackandcallsign)){
enable_ackandcallsign = true;
create_Ack_andcallsign = true;
enable_T_frame = false;
@@ -571,7 +596,8 @@
}
void execute_OBSRS_TC(Base_tc *tcp){
- flags_init ;
+ current_obsrs_tc = tcp;
+ flags_init;
sent_tmfrom_SDcard = true;
if( GETshort_or_long_tc(tcp) == SHORT_TC_CODE ){
short_TC = true;
