working

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of COM_MNG_TMTC_SIMPLE by Shreesha S

Files at this revision

API Documentation at this revision

Comitter:
ee12b079
Date:
Tue Jan 26 10:05:19 2016 +0000
Parent:
97:717c7908c822
Child:
99:efde3df6cd94
Commit message:
Both threads working without SD card functions

Changed in this revision

COM_MNG_TMTC.h Show annotated file Show diff for this revision Revisions of this file
Compression.h Show annotated file Show diff for this revision Revisions of this file
OBSRS.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
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/COM_MNG_TMTC.h	Mon Jan 25 14:20:44 2016 +0000
+++ b/COM_MNG_TMTC.h	Tue Jan 26 10:05:19 2016 +0000
@@ -1439,7 +1439,9 @@
                             }\
                             /*SEND call sign, ACK_L1, NON OBSRS TM TO GS*/\
                             snd_tm.head_pointer(tm_ptr_head);\
-                            transmit_adf;\ 
+                            gPC.puts("enter_adf\r\n");\
+                            transmit_adf;\
+                            gPC.puts("exit_adf\r\n");\ 
                             /*DELETE THE TM AFTER USE*/\
                             tm_ptr = tm_ptr_head;\
                             overflowCountExecute = 0;\
--- a/Compression.h	Mon Jan 25 14:20:44 2016 +0000
+++ b/Compression.h	Tue Jan 26 10:05:19 2016 +0000
@@ -67,7 +67,10 @@
 
 //give the pointer of 6 second data to this function
 void srp(unsigned char * head){
-    sci_time = FCTN_CDMS_RD_RTC();
+    //sci_time = FCTN_CDMS_RD_RTC();
+    sci_time = 0;
+    gPC.puts("enter srp");
+    
     for (int i = 0; i < 52 ; i++){
         scp_bin[i] = 0;
     }
@@ -155,6 +158,8 @@
                 }
             }//below thershold ends here.
         
+        //gPC.puts("below_thresh\r\n");
+        
             if(at == 1){
                 pointer = sfp + 6; debug_cntr = 6;space = 8;
                 sfp[0] = (sci_time>>27)&0xff;   sfp[1] = (sci_time>>19)&0xff;   sfp[2] = (sci_time>>11)&0xff;   sfp[3] = (sci_time>>3)&0xff;
@@ -238,6 +243,8 @@
                 }
             }
         }   
+        
+        //gPC.puts("sci fine pack\r\n");
         //science fine packet is complete here.
         //lets try to make frame now******************************************************************************************************************************
         if(srp_mode == 0){
@@ -272,7 +279,7 @@
                 if(id == 1){    //below thereshold
                     space = adjust(1,0,pointer,8);
                     space = adjust(4,3,pointer,space);
-                    FSC_science = FCTN_SD_MNGR(3);
+                    //FSC_science = FCTN_SD_MNGR(3);
                     //gPC.printf("SID = 3, FSC = %02X\r\n", FSC_science);
                     frames[id][1] = (FSC_science>>24)&0xff;
                     frames[id][2] = (FSC_science>>16)&0xff;
@@ -286,7 +293,7 @@
                 }else if(id == 2){
                     space = adjust(1,0,pointer,8);
                     space = adjust(4,2,pointer,space);
-                    FSC_science = FCTN_SD_MNGR(2);
+                    //FSC_science = FCTN_SD_MNGR(2);
                     //gPC.printf("SID = 2, FSC = %02X\r\n", FSC_science);
                     frames[id][1] = (FSC_science>>16)&0xff;
                     frames[id][2] = (FSC_science>>8)&0xff;
@@ -299,9 +306,9 @@
                 interleave(TM_convoluted_data,TM_interleave_data);
                 interleave(TM_convoluted_data+ 135,TM_interleave_data + 144);
                 if(id == 1)
-                    SD_WRITE(TM_interleave_data,FSC_science,3);
+                    /*SD_WRITE(TM_interleave_data,FSC_science,3)*/;
                 else if (id == 2)
-                    SD_WRITE(TM_interleave_data,FSC_science,2);
+                    /*SD_WRITE(TM_interleave_data,FSC_science,2)*/;
                 position_tm_frame[id] = position_tm_starting[id];
                 frames[id][6-id] = (length-1) - j;      // first head pointer.
             }
@@ -367,6 +374,8 @@
             ezf = 0;
     }
     
+    gPC.puts("scp\r\n");
+    
     pointer = scp;      debug_cntr = 0;     space = 8;
     unsigned char packet_pp = 1;    //where to get this packet present bit----------------------------------------------------------------------------------
     int sfp_at_counter; //----------------------------------------------------------------------------------------------------------------------------------
@@ -505,6 +514,9 @@
             }
         }
     }//-----------------------------------------------------------------------------------------------------------------------------------------------------
