Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of COM_MNG_TMTC_SIMPLE by
Diff: adf.h
- Revision:
- 53:18db568f1098
- Parent:
- 52:0bd68655c651
- Child:
- 55:39e59903bc3a
- Child:
- 69:20f09a0c3fd2
- Child:
- 71:9193fbdaa3e1
--- a/adf.h Thu Jan 14 06:16:42 2016 +0000
+++ b/adf.h Thu Jan 14 10:32:40 2016 +0000
@@ -94,41 +94,6 @@
}
-//#define assrt_phy_on(cmd_err_cnt, spi_err_cnt, state_err_cnt, return_this){\
-// status=check_status();\
-// if((status&0x1F)==0x12){\
-// return 0;\
-// }\
-// else if(cmd_err_cnt>THRS||spi_err_cnt>THRS){\
-// return 1;\
-// }\
-// else if(state_err_cnt>STATE_ERR_THRS){\
-// return 1;\
-// }\
-// else if((status&0xA0)==0xA0){\
-// cs_adf=0;\
-// spi.write(0xB1);\
-// cs_adf=1;\
-// wait_us(PHY_ON_EXEC_TIME);\
-// return assrt_phy_on(cmd_err_cnt,spi_err_cnt,state_err_cnt+1);\
-// }\
-// else if(status&0x80==0x00){\
-// wait_ms(5);\
-// //Error: SPI=0 Not ready CMD= Dont care
-// return assrt_phy_on(cmd_err_cnt,spi_err_cnt+1,state_err_cnt);\
-// }\
-// else{\
-// if(status&0xA0==0x80){\
-// wait_ms(1);\
-// //Error: Command Not ready SPI Ready cmd_err_cnt is a global variable
-// return assrt_phy_on(cmd_err_cnt+1,spi_err_cnt,state_err_cnt);\
-// }\
-// }\
-//}
-
-
-
-
#define initial_adf_check {\
spi.write(CMD_PHY_OFF);\
int tempReturn = 0;\
@@ -164,101 +129,6 @@
bool bcn_flag=0;
bool bbram_flag=0;
-//bool assrt_phy_off(int cmd_err_cnt,int spi_err_cnt,int state_err_cnt){
-// status=check_status();
-// if(status==0xB1){
-// return 0;
-// }
-// else if(cmd_err_cnt>THRS||spi_err_cnt>THRS){
-// return 1;//You need to Reset the hardware
-// }
-// else if(state_err_cnt>STATE_ERR_THRS){
-// return 1;//Again reset the hardware
-// }
-// else if((status&0xA0)==0xA0){ //If Status' first three bit ore 0b1X1 =>SPI ready, Dont care interrupt and CMD Ready.
-// cs_adf=0;
-// spi.write(CMD_PHY_OFF); //CMD_PHY_OFF=0xB0
-// cs_adf=1;
-// wait_us(PHY_OFF_EXEC_TIME);// Typical = 24us We are giving 300us
-// return assrt_phy_off(cmd_err_cnt,spi_err_cnt,state_err_cnt+1);
-// }
-// else if(status&0x80==0x00){
-// wait_ms(5);
-// //Error: SPI=0 Not ready CMD= Dont care
-// return assrt_phy_off(cmd_err_cnt,spi_err_cnt+1,state_err_cnt);
-// }
-// else {//if(status&0xA0==0x80){
-// wait_ms(1);
-// //Error: Command Not ready SPI Ready cmd_err_cnt is a global variable
-// return assrt_phy_off(cmd_err_cnt+1,spi_err_cnt,state_err_cnt);
-// }
-//}
-
-//bool assrt_phy_on(int cmd_err_cnt,int spi_err_cnt,int state_err_cnt){
-// status=check_status();
-// if((status&0x1F)==0x12){
-// return 0;
-// }
-// else if(cmd_err_cnt>THRS||spi_err_cnt>THRS){
-// return 1;//You need to Reset the hardware
-// }
-// else if(state_err_cnt>STATE_ERR_THRS){
-// return 1;//Again reset the hardware
-// }
-// else if((status&0xA0)==0xA0){ //If Status' first three bit ore 0b1X1 =>SPI ready, Dont care interrupt and CMD Ready.
-// cs_adf=0;
-// spi.write(0xB1); //CMD_PHY_OFF
-// cs_adf=1;
-// wait_us(PHY_ON_EXEC_TIME);// Typical = 24us We are giving 300us
-// return assrt_phy_on(cmd_err_cnt,spi_err_cnt,state_err_cnt+1);
-// }
-// else if(status&0x80==0x00){
-// wait_ms(5);
-// //Error: SPI=0 Not ready CMD= Dont care
-// return assrt_phy_on(cmd_err_cnt,spi_err_cnt+1,state_err_cnt);
-// }
-// else{
-// if(status&0xA0==0x80){
-// wait_ms(1);
-// //Error: Command Not ready SPI Ready cmd_err_cnt is a global variable
-// return assrt_phy_on(cmd_err_cnt+1,spi_err_cnt,state_err_cnt);
-// }
-// }
-//}
-
-
-// bool assrt_phy_tx(int cmd_err_cnt,int spi_err_cnt,int state_err_cnt){
-// status=check_status();
-// if((status & 0x1F) == 0x14){
-// return 0;
-// }
-// else if(cmd_err_cnt>THRS||spi_err_cnt>THRS){
-// return 1;//You need to Reset the hardware
-// }
-// else if(state_err_cnt>STATE_ERR_THRS){
-// return 1;//Again reset the hardware
-// }
-// else if((status&0xA0)==0xA0){ //If Status' first three bit ore 0b1X1 =>SPI ready, Dont care interrupt and CMD Ready.
-// cs_adf=0;
-// spi.write(0xB1); //CMD_PHY_OFF
-// cs_adf=1;
-// wait_us(PHY_TX_EXEC_TIME);// Typical = 24us We are giving 300us
-// return assrt_phy_tx(cmd_err_cnt,spi_err_cnt,state_err_cnt+1);
-// }
-// else if(status&0x80==0x00){
-// wait_ms(1);
-// //Error: SPI=0 Not ready CMD= Dont care
-// return assrt_phy_tx(cmd_err_cnt,spi_err_cnt+1,state_err_cnt);
-// }
-// else {
-// if(status&0xA0==0x80){
-// wait_us(50);
-// //Error: Command Not ready SPI Ready cmd_err_cnt is a global variable
-// return assrt_phy_tx(cmd_err_cnt+1,spi_err_cnt,state_err_cnt);
-// }
-// }
-//}
-
bool hardware_reset(int bcn_call){
for(int i= 0; i < 20 ; i++){
gCS_ADF=0;
@@ -284,61 +154,6 @@
return 1;
}
-//bool hardware_reset(int bcn_call){
-// if (bcn_call>20){//Worst Case 20seconds will be lost !
-// return 1;
-// }
-// int count=0;
-// cs_adf=0;
-// spi.write(CMD_HW_RESET);
-// cs_adf=1;
-// wait_ms(2);// Typically 1 ms
-// while(count<10 && miso_err_cnt<10){
-// if(MISO_PIN){
-// int temp_return;
-// assrt_phy_off(0,0,0,temp_return);
-// if(!temp_return){
-// break;
-// }
-// count++;
-// }
-// else{
-// wait_us(50);
-// miso_err_cnt++;
-// }
-// }
-// if(count==10 ||miso_err_cnt==10){
-// return hardware_reset(bcn_call+1);
-// }
-// else
-// return 0;
-//
-//}
-
-
-
-
-//void initial_adf_check(){
-// spi.write(CMD_PHY_OFF); //0xB0
-// while(hw_reset_err_cnt<2){
-//
-// if(!assrt_phy_off(0,0,0)){ //assrt_phy_off () returns 0 if state is PHY_OFF , returns 1 if couldn't go to PHY_OFF
-// bbram_write();
-// bbram_flag=1;
-// break;
-// }
-// else{
-// hardware_reset(0); // Asserts Hardware for 20sec(20times). PHY_OFF for 20,000 times
-// hw_reset_err_cnt++;
-// }
-// }
-// assrt_phy_off(0,0,0);// We actually do not need this but make sure "we do not need this"
-// if(!bbram_flag){
-// //Switch to beacon
-// bcn_flag=1;
-// }
-//}
-
//for reseting the transmission call assert function after b5 and b1. after b1 assert_phi_on and after b5 assert_phi_tx.
//----------------------------------------------------------------------------
@@ -388,7 +203,6 @@
SPI_mutex.unlock();\
}
-
#define write_data {\
SPI_mutex.lock();\
gCS_ADF=0;\
@@ -402,6 +216,7 @@
spi.write(0x20);\
for(unsigned char i=0; i<112;i++){\
spi.write(buffer_112[i]);\
+ /*gPC.printf("0x%X,",spi.write(buffer_112[i]));*/\
}\
}\
else{\
@@ -409,6 +224,7 @@
spi.write(0x90);\
for(unsigned char i=0; i<112;i++){\
spi.write(buffer_112[i]);\
+ /*gPC.printf("0x%X,",spi.write(buffer_112[i]));*/\
}\
}\
gCS_ADF=1;\
@@ -515,14 +331,6 @@
adf_SND_SDCard;
}
-//Timeout ADF_non_responsive_timeout;
-//bool ADF_non_responsive_flag = false;
-//
-//void ADF_non_responsive_fun(){
-// ADF_non_responsive_flag = true;
-// gCOM_MNG_TMTC_THREAD->signal_set(signal);
-//}
-
#define configure_adf {\
finish_write_data = false;\
buffer_state = true;\
@@ -564,32 +372,4 @@
}\
}\
gPC.puts("after while loop\r\n");\
-}
-// if( ADF_non_responsive_flag == false ){
-// if(finish_write_data){
-// if(ADF_off){
-// break;
-// }
-// }
-// SPI_mutex.lock();
-// ticker.detach();
-// // wait_ms(35);
-// gCS_ADF=0;
-// spi.write(0xB1);
-// gCS_ADF=1;
-// SPI_mutex.unlock();
-// loop_on = false;
-// gPC.puts("Transmission done\r\n");
-// }
-// else{
-// ADF_off = true;
-// }
-// }else{
-// write_data;
-// snd_tm.transmit_data(buffer_112,&last_buffer);
-// }
-// }
-// else{
-// gPC.puts("ADF non responsive\r\n");
-// break;
-// }
\ No newline at end of file
+}
\ No newline at end of file
