for frequency correction testing

Dependencies:   FreescaleIAP SimpleDMA mbed-rtos mbed

Fork of CDMS_CODE by shubham c

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers COM_POWER_OFF_TX.h Source File

COM_POWER_OFF_TX.h

00001 #define RESET_CDMS_TC {\
00002     Base_tc *RESET_tc = new Short_tc;\
00003     RESET_tc->next_TC = NULL;\
00004     PUTshort_or_long(RESET_tc,SHORT_TC_CODE);\
00005     PUTcrc_pass(RESET_tc,0x1);\
00006     PUTexec_status(RESET_tc,0);\
00007     RESET_tc->TC_string[0] = 0x01;\
00008     RESET_tc->TC_string[1] = 0x81;\
00009     RESET_tc->TC_string[2] = 0x81;\
00010     RESET_tc->TC_string[3] = 0x38;\
00011     RESET_tc->TC_string[4] = 0;\
00012     RESET_tc->TC_string[5] = 0;\
00013     RESET_tc->TC_string[6] = 0;\
00014     RESET_tc->TC_string[7] = 0;\
00015     RESET_tc->TC_string[8] = 0;\
00016     uint16_t crc16 = crc16_gen(RESET_tc->TC_string, 9);\
00017     RESET_tc->TC_string[9]  = (crc16 & 0xFF00)>>8;\
00018     RESET_tc->TC_string[10] = (crc16 & 0x00FF);\
00019     Base_tm *tm_ptr = NULL;\
00020     tm_ptr =  FCTN_CDMS_RLY_TMTC(RESET_tc);\
00021     delete RESET_tc;\
00022     /*DELETE THE TM AFTER USE*/\
00023     Base_tm *del_tm = tm_ptr;\
00024     while( del_tm != NULL ){\
00025         Base_tm *temp = del_tm->next_TM;\
00026         delete del_tm;\
00027         del_tm = temp;\
00028     }\
00029 }
00030 
00031 #define resume_bcn {\
00032     Base_tc *beacon_tc = new Long_tc;\
00033     beacon_tc->next_TC = NULL;\
00034     PUTshort_or_long(beacon_tc,LONG_TC_CODE);\
00035     PUTcrc_pass(beacon_tc,0x1);\
00036     PUTexec_status(beacon_tc,0);\
00037     beacon_tc->TC_string[0] = 0x01;\
00038     beacon_tc->TC_string[1] = BCN_APID_SOURCE;\
00039     beacon_tc->TC_string[2] = BCN_SERVICE;\
00040     beacon_tc->TC_string[3] = 0xE2;\
00041     beacon_tc->TC_string[4] = 0x00;\
00042     beacon_tc->TC_string[5] = 0;\
00043     beacon_tc->TC_string[6] = 0;\
00044     beacon_tc->TC_string[7] = 0;\
00045     beacon_tc->TC_string[8] = 0;\
00046     uint16_t crc16 = crc16_gen(beacon_tc->TC_string, 9);\
00047     beacon_tc->TC_string[9]  = (crc16 & 0xFF00)>>8;\
00048     beacon_tc->TC_string[10] = (crc16 & 0x00FF);\
00049     for(int i = 11; i < 135; i++){\
00050         beacon_tc->TC_string[i] = 0;\
00051     }\
00052     Base_tm *tm_ptr = NULL;\
00053     tm_ptr =  FCTN_CDMS_RLY_TMTC(beacon_tc);\
00054     delete beacon_tc;\
00055     /*DELETE THE TM AFTER USE*/\
00056     Base_tm *del_tm = tm_ptr;\
00057     int overCount = 0;\
00058     while( del_tm != NULL ){\
00059         if( (overCount < TM_OVERFLOW_CONSTANT) ){\
00060             Base_tm *temp = del_tm->next_TM;\
00061             delete del_tm;\
00062             del_tm = temp;\
00063             ++overCount;\
00064         }\
00065         else{\
00066             RESET_CDMS;\
00067             break;\
00068         }\
00069     }\
00070 }
00071 
00072 #define COM_POWER_OFF_TX {\
00073     /*gPC.puts("Inside COM_POWER_OFF_TX\r\n");*/\
00074     COM_TX_CNTRL = 0;\
00075     RX1M.attach(&rx_read, Serial::RxIrq);\
00076     gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\
00077     RF_SW_CNTRL_BCN = 1;\
00078     Thread::wait(25);\
00079     RF_SW_CNTRL_BCN = 0;\
00080     gFLAGS = gFLAGS | RF_SW_STATUS_FLAG;\
00081     if( gFLAGS & COM_AUTO_POWER_OFF_BAE_FLAG ){\
00082         /*gPC.puts("powering on bae\r\n")*/;\
00083         SW_ON_BAE;\
00084         gFLAGS & (~COM_AUTO_POWER_OFF_BAE_FLAG);\
00085         gPC.puts("resumning bcn\r\n");\
00086         resume_bcn;\
00087     }\
00088     else{\
00089         if( /*gFLAGS & BAE_SW_EN_FLAG*/true ){\
00090         gPC.puts("resumning bcn2\r\n");\
00091             resume_bcn;\
00092         }\
00093     }\
00094     gFLAGS = gFLAGS & (~COM_PA_HOT_FLAG);\
00095     gFLAGS = gFLAGS & (~COM_PA_OC_FLAG);\
00096     gCOM_PA_COOLING_TIMEOUT.detach();\
00097     gFLAGS = gFLAGS & (~COM_TX_FLAG);\
00098     gFLAGS = gFLAGS & (~COM_SESSION_TIMEOUT_FLAG);\
00099     /*gPC.puts("completed com_power_off tx\r\n")*/;\
00100 }