June 30

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Committer:
chaithanyarss
Date:
Sat Jul 02 13:36:18 2016 +0000
Revision:
191:d14b1c783736
Parent:
190:28a07943dded
;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shreeshas95 7:fcd26c28411d 1 // TESTING PUSH PULL IN MAIN CPP
shreeshas95 7:fcd26c28411d 2
shreeshas95 0:f016e9e8d48b 3 #include "mbed.h"
chaithanyarss 191:d14b1c783736 4 #include "FreescaleIAP.h"
ee12b079 98:fd99ddc0e0a1 5
ee12b079 99:efde3df6cd94 6 #define DEBUG 1
ee12b079 98:fd99ddc0e0a1 7
shreeshas95 101:bece931236a2 8 #include "SimpleDMA.h"
shreeshas95 101:bece931236a2 9 #include "dmaSPIslave.h"
shreeshas95 0:f016e9e8d48b 10 #include "rtos.h"
shreeshas95 1:a0055b3280c8 11 #include "mbed_debug.h"
shreeshas95 0:f016e9e8d48b 12
chaithanyarss 190:28a07943dded 13 #include "pinconfig.h"
shreeshas95 0:f016e9e8d48b 14 #include "Structures.h"
shreeshas95 0:f016e9e8d48b 15 #include "DefinitionsAndGlobals.h"
chaithanyarss 190:28a07943dded 16 #include "cdms_rtc.h"
aniruddhv 144:4c20fcc105ce 17 void rx_read();
shreeshas95 0:f016e9e8d48b 18 #include "crc.h"
shreeshas95 103:b55559925dc1 19 #include "i2c.h"
shreeshas95 1:a0055b3280c8 20 #include "COM_SND_TM_functions.h"
shreeshas95 1:a0055b3280c8 21 #include "COM_SND_TM.h"
ee12b079 99:efde3df6cd94 22 #include "cdms_sd.h"
krishanprajapat 117:bfdc807f3d3c 23 #include "common_functions.h"
chaithanyarss 190:28a07943dded 24 #include "Reset_functions.h"
chaithanyarss 189:fba4aeebf004 25 #include "CDMS_HK.h"
ee12b079 86:a26f5f22631d 26 #include "OBSRS.h"
shreeshas95 1:a0055b3280c8 27 #include "adf.h"
shreeshas95 0:f016e9e8d48b 28 #include "COM_RCV_TC.h"
chaithanyarss 190:28a07943dded 29 #include "CDMS_PL.h"
chaithanyarss 190:28a07943dded 30 #include "FMS_all.h"
shreeshas95 0:f016e9e8d48b 31 #include "COM_MNG_TMTC.h"
aniruddhv 144:4c20fcc105ce 32 #include "COM_POWER_OFF_TX.h"
shreeshas95 4:104dd82c99b8 33 #include "COM_POWER_ON_TX.h"
ee12b079 96:4ca92f9775e0 34 #include "Compression.h"
shreeshas95 0:f016e9e8d48b 35 #include "ThreadsAndFunctions.h"
shreeshas95 0:f016e9e8d48b 36
chaithanyarss 190:28a07943dded 37
shreeshas95 105:5ce0337e7c15 38 //void set_sig(){gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL);}
shreeshas95 0:f016e9e8d48b 39 int main()
shreeshas95 0:f016e9e8d48b 40 {
ee12b079 97:717c7908c822 41 //gLEDR = 1;
ee12b079 96:4ca92f9775e0 42
shreeshas95 0:f016e9e8d48b 43 // ******************INITIALISATIONS START******************
shreeshas95 0:f016e9e8d48b 44 // COM RX
shreeshas95 0:f016e9e8d48b 45 RX1M.baud(1200);
shreeshas95 0:f016e9e8d48b 46 gRX_HEAD_DATA_NODE = new COM_RX_DATA_NODE;
shreeshas95 0:f016e9e8d48b 47 gRX_HEAD_DATA_NODE->next_node = NULL;
shreeshas95 0:f016e9e8d48b 48 gRX_CURRENT_DATA_NODE = gRX_HEAD_DATA_NODE;
shreeshas95 2:2caf2a9a13aa 49 gRX_COUNT = 0;
shreeshas95 2:2caf2a9a13aa 50 // gRX_CURRENT_PTR = gRX_CURRENT_DATA_NODE->values;
shreeshas95 0:f016e9e8d48b 51 RX1M.attach(&rx_read, Serial::RxIrq);
shreeshas95 0:f016e9e8d48b 52
chaithanyarss 187:2c7263530c57 53 gPC.baud(9600);
shreeshas95 0:f016e9e8d48b 54
shreeshas95 0:f016e9e8d48b 55 // COMMON SPI
shreeshas95 0:f016e9e8d48b 56 spi.format(8,0);
shreeshas95 0:f016e9e8d48b 57 spi.frequency(1000000);
shreeshas95 0:f016e9e8d48b 58
shreeshas95 0:f016e9e8d48b 59 // SD CARD
ee12b079 86:a26f5f22631d 60 cs_sd = 1;
shreeshas95 2:2caf2a9a13aa 61 gCS_RTC = 1;
ee12b079 90:df55a5f68331 62 gCS_ADF = 1;
ee12b079 93:4d76de54a699 63
chaithanyarss 191:d14b1c783736 64 // FCTN_CDMS_INIT_RTC(); /* rtc initialization*/
chaithanyarss 191:d14b1c783736 65 //FCTN_CDMS_SD_INIT(); /*sd card initialization*/
chaithanyarss 191:d14b1c783736 66 uint32_t lol = flash_size();
chaithanyarss 191:d14b1c783736 67 gPC.printf("0x%08X\n",lol);
shreeshas95 0:f016e9e8d48b 68
ee12b079 134:4694fc291ce1 69 if (DEBUG)
chaithanyarss 187:2c7263530c57 70 gPC.puts("\rwelcome to mng_22tmtc\r\n");
chaithanyarss 187:2c7263530c57 71
ee12b079 134:4694fc291ce1 72
shreeshas95 0:f016e9e8d48b 73 // COM_MNG_TMTC THREAD
shreeshas95 0:f016e9e8d48b 74 gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN);
shreeshas95 0:f016e9e8d48b 75 gCOM_MNG_TMTC_THREAD->set_priority(osPriorityAboveNormal);
ee12b079 134:4694fc291ce1 76 if (DEBUG)
ee12b079 134:4694fc291ce1 77 gPC.puts("allocating threads\r\n");
ee12b079 113:b8991d9e3b6c 78 gSCIENCE_THREAD = new Thread(SCIENCE_FUN);
ee12b079 94:611c066467a1 79 // gPC.puts("step one complete\r\n");
ee12b079 113:b8991d9e3b6c 80 gSCIENCE_THREAD->set_priority(osPriorityBelowNormal);
chaithanyarss 190:28a07943dded 81 //gHK_THREAD = new Thread(HK_);
ee12b079 134:4694fc291ce1 82 if (DEBUG)
ee12b079 134:4694fc291ce1 83 gPC.puts("competed allocating threads\r\n");
ee12b079 134:4694fc291ce1 84
shreeshas95 0:f016e9e8d48b 85 // *******************INITIALISATIONS END********************
shreeshas95 0:f016e9e8d48b 86
ee12b079 113:b8991d9e3b6c 87 //RtosTimer gCDMS_HK_TIMER(FCTN_CDMS_HK_MAIN, osTimerPeriodic);
ee12b079 113:b8991d9e3b6c 88 //gCDMS_HK_TIMER.start(5000);
shreeshas95 104:a50ae79ca36e 89
ee12b079 97:717c7908c822 90 /*starting the thread with signal*/
shreeshas95 105:5ce0337e7c15 91 // set_sig();
ee12b079 97:717c7908c822 92
ee12b079 94:611c066467a1 93 /*Calculating Stack used*/
ee12b079 94:611c066467a1 94
ee12b079 96:4ca92f9775e0 95 int state;
ee12b079 96:4ca92f9775e0 96 /*while (true) {
ee12b079 96:4ca92f9775e0 97 Thread::wait(500);
ee12b079 96:4ca92f9775e0 98 state = gSCIENCE_THREAD->get_state();
ee12b079 96:4ca92f9775e0 99 //gPC.printf("Thread state %d\r\n", state);
ee12b079 96:4ca92f9775e0 100 if(state == Thread::Inactive)
ee12b079 96:4ca92f9775e0 101 {delete gSCIENCE_THREAD;
ee12b079 96:4ca92f9775e0 102 break;}
ee12b079 96:4ca92f9775e0 103 }*/
ee12b079 96:4ca92f9775e0 104
ee12b079 96:4ca92f9775e0 105
ee12b079 96:4ca92f9775e0 106
shreeshas95 0:f016e9e8d48b 107 while(true){
ee12b079 97:717c7908c822 108 Thread::wait(osWaitForever);
ee12b079 96:4ca92f9775e0 109 //state = gCOM_MNG_TMTC_THREAD->get_state() + '0';
ee12b079 96:4ca92f9775e0 110 gLEDG = !gLEDG;
ee12b079 96:4ca92f9775e0 111 //gPC.putc(state);
shreeshas95 0:f016e9e8d48b 112 }
shreeshas95 0:f016e9e8d48b 113 }