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:
shreeshas95
Date:
Wed Dec 23 05:37:55 2015 +0000
Parent:
2:2caf2a9a13aa
Child:
4:104dd82c99b8
Commit message:
for krishan to test adf

Changed in this revision

DefinitionsAndGlobals.h Show annotated file Show diff for this revision Revisions of this file
ThreadsAndFunctions.h Show annotated file Show diff for this revision Revisions of this file
adf.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/DefinitionsAndGlobals.h	Tue Dec 22 06:09:48 2015 +0000
+++ b/DefinitionsAndGlobals.h	Wed Dec 23 05:37:55 2015 +0000
@@ -83,6 +83,9 @@
     #define OBOSC_SUB_REP_LE 0x0F
     #define OBOSC_SUB_RESET 0x07
     
+// PAYLOAD
+    #define PAYLOAD_BUFFER_LENGTH 2190
+    
 // ****************GLOBAL VARIABLES******************
 // DEBUG
 Serial gPC( USBTX, USBRX );
@@ -130,4 +133,8 @@
 uint8_t gLAST_L1_ACK[TM_SHORT_SIZE];
 uint8_t gLAST_L1_ACK_BUFFER[TM_SHORT_SIZE];
 uint8_t gOBOSC_PSC = PSC_START_VALUE;
-Base_tc* gOBOSC_HEAD = NULL;
\ No newline at end of file
+Base_tc* gOBOSC_HEAD = NULL;
+
+// SCIENCE_THREAD
+Thread* gSCIENCE_THREAD = NULL;
+uint8_t gPAYLOAD_BUFFER[PAYLOAD_BUFFER_LENGTH];
\ No newline at end of file
--- a/ThreadsAndFunctions.h	Tue Dec 22 06:09:48 2015 +0000
+++ b/ThreadsAndFunctions.h	Wed Dec 23 05:37:55 2015 +0000
@@ -151,4 +151,48 @@
             gFLAGS = gFLAGS & (~COM_SESSION_FLAG);
         }
     }
+}
+
+void SCIENCE_FUN(void const *args){
+//    SPIpayload.format(8,0);
+//    SPIpayload.frequency(1000000);
+    for ( int i = 0 ; i < PAYLOAD_BUFFER_LENGTH ; i++ ){
+        gPAYLOAD_BUFFER[i] = 1;
+    }
+
+    // initialise the buffer for dma
+    // SPIpayload.bulkRead_init(VAR_SPACE::payload_dma_buffer, PAYLOAD_DMA_SIZE, &payload_interrupt_fun);
+    // start dma read
+    // SPIpayload.bulkRead_start();
+
+    // attach DMA interrupt
+    while(true){
+         gSCIENCE_THREAD->signal_wait(0x01);
+
+//*********************************************************THE TEST
+        
+        //read rtc time later
+        uint64_t RTC_time = 0;
+        Science_Data_Compression::complete_compression( gPAYLOAD_BUFFER , RTC_time);
+//        SPI_mutex.lock();
+//        disk_write(SDcard_lastWritten ,  5);
+//        SPI_mutex.unlock();
+
+//**********************************************THE TEST
+
+
+
+//        counter_for_payload++;
+//        if(counter_for_payload == 10){
+//         payload_ticker.detach();
+//         ledg = 0;
+//         PC.puts("its over\r\n");
+//        }
+        
+        
+        
+        
+//        SPIpayload.bulkRead_start();
+
+    }
 }
\ No newline at end of file
--- a/adf.h	Tue Dec 22 06:09:48 2015 +0000
+++ b/adf.h	Wed Dec 23 05:37:55 2015 +0000
@@ -484,7 +484,7 @@
     send_data;\
     while(loop_on){\
         /*led2=!led2;*/\
-        Thread::signal_wait(COM_MNG_TMTC_SIGNAL_ADF_SD);\
+        gCOM_MNG_TMTC_THREAD->signal_wait(COM_MNG_TMTC_SIGNAL_ADF_SD);\
         if(ADF_off){\
             SPI_mutex.lock();\
             ticker.detach();\
@@ -540,7 +540,7 @@
 //    ADF_non_responsive_timeout.attach(&ADF_non_responsive_fun, 10);
 
     while(loop_on){
-        Thread::signal_wait(COM_MNG_TMTC_SIGNAL_ADF_NSD);
+        gCOM_MNG_TMTC_THREAD->signal_wait(COM_MNG_TMTC_SIGNAL_ADF_NSD);
 //        if( ADF_non_responsive_flag == false ){
             if(ADF_off){
                 SPI_mutex.lock();
--- a/main.cpp	Tue Dec 22 06:09:48 2015 +0000
+++ b/main.cpp	Wed Dec 23 05:37:55 2015 +0000
@@ -53,6 +53,10 @@
     gCOM_MNG_TMTC_THREAD->set_priority(osPriorityAboveNormal);
     // *******************INITIALISATIONS END********************
     
+    // SCIENCE THREAD
+    gSCIENCE_THREAD = new Thread(SCIENCE_FUN);
+    gSCIENCE_THREAD->set_priority(osPriorityBelowNormal);
+    
     //adf test
     gPC.puts("Testing ADF\r\n");
     Base_tm *testTM = new Short_tm;