![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
CDMS_CODE_samp_23SEP_DMA_flag
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE_samp_23SEP_DMA by
COM_POWER_OFF_TX.h@231:e2bd2a990bfe, 2016-07-05 (annotated)
- Committer:
- ee12b079
- Date:
- Tue Jul 05 11:27:29 2016 +0000
- Revision:
- 231:e2bd2a990bfe
- Parent:
- 12:ffdb29353058
Added Aniruddh's changes, to be tested, use earlier revisions for testing BAE, CDMS
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ee12b079 | 231:e2bd2a990bfe | 1 | /*#define RESET_CDMS_TC {\ |
ee12b079 | 231:e2bd2a990bfe | 2 | Base_tc *RESET_tc = new Short_tc;\ |
ee12b079 | 231:e2bd2a990bfe | 3 | RESET_tc->next_TC = NULL;\ |
ee12b079 | 231:e2bd2a990bfe | 4 | PUTshort_or_long(RESET_tc,SHORT_TC_CODE);\ |
ee12b079 | 231:e2bd2a990bfe | 5 | PUTcrc_pass(RESET_tc,0x1);\ |
ee12b079 | 231:e2bd2a990bfe | 6 | PUTexec_status(RESET_tc,0);\ |
ee12b079 | 231:e2bd2a990bfe | 7 | RESET_tc->TC_string[0] = 0x01;\ |
ee12b079 | 231:e2bd2a990bfe | 8 | RESET_tc->TC_string[1] = 0x81;\ |
ee12b079 | 231:e2bd2a990bfe | 9 | RESET_tc->TC_string[2] = 0x81;\ |
ee12b079 | 231:e2bd2a990bfe | 10 | RESET_tc->TC_string[3] = 0x38;\ |
ee12b079 | 231:e2bd2a990bfe | 11 | RESET_tc->TC_string[4] = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 12 | RESET_tc->TC_string[5] = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 13 | RESET_tc->TC_string[6] = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 14 | RESET_tc->TC_string[7] = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 15 | RESET_tc->TC_string[8] = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 16 | uint16_t crc16 = crc16_gen(RESET_tc->TC_string, 9);\ |
ee12b079 | 231:e2bd2a990bfe | 17 | RESET_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\ |
ee12b079 | 231:e2bd2a990bfe | 18 | RESET_tc->TC_string[10] = (crc16 & 0x00FF);\ |
ee12b079 | 231:e2bd2a990bfe | 19 | Base_tm *tm_ptr = NULL;\ |
ee12b079 | 231:e2bd2a990bfe | 20 | tm_ptr = FCTN_CDMS_RLY_TMTC(RESET_tc);\ |
ee12b079 | 231:e2bd2a990bfe | 21 | delete RESET_tc;\ |
ee12b079 | 231:e2bd2a990bfe | 22 | /*DELETE THE TM AFTER USE*//* |
ee12b079 | 231:e2bd2a990bfe | 23 | Base_tm *del_tm = tm_ptr;\ |
ee12b079 | 231:e2bd2a990bfe | 24 | while( del_tm != NULL ){\ |
ee12b079 | 231:e2bd2a990bfe | 25 | Base_tm *temp = del_tm->next_TM;\ |
ee12b079 | 231:e2bd2a990bfe | 26 | delete del_tm;\ |
ee12b079 | 231:e2bd2a990bfe | 27 | del_tm = temp;\ |
ee12b079 | 231:e2bd2a990bfe | 28 | }\ |
ee12b079 | 231:e2bd2a990bfe | 29 | }*/ |
ee12b079 | 231:e2bd2a990bfe | 30 | |
ee12b079 | 231:e2bd2a990bfe | 31 | #define power_on_bae {\ |
ee12b079 | 231:e2bd2a990bfe | 32 | Base_tc *power_on_BAE = new Short_tc;\ |
ee12b079 | 231:e2bd2a990bfe | 33 | power_on_BAE->next_TC = NULL;\ |
ee12b079 | 231:e2bd2a990bfe | 34 | PUTshort_or_long(power_on_BAE,SHORT_TC_CODE);\ |
ee12b079 | 231:e2bd2a990bfe | 35 | PUTcrc_pass(power_on_BAE,0x1);\ |
ee12b079 | 231:e2bd2a990bfe | 36 | PUTexec_status(power_on_BAE,0);\ |
ee12b079 | 231:e2bd2a990bfe | 37 | power_on_BAE->TC_string[0] = 0x01;\ |
ee12b079 | 231:e2bd2a990bfe | 38 | power_on_BAE->TC_string[1] = BAE_APID_SOURCE;\ |
ee12b079 | 231:e2bd2a990bfe | 39 | power_on_BAE->TC_string[2] = BAE_SERVICE;\ |
ee12b079 | 231:e2bd2a990bfe | 40 | power_on_BAE->TC_string[3] = BAE_POWER_ON_PID;\ |
ee12b079 | 231:e2bd2a990bfe | 41 | power_on_BAE->TC_string[4] = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 42 | power_on_BAE->TC_string[5] = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 43 | power_on_BAE->TC_string[6] = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 44 | power_on_BAE->TC_string[7] = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 45 | power_on_BAE->TC_string[8] = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 46 | uint16_t crc16 = crc16_gen(power_on_BAE->TC_string, 9);\ |
ee12b079 | 231:e2bd2a990bfe | 47 | power_on_BAE->TC_string[9] = (crc16 & 0xFF00)>>8;\ |
ee12b079 | 231:e2bd2a990bfe | 48 | power_on_BAE->TC_string[10] = (crc16 & 0x00FF);\ |
ee12b079 | 231:e2bd2a990bfe | 49 | Base_tm *tm_ptr = NULL;\ |
ee12b079 | 231:e2bd2a990bfe | 50 | tm_ptr = FCTN_CDMS_RLY_TMTC(power_on_BAE);\ |
ee12b079 | 231:e2bd2a990bfe | 51 | delete power_on_BAE;\ |
ee12b079 | 231:e2bd2a990bfe | 52 | /*DELETE THE TM AFTER USE*/\ |
ee12b079 | 231:e2bd2a990bfe | 53 | Base_tm *del_tm = tm_ptr;\ |
ee12b079 | 231:e2bd2a990bfe | 54 | int overCount = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 55 | while( del_tm != NULL ){\ |
ee12b079 | 231:e2bd2a990bfe | 56 | if( (overCount < TM_OVERFLOW_CONSTANT) ){\ |
ee12b079 | 231:e2bd2a990bfe | 57 | Base_tm *temp = del_tm->next_TM;\ |
ee12b079 | 231:e2bd2a990bfe | 58 | delete del_tm;\ |
ee12b079 | 231:e2bd2a990bfe | 59 | del_tm = temp;\ |
ee12b079 | 231:e2bd2a990bfe | 60 | ++overCount;\ |
ee12b079 | 231:e2bd2a990bfe | 61 | }\ |
ee12b079 | 231:e2bd2a990bfe | 62 | else{\ |
ee12b079 | 231:e2bd2a990bfe | 63 | RESET_CDMS;\ |
ee12b079 | 231:e2bd2a990bfe | 64 | break;\ |
ee12b079 | 231:e2bd2a990bfe | 65 | }\ |
ee12b079 | 231:e2bd2a990bfe | 66 | }\ |
ee12b079 | 231:e2bd2a990bfe | 67 | } |
ee12b079 | 231:e2bd2a990bfe | 68 | |
ee12b079 | 231:e2bd2a990bfe | 69 | #define resume_bcn {\ |
ee12b079 | 231:e2bd2a990bfe | 70 | Base_tc *beacon_tc = new Long_tc;\ |
ee12b079 | 231:e2bd2a990bfe | 71 | beacon_tc->next_TC = NULL;\ |
ee12b079 | 231:e2bd2a990bfe | 72 | PUTshort_or_long(beacon_tc,LONG_TC_CODE);\ |
ee12b079 | 231:e2bd2a990bfe | 73 | PUTcrc_pass(beacon_tc,0x1);\ |
ee12b079 | 231:e2bd2a990bfe | 74 | PUTexec_status(beacon_tc,0);\ |
ee12b079 | 231:e2bd2a990bfe | 75 | beacon_tc->TC_string[0] = 0x01;\ |
ee12b079 | 231:e2bd2a990bfe | 76 | beacon_tc->TC_string[1] = BCN_APID_SOURCE;\ |
ee12b079 | 231:e2bd2a990bfe | 77 | beacon_tc->TC_string[2] = BCN_SERVICE;\ |
ee12b079 | 231:e2bd2a990bfe | 78 | beacon_tc->TC_string[3] = 0xE2;\ |
ee12b079 | 231:e2bd2a990bfe | 79 | beacon_tc->TC_string[4] = 0x00;\ |
ee12b079 | 231:e2bd2a990bfe | 80 | beacon_tc->TC_string[5] = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 81 | beacon_tc->TC_string[6] = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 82 | beacon_tc->TC_string[7] = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 83 | beacon_tc->TC_string[8] = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 84 | uint16_t crc16 = crc16_gen(beacon_tc->TC_string, 9);\ |
ee12b079 | 231:e2bd2a990bfe | 85 | beacon_tc->TC_string[9] = (crc16 & 0xFF00)>>8;\ |
ee12b079 | 231:e2bd2a990bfe | 86 | beacon_tc->TC_string[10] = (crc16 & 0x00FF);\ |
ee12b079 | 231:e2bd2a990bfe | 87 | for(int i = 11; i < 135; i++){\ |
ee12b079 | 231:e2bd2a990bfe | 88 | beacon_tc->TC_string[i] = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 89 | }\ |
ee12b079 | 231:e2bd2a990bfe | 90 | Base_tm *tm_ptr = NULL;\ |
ee12b079 | 231:e2bd2a990bfe | 91 | tm_ptr = FCTN_CDMS_RLY_TMTC(beacon_tc);\ |
ee12b079 | 231:e2bd2a990bfe | 92 | delete beacon_tc;\ |
ee12b079 | 231:e2bd2a990bfe | 93 | /*DELETE THE TM AFTER USE*/\ |
ee12b079 | 231:e2bd2a990bfe | 94 | Base_tm *del_tm = tm_ptr;\ |
ee12b079 | 231:e2bd2a990bfe | 95 | int overCount = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 96 | while( del_tm != NULL ){\ |
ee12b079 | 231:e2bd2a990bfe | 97 | if( (overCount < TM_OVERFLOW_CONSTANT) ){\ |
ee12b079 | 231:e2bd2a990bfe | 98 | Base_tm *temp = del_tm->next_TM;\ |
ee12b079 | 231:e2bd2a990bfe | 99 | delete del_tm;\ |
ee12b079 | 231:e2bd2a990bfe | 100 | del_tm = temp;\ |
ee12b079 | 231:e2bd2a990bfe | 101 | ++overCount;\ |
ee12b079 | 231:e2bd2a990bfe | 102 | }\ |
ee12b079 | 231:e2bd2a990bfe | 103 | else{\ |
ee12b079 | 231:e2bd2a990bfe | 104 | RESET_CDMS;\ |
ee12b079 | 231:e2bd2a990bfe | 105 | break;\ |
ee12b079 | 231:e2bd2a990bfe | 106 | }\ |
ee12b079 | 231:e2bd2a990bfe | 107 | }\ |
ee12b079 | 231:e2bd2a990bfe | 108 | } |
ee12b079 | 231:e2bd2a990bfe | 109 | |
shreeshas95 | 4:104dd82c99b8 | 110 | #define COM_POWER_OFF_TX {\ |
aniruddhv | 12:ffdb29353058 | 111 | /*gPC.puts("Inside COM_POWER_OFF_TX\r\n");*/\ |
ee12b079 | 231:e2bd2a990bfe | 112 | COM_TX_CNTRL = 0;\ |
shreeshas95 | 4:104dd82c99b8 | 113 | RX1M.attach(&rx_read, Serial::RxIrq);\ |
shreeshas95 | 4:104dd82c99b8 | 114 | gFLAGS = gFLAGS & (~COM_MNG_TMTC_RUNNING_FLAG);\ |
ee12b079 | 231:e2bd2a990bfe | 115 | RF_SW_CNTRL_BCN = 1;\ |
ee12b079 | 231:e2bd2a990bfe | 116 | Thread::wait(25);\ |
ee12b079 | 231:e2bd2a990bfe | 117 | RF_SW_CNTRL_BCN = 0;\ |
ee12b079 | 231:e2bd2a990bfe | 118 | gFLAGS = gFLAGS | RF_SW_STATUS_FLAG;\ |
ee12b079 | 231:e2bd2a990bfe | 119 | if( gFLAGS & COM_AUTO_POWER_OFF_BAE_FLAG ){\ |
ee12b079 | 231:e2bd2a990bfe | 120 | power_on_bae;\ |
ee12b079 | 231:e2bd2a990bfe | 121 | gFLAGS = gFLAGS | BAE_SW_EN_FLAG;\ |
ee12b079 | 231:e2bd2a990bfe | 122 | gFLAGS & (~COM_AUTO_POWER_OFF_BAE_FLAG);\ |
ee12b079 | 231:e2bd2a990bfe | 123 | resume_bcn;\ |
ee12b079 | 231:e2bd2a990bfe | 124 | }\ |
ee12b079 | 231:e2bd2a990bfe | 125 | else{\ |
ee12b079 | 231:e2bd2a990bfe | 126 | if( gFLAGS & BAE_SW_EN_FLAG ){\ |
ee12b079 | 231:e2bd2a990bfe | 127 | resume_bcn;\ |
ee12b079 | 231:e2bd2a990bfe | 128 | }\ |
ee12b079 | 231:e2bd2a990bfe | 129 | }\ |
shreeshas95 | 4:104dd82c99b8 | 130 | gFLAGS = gFLAGS & (~COM_PA_HOT_FLAG);\ |
ee12b079 | 231:e2bd2a990bfe | 131 | gFLAGS = gFLAGS & (~COM_PA_OC_FLAG);\ |
shreeshas95 | 4:104dd82c99b8 | 132 | gCOM_PA_COOLING_TIMEOUT.detach();\ |
shreeshas95 | 4:104dd82c99b8 | 133 | gFLAGS = gFLAGS & (~COM_TX_FLAG);\ |
ee12b079 | 231:e2bd2a990bfe | 134 | gFLAGS = gFLAGS & (~COM_SESSION_TIMEOUT_FLAG);\ |
ee12b079 | 231:e2bd2a990bfe | 135 | /*gPC.puts("completed com_power_off tx\r\n");*/\ |
shreeshas95 | 4:104dd82c99b8 | 136 | } |