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:
195:6a549c0e9287
Parent:
193:f76b475d7807
Child:
199:9f03d6ca94c9
diff -r ab528911780d -r 6a549c0e9287 OBSRS.h
--- a/OBSRS.h	Wed Jun 29 14:24:12 2016 +0000
+++ b/OBSRS.h	Wed Jun 29 15:23:12 2016 +0000
@@ -44,12 +44,12 @@
 uint8_t SID ;
 unsigned char buffer_112[112];
 uint32_t FSC;
-uint16_t read_success = false;
+uint8_t read_success = 0;
 uint16_t counter_buffer_112=0, counter_EoS=0,T_frames_sent=0;
 uint16_t counter_interleavedata=0;
 uint16_t counter_buffer_512=0;
 uint16_t max_segments  =  65415/(48+T_frames_in_segment*159);
-uint16_t ack_code = 0xA0;
+uint8_t ack_code = 0xA0;
 uint8_t segments_sent = 0;
 uint8_t counter_SCH40 = 0;
 uint8_t counter_FCCH80 = 0;
@@ -138,7 +138,7 @@
  enable_FCCH = false;\
  enable_DS = false;\
  half_buffer = 0;\
- read_success = false;\
+ read_success = 0;\
  counter_buffer_112=0;\
  counter_EoS=0;\
  T_frames_sent=0;\
@@ -580,7 +580,7 @@
 //                        }
                   int write_success = SD_WRITE(write_buffer,FSC + block_counter,SID);
 //                   wait_ms(8);
-                   read_success = SD_READ(buffer_512, FSC + block_counter,SID);
+                   ack_code = SD_READ(buffer_512, FSC + block_counter,SID);
                    for(int i = 0; i<512;i++)
                    if(write_buffer[i] != buffer_512[i])
                    gPC.printf("incorrect");
@@ -588,27 +588,29 @@
                    gPC.printf("read block %d \n\r",read_success);
              }
                else{
-                   read_success = SD_READ(buffer_512, list_of_FSC[block_counter],SID);
+                   ack_code = SD_READ(buffer_512, list_of_FSC[block_counter],SID);
                    }
                block_counter++;
                if(block_counter == no_of_frames){
                        last_block=true;
                }
                enable_read_block = false;
-               if(read_success == 0){
-//                   cout<<"read one block successfully"<<" ";
-                    ack_code = 0xA0;
+               if(ack_code == 0xA0){
+                   gPC.puts("read one block successfully");
                    enable_T_frame = true;
                    enable_SCH = true;
                 }
-                else if(read_success == 1){
-                    ack_code = 0x85;
+                else if(ack_code == 0x88 || ack_code == 0x89){
+
                     gPC.printf("Hardware failure");
                     enable_T_frame = false;
                 }
-                else if(read_success == 2){
-                    ack_code = 0x86;
-                    gPC.printf("Invalid FSC");
+                else if(ack_code == 0x02){
+                    gPC.printf("Invalid SID");
+                    enable_T_frame = false;
+                }
+                else if(ack_code == 0x86){
+                    gPC.printf("FSC outof bounds");
                     enable_T_frame = false;
                 }
                 else{