CDMS_CODE_samp_23SEP_DMA_flag

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE_samp_23SEP_DMA by iitm sat

Revision:
227:05e929bdd4dc
Parent:
224:3ac1f91e0ebc
--- a/COM_MNG_TMTC.h	Mon Jul 04 14:31:30 2016 +0000
+++ b/COM_MNG_TMTC.h	Mon Jul 04 20:27:37 2016 +0000
@@ -12,7 +12,7 @@
 
 //#include "Flash.h"
 
-DigitalIn tm_status_4m_slv(PIN39); //I2C interrupt to CDMS from BAE
+//DigitalIn tm_status_4m_slv(PIN39); //I2C interrupt to CDMS from BAE
 //DigitalIn tm_status_4m_pl(PIN61); //I2C interrupt to CDMS from PL
 #define RESET_CDMS NVIC_SystemReset()
 
@@ -359,12 +359,13 @@
         {
             BAE_I2C_mutex.lock();
             gPC.printf("Telecommand is for BAE\r\n");
-            gPC.printf("Sending TC to BAE...\r\n"); //interrupt to be sent to the bae
-            y = FCTN_I2C_WRITE((char*)tc_ptr->TC_string,TC_LONG_SIZE);                         // Check for SHORT and LONG TC and then send
+            //gPC.printf("Sending TC to BAE...\r\n"); //interrupt to be sent to the bae
+            y = FCTN_I2C_WRITE((char*)tc_ptr->TC_string,135);                         // Check for SHORT and LONG TC and then send
                 
             if(y==1)                                                            
             {                                                                               
                 ACK_L234(tm_ptr_short,0x03,GETpacket_seq_count(tc_ptr));
+                BAE_I2C_mutex.unlock();
                 return tm_ptr_short;
             }                                  
             else if(y==0)
@@ -380,16 +381,18 @@
                 {
                     gPC.printf("BAE_I2C_GPIO is high\r\n");
                     
-                    y=FCTN_I2C_READ((char*)tm_pointer->TM_string,TM_LONG_SIZE);            //rify later about the size
+                    y=FCTN_I2C_READ((char*)tm_pointer->TM_string,134);            //rify later about the size
                     if(y==0)
                     {
                         tm_pointer->next_TM=NULL;
+                        BAE_I2C_mutex.unlock();
                         return tm_ptr;
                     }
                     else if(y==1)
                     {
                         ACK_L234(tm_ptr_short,0x85,GETpacket_seq_count(tc_ptr));                
                         //gPC.printf("\n\rPTE->PDIR = 0x%08X",PTE->PDIR);
+                        BAE_I2C_mutex.unlock();
                         return tm_ptr_short;
                         break;  
                     }
@@ -398,10 +401,10 @@
                 {
                     gPC.printf("BAE_I2C_GPIO is not high\r\n");                    
                     ACK_L234(tm_ptr_short,0x84,GETpacket_seq_count(tc_ptr));
+                    BAE_I2C_mutex.unlock();
                     return tm_ptr_short;
                 }
-            }
-            BAE_I2C_mutex.unlock();
+            }          
         }
 
         case 2: // APID = 2 corresponds to CDMS