CDMS code for testing sbc

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Revision:
268:ded5306a1fd1
Parent:
267:783c248a6207
Child:
269:72529b247333
--- a/main.cpp	Sat Jul 16 16:04:14 2016 +0000
+++ b/main.cpp	Wed Jul 20 09:58:59 2016 +0000
@@ -35,108 +35,6 @@
 #include "ThreadsAndFunctions.h"
 #include "TEST_PL.h"
 
-#define PL_TC(tm_ptr){\
-    Base_tc *beacon_tc = new Long_tc;\
-    beacon_tc->next_TC = NULL;\
-    PUTshort_or_long(beacon_tc,LONG_TC_CODE);\
-    PUTcrc_pass(beacon_tc,0x1);\
-    PUTexec_status(beacon_tc,0);\
-    beacon_tc->TC_string[0] = 0x01;\
-    beacon_tc->TC_string[1] = 0x60;\
-    beacon_tc->TC_string[2] = 0x81;\
-    beacon_tc->TC_string[3] = 0x21;\
-    beacon_tc->TC_string[4] = 0x00;\
-    beacon_tc->TC_string[5] = 0;\
-    beacon_tc->TC_string[6] = 0;\
-    beacon_tc->TC_string[7] = 0;\
-    beacon_tc->TC_string[8] = 0;\
-    uint16_t crc16 = crc16_gen(beacon_tc->TC_string, 9);\
-    beacon_tc->TC_string[9]  = (crc16 & 0xFF00)>>8;\
-    beacon_tc->TC_string[10] = (crc16 & 0x00FF);\
-    for(int i = 11; i<135;i++) beacon_tc->TC_string[i] = 0;\
-    tm_ptr =  FCTN_CDMS_RLY_TMTC(beacon_tc);\
-    delete PL_TC;\
-    Base_tm *temp;\
-    temp = tm_ptr;\
-    while(tm_ptr!=NULL)\
-    {\
-        temp = temp->next_TM;\
-        delete tm_ptr;\
-        tm_ptr = temp;\
-    }\
-}
-#define OBSRS_TC(tm_ptr){\
-    Base_tc *beacon_tc = new Short_tc;\
-    beacon_tc->next_TC = NULL;\
-    PUTshort_or_long(beacon_tc,SHORT_TC_CODE);\
-    PUTcrc_pass(beacon_tc,0x1);\
-    PUTexec_status(beacon_tc,0);\
-    beacon_tc->TC_string[0] = 0x01;\
-    beacon_tc->TC_string[1] = 0x20;\
-    beacon_tc->TC_string[2] = 0xf2;\
-    beacon_tc->TC_string[3] = 0x00;\
-    beacon_tc->TC_string[4] = 0x00;\
-    beacon_tc->TC_string[5] = 0;\
-    beacon_tc->TC_string[6] = 2;\
-    beacon_tc->TC_string[7] = 0;\
-    beacon_tc->TC_string[8] = 2;\
-    uint16_t crc16 = crc16_gen(beacon_tc->TC_string, 9);\
-    beacon_tc->TC_string[9]  = (crc16 & 0xFF00)>>8;\
-    beacon_tc->TC_string[10] = (crc16 & 0x00FF);\
-    Base_tm *tm_ptr_head = NULL;\
-                            get_call_sign(tm_ptr_head);\
-                            Base_tm *put_tm_here = NULL;\
-                            /*execute_obsrs(current_TC, put_tm_here)*/\
-                            /*read_TC(current_TC);*/\
-                            execute_OBSRS_TC(beacon_tc);\
-                            gPC.puts("enter_adf\r\n");\
-                            transmit_adf;\
-                            gPC.puts("exit_adf\r\n");\
-}
-
-#define BAE_tc(tm_ptr) {\
-    Base_tc *bae_tc = new  Long_tc;\
-    bae_tc->next_TC = NULL;\
-    PUTshort_or_long(bae_tc,0);\
-    PUTcrc_pass(bae_tc,0x1);\
-    PUTexec_status(bae_tc,0);\
-    bae_tc->TC_string[0] = 0x01;\
-    bae_tc->TC_string[1] = 0x71;\
-    bae_tc->TC_string[2] = 0x81;\
-    bae_tc->TC_string[3] = 0x32;\
-    bae_tc->TC_string[4] = 0;\
-    bae_tc->TC_string[5] = 0;\
-    bae_tc->TC_string[6] = 0;\
-    bae_tc->TC_string[7] = 0;\
-    bae_tc->TC_string[8] = 0;\
-    uint16_t crc16 = crc16_gen(bae_tc->TC_string, 9);\
-    bae_tc->TC_string[9]  = (uint8_t)(crc16 & 0xFF00)>>8;\
-    bae_tc->TC_string[10] = (uint8_t)(crc16 & 0x00FF);\
-    for(uint8_t i=11;i<135;i++)\
-        bae_tc->TC_string[i] = 0;\
-    tm_ptr =  FCTN_CDMS_RLY_TMTC(bae_tc);\
-    delete bae_tc;\
-    Base_tm *temp;\
-    temp = tm_ptr;\
-    while(tm_ptr!=NULL)\
-    {\
-        temp = temp->next_TM;\
-        delete tm_ptr;\
-        tm_ptr = temp;\
-    }\
-}
-
-void BAE_TC();
-void BAE_TC()
-{
-    Base_tm *tm_ptr = new Long_tm;     
-    BAE_tc(tm_ptr);    
-}
-
-uint8_t test_srp[]= {
-                    
-                    };
-
 int main()
 {    
     CDMS_I2C_GPIO = 0; 
@@ -149,7 +47,7 @@
     gRX_COUNT = 0;
     RX1M.attach(&rx_read, Serial::RxIrq);
     
-    gPC.baud(9600);//changed for bypassing COM
+    gPC.baud(1200);//changed for bypassing COM
     
     // COMMON SPI
     spi.format(8,0);
@@ -160,12 +58,12 @@
     gCS_RTC = 1;
     gCS_ADF = 1;
     
-    //FCTN_CDMS_INIT_RTC();/* rtc initialization*/
-    //FCTN_CDMS_SD_INIT();/* sd card initialization*/
+    FCTN_CDMS_INIT_RTC();/* rtc initialization*/
+    FCTN_CDMS_SD_INIT();/* sd card initialization*/
     
     
-    //uint8_t test[512] = {0};
-    //disk_write(test,7000); //to be used only just before launch
+    uint8_t test[512] = {0};
+    disk_write(test,7000); //to be used only just before launch
     
     #if DEBUG
     gPC.puts("welcome to mng_tmtc\r\n");
@@ -178,14 +76,14 @@
     // COM_POWER_ON_TX();
     
     // COM_MNG_TMTC THREAD
-    /*gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN);
+    gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN);
     gCOM_MNG_TMTC_THREAD->set_priority(osPriorityHigh);
     
     gHK_THREAD = new Thread(FCTN_CDMS_HK_MAIN);
     gHK_THREAD->set_priority(osPriorityAboveNormal);
     
     gSCIENCE_THREAD = new Thread(SCIENCE_FUN);
-    gSCIENCE_THREAD->set_priority(osPriorityAboveNormal);*/
+    gSCIENCE_THREAD->set_priority(osPriorityAboveNormal);
     
     #if DEBUG
     gPC.puts("completed allocating threads\r\n");
@@ -194,14 +92,14 @@
     master.frequency(400000);
     
     /*HK_counter = new RtosTimer(hk_isr, osTimerPeriodic,(void * )NULL);
-    HK_counter->start(10000);
+    HK_counter->start(10000);*/
     
     sys_reset_cdms_timer = new RtosTimer(sys_pwr_reset, osTimerPeriodic, (void * )NULL);
-    sys_reset_cdms_timer->start(cdms_reset_timeout);*/
+    sys_reset_cdms_timer->start(cdms_reset_timeout);
 
     /*PL_wo_dma = new RtosTimer(payload_isr_fun_dma, osTimerPeriodic,(void * )NULL);
     PL_wo_dma->start(6000);*/
-    //gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL);
+    gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL);
     
     /*Timeout flipper;
     flipper.attach(BAE_TC,31);*/