CDMS_CODE_samp_23SEP_DMA_flag
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE_samp_23SEP_DMA by
main.cpp@290:3159ff1081a2, 2016-08-07 (annotated)
- Committer:
- chaithanyarss
- Date:
- Sun Aug 07 10:36:59 2016 +0000
- Revision:
- 290:3159ff1081a2
- Parent:
- 289:9bd62b69874c
- Child:
- 292:61aa2169ea1c
testing in indo mim. DMA not working;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shreeshas95 | 7:fcd26c28411d | 1 | // TESTING PUSH PULL IN MAIN CPP |
shreeshas95 | 7:fcd26c28411d | 2 | |
shreeshas95 | 0:f016e9e8d48b | 3 | #include "mbed.h" |
ee12b079 | 98:fd99ddc0e0a1 | 4 | |
ee12b079 | 99:efde3df6cd94 | 5 | #define DEBUG 1 |
ee12b079 | 98:fd99ddc0e0a1 | 6 | |
shreeshas95 | 101:bece931236a2 | 7 | #include "SimpleDMA.h" |
shreeshas95 | 101:bece931236a2 | 8 | #include "dmaSPIslave.h" |
shreeshas95 | 0:f016e9e8d48b | 9 | #include "rtos.h" |
shreeshas95 | 1:a0055b3280c8 | 10 | #include "mbed_debug.h" |
aniruddhv | 262:752c8689944a | 11 | void rx_read(); |
shreeshas95 | 0:f016e9e8d48b | 12 | #include "Structures.h" |
shreeshas95 | 103:b55559925dc1 | 13 | #include "pinconfig.h" |
shreeshas95 | 0:f016e9e8d48b | 14 | #include "DefinitionsAndGlobals.h" |
shreeshas95 | 0:f016e9e8d48b | 15 | #include "crc.h" |
shreeshas95 | 103:b55559925dc1 | 16 | #include "i2c.h" |
shreeshas95 | 1:a0055b3280c8 | 17 | #include "COM_SND_TM_functions.h" |
shreeshas95 | 1:a0055b3280c8 | 18 | #include "COM_SND_TM.h" |
ee12b079 | 289:9bd62b69874c | 19 | #include "Flash.h" |
ee12b079 | 210:f4acf895b598 | 20 | #include "cdms_rtc.h" |
ee12b079 | 99:efde3df6cd94 | 21 | #include "cdms_sd.h" |
krishanprajapat | 117:bfdc807f3d3c | 22 | #include "common_functions.h" |
ee12b079 | 210:f4acf895b598 | 23 | #include "RESET_functions.h" |
ee12b079 | 289:9bd62b69874c | 24 | #include "CDMS_PL.h" |
ee12b079 | 210:f4acf895b598 | 25 | #include "CDMS_HK.h" |
shreeshas95 | 1:a0055b3280c8 | 26 | #include "adf.h" |
shreeshas95 | 0:f016e9e8d48b | 27 | #include "COM_RCV_TC.h" |
ee12b079 | 210:f4acf895b598 | 28 | #include "FMS_all.h" |
chaithanyarss | 261:1e54415b34d3 | 29 | #include "Compression.h" |
shreeshas95 | 0:f016e9e8d48b | 30 | #include "COM_MNG_TMTC.h" |
aniruddhv | 262:752c8689944a | 31 | #include "COM_POWER_OFF_TX.h" |
shreeshas95 | 4:104dd82c99b8 | 32 | #include "COM_POWER_ON_TX.h" |
aniruddhv | 262:752c8689944a | 33 | #include "OBSRS.h" |
shreeshas95 | 0:f016e9e8d48b | 34 | #include "ThreadsAndFunctions.h" |
ee12b079 | 210:f4acf895b598 | 35 | #include "TEST_PL.h" |
shreeshas95 | 0:f016e9e8d48b | 36 | |
shreeshas95 | 0:f016e9e8d48b | 37 | int main() |
prasanthbj05 | 267:783c248a6207 | 38 | { |
ee12b079 | 284:5bfd48ce169d | 39 | |
ee12b079 | 285:fe33b39dd267 | 40 | //RELAY SWITCHING |
ee12b079 | 284:5bfd48ce169d | 41 | |
ee12b079 | 285:fe33b39dd267 | 42 | |
ee12b079 | 285:fe33b39dd267 | 43 | RF_SW_CNTRL_BCN = 1; |
ee12b079 | 285:fe33b39dd267 | 44 | Thread::wait(25); |
ee12b079 | 285:fe33b39dd267 | 45 | RF_SW_CNTRL_BCN = 0; |
ee12b079 | 284:5bfd48ce169d | 46 | PYLD_DFF = 1; |
ee12b079 | 284:5bfd48ce169d | 47 | |
ee12b079 | 284:5bfd48ce169d | 48 | for(int i= 0; i< 10 ; i++) |
ee12b079 | 284:5bfd48ce169d | 49 | {PYLD_DFF_CLK = !PYLD_DFF_CLK; |
ee12b079 | 284:5bfd48ce169d | 50 | wait_us(10);} |
ee12b079 | 284:5bfd48ce169d | 51 | |
ee12b079 | 185:3b3cd96a7811 | 52 | CDMS_I2C_GPIO = 0; |
ee12b079 | 210:f4acf895b598 | 53 | PL_I2C_GPIO = 0; |
ee12b079 | 162:48fda0b8d573 | 54 | |
shreeshas95 | 0:f016e9e8d48b | 55 | RX1M.baud(1200); |
shreeshas95 | 0:f016e9e8d48b | 56 | gRX_HEAD_DATA_NODE = new COM_RX_DATA_NODE; |
shreeshas95 | 0:f016e9e8d48b | 57 | gRX_HEAD_DATA_NODE->next_node = NULL; |
shreeshas95 | 0:f016e9e8d48b | 58 | gRX_CURRENT_DATA_NODE = gRX_HEAD_DATA_NODE; |
shreeshas95 | 2:2caf2a9a13aa | 59 | gRX_COUNT = 0; |
shreeshas95 | 0:f016e9e8d48b | 60 | RX1M.attach(&rx_read, Serial::RxIrq); |
shreeshas95 | 0:f016e9e8d48b | 61 | |
ee12b079 | 268:ded5306a1fd1 | 62 | gPC.baud(1200);//changed for bypassing COM |
shreeshas95 | 0:f016e9e8d48b | 63 | |
ee12b079 | 288:aa93d6652381 | 64 | //Base_tm *tm_ptr = NULL; |
ee12b079 | 288:aa93d6652381 | 65 | //SET_BCN_STANDBY(tm_ptr); |
ee12b079 | 288:aa93d6652381 | 66 | //gPC.puts("set Bcn off\r\n"); |
ee12b079 | 285:fe33b39dd267 | 67 | |
shreeshas95 | 0:f016e9e8d48b | 68 | // COMMON SPI |
shreeshas95 | 0:f016e9e8d48b | 69 | spi.format(8,0); |
chaithanyarss | 261:1e54415b34d3 | 70 | spi.frequency(500000); |
shreeshas95 | 0:f016e9e8d48b | 71 | |
shreeshas95 | 0:f016e9e8d48b | 72 | // SD CARD |
ee12b079 | 86:a26f5f22631d | 73 | cs_sd = 1; |
shreeshas95 | 2:2caf2a9a13aa | 74 | gCS_RTC = 1; |
ee12b079 | 90:df55a5f68331 | 75 | gCS_ADF = 1; |
ee12b079 | 93:4d76de54a699 | 76 | |
ee12b079 | 274:5c02ff05f3da | 77 | FCTN_CDMS_INIT_RTC();/* rtc initialization*/ |
ee12b079 | 268:ded5306a1fd1 | 78 | FCTN_CDMS_SD_INIT();/* sd card initialization*/ |
shreeshas95 | 0:f016e9e8d48b | 79 | |
ee12b079 | 196:c51bf4993f75 | 80 | |
ee12b079 | 274:5c02ff05f3da | 81 | uint8_t test[512] = {0}; |
ee12b079 | 268:ded5306a1fd1 | 82 | disk_write(test,7000); //to be used only just before launch |
ee12b079 | 196:c51bf4993f75 | 83 | |
ee12b079 | 113:b8991d9e3b6c | 84 | #if DEBUG |
ee12b079 | 113:b8991d9e3b6c | 85 | gPC.puts("welcome to mng_tmtc\r\n"); |
ee12b079 | 113:b8991d9e3b6c | 86 | #endif |
ee12b079 | 113:b8991d9e3b6c | 87 | |
ee12b079 | 246:565458eefd94 | 88 | #if DEBUG |
ee12b079 | 246:565458eefd94 | 89 | gPC.puts("allocating threads\r\n"); |
ee12b079 | 246:565458eefd94 | 90 | #endif |
ee12b079 | 185:3b3cd96a7811 | 91 | |
aniruddhv | 264:f7d8f9f361e3 | 92 | // COM_POWER_ON_TX(); |
aniruddhv | 264:f7d8f9f361e3 | 93 | |
shreeshas95 | 0:f016e9e8d48b | 94 | // COM_MNG_TMTC THREAD |
ee12b079 | 268:ded5306a1fd1 | 95 | gCOM_MNG_TMTC_THREAD = new Thread(COM_MNG_TMTC_FUN); |
ee12b079 | 162:48fda0b8d573 | 96 | gCOM_MNG_TMTC_THREAD->set_priority(osPriorityHigh); |
ee12b079 | 246:565458eefd94 | 97 | |
ee12b079 | 246:565458eefd94 | 98 | gHK_THREAD = new Thread(FCTN_CDMS_HK_MAIN); |
ee12b079 | 246:565458eefd94 | 99 | gHK_THREAD->set_priority(osPriorityAboveNormal); |
ee12b079 | 246:565458eefd94 | 100 | |
ee12b079 | 113:b8991d9e3b6c | 101 | gSCIENCE_THREAD = new Thread(SCIENCE_FUN); |
ee12b079 | 268:ded5306a1fd1 | 102 | gSCIENCE_THREAD->set_priority(osPriorityAboveNormal); |
ee12b079 | 246:565458eefd94 | 103 | |
ee12b079 | 99:efde3df6cd94 | 104 | #if DEBUG |
prasanthbj05 | 266:ae588e75cfa4 | 105 | gPC.puts("completed allocating threads\r\n"); |
prasanthbj05 | 267:783c248a6207 | 106 | #endif |
ee12b079 | 246:565458eefd94 | 107 | |
ee12b079 | 170:286ef9dad36a | 108 | master.frequency(400000); |
ee12b079 | 246:565458eefd94 | 109 | |
ee12b079 | 271:72529b247333 | 110 | HK_counter = new RtosTimer(hk_isr, osTimerPeriodic,(void * )NULL); |
ee12b079 | 278:1d837d6dfb6e | 111 | //gHK_THREAD->signal_set(HK_SIGNAL); |
ee12b079 | 278:1d837d6dfb6e | 112 | HK_counter->start(10000); |
ee12b079 | 253:fd6696d91e74 | 113 | |
aniruddhv | 262:752c8689944a | 114 | sys_reset_cdms_timer = new RtosTimer(sys_pwr_reset, osTimerPeriodic, (void * )NULL); |
ee12b079 | 268:ded5306a1fd1 | 115 | sys_reset_cdms_timer->start(cdms_reset_timeout); |
aniruddhv | 262:752c8689944a | 116 | |
chaithanyarss | 290:3159ff1081a2 | 117 | //PL_wo_dma = new RtosTimer(payload_isr_fun_dma, osTimerPeriodic,(void * )NULL); |
chaithanyarss | 290:3159ff1081a2 | 118 | //PL_wo_dma->start(6000); |
ee12b079 | 278:1d837d6dfb6e | 119 | //gSCIENCE_THREAD->signal_set(SCIENCE_SIGNAL); |
ee12b079 | 203:424308159a56 | 120 | |
chaithanyarss | 261:1e54415b34d3 | 121 | /*Timeout flipper; |
chaithanyarss | 261:1e54415b34d3 | 122 | flipper.attach(BAE_TC,31);*/ |
ee12b079 | 203:424308159a56 | 123 | |
ee12b079 | 232:b1458c1e9199 | 124 | /*while(1){ |
chaithanyarss | 228:335da5b0d3e4 | 125 | gPC.printf("PL_TC sending\r\n"); |
ee12b079 | 199:9f03d6ca94c9 | 126 | |
chaithanyarss | 228:335da5b0d3e4 | 127 | Base_tm *tm_ptr = new Long_tm; |
chaithanyarss | 228:335da5b0d3e4 | 128 | PL_TC(tm_ptr); |
chaithanyarss | 228:335da5b0d3e4 | 129 | wait(1); |
chaithanyarss | 228:335da5b0d3e4 | 130 | } |
ee12b079 | 232:b1458c1e9199 | 131 | gPC.printf("PL_TC sent");*/ |
chaithanyarss | 290:3159ff1081a2 | 132 | //test_pl_main(); |
shreeshas95 | 0:f016e9e8d48b | 133 | while(true){ |
ee12b079 | 97:717c7908c822 | 134 | Thread::wait(osWaitForever); |
ee12b079 | 96:4ca92f9775e0 | 135 | gLEDG = !gLEDG; |
shreeshas95 | 0:f016e9e8d48b | 136 | } |
shreeshas95 | 0:f016e9e8d48b | 137 | } |