+    
+    gPC.puts("sci frame starts\r\n");
+    
     //time to make scp frame
     id = 0;
     if(srp_mode == 0 && compression_option == 0){
@@ -550,7 +562,7 @@
                 pointer = frames[id];
                 space = adjust(1,0,pointer,8);
                 space = adjust(4,1,pointer,space);
-                FSC_science = FCTN_SD_MNGR(1);
+                //FSC_science = FCTN_SD_MNGR(1);
                 //gPC.printf("SID = 1, FSC = %02X\r\n", FSC_science);
                 frames[id][1] = (FSC_science>>16)&0xff;
                 frames[id][2] = (FSC_science>>8)&0xff;
@@ -564,7 +576,7 @@
                 convolution(frames[id]);
                 interleave(TM_convoluted_data,TM_interleave_data);
                 interleave(TM_convoluted_data+ 135,TM_interleave_data + 144);
-                SD_WRITE(TM_interleave_data,FSC_science,1);
+                /*SD_WRITE(TM_interleave_data,FSC_science,1);*/
                 position_tm_frame[id] = position_tm_starting[id];
                 frames[id][4] = (length-1) - j;
             }
--- a/OBSRS.h	Mon Jan 25 14:20:44 2016 +0000
+++ b/OBSRS.h	Tue Jan 26 10:05:19 2016 +0000
@@ -436,9 +436,9 @@
 //                        for(int i=0;i<512;i++){
 //                        printf("0x%02X,",write_buffer[i]);
 //                        }
-                   int write_success = SD_WRITE(write_buffer,FSC + block_counter,SID);
+                   //int write_success = SD_WRITE(write_buffer,FSC + block_counter,SID);
 //                   wait_ms(8);
-                   read_success = SD_READ(buffer_512, FSC + block_counter,SID);
+                   //read_success = SD_READ(buffer_512, FSC + block_counter,SID);
 //                   wait_ms(8);
 //                   cout<<"read_success = "<<read_success<<ENDL<<"\r\n";
 //                   cout<<"write_success = "<<write_success<<ENDL;
@@ -447,7 +447,7 @@
 //                        }
                }
                else{
-                   read_success = SD_READ(buffer_512, list_of_FSC[block_counter],SID);
+                   /*read_success = SD_READ(buffer_512, list_of_FSC[block_counter],SID)*/;
                    }
                ack_code = read_success;
                block_counter++;
@@ -494,7 +494,7 @@
     
 //    short_TC = true;
     //pc.printf("WELCOME\n\r");
-    FCTN_CDMS_SD_INIT();/* sd card initialization*/
+    //FCTN_CDMS_SD_INIT();/* sd card initialization*/
 //    SID = 0x0;
 //    FSC =10;
 //    no_of_frames =1;
--- a/ThreadsAndFunctions.h	Mon Jan 25 14:20:44 2016 +0000
+++ b/ThreadsAndFunctions.h	Tue Jan 26 10:05:19 2016 +0000
@@ -102,7 +102,8 @@
             }
         }
         else if( gFLAGS & NEW_TC_RECEIVED ){
-            /*gPC.puts("NEW TC RECEIVED\r\n");*/
+            gPC.puts("NEW TC RECEIVED\r\n");
+//            DEBUF_PRINT("NEW TC RECEIVED\r\n");
             Thread::wait(2000);    /*To be removed in flight model*/
             gFLAGS = gFLAGS & (~NEW_TC_RECEIVED);
             gFLAGS = gFLAGS | COM_MNG_TMTC_RUNNING_FLAG;
@@ -142,7 +143,8 @@
                             if( tempPAHot == 0xFF ){
                                 gFLAGS = gFLAGS & ~(COM_PA_HOT_FLAG);
                                 gCOM_PA_COOLING_TIMEOUT.detach();
-                                /*gPC.puts("EXECUTING TELECOMMANDS\r\n");*/
+                                gPC.puts("EXECUTING TELECOMMANDS\r\n");
+//                                DEBUF_PRINT("EXECUTING TELECOMMANDS\r\n");
                                 EXECUTE_OBOSC_ONLY;
                                 EXECUTE_TC;
                                 /*gPC.puts("COMPLETED EXECUTION\r\n");*/
@@ -300,8 +302,11 @@
 //        gLEDR = !gLEDR;
 //    }
     while(true){
+        gPC.puts("entering sci\r\n");
         gSCIENCE_THREAD->signal_wait(SCIENCE_SIGNAL);
+        gPC.puts("sig_set\r\n");
         srp(payload_data);
+        gPC.puts("exit_srp\r\n");
     }
 }
 
--- a/main.cpp	Mon Jan 25 14:20:44 2016 +0000
+++ b/main.cpp	Tue Jan 26 10:05:19 2016 +0000
@@ -1,6 +1,14 @@
 // TESTING PUSH PULL IN MAIN CPP
 
 #include "mbed.h"
+
+//#define DEBUG_DEF 1
+//
+//#define DEBUF_PRINT(x) \
+//    #ifdef DEBUG_DEF \
+//    gPC.puts(x);\
+//    #endif
+
 #include "rtos.h"
 #include "mbed_debug.h"
 
@@ -10,7 +18,7 @@
 #include "COM_SND_TM_functions.h"
 #include "COM_SND_TM.h"
 //#include "SDCread.h"
-#include "cdms_sd.h"
+//#include "cdms_sd.h"
 #include "OBSRS.h"
 #include "adf.h"
 //#include "SDC_init.h"
@@ -51,8 +59,8 @@
     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*/
     
     // initialise_card();
     // int result= initialise_card();
@@ -74,7 +82,7 @@
     // *******************INITIALISATIONS END********************
     
     /*starting the thread with signal*/
-    inr.rise(&set_sig);
+    set_sig();
     
     
     /*Calculating Stack used*/