![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Repository for testing ADF code of COM_TMTC_SIMPLE
Fork of COM_MNG_TMTC_SIMPLE by
Diff: adf.h
- Revision:
- 4:e37674541504
- Parent:
- 3:6c81fc8834e2
--- a/adf.h Wed Dec 23 05:37:55 2015 +0000 +++ b/adf.h Thu Dec 24 18:38:12 2015 +0000 @@ -12,8 +12,7 @@ //int initialise_card(); //int disk_initialize(); -#define bbram_write {\ - SPI_mutex.lock();\ +#define bbram_write {\//SPI_mutex.lock();\ gCS_ADF=0;\ spi.write(0xB0);\ wait_us(300);\ @@ -22,8 +21,7 @@ for(int i=0;i<66;i++){\ spi.write(bbram_buffer[i]);\ }\ - gCS_ADF=1;\ - SPI_mutex.unlock();\ + gCS_ADF=1;\//SPI_mutex.unlock();\ } //------------------------------------------------------------------------ // state checking functions @@ -341,8 +339,7 @@ //for reseting the transmission call assert function after b5 and b1. after b1 assert_phi_on and after b5 assert_phi_tx. //---------------------------------------------------------------------------- -# define initiate {\ - SPI_mutex.lock();\ +# define initiate {\//SPI_mutex.lock();\ gCS_ADF=0;\ spi.write(0xFF);\ spi.write(0xFF);\ @@ -376,13 +373,11 @@ spi.write(0x09);\ spi.write(0x39);\ spi.write(0x10);\ - gCS_ADF=1;\ - SPI_mutex.unlock();\ + gCS_ADF=1;\//SPI_mutex.unlock();\ } -#define write_data {\ - SPI_mutex.lock();\ +#define write_data {\//SPI_mutex.lock();\ gCS_ADF=0;\ spi.write(0x0B);\ spi.write(0x36);\ @@ -403,8 +398,7 @@ spi.write(buffer_112[i]);\ }\ }\ - gCS_ADF=1;\ - SPI_mutex.unlock();\ + gCS_ADF=1;\//SPI_mutex.unlock();\ buffer_state = !buffer_state;\ if(last_buffer){\ ADF_off = true;\ @@ -420,16 +414,14 @@ } -#define send_data {\ - SPI_mutex.lock();\ +#define send_data {\ // SPI_mutex.lock();\ gCS_ADF=0;\ spi.write(0xBB);\ gCS_ADF=1;\ gCS_ADF=0;\ spi.write(0xFF);\ spi.write(0xFF);\ - gCS_ADF=1;\ - SPI_mutex.unlock();\ + gCS_ADF=1;\ // SPI_mutex.unlock();\ if(sent_tmfrom_SDcard){\ send_tm_from_SD_card();\ }else{\ @@ -446,8 +438,7 @@ send_tm_from_SD_card();\ }else{\ snd_tm.transmit_data(buffer_112,&last_buffer);\ - }\ - SPI_mutex.lock();\ + }\ //SPI_mutex.lock();\ gCS_ADF=0;\ spi.write(0xB1);\ gCS_ADF=1;\ @@ -463,58 +454,57 @@ gCS_ADF=0;\ spi.write(0xFF);\ spi.write(0xFF);\ - gCS_ADF=1;\ - SPI_mutex.unlock();\ + gCS_ADF=1;\ //SPI_mutex.unlock();\ ticker.attach_us(&check,32000);\ } -#define adf_SND_SDCard {\ - buffer_state = true;\ - last_buffer = false;\ - loop_on = true;\ - ADF_off = false;\ - sent_tmfrom_SDcard = true;\ - signal = COM_MNG_TMTC_SIGNAL_ADF_SD;\ - start_block_num = starting_add;\ - end_block_num = ending_add;\ - initial_adf_check;\ - initiate;\ - send_data;\ - while(loop_on){\ - /*led2=!led2;*/\ - gCOM_MNG_TMTC_THREAD->signal_wait(COM_MNG_TMTC_SIGNAL_ADF_SD);\ - if(ADF_off){\ - SPI_mutex.lock();\ - ticker.detach();\ - gCS_ADF=0;\ - spi.write(0xB1);\ - gCS_ADF=1;\ - SPI_mutex.unlock();\ - gPC.puts("transmission done\r\n");\ - loop_on = false;\ - }else{\ - write_data;\ - if(!last_buffer)\ - send_tm_from_SD_card();\ - }\ - }\ -} +//#define adf_SND_SDCard {\ +// buffer_state = true;\ +// last_buffer = false;\ +// loop_on = true;\ +// ADF_off = false;\ +// sent_tmfrom_SDcard = true;\ +// signal = COM_MNG_TMTC_SIGNAL_ADF_SD;\ +// start_block_num = starting_add;\ +// end_block_num = ending_add;\ +// initial_adf_check;\ +// initiate;\ +// send_data;\ +// while(loop_on){\ +// /*led2=!led2;*/\ +// gCOM_MNG_TMTC_THREAD->signal_wait(COM_MNG_TMTC_SIGNAL_ADF_SD);\ +// if(ADF_off){\ +// SPI_mutex.lock();\ +// ticker.detach();\ +// gCS_ADF=0;\ +// spi.write(0xB1);\ +// gCS_ADF=1;\ +// SPI_mutex.unlock();\ +// gPC.puts("transmission done\r\n");\ +// loop_on = false;\ +// }else{\ +// write_data;\ +// if(!last_buffer)\ +// send_tm_from_SD_card();\ +// }\ +// }\ +//} -void read_TC(Base_tc* TC_ptr){ - gPC.puts("Inside sd card sending\r\n"); - unsigned char service_subtype = 0; - uint64_t starting_add = 0, ending_add = 0; - service_subtype = (TC_ptr->TC_string[2])&0x0f; - starting_add = (TC_ptr->TC_string[5]) + ( (TC_ptr->TC_string[4])<<8 ) + ( (TC_ptr->TC_string[3]) <<16); - ending_add = (TC_ptr->TC_string[8]) + ( (TC_ptr->TC_string[7])<<8 ) + ( (TC_ptr->TC_string[6]) <<16); - starting_add = 10; // for now - ending_add = 20; -// adf_SND_SDCard(starting_add , ending_add); - gPC.puts("sending from sd card\r\n"); - adf_SND_SDCard; -} +//void read_TC(Base_tc* TC_ptr){ +// gPC.puts("Inside sd card sending\r\n"); +// unsigned char service_subtype = 0; +// uint64_t starting_add = 0, ending_add = 0; +// service_subtype = (TC_ptr->TC_string[2])&0x0f; +// starting_add = (TC_ptr->TC_string[5]) + ( (TC_ptr->TC_string[4])<<8 ) + ( (TC_ptr->TC_string[3]) <<16); +// ending_add = (TC_ptr->TC_string[8]) + ( (TC_ptr->TC_string[7])<<8 ) + ( (TC_ptr->TC_string[6]) <<16); +// starting_add = 10; // for now +// ending_add = 20; +//// adf_SND_SDCard(starting_add , ending_add); +// gPC.puts("sending from sd card\r\n"); +// adf_SND_SDCard; +//} //Timeout ADF_non_responsive_timeout; //bool ADF_non_responsive_flag = false; @@ -531,7 +521,7 @@ ADF_off = false; sent_tmfrom_SDcard = false; - signal = COM_MNG_TMTC_SIGNAL_ADF_NSD; +// signal = COM_MNG_TMTC_SIGNAL_ADF_NSD; initial_adf_check; initiate; send_data;