
CDMS code for testing sbc
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
COM_POWER_OFF_TX.h@218:c63cdba0550f, 2016-07-03 (annotated)
- Committer:
- chaithanyarss
- Date:
- Sun Jul 03 15:25:24 2016 +0000
- Revision:
- 218:c63cdba0550f
- Parent:
- 217:93505a6f8db7
Flash Completed;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chaithanyarss | 217:93505a6f8db7 | 1 | |
chaithanyarss | 217:93505a6f8db7 | 2 | #define resume_bcn {\ |
chaithanyarss | 217:93505a6f8db7 | 3 | Base_tc *beacon_tc = new Long_tc;\ |
chaithanyarss | 217:93505a6f8db7 | 4 | beacon_tc->next_TC = NULL;\ |
chaithanyarss | 217:93505a6f8db7 | 5 | PUTshort_or_long(beacon_tc,LONG_TC_CODE);\ |
chaithanyarss | 217:93505a6f8db7 | 6 | PUTcrc_pass(beacon_tc,0x1);\ |
chaithanyarss | 217:93505a6f8db7 | 7 | PUTexec_status(beacon_tc,0);\ |
chaithanyarss | 217:93505a6f8db7 | 8 | beacon_tc->TC_string[0] = 0x01;\ |
chaithanyarss | 217:93505a6f8db7 | 9 | beacon_tc->TC_string[1] = BCN_APID_SOURCE;\ |
chaithanyarss | 217:93505a6f8db7 | 10 | beacon_tc->TC_string[2] = BCN_SERVICE;\ |
chaithanyarss | 217:93505a6f8db7 | 11 | beacon_tc->TC_string[3] = 0xE2;\ |
chaithanyarss | 217:93505a6f8db7 | 12 | beacon_tc->TC_string[4] = 0x00;\ |
chaithanyarss | 217:93505a6f8db7 | 13 | beacon_tc->TC_string[5] = 0;\ |
chaithanyarss | 217:93505a6f8db7 | 14 | beacon_tc->TC_string[6] = 0;\ |
chaithanyarss | 217:93505a6f8db7 | 15 | beacon_tc->TC_string[7] = 0;\ |
chaithanyarss | 217:93505a6f8db7 | 16 | beacon_tc->TC_string[8] = 0;\ |
chaithanyarss | 217:93505a6f8db7 | 17 | uint16_t crc16 = crc16_gen(beacon_tc->TC_string, 9);\ |
chaithanyarss | 217:93505a6f8db7 | 18 | beacon_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\ |
chaithanyarss | 217:93505a6f8db7 | 19 | beacon_tc->TC_string[10] = (crc16 & 0x00FF);\ |
chaithanyarss | 217:93505a6f8db7 | 20 | for(int i = 11; i < 135; i++){\ |
chaithanyarss | 217:93505a6f8db7 | 21 | beacon_tc->TC_string[i] = 0;\ |
chaithanyarss | 217:93505a6f8db7 | 22 | }\ |
chaithanyarss | 217:93505a6f8db7 | 23 | Base_tm *tm_ptr = NULL;\ |
chaithanyarss | 217:93505a6f8db7 | 24 | tm_ptr = FCTN_CDMS_RLY_TMTC(beacon_tc);\ |
chaithanyarss | 217:93505a6f8db7 | 25 | delete beacon_tc;\ |
chaithanyarss | 217:93505a6f8db7 | 26 | /*DELETE THE TM AFTER USE*/\ |
chaithanyarss | 217:93505a6f8db7 | 27 | Base_tm *del_tm = tm_ptr;\ |
chaithanyarss | 217:93505a6f8db7 | 28 | int overCount = 0;\ |
chaithanyarss | 217:93505a6f8db7 | 29 | while( del_tm != NULL ){\ |
chaithanyarss | 217:93505a6f8db7 | 30 | if( (overCount < TM_OVERFLOW_CONSTANT) ){\ |
chaithanyarss | 217:93505a6f8db7 | 31 | Base_tm *temp = del_tm->next_TM;\ |
chaithanyarss | 217:93505a6f8db7 | 32 | delete del_tm;\ |
chaithanyarss | 217:93505a6f8db7 | 33 | del_tm = temp;\ |
chaithanyarss | 217:93505a6f8db7 | 34 | ++overCount;\ |
chaithanyarss | 217:93505a6f8db7 | 35 | }\ |
chaithanyarss | 217:93505a6f8db7 | 36 | else{\ |
chaithanyarss | 217:93505a6f8db7 | 37 | RESET_CDMS;\ |
chaithanyarss | 217:93505a6f8db7 | 38 | break;\ |
chaithanyarss | 217:93505a6f8db7 | 39 | }\ |
chaithanyarss | 217:93505a6f8db7 | 40 | }\ |
chaithanyarss | 217:93505a6f8db7 | 41 | } |
chaithanyarss | 217:93505a6f8db7 | 42 | |
shreeshas95 | 4:104dd82c99b8 | 43 | #define COM_POWER_OFF_TX {\ |
aniruddhv | 12:ffdb29353058 | 44 | /*gPC.puts("Inside COM_POWER_OFF_TX\r\n");*/\ |
chaithanyarss | 217:93505a6f8db7 | 45 | COM_TX_CNTRL = 0;\ |
shreeshas95 | 4:104dd82c99b8 | 46 | RX1M.attach(&rx_read, Serial::RxIrq);\ |
shreeshas95 | 4:104dd82c99b8 | 47 | gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\ |
chaithanyarss | 217:93505a6f8db7 | 48 | RF_SW_CNTRL_BCN = 1;\ |
chaithanyarss | 217:93505a6f8db7 | 49 | Thread::wait(25);\ |
chaithanyarss | 217:93505a6f8db7 | 50 | RF_SW_CNTRL_BCN = 0;\ |
chaithanyarss | 217:93505a6f8db7 | 51 | gFLAGS = gFLAGS | RF_SW_STATUS_FLAG;\ |
chaithanyarss | 217:93505a6f8db7 | 52 | if( gFLAGS & COM_AUTO_POWER_OFF_BAE_FLAG ){\ |
chaithanyarss | 218:c63cdba0550f | 53 | BAE_SW_EN_DS = 0;\ |
chaithanyarss | 217:93505a6f8db7 | 54 | gFLAGS = gFLAGS | BAE_SW_EN_FLAG;\ |
chaithanyarss | 217:93505a6f8db7 | 55 | gFLAGS & (~COM_AUTO_POWER_OFF_BAE_FLAG);\ |
chaithanyarss | 217:93505a6f8db7 | 56 | resume_bcn;\ |
chaithanyarss | 217:93505a6f8db7 | 57 | }\ |
chaithanyarss | 217:93505a6f8db7 | 58 | else{\ |
chaithanyarss | 217:93505a6f8db7 | 59 | if( gFLAGS & BAE_SW_EN_FLAG ){\ |
chaithanyarss | 217:93505a6f8db7 | 60 | resume_bcn;\ |
chaithanyarss | 217:93505a6f8db7 | 61 | }\ |
chaithanyarss | 217:93505a6f8db7 | 62 | }\ |
shreeshas95 | 4:104dd82c99b8 | 63 | gFLAGS = gFLAGS & (~COM_PA_HOT_FLAG);\ |
chaithanyarss | 217:93505a6f8db7 | 64 | gFLAGS = gFLAGS & (~COM_PA_OC_FLAG);\ |
shreeshas95 | 4:104dd82c99b8 | 65 | gCOM_PA_COOLING_TIMEOUT.detach();\ |
shreeshas95 | 4:104dd82c99b8 | 66 | gFLAGS = gFLAGS & (~COM_TX_FLAG);\ |
chaithanyarss | 217:93505a6f8db7 | 67 | gFLAGS = gFLAGS & (~COM_SESSION_TIMEOUT_FLAG);\ |
chaithanyarss | 217:93505a6f8db7 | 68 | /*gPC.puts("completed com_power_off tx\r\n");*/\ |
shreeshas95 | 4:104dd82c99b8 | 69 | } |