To fix the hang problem
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
COM_POWER_OFF_TX.h@211:77bee0cbebfe, 2016-06-18 (annotated)
- Committer:
- aniruddhv
- Date:
- Sat Jun 18 09:07:28 2016 +0000
- Revision:
- 211:77bee0cbebfe
- Parent:
- 160:ef280e6dda44
- Child:
- 212:3d13a06bcd3a
delete CDMS TC, update unknown TC_STATUS,
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aniruddhv | 155:ca7365c03fd7 | 1 | #define RESET_CDMS {\ |
aniruddhv | 155:ca7365c03fd7 | 2 | Base_tc *RESET_tc = new Short_tc;\ |
aniruddhv | 155:ca7365c03fd7 | 3 | RESET_tc->next_TC = NULL;\ |
aniruddhv | 155:ca7365c03fd7 | 4 | PUTshort_or_long(RESET_tc,SHORT_TC_CODE);\ |
aniruddhv | 155:ca7365c03fd7 | 5 | PUTcrc_pass(RESET_tc,0x1);\ |
aniruddhv | 155:ca7365c03fd7 | 6 | PUTexec_status(RESET_tc,0);\ |
aniruddhv | 155:ca7365c03fd7 | 7 | RESET_tc->TC_string[0] = 0x01;\ |
aniruddhv | 155:ca7365c03fd7 | 8 | RESET_tc->TC_string[1] = 0x81;\ |
aniruddhv | 155:ca7365c03fd7 | 9 | RESET_tc->TC_string[2] = 0x81;\ |
aniruddhv | 155:ca7365c03fd7 | 10 | RESET_tc->TC_string[3] = 0x38;\ |
aniruddhv | 155:ca7365c03fd7 | 11 | RESET_tc->TC_string[4] = 0;\ |
aniruddhv | 155:ca7365c03fd7 | 12 | RESET_tc->TC_string[5] = 0;\ |
aniruddhv | 155:ca7365c03fd7 | 13 | RESET_tc->TC_string[6] = 0;\ |
aniruddhv | 155:ca7365c03fd7 | 14 | RESET_tc->TC_string[7] = 0;\ |
aniruddhv | 155:ca7365c03fd7 | 15 | RESET_tc->TC_string[8] = 0;\ |
aniruddhv | 155:ca7365c03fd7 | 16 | uint16_t crc16 = crc16_gen(RESET_tc->TC_string, 9);\ |
aniruddhv | 155:ca7365c03fd7 | 17 | RESET_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\ |
aniruddhv | 155:ca7365c03fd7 | 18 | RESET_tc->TC_string[10] = (crc16 & 0x00FF);\ |
aniruddhv | 155:ca7365c03fd7 | 19 | FCTN_CDMS_RLY_TMTC(RESET_tc);\ |
aniruddhv | 211:77bee0cbebfe | 20 | delete RESET_tc;\ |
aniruddhv | 155:ca7365c03fd7 | 21 | } |
aniruddhv | 155:ca7365c03fd7 | 22 | |
aniruddhv | 137:489a93a04d6b | 23 | #define power_on_bae {\ |
aniruddhv | 144:4c20fcc105ce | 24 | Base_tc *power_on_BAE = new Short_tc;\ |
aniruddhv | 144:4c20fcc105ce | 25 | power_on_BAE->next_TC = NULL;\ |
aniruddhv | 144:4c20fcc105ce | 26 | PUTshort_or_long(power_on_BAE,SHORT_TC_CODE);\ |
aniruddhv | 144:4c20fcc105ce | 27 | PUTcrc_pass(power_on_BAE,0x1);\ |
aniruddhv | 144:4c20fcc105ce | 28 | PUTexec_status(power_on_BAE,0);\ |
aniruddhv | 144:4c20fcc105ce | 29 | power_on_BAE->TC_string[0] = 0x01;\ |
aniruddhv | 144:4c20fcc105ce | 30 | power_on_BAE->TC_string[1] = BAE_APID_SOURCE;\ |
aniruddhv | 144:4c20fcc105ce | 31 | power_on_BAE->TC_string[2] = BAE_SERVICE;\ |
aniruddhv | 144:4c20fcc105ce | 32 | power_on_BAE->TC_string[3] = BAE_POWER_ON_PID;\ |
aniruddhv | 144:4c20fcc105ce | 33 | power_on_BAE->TC_string[4] = 0;\ |
aniruddhv | 144:4c20fcc105ce | 34 | power_on_BAE->TC_string[5] = 0;\ |
aniruddhv | 144:4c20fcc105ce | 35 | power_on_BAE->TC_string[6] = 0;\ |
aniruddhv | 144:4c20fcc105ce | 36 | power_on_BAE->TC_string[7] = 0;\ |
aniruddhv | 144:4c20fcc105ce | 37 | power_on_BAE->TC_string[8] = 0;\ |
aniruddhv | 144:4c20fcc105ce | 38 | uint16_t crc16 = crc16_gen(power_on_BAE->TC_string, 9);\ |
aniruddhv | 144:4c20fcc105ce | 39 | power_on_BAE->TC_string[9] = (crc16 & 0xFF00)>>8;\ |
aniruddhv | 144:4c20fcc105ce | 40 | power_on_BAE->TC_string[10] = (crc16 & 0x00FF);\ |
aniruddhv | 144:4c20fcc105ce | 41 | Base_tm *tm_ptr = new Short_tm;\ |
aniruddhv | 144:4c20fcc105ce | 42 | tm_ptr = FCTN_CDMS_RLY_TMTC(power_on_BAE);\ |
aniruddhv | 211:77bee0cbebfe | 43 | delete power_on_BAE;\ |
aniruddhv | 144:4c20fcc105ce | 44 | /*DELETE THE TM AFTER USE*/\ |
aniruddhv | 144:4c20fcc105ce | 45 | Base_tm *del_tm = tm_ptr;\ |
aniruddhv | 144:4c20fcc105ce | 46 | int overCount = 0;\ |
aniruddhv | 144:4c20fcc105ce | 47 | while( del_tm != NULL ){\ |
aniruddhv | 144:4c20fcc105ce | 48 | if( (overCount < TM_OVERFLOW_CONSTANT) ){\ |
aniruddhv | 144:4c20fcc105ce | 49 | Base_tm *temp = del_tm->next_TM;\ |
aniruddhv | 144:4c20fcc105ce | 50 | delete del_tm;\ |
aniruddhv | 144:4c20fcc105ce | 51 | del_tm = temp;\ |
aniruddhv | 144:4c20fcc105ce | 52 | ++overCount;\ |
aniruddhv | 144:4c20fcc105ce | 53 | }\ |
aniruddhv | 144:4c20fcc105ce | 54 | else{\ |
aniruddhv | 155:ca7365c03fd7 | 55 | RESET_CDMS;\ |
aniruddhv | 144:4c20fcc105ce | 56 | break;\ |
aniruddhv | 144:4c20fcc105ce | 57 | }\ |
aniruddhv | 144:4c20fcc105ce | 58 | }\ |
aniruddhv | 137:489a93a04d6b | 59 | } |
aniruddhv | 137:489a93a04d6b | 60 | |
aniruddhv | 137:489a93a04d6b | 61 | #define resume_bcn {\ |
aniruddhv | 137:489a93a04d6b | 62 | Base_tc *beacon_tc = new Short_tc;\ |
aniruddhv | 137:489a93a04d6b | 63 | beacon_tc->next_TC = NULL;\ |
aniruddhv | 144:4c20fcc105ce | 64 | PUTshort_or_long(beacon_tc,SHORT_TC_CODE);\ |
aniruddhv | 137:489a93a04d6b | 65 | PUTcrc_pass(beacon_tc,0x1);\ |
aniruddhv | 137:489a93a04d6b | 66 | PUTexec_status(beacon_tc,0);\ |
aniruddhv | 137:489a93a04d6b | 67 | beacon_tc->TC_string[0] = 0x01;\ |
aniruddhv | 144:4c20fcc105ce | 68 | beacon_tc->TC_string[1] = BCN_APID_SOURCE;\ |
aniruddhv | 144:4c20fcc105ce | 69 | beacon_tc->TC_string[2] = BCN_SERVICE;\ |
aniruddhv | 160:ef280e6dda44 | 70 | beacon_tc->TC_string[3] = 0xE2;\ |
aniruddhv | 137:489a93a04d6b | 71 | beacon_tc->TC_string[4] = 0x00;\ |
aniruddhv | 137:489a93a04d6b | 72 | beacon_tc->TC_string[5] = 0;\ |
aniruddhv | 137:489a93a04d6b | 73 | beacon_tc->TC_string[6] = 0;\ |
aniruddhv | 137:489a93a04d6b | 74 | beacon_tc->TC_string[7] = 0;\ |
aniruddhv | 160:ef280e6dda44 | 75 | beacon_tc->TC_string[8] = 0;\ |
aniruddhv | 137:489a93a04d6b | 76 | uint16_t crc16 = crc16_gen(beacon_tc->TC_string, 9);\ |
aniruddhv | 137:489a93a04d6b | 77 | beacon_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\ |
aniruddhv | 137:489a93a04d6b | 78 | beacon_tc->TC_string[10] = (crc16 & 0x00FF);\ |
aniruddhv | 137:489a93a04d6b | 79 | Base_tm *tm_ptr = new Short_tm;\ |
aniruddhv | 137:489a93a04d6b | 80 | tm_ptr = FCTN_CDMS_RLY_TMTC(beacon_tc);\ |
aniruddhv | 211:77bee0cbebfe | 81 | delete beacon_tc;\ |
aniruddhv | 137:489a93a04d6b | 82 | } |
aniruddhv | 137:489a93a04d6b | 83 | |
shreeshas95 | 4:104dd82c99b8 | 84 | #define COM_POWER_OFF_TX {\ |
aniruddhv | 12:ffdb29353058 | 85 | /*gPC.puts("Inside COM_POWER_OFF_TX\r\n");*/\ |
aniruddhv | 155:ca7365c03fd7 | 86 | COM_TX_CNTRL = 0;\ |
shreeshas95 | 4:104dd82c99b8 | 87 | RX1M.attach(&rx_read, Serial::RxIrq);\ |
shreeshas95 | 4:104dd82c99b8 | 88 | gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\ |
aniruddhv | 144:4c20fcc105ce | 89 | RF_SW_CNTRL_BCN = 1;\ |
aniruddhv | 144:4c20fcc105ce | 90 | Thread::wait(25);\ |
aniruddhv | 144:4c20fcc105ce | 91 | RF_SW_CNTRL_BCN = 0;\ |
aniruddhv | 137:489a93a04d6b | 92 | gFLAGS = gFLAGS | RF_SW_STATUS_FLAG;\ |
aniruddhv | 137:489a93a04d6b | 93 | if( gFLAGS & COM_AUTO_POWER_OFF_BAE_FLAG ){\ |
aniruddhv | 137:489a93a04d6b | 94 | power_on_bae;\ |
aniruddhv | 137:489a93a04d6b | 95 | gFLAGS = gFLAGS | BAE_SW_EN_FLAG;\ |
aniruddhv | 137:489a93a04d6b | 96 | gFLAGS & (~COM_AUTO_POWER_OFF_BAE_FLAG);\ |
aniruddhv | 137:489a93a04d6b | 97 | resume_bcn;\ |
aniruddhv | 137:489a93a04d6b | 98 | }\ |
aniruddhv | 137:489a93a04d6b | 99 | else{\ |
aniruddhv | 137:489a93a04d6b | 100 | if( gFLAGS & BAE_SW_EN_FLAG ){\ |
aniruddhv | 137:489a93a04d6b | 101 | resume_bcn;\ |
aniruddhv | 137:489a93a04d6b | 102 | }\ |
aniruddhv | 137:489a93a04d6b | 103 | }\ |
shreeshas95 | 4:104dd82c99b8 | 104 | gFLAGS = gFLAGS & (~COM_PA_HOT_FLAG);\ |
shreeshas95 | 4:104dd82c99b8 | 105 | gCOM_PA_COOLING_TIMEOUT.detach();\ |
shreeshas95 | 4:104dd82c99b8 | 106 | gFLAGS = gFLAGS & (~COM_TX_FLAG);\ |
aniruddhv | 137:489a93a04d6b | 107 | gFLAGS = gFLAGS & (~COM_SESSION_TIMEOUT_FLAG);\ |
aniruddhv | 137:489a93a04d6b | 108 | /*gPC.puts("completed com_power_off tx\r\n");*/\ |
shreeshas95 | 4:104dd82c99b8 | 109 | } |