publishing to check changes in cdms code

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE_samp_23SEP_DMA_flag by samp Srinivasan

Revision:
121:bd7263168ee4
Parent:
119:2b5632bc78ab
Child:
122:b99f8be0a51a
diff -r d79297a4f89d -r bd7263168ee4 OBSRS.h
--- a/OBSRS.h	Sat Feb 06 19:26:01 2016 +0000
+++ b/OBSRS.h	Sat Feb 06 20:06:25 2016 +0000
@@ -14,6 +14,7 @@
 
 using namespace std;
 
+Base_tm *callsign = NULL;
 bool send_EoS_and_stop = false;
 bool adf_limit = false;
 bool stop = false;
@@ -56,7 +57,6 @@
 uint8_t counter_S_frame = 0;
 uint16_t T_frame_Ack_andcallsign_sent = 0; 
 uint16_t T_frame_in_Ackandcallsign = 4;                        // needs to get from sukhdeep depends on size of Ack_L1
-uint64_t start_block_num ;
 uint8_t block_counter = 0;
 uint8_t no_of_frames =0;                             
 int Ack_L1; // should be always even
@@ -94,7 +94,7 @@
     ackl234new->TM_string[12] = crc & 0x00FF;    \
 }
 
-#define make_T_frame_Ack_andcallsign {\             
+#define make_T_frame_Ack_andcallsign {\            
 }
 
 void restart_adf(){
@@ -125,7 +125,51 @@
     return 1;
 }
 
-#define send_Ack_andcallsign{\                                                    
+#define flags_init {\
+ send_EoS_and_stop = false; \
+ adf_limit = false;\
+ stop = false;\
+ PA_HOT=0;\
+ short_TC;\
+ valid_SID = true;\
+ enable_call_sign = true;\
+ enable_new_segment=true;\
+ enable_S_frame = true;\
+ enable_read_block = false;\
+ enable_T_frame = false;\
+ enable_Ack_andcallsign = false;\
+ enable_ackandcallsign = false;\
+ new_session =true;\
+ enable_EoS=false;\
+ create_Ack_andcallsign = true;\
+ Ack_andcallsign_over = false;\
+ repeat_last_2T_frames = false;\
+ last_block = false;\
+ last_buffer = false;\
+ new_OBSRS_TC = true;\
+ enable_SCH = true;\
+ enable_FCCH = false;\
+ enable_DS = false;\
+ half_buffer = 0;\
+ read_success = false;\
+ counter_buffer_112=0;\
+ counter_EoS=0;\
+ T_frames_sent=0;\
+ counter_call_sign_buffer=0;\
+ counter_buffer_512=0;\
+ counter_Ack_andcallsign = 0;\
+ ack_code = 0xA0;\
+ segments_sent = 0;\
+ counter_SCH40 = 0;\
+ counter_FCCH80 = 0;\
+ counter_S_frame = 0;\
+ T_frame_Ack_andcallsign_sent = 0;\
+ T_frame_in_Ackandcallsign = 4;\
+ block_counter = 0;\
+ no_of_frames =0;\
+}
+
+#define send_Ack_andcallsign{\
     if(T_frames_sent < T_frames_in_segment){\
         buffer_112[counter_buffer_112] = Ack_andcallsign[counter_Ack_andcallsign++];          /* to be changed sukhdeep should write in buffer_112*/\
         if(counter_Ack_andcallsign == 318){\
@@ -205,7 +249,7 @@
                if(new_OBSRS_TC){\
                     enable_call_sign = true;\
                     new_OBSRS_TC = false;\
-                    Base_tm *callsign = NULL;\
+                    callsign->next_TM =NULL;\
                     get_call_sign(callsign);\
                     snd_tm.head_pointer(callsign);\
                     int temp = snd_tm.make_shor_tm();\
@@ -281,18 +325,6 @@
         }\
 }
 
-//uint16_t SD_READ(uint64_t block_to_read){
-//    for(int i=0;i<318;i++){
-//        buffer_512[counter_buffer_512++] = 0xff;
-//    }
-//    for(int i=319;i<512;i++){
-//        buffer_512[counter_buffer_512++] = 0x00;
-//    }
-//    counter_buffer_512 = 0;
-//    return 0xA0; // if success
-////    return 0x85; // Hardware failure
-//   // return 0x86; // invalid TC
-//}
 
 void send_tm_from_SD_card_fun(){
     for(counter_buffer_112=0;counter_buffer_112<112;counter_buffer_112++){
@@ -431,8 +463,9 @@
         else if(enable_ackandcallsign){
             if(create_Ack_andcallsign){
                 create_Ack_L234;
-                Ack_L1 = get_Ack_L1();
-                make_T_frame_Ack_andcallsign;
+                Base_tm *ack_and_callsign = callsign;
+                snd_tm.head_pointer(ack_and_callsign);
+                T_frame_in_Ackandcallsign = 2*snd_tm.make_shor_tm();
                 create_Ack_andcallsign = false;
             }    
             send_Ack_andcallsign;
@@ -516,6 +549,7 @@
 }
 
 void execute_OBSRS_TC(Base_tc *tcp){
+    flags_init;
     sent_tmfrom_SDcard = true;
     if( GETshort_or_long_tc(tcp) == SHORT_TC_CODE ){
         short_TC = true;
@@ -546,7 +580,8 @@
     gPC.printf("sid = %u \r\n",SID);
     gPC.printf("FSC = %u\r\n",FSC);
     gPC.puts("exit_sdcard");
-//    SID = 0x0;
+    
+//    SID = 0x1;
 //    FSC = 10;
 //    no_of_frames = 2;
 //    cout<<"max_segments = "<<max_segments<<ENDL;