Repository for CDMS code

Dependencies:   SimpleDMA mbed-rtos mbed eeprom

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Files at this revision

API Documentation at this revision

Comitter:
ee12b079
Date:
Thu Jul 07 17:25:37 2016 +0000
Parent:
238:4abbc6a3a641
Child:
240:946a9342a95f
Commit message:
testing

Changed in this revision

TEST_PL.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/TEST_PL.h	Thu Jul 07 17:13:00 2016 +0000
+++ b/TEST_PL.h	Thu Jul 07 17:25:37 2016 +0000
@@ -423,20 +423,20 @@
 }
 void test_pl_main()
 {
-    //uint32_t temp_pl_block[192] = {0};
+    uint32_t temp_pl_block[192] = {0};
     uint8_t wrong_modify=0,z;
     Base_tm* test_tm_ptr;    
     //Base_tm* temp;
-    //for(z=0;z<192;z++)
-    //    pl_block[z] = 0xFFFFFFFF;
-    //testing 0xF
+    for(z=0;z<192;z++)
+        pl_block[z] = 0xFFFFFFFF;
+   // testing 0xF
     send_verify_0xF(test_tm_ptr);
-    //for(z=0;z<192;z++)  
-    //    temp_pl_block[z] = pl_block[z];
+    for(z=0;z<192;z++)  
+        temp_pl_block[z] = pl_block[z];
         
     //testing TC = 0x1,0x2...0x6
     uint8_t w =1;
-    for(uint8_t v=1;w<7;w++)
+    for(uint8_t v=1;w<2;w++)
     {        
         /*switch(v)
         {
@@ -477,7 +477,7 @@
         {
             test_schedule_6(test_tm_ptr);
         }
-        /*for(z=0;z<192;z++)
+        for(z=0;z<192;z++)
         {
             if((z>=((v-1)*32)) && (z<=((v*32)-1)))
                 z++;
@@ -501,11 +501,11 @@
                 //gPC.printf("\n\r%03d-0x%08X\t%03d-0x%08X",(i),pl_block[i],(i)+1,pl_block[(i)+1]);
                 //gPC.printf("\t%03d-0x%08X\t%03d-0x%08X\n",(i)+2,pl_block[(i)+2],(i)+3,pl_block[(i)+3]);
             }
-        }*/
+        }
         send_verify_0xF(test_tm_ptr);
         verify_extracted(v);
-        //for(z=0;z<192;z++)
-        //    temp_pl_block[z] = pl_block[z];
+        for(z=0;z<192;z++)
+            temp_pl_block[z] = pl_block[z];
         wait(1);
     }
     gPC.printf("\n\rTesting TC_TM block processing complete");
--- a/main.cpp	Thu Jul 07 17:13:00 2016 +0000
+++ b/main.cpp	Thu Jul 07 17:25:37 2016 +0000
@@ -85,21 +85,29 @@
                             transmit_adf;\
                             gPC.puts("exit_adf\r\n");\
 }
-
+//void set_sig(){gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL);}
 int main()
 {
     
     CDMS_I2C_GPIO = 0; 
     PL_I2C_GPIO = 0; 
     
+    //gLEDR = 1;
+    
+    // ******************INITIALISATIONS START******************
+    // COM RX
+    
     RX1M.baud(1200);
     gRX_HEAD_DATA_NODE = new COM_RX_DATA_NODE;
     gRX_HEAD_DATA_NODE->next_node = NULL;
     gRX_CURRENT_DATA_NODE = gRX_HEAD_DATA_NODE;
     gRX_COUNT = 0;
+//    gRX_CURRENT_PTR = gRX_CURRENT_DATA_NODE->values;
     RX1M.attach(&rx_read, Serial::RxIrq);
     
-    gPC.baud(115200);//changed for bypassing COM
+    // DEBUG
+    //gPC.puts("welcome to mng_tm_tc\r\n");
+    gPC.baud(9600);//changed for bypassing COM
     
     // COMMON SPI
     spi.format(8,0);
@@ -111,41 +119,33 @@
     gCS_ADF = 1;
     
     FCTN_CDMS_INIT_RTC();/* rtc initialization*/
-    FCTN_CDMS_SD_INIT();/* sd card 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");
     #endif
     
+    
+    
+    // COM_MNG_TMTC THREAD
+    /*gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN);
+    gCOM_MNG_TMTC_THREAD->set_priority(osPriorityHigh);
     #if DEBUG
     gPC.puts("allocating threads\r\n");
     #endif
-    
-    // COM_MNG_TMTC THREAD
-    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);
+   // gPC.puts("step one complete\r\n");
     gSCIENCE_THREAD->set_priority(osPriorityAboveNormal);
-    
     #if DEBUG
     gPC.puts("competed allocating threads\r\n");
-    #endif
-    
+    #endif*/
     
     
     master.frequency(400000);
-    
-    HK_counter = new RtosTimer(hk_isr, osTimerPeriodic,(void * )NULL);
-    HK_counter->start(10000);
-    
     //PL_wo_dma = new RtosTimer(payload_isr_fun_dma, osTimerPeriodic,(void * )NULL);
     //PL_wo_dma->start(6000);//
     //gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL);
@@ -161,8 +161,39 @@
     }
     gPC.printf("PL_TC sent");*/
     
+    // *******************INITIALISATIONS END********************
+    
+    //FCTN_CDMS_HK_MAIN((void *)NULL);
+    //RtosTimer gCDMS_HK_TIMER(FCTN_CDMS_HK_MAIN, osTimerPeriodic);
+    //gCDMS_HK_TIMER.start(5000);
+    
+    test_pl_main();
+    
+    RtosTimer gCDMS_PL_TIMER(FCTN_CDMS_PL_MAIN, osTimerPeriodic);
+    gCDMS_PL_TIMER.start(10000);
+    
+    /*starting the thread with signal*/
+    //set_sig();
+    //payload_isr_fun();
+    
+    /*Calculating Stack used*/
+    
+    int state;
+    /*while (true) { 
+    Thread::wait(500); 
+    state = gSCIENCE_THREAD->get_state(); 
+    //gPC.printf("Thread state %d\r\n", state); 
+    if(state == Thread::Inactive) 
+    {delete gSCIENCE_THREAD;
+    break;}
+    }*/
+    
+    
+    
     while(true){
         Thread::wait(osWaitForever);
+        //state = gCOM_MNG_TMTC_THREAD->get_state() + '0';
          gLEDG = !gLEDG;
+        //gPC.putc(state); 
     }
 }
\ No newline at end of file