To fix the hang problem
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
COM_POWER_OFF_TX.h@333:cddef120cae3, 2016-12-30 (annotated)
- Committer:
- chaithanyarss
- Date:
- Fri Dec 30 13:31:44 2016 +0000
- Revision:
- 333:cddef120cae3
- Parent:
- 319:c11a52b91d25
Corrected MAX-MIN, corrected bae sw on after telecommand, ; Magesh added some correction.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aniruddhv | 262:752c8689944a | 1 | #define RESET_CDMS_TC {\ |
aniruddhv | 262:752c8689944a | 2 | Base_tc *RESET_tc = new Short_tc;\ |
aniruddhv | 262:752c8689944a | 3 | RESET_tc->next_TC = NULL;\ |
aniruddhv | 262:752c8689944a | 4 | PUTshort_or_long(RESET_tc,SHORT_TC_CODE);\ |
aniruddhv | 262:752c8689944a | 5 | PUTcrc_pass(RESET_tc,0x1);\ |
aniruddhv | 262:752c8689944a | 6 | PUTexec_status(RESET_tc,0);\ |
aniruddhv | 262:752c8689944a | 7 | RESET_tc->TC_string[0] = 0x01;\ |
aniruddhv | 262:752c8689944a | 8 | RESET_tc->TC_string[1] = 0x81;\ |
aniruddhv | 262:752c8689944a | 9 | RESET_tc->TC_string[2] = 0x81;\ |
aniruddhv | 262:752c8689944a | 10 | RESET_tc->TC_string[3] = 0x38;\ |
aniruddhv | 262:752c8689944a | 11 | RESET_tc->TC_string[4] = 0;\ |
aniruddhv | 262:752c8689944a | 12 | RESET_tc->TC_string[5] = 0;\ |
aniruddhv | 262:752c8689944a | 13 | RESET_tc->TC_string[6] = 0;\ |
aniruddhv | 262:752c8689944a | 14 | RESET_tc->TC_string[7] = 0;\ |
aniruddhv | 262:752c8689944a | 15 | RESET_tc->TC_string[8] = 0;\ |
aniruddhv | 262:752c8689944a | 16 | uint16_t crc16 = crc16_gen(RESET_tc->TC_string, 9);\ |
aniruddhv | 262:752c8689944a | 17 | RESET_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\ |
aniruddhv | 262:752c8689944a | 18 | RESET_tc->TC_string[10] = (crc16 & 0x00FF);\ |
aniruddhv | 262:752c8689944a | 19 | Base_tm *tm_ptr = NULL;\ |
aniruddhv | 262:752c8689944a | 20 | tm_ptr = FCTN_CDMS_RLY_TMTC(RESET_tc);\ |
aniruddhv | 262:752c8689944a | 21 | delete RESET_tc;\ |
aniruddhv | 262:752c8689944a | 22 | /*DELETE THE TM AFTER USE*/\ |
aniruddhv | 262:752c8689944a | 23 | Base_tm *del_tm = tm_ptr;\ |
aniruddhv | 262:752c8689944a | 24 | while( del_tm != NULL ){\ |
aniruddhv | 262:752c8689944a | 25 | Base_tm *temp = del_tm->next_TM;\ |
aniruddhv | 262:752c8689944a | 26 | delete del_tm;\ |
aniruddhv | 262:752c8689944a | 27 | del_tm = temp;\ |
aniruddhv | 262:752c8689944a | 28 | }\ |
aniruddhv | 262:752c8689944a | 29 | } |
aniruddhv | 262:752c8689944a | 30 | |
aniruddhv | 262:752c8689944a | 31 | #define resume_bcn {\ |
aniruddhv | 262:752c8689944a | 32 | Base_tc *beacon_tc = new Long_tc;\ |
aniruddhv | 262:752c8689944a | 33 | beacon_tc->next_TC = NULL;\ |
aniruddhv | 262:752c8689944a | 34 | PUTshort_or_long(beacon_tc,LONG_TC_CODE);\ |
aniruddhv | 262:752c8689944a | 35 | PUTcrc_pass(beacon_tc,0x1);\ |
aniruddhv | 262:752c8689944a | 36 | PUTexec_status(beacon_tc,0);\ |
aniruddhv | 262:752c8689944a | 37 | beacon_tc->TC_string[0] = 0x01;\ |
aniruddhv | 262:752c8689944a | 38 | beacon_tc->TC_string[1] = BCN_APID_SOURCE;\ |
aniruddhv | 262:752c8689944a | 39 | beacon_tc->TC_string[2] = BCN_SERVICE;\ |
aniruddhv | 262:752c8689944a | 40 | beacon_tc->TC_string[3] = 0xE2;\ |
aniruddhv | 262:752c8689944a | 41 | beacon_tc->TC_string[4] = 0x00;\ |
aniruddhv | 262:752c8689944a | 42 | beacon_tc->TC_string[5] = 0;\ |
aniruddhv | 262:752c8689944a | 43 | beacon_tc->TC_string[6] = 0;\ |
aniruddhv | 262:752c8689944a | 44 | beacon_tc->TC_string[7] = 0;\ |
aniruddhv | 262:752c8689944a | 45 | beacon_tc->TC_string[8] = 0;\ |
aniruddhv | 262:752c8689944a | 46 | uint16_t crc16 = crc16_gen(beacon_tc->TC_string, 9);\ |
aniruddhv | 262:752c8689944a | 47 | beacon_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\ |
aniruddhv | 262:752c8689944a | 48 | beacon_tc->TC_string[10] = (crc16 & 0x00FF);\ |
aniruddhv | 262:752c8689944a | 49 | for(int i = 11; i < 135; i++){\ |
aniruddhv | 262:752c8689944a | 50 | beacon_tc->TC_string[i] = 0;\ |
aniruddhv | 262:752c8689944a | 51 | }\ |
aniruddhv | 262:752c8689944a | 52 | Base_tm *tm_ptr = NULL;\ |
aniruddhv | 262:752c8689944a | 53 | tm_ptr = FCTN_CDMS_RLY_TMTC(beacon_tc);\ |
aniruddhv | 262:752c8689944a | 54 | delete beacon_tc;\ |
aniruddhv | 262:752c8689944a | 55 | /*DELETE THE TM AFTER USE*/\ |
aniruddhv | 262:752c8689944a | 56 | Base_tm *del_tm = tm_ptr;\ |
aniruddhv | 262:752c8689944a | 57 | int overCount = 0;\ |
aniruddhv | 262:752c8689944a | 58 | while( del_tm != NULL ){\ |
aniruddhv | 262:752c8689944a | 59 | if( (overCount < TM_OVERFLOW_CONSTANT) ){\ |
aniruddhv | 262:752c8689944a | 60 | Base_tm *temp = del_tm->next_TM;\ |
aniruddhv | 262:752c8689944a | 61 | delete del_tm;\ |
aniruddhv | 262:752c8689944a | 62 | del_tm = temp;\ |
aniruddhv | 262:752c8689944a | 63 | ++overCount;\ |
aniruddhv | 262:752c8689944a | 64 | }\ |
aniruddhv | 262:752c8689944a | 65 | else{\ |
aniruddhv | 262:752c8689944a | 66 | RESET_CDMS;\ |
aniruddhv | 262:752c8689944a | 67 | break;\ |
aniruddhv | 262:752c8689944a | 68 | }\ |
aniruddhv | 262:752c8689944a | 69 | }\ |
aniruddhv | 262:752c8689944a | 70 | } |
aniruddhv | 262:752c8689944a | 71 | |
shreeshas95 | 4:104dd82c99b8 | 72 | #define COM_POWER_OFF_TX {\ |
ee12b079 | 295:699801854b71 | 73 | /*gPC.puts("Inside COM_POWER_OFF_TX\r\n");*/\ |
aniruddhv | 262:752c8689944a | 74 | COM_TX_CNTRL = 0;\ |
shreeshas95 | 4:104dd82c99b8 | 75 | RX1M.attach(&rx_read, Serial::RxIrq);\ |
shreeshas95 | 4:104dd82c99b8 | 76 | gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\ |
aniruddhv | 262:752c8689944a | 77 | RF_SW_CNTRL_BCN = 1;\ |
aniruddhv | 262:752c8689944a | 78 | Thread::wait(25);\ |
aniruddhv | 262:752c8689944a | 79 | RF_SW_CNTRL_BCN = 0;\ |
ee12b079 | 319:c11a52b91d25 | 80 | gFLAGS = gFLAGS & (~RF_SW_STATUS_FLAG);/*RF_SW_STATUS_FLAG set to RF_COM_BCN*/\ |
aniruddhv | 262:752c8689944a | 81 | if( gFLAGS & COM_AUTO_POWER_OFF_BAE_FLAG ){\ |
ee12b079 | 295:699801854b71 | 82 | /*gPC.puts("powering on bae\r\n")*/;\ |
chaithanyarss | 333:cddef120cae3 | 83 | SW_ON_BAE();\ |
aniruddhv | 262:752c8689944a | 84 | gFLAGS & (~COM_AUTO_POWER_OFF_BAE_FLAG);\ |
aniruddhv | 264:f7d8f9f361e3 | 85 | gPC.puts("resumning bcn\r\n");\ |
aniruddhv | 262:752c8689944a | 86 | resume_bcn;\ |
aniruddhv | 262:752c8689944a | 87 | }\ |
aniruddhv | 262:752c8689944a | 88 | else{\ |
aniruddhv | 264:f7d8f9f361e3 | 89 | if( /*gFLAGS & BAE_SW_EN_FLAG*/true ){\ |
aniruddhv | 264:f7d8f9f361e3 | 90 | gPC.puts("resumning bcn2\r\n");\ |
aniruddhv | 262:752c8689944a | 91 | resume_bcn;\ |
aniruddhv | 262:752c8689944a | 92 | }\ |
aniruddhv | 262:752c8689944a | 93 | }\ |
shreeshas95 | 4:104dd82c99b8 | 94 | gFLAGS = gFLAGS & (~COM_PA_HOT_FLAG);\ |
aniruddhv | 262:752c8689944a | 95 | gFLAGS = gFLAGS & (~COM_PA_OC_FLAG);\ |
shreeshas95 | 4:104dd82c99b8 | 96 | gCOM_PA_COOLING_TIMEOUT.detach();\ |
shreeshas95 | 4:104dd82c99b8 | 97 | gFLAGS = gFLAGS & (~COM_TX_FLAG);\ |
aniruddhv | 262:752c8689944a | 98 | gFLAGS = gFLAGS & (~COM_SESSION_TIMEOUT_FLAG);\ |
ee12b079 | 295:699801854b71 | 99 | /*gPC.puts("completed com_power_off tx\r\n")*/;\ |
shreeshas95 | 4:104dd82c99b8 | 100 | } |