I2C code testing

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE_pl123 by Siva ram

Revision:
47:5660bd20b146
Parent:
35:3beac900a034
Child:
50:7e4aa9f82e05
--- a/COM_MNG_TMTC.h	Thu Jan 07 10:35:40 2016 +0000
+++ b/COM_MNG_TMTC.h	Mon Jan 11 12:01:14 2016 +0000
@@ -425,8 +425,8 @@
 inline Base_tm* FCTN_CDMS_RLY_TMTC(Base_tc *tc_ptr){
     uint8_t ACKCODE = 0x00;
     printf("\rTC execution in progress\r\n");
-    Base_tm *tm_ptr = new Long_tm;
-    Base_tm *tm_pointer = tm_ptr;
+    Base_tm *tm_pointer = new Long_tm;
+    Base_tm *tm_ptr = tm_pointer;
     received = 0;
     switch(GETapid(tc_ptr))
     {
@@ -467,7 +467,7 @@
             else
             {
                 printf("Telemetry is not received from BAE\r\n");
-                tm_pointer = new Short_tm;
+                //tm_pointer = new Short_tm;
                 tm_pointer->TM_string[0] = 0xB0;
                 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
                 tm_pointer->TM_string[2] = 0x01;
@@ -498,10 +498,10 @@
                             {
                             printf("sub_service:Read from RAM_Memory\r\n");
                             mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]);                                                       
-                            {                                 
+                                                             
                                     Data[0] = FCTN_CDMS_RD_FLASH(0);
                                     Data[1] = FCTN_CDMS_RD_FLASH(1);
-                                    tm_pointer = new Long_tm;
+                                    //tm_pointer = new Long_tm;
                                     tm_pointer->TM_string[0] = 0x30;
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
                                     tm_pointer->TM_string[2] = (uint8_t)(flash_counter);
@@ -522,10 +522,10 @@
                             {
                             printf("sub_service:Read from Flash_Memory\r\n");
                             mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]);                           
-                            {                                                                 
+                                                                                             
                                     Data[0] = FCTN_CDMS_RD_FLASH(0);
                                     Data[1] = FCTN_CDMS_RD_FLASH(1);                                                                                             
-                                    tm_pointer = new Long_tm;
+                                    //tm_pointer = new Long_tm;
                                     tm_pointer->TM_string[0] = 0x30;
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
                                     tm_pointer->TM_string[2] = (uint8_t)(flash_counter);
@@ -548,7 +548,7 @@
                                     mid=(uint16_t)(tc_ptr->TC_string[3]<<4)+(uint16_t)(tc_ptr->TC_string[4]);                                   
                                     block = (((uint32_t)(tc_ptr->TC_string[5])<<24)|((uint32_t)(tc_ptr->TC_string[5])<<16)|((uint32_t)(tc_ptr->TC_string[5])<<8)|((uint32_t)(tc_ptr->TC_string[5])));
                                     FCTN_CDMS_WR_FLASH(mid,block);
-                                    tm_pointer = new Short_tm;
+                                    //tm_pointer = new Short_tm;
                                     tm_pointer->TM_string[0] = 0xB0;
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
                                     tm_pointer->TM_string[2] = 0x01;
@@ -567,7 +567,7 @@
                             default:
                             {
                                 printf("INVALID TC\r\n"); //Send Invalid TC Telemetry
-                                tm_pointer = new Short_tm;
+                                //tm_pointer = new Short_tm;
                                 tm_pointer->TM_string[0] = 0xB0;
                                 tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
                                 tm_pointer->TM_string[2] = 0x01;
@@ -593,7 +593,7 @@
                               if(GETpid(tc_ptr)==0x01)
                                 {
                                     printf("TC_PL_INIT\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -610,7 +610,7 @@
                                 else if(GETpid(tc_ptr)==0x02)
                                 {
                                     printf("TC_PL_MAIN\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -627,7 +627,7 @@
                                else if(GETpid(tc_ptr)==0x03)
                                 {
                                     printf("TC_COM_INIT\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -644,7 +644,7 @@
                                 else if(GETpid(tc_ptr)==0x04)
                                 {
                                     printf("TC_CDMS_HK_MAIN\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                    
@@ -661,7 +661,7 @@
                                 else if(GETpid(tc_ptr)==0x11)
                                 {
                                     printf("TC_SW_ON_SD\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -678,7 +678,7 @@
                                 else if(GETpid(tc_ptr)==0x12)
                                 {
                                     printf("TC_SW_ON_RTC\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                    
@@ -695,7 +695,7 @@
                                 else if(GETpid(tc_ptr)==0x13)
                                 {
                                     printf("TC_SW_ON_BAE\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -712,7 +712,7 @@
                                 else if(GETpid(tc_ptr)==0x14)
                                 {
                                     printf("TC_SW_ON_PL_DL\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                    
@@ -729,7 +729,7 @@
                                  else if(GETpid(tc_ptr)==0x15)
                                 {
                                     printf("TC_SW_ON_PL_AG_HV\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -746,7 +746,7 @@
                                  else if(GETpid(tc_ptr)==0x16)
                                 {
                                     printf("TC_SW_ON_V_A_EN\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -763,7 +763,7 @@
                                 else if(GETpid(tc_ptr)==0x21)
                                 {
                                     printf("TC_SW_OFF_SD\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -780,7 +780,7 @@
                                 else if(GETpid(tc_ptr)==0x22)
                                 {
                                     printf("TC_SW_OFF_RTC\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                    
@@ -797,7 +797,7 @@
                                 else if(GETpid(tc_ptr)==0x23)
                                 {
                                     printf("TC_SW_OFF_BAE\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -814,7 +814,7 @@
                                 else if(GETpid(tc_ptr)==0x24)
                                 {
                                     printf("TC_SW_OFF_PL_DL\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -831,7 +831,7 @@
                                  else if(GETpid(tc_ptr)==0x25)
                                 {
                                     printf("TC_SW_OFF_PL_AG_HV\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -848,7 +848,7 @@
                                  else if(GETpid(tc_ptr)==0x26)
                                 {
                                     printf("TC_SW_OFF_V_A_EN\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                    
@@ -865,7 +865,7 @@
                                 else if(GETpid(tc_ptr)==0x31)
                                 {
                                     printf("TC_RST_SD\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -882,7 +882,7 @@
                                 else if(GETpid(tc_ptr)==0x32)
                                 {
                                     printf("TC_RST_RTC\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -899,7 +899,7 @@
                                 else if(GETpid(tc_ptr)==0x33)
                                 {
                                     printf("TC_RST_BAE\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -916,7 +916,7 @@
                                 else if(GETpid(tc_ptr)==0x34)
                                 {
                                     printf("TC_RST_PL_DL\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -934,7 +934,7 @@
                                 else if(GETpid(tc_ptr)==0xC1)
                                 {
                                     printf("RESET_HK_COUNTER\r\n"); // call PWR_SWCH_ON function
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = ACKCODE;                                   
@@ -951,7 +951,7 @@
                                 else if(GETpid(tc_ptr)==0xF1)
                                 {
                                     printf("RD_RTC\r\n"); //call RD_RTC
-                                    tm_pointer = new Short_tm;
+                                    //tm_pointer = new Short_tm;
                                     tm_pointer->TM_string[0] = 0xD0;
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);
                                     tm_pointer->TM_string[2] = 0x01;
@@ -972,7 +972,7 @@
                                 else 
                                 {
                                     printf("INVALID TC\r\n");
-                                    tm_pointer = new Short_tm; 
+                                    //tm_pointer = new Short_tm; 
                                     tm_pointer->TM_string[0] = 0xB0; 
                                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                                     tm_pointer->TM_string[2] = 0x01;
@@ -988,13 +988,13 @@
                                     return tm_ptr;
                                 }
                             }                          
-                        }                      
-                    }                 
+                                              
+                                     
                 }
                 default:
                 {
                     printf("INVALID TC"); //send invalid TC TM
-                    tm_pointer = new Short_tm; 
+                    //tm_pointer = new Short_tm; 
                     tm_pointer->TM_string[0] = 0xB0; 
                     tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
                     tm_pointer->TM_string[2] = 0x01;
@@ -1035,7 +1035,7 @@
         default: //invalid TC
         {
             printf("INVALID TC\r\n");
-            tm_pointer = new Short_tm; 
+            //tm_pointer = new Short_tm; 
             tm_pointer->TM_string[0] = 0xB0; 
             tm_pointer->TM_string[1] = GETpacket_seq_count(tc_ptr);                                    
             tm_pointer->TM_string[2] = 0x01;
@@ -1384,6 +1384,7 @@
                                 gFLAGS = gFLAGS | COM_PA_HOT_FLAG;\
                             }\
                             tm_ptr = tm_ptr_head;\
+                            gPC.printf("\n");\
                             while( tm_ptr != NULL ){\
                                 int length = TM_SHORT_SIZE;\
                                 if( GETshort_or_long_tm(tm_ptr->fields) == SHORT_TM_CODE ){\
@@ -1394,13 +1395,17 @@
                                 }\
                                 /*gPC.puts("Printing Call Sign, ACK_L1, TM list");*/\
                                 for(int i = 0 ; i < length ; ++i){\
-                                    gPC.putc(tm_ptr->TM_string[i]);\
+                                    /*gPC.printf("%02X",tm_ptr->TM_string[i]);*/\
                                 }\
+                                gPC.printf("preTM\n");\
                                 tm_ptr = tm_ptr->next_TM;\
+                                gPC.printf("next TM\n");\
                             }\
+                            gPC.printf("\n");\
                             /*SEND DATA TO GS*/\
-                            /*snd_tm.head_pointer(tm_ptr_head);*/\
-                            /*adf_not_SDcard();*/\
+                            gPC.printf("sending data to GS\n");\
+                            snd_tm.head_pointer(tm_ptr_head);\
+                            adf_not_SDcard;\
                             /*DELETE THE TM AFTER USE*/\
                             tm_ptr = tm_ptr_head;\
                             overflowCountExecute = 0;\