![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
things are working
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of CDMS_DEC_2016_jan by
structure.h@4:560716ec8414, 2016-01-23 (annotated)
- Committer:
- cholletisaik777
- Date:
- Sat Jan 23 11:33:47 2016 +0000
- Revision:
- 4:560716ec8414
- Parent:
- 0:bcbd76c86cde
things are working
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cholletisaik777 | 0:bcbd76c86cde | 1 | #include "mbed.h" |
cholletisaik777 | 0:bcbd76c86cde | 2 | //SIZE |
cholletisaik777 | 0:bcbd76c86cde | 3 | #define TC_SHORT_SIZE 11 |
cholletisaik777 | 0:bcbd76c86cde | 4 | #define TC_LONG_SIZE 135 |
cholletisaik777 | 0:bcbd76c86cde | 5 | #define TM_LONG_SIZE 134 |
cholletisaik777 | 0:bcbd76c86cde | 6 | #define TM_SHORT_SIZE 13 |
cholletisaik777 | 0:bcbd76c86cde | 7 | |
cholletisaik777 | 0:bcbd76c86cde | 8 | //TELECOMMAND: |
cholletisaik777 | 0:bcbd76c86cde | 9 | |
cholletisaik777 | 0:bcbd76c86cde | 10 | // exec_status: |
cholletisaik777 | 0:bcbd76c86cde | 11 | // 0: unexecuted |
cholletisaik777 | 0:bcbd76c86cde | 12 | // 1: successfully executed |
cholletisaik777 | 0:bcbd76c86cde | 13 | // 2: Execution Failed |
cholletisaik777 | 0:bcbd76c86cde | 14 | // 3: Disabled |
cholletisaik777 | 0:bcbd76c86cde | 15 | // 4: Marked For retry |
cholletisaik777 | 0:bcbd76c86cde | 16 | |
cholletisaik777 | 0:bcbd76c86cde | 17 | //MASKS |
cholletisaik777 | 0:bcbd76c86cde | 18 | #define SHORT_LONG_TC_MASK 0x10 |
cholletisaik777 | 0:bcbd76c86cde | 19 | #define CRC_MASK 0x08 |
cholletisaik777 | 0:bcbd76c86cde | 20 | #define EXEC_STATUS_MASK 0x07 |
cholletisaik777 | 0:bcbd76c86cde | 21 | |
cholletisaik777 | 0:bcbd76c86cde | 22 | //USE ONLY THE BELOW MACROS TO MODIFY 'flags' VARIABLE |
cholletisaik777 | 0:bcbd76c86cde | 23 | //x should be a Base_tc pointer |
cholletisaik777 | 0:bcbd76c86cde | 24 | #define GETshort_or_long_tc(x) ( ( (x->flags) & SHORT_LONG_TC_MASK ) >> 4 ) |
cholletisaik777 | 0:bcbd76c86cde | 25 | #define GETcrc_pass(x) ( ( (x->flags) & CRC_MASK ) >> 3 ) |
cholletisaik777 | 0:bcbd76c86cde | 26 | #define GETabort_on_nack(x) ( ( (x->TC_string[1]) & 0x08 ) >> 3 ) |
cholletisaik777 | 0:bcbd76c86cde | 27 | #define GETapid(x) ( ( (x->TC_string[1]) & 0xC0 ) >> 6 ) |
cholletisaik777 | 0:bcbd76c86cde | 28 | #define GETexec_status(x) ( (x->flags) & EXEC_STATUS_MASK ) |
cholletisaik777 | 0:bcbd76c86cde | 29 | #define GETpacket_seq_count(x) (x->TC_string[0]) |
cholletisaik777 | 0:bcbd76c86cde | 30 | #define GETservice_type(x) ( (x->TC_string[2]) & 0xF0 ) |
cholletisaik777 | 0:bcbd76c86cde | 31 | #define GETservice_subtype(x) ( (x->TC_string[2]) & 0x0F ) |
cholletisaik777 | 0:bcbd76c86cde | 32 | #define GETpid(x) (x->TC_string[3]) |
cholletisaik777 | 0:bcbd76c86cde | 33 | |
cholletisaik777 | 0:bcbd76c86cde | 34 | //x should be a Base_tc pointer |
cholletisaik777 | 0:bcbd76c86cde | 35 | //y should be a 16-bit number with relevant data in LSB |
cholletisaik777 | 0:bcbd76c86cde | 36 | //use in a seperate line with ; at the end: similar to a function |
cholletisaik777 | 0:bcbd76c86cde | 37 | #define PUTshort_or_long(x,y) x->flags = ( (x->flags) & ~(SHORT_LONG_TC_MASK)) | ( (y << 4) & SHORT_LONG_TC_MASK ) |
cholletisaik777 | 0:bcbd76c86cde | 38 | #define PUTcrc_pass(x,y) x->flags = ( (x->flags) & ~(CRC_MASK)) | ( (y << 3) & CRC_MASK) |
cholletisaik777 | 0:bcbd76c86cde | 39 | #define PUTexec_status(x,y) x->flags = ( (x->flags) & ~(EXEC_STATUS_MASK)) | ( y & EXEC_STATUS_MASK) |
cholletisaik777 | 0:bcbd76c86cde | 40 | |
cholletisaik777 | 0:bcbd76c86cde | 41 | //PARENT TELECOMMAND CLASS |
cholletisaik777 | 0:bcbd76c86cde | 42 | class Base_tc{ |
cholletisaik777 | 0:bcbd76c86cde | 43 | public: |
cholletisaik777 | 0:bcbd76c86cde | 44 | uint8_t flags; |
cholletisaik777 | 0:bcbd76c86cde | 45 | uint8_t *TC_string; |
cholletisaik777 | 0:bcbd76c86cde | 46 | Base_tc *next_TC; |
cholletisaik777 | 0:bcbd76c86cde | 47 | |
cholletisaik777 | 0:bcbd76c86cde | 48 | virtual ~Base_tc(){} |
cholletisaik777 | 0:bcbd76c86cde | 49 | }; |
cholletisaik777 | 0:bcbd76c86cde | 50 | |
cholletisaik777 | 0:bcbd76c86cde | 51 | //DERIVED CLASS - SHORT TC |
cholletisaik777 | 0:bcbd76c86cde | 52 | class Short_tc : public Base_tc{ |
cholletisaik777 | 0:bcbd76c86cde | 53 | private: |
cholletisaik777 | 0:bcbd76c86cde | 54 | uint8_t fix_str[TC_SHORT_SIZE]; |
cholletisaik777 | 0:bcbd76c86cde | 55 | public: |
cholletisaik777 | 0:bcbd76c86cde | 56 | Short_tc(){ |
cholletisaik777 | 0:bcbd76c86cde | 57 | TC_string = fix_str; |
cholletisaik777 | 0:bcbd76c86cde | 58 | flags = 0; |
cholletisaik777 | 0:bcbd76c86cde | 59 | } |
cholletisaik777 | 0:bcbd76c86cde | 60 | |
cholletisaik777 | 0:bcbd76c86cde | 61 | ~Short_tc(){} |
cholletisaik777 | 0:bcbd76c86cde | 62 | }; |
cholletisaik777 | 0:bcbd76c86cde | 63 | |
cholletisaik777 | 0:bcbd76c86cde | 64 | //DERIVED CLASS - LONG TC |
cholletisaik777 | 0:bcbd76c86cde | 65 | class Long_tc : public Base_tc{ |
cholletisaik777 | 0:bcbd76c86cde | 66 | private: |
cholletisaik777 | 0:bcbd76c86cde | 67 | uint8_t fix_str[TC_LONG_SIZE]; |
cholletisaik777 | 0:bcbd76c86cde | 68 | public: |
cholletisaik777 | 0:bcbd76c86cde | 69 | Long_tc(){ |
cholletisaik777 | 0:bcbd76c86cde | 70 | TC_string = fix_str; |
cholletisaik777 | 0:bcbd76c86cde | 71 | flags = 0; |
cholletisaik777 | 0:bcbd76c86cde | 72 | } |
cholletisaik777 | 0:bcbd76c86cde | 73 | |
cholletisaik777 | 0:bcbd76c86cde | 74 | ~Long_tc(){} |
cholletisaik777 | 0:bcbd76c86cde | 75 | }; |
cholletisaik777 | 0:bcbd76c86cde | 76 | |
cholletisaik777 | 0:bcbd76c86cde | 77 | // TELEMETRY: |
cholletisaik777 | 0:bcbd76c86cde | 78 | // MASKS |
cholletisaik777 | 0:bcbd76c86cde | 79 | #define SHORT_LONG_TM_MASK 0x10 |
cholletisaik777 | 0:bcbd76c86cde | 80 | #define TMID_MASK 0x0F |
cholletisaik777 | 0:bcbd76c86cde | 81 | |
cholletisaik777 | 0:bcbd76c86cde | 82 | //x should be 'fields' variable defined in the Base_tm |
cholletisaik777 | 0:bcbd76c86cde | 83 | #define GETshort_or_long_tm(x) ((x & SHORT_LONG_TM_MASK) >> 4) |
cholletisaik777 | 0:bcbd76c86cde | 84 | #define GETtmid(x) (x & TMID_MASK) |
cholletisaik777 | 0:bcbd76c86cde | 85 | |
cholletisaik777 | 0:bcbd76c86cde | 86 | //x should be 'fields' variable defines in the Base_tm |
cholletisaik777 | 0:bcbd76c86cde | 87 | //y should be an 8-bit number with relevent data at LSB |
cholletisaik777 | 0:bcbd76c86cde | 88 | #define PUTshort_or_long_tm(x,y) x = (x & ~(SHORT_LONG_TM_MASK)) | ((y<<4) & SHORT_LONG_TM_MASK) |
cholletisaik777 | 0:bcbd76c86cde | 89 | #define PUTtmid(x,y) x = (x & ~(TMID_MASK)) | (y & TMID_MASK) |
cholletisaik777 | 0:bcbd76c86cde | 90 | |
cholletisaik777 | 0:bcbd76c86cde | 91 | // PARENT TELEMETRY CLASS |
cholletisaik777 | 0:bcbd76c86cde | 92 | class Base_tm{ |
cholletisaik777 | 0:bcbd76c86cde | 93 | public: |
cholletisaik777 | 0:bcbd76c86cde | 94 | uint8_t fields; |
cholletisaik777 | 0:bcbd76c86cde | 95 | uint8_t *TM_string; |
cholletisaik777 | 0:bcbd76c86cde | 96 | Base_tm *next_TM; |
cholletisaik777 | 0:bcbd76c86cde | 97 | |
cholletisaik777 | 0:bcbd76c86cde | 98 | virtual ~Base_tm(){} |
cholletisaik777 | 0:bcbd76c86cde | 99 | }; |
cholletisaik777 | 0:bcbd76c86cde | 100 | |
cholletisaik777 | 0:bcbd76c86cde | 101 | // DERIVED CLASS : Long tm [type 0] |
cholletisaik777 | 0:bcbd76c86cde | 102 | // type 0 |
cholletisaik777 | 0:bcbd76c86cde | 103 | class Long_tm : public Base_tm{ |
cholletisaik777 | 0:bcbd76c86cde | 104 | private: |
cholletisaik777 | 0:bcbd76c86cde | 105 | uint8_t fix_str[TM_LONG_SIZE]; |
cholletisaik777 | 0:bcbd76c86cde | 106 | public: |
cholletisaik777 | 0:bcbd76c86cde | 107 | Long_tm(){ |
cholletisaik777 | 0:bcbd76c86cde | 108 | TM_string = fix_str; |
cholletisaik777 | 0:bcbd76c86cde | 109 | // type 0 |
cholletisaik777 | 0:bcbd76c86cde | 110 | fields = 0; |
cholletisaik777 | 0:bcbd76c86cde | 111 | } |
cholletisaik777 | 0:bcbd76c86cde | 112 | |
cholletisaik777 | 0:bcbd76c86cde | 113 | ~Long_tm(){} |
cholletisaik777 | 0:bcbd76c86cde | 114 | }; |
cholletisaik777 | 0:bcbd76c86cde | 115 | |
cholletisaik777 | 0:bcbd76c86cde | 116 | // DERIVED CLASS : Short tm [type 1] |
cholletisaik777 | 0:bcbd76c86cde | 117 | // type 1 |
cholletisaik777 | 0:bcbd76c86cde | 118 | class Short_tm : public Base_tm{ |
cholletisaik777 | 0:bcbd76c86cde | 119 | private: |
cholletisaik777 | 0:bcbd76c86cde | 120 | uint8_t fix_str[TM_SHORT_SIZE]; |
cholletisaik777 | 0:bcbd76c86cde | 121 | public: |
cholletisaik777 | 0:bcbd76c86cde | 122 | Short_tm(){ |
cholletisaik777 | 0:bcbd76c86cde | 123 | TM_string = fix_str; |
cholletisaik777 | 0:bcbd76c86cde | 124 | // type 1 |
cholletisaik777 | 0:bcbd76c86cde | 125 | fields = 0x10; |
cholletisaik777 | 0:bcbd76c86cde | 126 | } |
cholletisaik777 | 0:bcbd76c86cde | 127 | |
cholletisaik777 | 0:bcbd76c86cde | 128 | ~Short_tm(){} |
cholletisaik777 | 0:bcbd76c86cde | 129 | }; |
cholletisaik777 | 0:bcbd76c86cde | 130 | |
cholletisaik777 | 0:bcbd76c86cde | 131 | //////////////////////////////END |
cholletisaik777 | 0:bcbd76c86cde | 132 | |
cholletisaik777 | 0:bcbd76c86cde | 133 | |
cholletisaik777 | 0:bcbd76c86cde | 134 | |
cholletisaik777 | 0:bcbd76c86cde | 135 | |
cholletisaik777 | 0:bcbd76c86cde | 136 | |
cholletisaik777 | 0:bcbd76c86cde | 137 | |
cholletisaik777 | 0:bcbd76c86cde | 138 | |
cholletisaik777 | 0:bcbd76c86cde | 139 | |
cholletisaik777 | 0:bcbd76c86cde | 140 | |
cholletisaik777 | 0:bcbd76c86cde | 141 | |
cholletisaik777 | 0:bcbd76c86cde | 142 | |
cholletisaik777 | 0:bcbd76c86cde | 143 | |
cholletisaik777 | 0:bcbd76c86cde | 144 | |
cholletisaik777 | 0:bcbd76c86cde | 145 | |
cholletisaik777 | 0:bcbd76c86cde | 146 | |
cholletisaik777 | 0:bcbd76c86cde | 147 | |
cholletisaik777 | 0:bcbd76c86cde | 148 | /*typedef struct TC_list{ |
cholletisaik777 | 0:bcbd76c86cde | 149 | // received from the RCV_TC |
cholletisaik777 | 0:bcbd76c86cde | 150 | unsigned char *TC_string; |
cholletisaik777 | 0:bcbd76c86cde | 151 | bool short_or_long; //'true' for short |
cholletisaik777 | 0:bcbd76c86cde | 152 | bool crc_pass; |
cholletisaik777 | 0:bcbd76c86cde | 153 | |
cholletisaik777 | 0:bcbd76c86cde | 154 | // updated info - updated in MNG_TC |
cholletisaik777 | 0:bcbd76c86cde | 155 | unsigned char packet_seq_count; |
cholletisaik777 | 0:bcbd76c86cde | 156 | unsigned char apid; |
cholletisaik777 | 0:bcbd76c86cde | 157 | bool abort_on_nack; |
cholletisaik777 | 0:bcbd76c86cde | 158 | bool enabled; |
cholletisaik777 | 0:bcbd76c86cde | 159 | // bool valid_execution; |
cholletisaik777 | 0:bcbd76c86cde | 160 | unsigned char exec_status; |
cholletisaik777 | 0:bcbd76c86cde | 161 | |
cholletisaik777 | 0:bcbd76c86cde | 162 | struct TC_list *next_TC; |
cholletisaik777 | 0:bcbd76c86cde | 163 | |
cholletisaik777 | 0:bcbd76c86cde | 164 | ~TC_list(){} |
cholletisaik777 | 0:bcbd76c86cde | 165 | }TC_list; |
cholletisaik777 | 0:bcbd76c86cde | 166 | |
cholletisaik777 | 0:bcbd76c86cde | 167 | typedef struct TM_list{ |
cholletisaik777 | 0:bcbd76c86cde | 168 | |
cholletisaik777 | 0:bcbd76c86cde | 169 | unsigned char *TM_string; |
cholletisaik777 | 0:bcbd76c86cde | 170 | // bool short_or_long; // true for short |
cholletisaik777 | 0:bcbd76c86cde | 171 | // pass while calling the function |
cholletisaik777 | 0:bcbd76c86cde | 172 | unsigned char tmid; |
cholletisaik777 | 0:bcbd76c86cde | 173 | struct TM_list *next_TM; |
cholletisaik777 | 0:bcbd76c86cde | 174 | |
cholletisaik777 | 0:bcbd76c86cde | 175 | ~TM_list(){} |
cholletisaik777 | 0:bcbd76c86cde | 176 | }TM_List;*/ |
cholletisaik777 | 0:bcbd76c86cde | 177 | |
cholletisaik777 | 0:bcbd76c86cde | 178 | |
cholletisaik777 | 0:bcbd76c86cde | 179 | |
cholletisaik777 | 0:bcbd76c86cde | 180 | |
cholletisaik777 | 0:bcbd76c86cde | 181 | |
cholletisaik777 | 0:bcbd76c86cde | 182 | |
cholletisaik777 | 0:bcbd76c86cde | 183 | |
cholletisaik777 | 0:bcbd76c86cde | 184 | |
cholletisaik777 | 0:bcbd76c86cde | 185 | |
cholletisaik777 | 0:bcbd76c86cde | 186 | |
cholletisaik777 | 0:bcbd76c86cde | 187 | |
cholletisaik777 | 0:bcbd76c86cde | 188 | |
cholletisaik777 | 0:bcbd76c86cde | 189 | |
cholletisaik777 | 0:bcbd76c86cde | 190 | |
cholletisaik777 | 0:bcbd76c86cde | 191 | |
cholletisaik777 | 0:bcbd76c86cde | 192 | |
cholletisaik777 | 0:bcbd76c86cde | 193 | |
cholletisaik777 | 0:bcbd76c86cde | 194 | |
cholletisaik777 | 0:bcbd76c86cde | 195 | |
cholletisaik777 | 0:bcbd76c86cde | 196 | |
cholletisaik777 | 0:bcbd76c86cde | 197 | |
cholletisaik777 | 0:bcbd76c86cde | 198 | |
cholletisaik777 | 0:bcbd76c86cde | 199 | ////PARENT CLASS |
cholletisaik777 | 0:bcbd76c86cde | 200 | //class Base_tc{ |
cholletisaik777 | 0:bcbd76c86cde | 201 | //public: |
cholletisaik777 | 0:bcbd76c86cde | 202 | // uint16_t fields; |
cholletisaik777 | 0:bcbd76c86cde | 203 | // uint8_t *TC_string; |
cholletisaik777 | 0:bcbd76c86cde | 204 | // Base_tc *next_node; |
cholletisaik777 | 0:bcbd76c86cde | 205 | |
cholletisaik777 | 0:bcbd76c86cde | 206 | // short = 0, long = 1 |
cholletisaik777 | 0:bcbd76c86cde | 207 | // bool GETshort_or_long(void){ |
cholletisaik777 | 0:bcbd76c86cde | 208 | // return (fields & SHORT_LONG_TC_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 209 | // } |
cholletisaik777 | 0:bcbd76c86cde | 210 | // void PUTshort_or_long(bool input){ |
cholletisaik777 | 0:bcbd76c86cde | 211 | // if(input){ |
cholletisaik777 | 0:bcbd76c86cde | 212 | // fields |= SHORT_LONG_TC_MASK; |
cholletisaik777 | 0:bcbd76c86cde | 213 | // } |
cholletisaik777 | 0:bcbd76c86cde | 214 | // else{ |
cholletisaik777 | 0:bcbd76c86cde | 215 | // fields &= ~(SHORT_LONG_TC_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 216 | // } |
cholletisaik777 | 0:bcbd76c86cde | 217 | // } |
cholletisaik777 | 0:bcbd76c86cde | 218 | // |
cholletisaik777 | 0:bcbd76c86cde | 219 | // bool inline GETcrc_pass(){ |
cholletisaik777 | 0:bcbd76c86cde | 220 | // return (fields & CRC_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 221 | // } |
cholletisaik777 | 0:bcbd76c86cde | 222 | // void inline PUTcrc_pass(bool input){ |
cholletisaik777 | 0:bcbd76c86cde | 223 | // if(input){ |
cholletisaik777 | 0:bcbd76c86cde | 224 | // fields |= CRC_MASK; |
cholletisaik777 | 0:bcbd76c86cde | 225 | // } |
cholletisaik777 | 0:bcbd76c86cde | 226 | // else{ |
cholletisaik777 | 0:bcbd76c86cde | 227 | // fields &= ~(CRC_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 228 | // } |
cholletisaik777 | 0:bcbd76c86cde | 229 | // } |
cholletisaik777 | 0:bcbd76c86cde | 230 | // |
cholletisaik777 | 0:bcbd76c86cde | 231 | // bool inline GETabort_on_nack(){ |
cholletisaik777 | 0:bcbd76c86cde | 232 | // return (fields & ABORT_ON_NACK_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 233 | // } |
cholletisaik777 | 0:bcbd76c86cde | 234 | // void inline PUTabort_on_nack(bool input){ |
cholletisaik777 | 0:bcbd76c86cde | 235 | // if(input){ |
cholletisaik777 | 0:bcbd76c86cde | 236 | // fields |= ABORT_ON_NACK_MASK; |
cholletisaik777 | 0:bcbd76c86cde | 237 | // } |
cholletisaik777 | 0:bcbd76c86cde | 238 | // else{ |
cholletisaik777 | 0:bcbd76c86cde | 239 | // fields &= ~(ABORT_ON_NACK_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 240 | // } |
cholletisaik777 | 0:bcbd76c86cde | 241 | // } |
cholletisaik777 | 0:bcbd76c86cde | 242 | // |
cholletisaik777 | 0:bcbd76c86cde | 243 | // uint8_t inline GETapid(){ |
cholletisaik777 | 0:bcbd76c86cde | 244 | // uint16_t temp = fields & APID_MASK; |
cholletisaik777 | 0:bcbd76c86cde | 245 | // temp = temp >> 10; |
cholletisaik777 | 0:bcbd76c86cde | 246 | // return (temp & 0xFF); |
cholletisaik777 | 0:bcbd76c86cde | 247 | // } |
cholletisaik777 | 0:bcbd76c86cde | 248 | // void inline PUTapid(uint8_t input){ |
cholletisaik777 | 0:bcbd76c86cde | 249 | // uint16_t temp = input; |
cholletisaik777 | 0:bcbd76c86cde | 250 | // temp = temp << 10; |
cholletisaik777 | 0:bcbd76c86cde | 251 | // fields &= ~(APID_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 252 | // fields |= (temp & APID_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 253 | // } |
cholletisaik777 | 0:bcbd76c86cde | 254 | // |
cholletisaik777 | 0:bcbd76c86cde | 255 | // uint8_t inline GETexec_status(){ |
cholletisaik777 | 0:bcbd76c86cde | 256 | // uint16_t temp = fields & EXEC_STATUS_MASK; |
cholletisaik777 | 0:bcbd76c86cde | 257 | // temp = temp >> 8; |
cholletisaik777 | 0:bcbd76c86cde | 258 | // return (temp & 0xFF); |
cholletisaik777 | 0:bcbd76c86cde | 259 | // } |
cholletisaik777 | 0:bcbd76c86cde | 260 | // void inline PUTexec_status(uint8_t input){ |
cholletisaik777 | 0:bcbd76c86cde | 261 | // uint16_t temp = input; |
cholletisaik777 | 0:bcbd76c86cde | 262 | // temp = temp << 8; |
cholletisaik777 | 0:bcbd76c86cde | 263 | // fields &= ~(EXEC_STATUS_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 264 | // fields |= (temp & EXEC_STATUS_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 265 | // } |
cholletisaik777 | 0:bcbd76c86cde | 266 | // |
cholletisaik777 | 0:bcbd76c86cde | 267 | // uint8_t inline GETpacket_seq_count(){ |
cholletisaik777 | 0:bcbd76c86cde | 268 | // uint16_t temp = fields & PACKET_SEQ_COUNT_MASK; |
cholletisaik777 | 0:bcbd76c86cde | 269 | // return (temp & 0xFF); |
cholletisaik777 | 0:bcbd76c86cde | 270 | // } |
cholletisaik777 | 0:bcbd76c86cde | 271 | // void inline PUTpacket_seq_count(uint8_t input){ |
cholletisaik777 | 0:bcbd76c86cde | 272 | // uint16_t temp = input; |
cholletisaik777 | 0:bcbd76c86cde | 273 | // fields &= ~(PACKET_SEQ_COUNT_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 274 | // fields |= (temp & PACKET_SEQ_COUNT_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 275 | // } |
cholletisaik777 | 0:bcbd76c86cde | 276 | // |
cholletisaik777 | 0:bcbd76c86cde | 277 | //// update everything other than short_or_long, and crc_pass from TC_string |
cholletisaik777 | 0:bcbd76c86cde | 278 | // void update_fields(){ |
cholletisaik777 | 0:bcbd76c86cde | 279 | //// abort on nack |
cholletisaik777 | 0:bcbd76c86cde | 280 | // uint8_t temp = TC_string[1]; |
cholletisaik777 | 0:bcbd76c86cde | 281 | // uint16_t t16 = 0; |
cholletisaik777 | 0:bcbd76c86cde | 282 | // if(temp & 0x10){ |
cholletisaik777 | 0:bcbd76c86cde | 283 | // fields |= ABORT_ON_NACK_MASK; |
cholletisaik777 | 0:bcbd76c86cde | 284 | // } |
cholletisaik777 | 0:bcbd76c86cde | 285 | // else{ |
cholletisaik777 | 0:bcbd76c86cde | 286 | // fields &= ~(ABORT_ON_NACK_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 287 | // } |
cholletisaik777 | 0:bcbd76c86cde | 288 | // |
cholletisaik777 | 0:bcbd76c86cde | 289 | // // apid |
cholletisaik777 | 0:bcbd76c86cde | 290 | // t16 = temp; |
cholletisaik777 | 0:bcbd76c86cde | 291 | // t16 = t16 << 4; |
cholletisaik777 | 0:bcbd76c86cde | 292 | // fields &= ~(APID_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 293 | // fields |= (t16 & APID_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 294 | // |
cholletisaik777 | 0:bcbd76c86cde | 295 | // // exec_status : default value of exec status |
cholletisaik777 | 0:bcbd76c86cde | 296 | // fields &= ~(EXEC_STATUS_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 297 | // |
cholletisaik777 | 0:bcbd76c86cde | 298 | // // packet seq count |
cholletisaik777 | 0:bcbd76c86cde | 299 | // temp = TC_string[0]; |
cholletisaik777 | 0:bcbd76c86cde | 300 | // t16 = temp; |
cholletisaik777 | 0:bcbd76c86cde | 301 | // fields &= ~(PACKET_SEQ_COUNT_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 302 | // fields |= (t16 & PACKET_SEQ_COUNT_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 303 | // } |
cholletisaik777 | 0:bcbd76c86cde | 304 | // |
cholletisaik777 | 0:bcbd76c86cde | 305 | // virtual ~Base_tc(){} |
cholletisaik777 | 0:bcbd76c86cde | 306 | //}; |
cholletisaik777 | 0:bcbd76c86cde | 307 | |
cholletisaik777 | 0:bcbd76c86cde | 308 | ////DERIVED CLASS - SHORT TC |
cholletisaik777 | 0:bcbd76c86cde | 309 | //class Short_tc : public Base_tc{ |
cholletisaik777 | 0:bcbd76c86cde | 310 | //private: |
cholletisaik777 | 0:bcbd76c86cde | 311 | // uint8_t fix_str[TC_SHORT_SIZE]; |
cholletisaik777 | 0:bcbd76c86cde | 312 | //public: |
cholletisaik777 | 0:bcbd76c86cde | 313 | // Short_tc(){ |
cholletisaik777 | 0:bcbd76c86cde | 314 | // TC_string = fix_str; |
cholletisaik777 | 0:bcbd76c86cde | 315 | // fields = 0; |
cholletisaik777 | 0:bcbd76c86cde | 316 | // } |
cholletisaik777 | 0:bcbd76c86cde | 317 | // |
cholletisaik777 | 0:bcbd76c86cde | 318 | // ~Short_tc(){} |
cholletisaik777 | 0:bcbd76c86cde | 319 | //}; |
cholletisaik777 | 0:bcbd76c86cde | 320 | // |
cholletisaik777 | 0:bcbd76c86cde | 321 | ////DERIVED CLASS - LONG TC |
cholletisaik777 | 0:bcbd76c86cde | 322 | //class Long_tc : public Base_tc{ |
cholletisaik777 | 0:bcbd76c86cde | 323 | //private: |
cholletisaik777 | 0:bcbd76c86cde | 324 | // uint8_t fix_str[TC_LONG_SIZE]; |
cholletisaik777 | 0:bcbd76c86cde | 325 | //public: |
cholletisaik777 | 0:bcbd76c86cde | 326 | // Long_tc(){ |
cholletisaik777 | 0:bcbd76c86cde | 327 | // TC_string = fix_str; |
cholletisaik777 | 0:bcbd76c86cde | 328 | // fields = 0; |
cholletisaik777 | 0:bcbd76c86cde | 329 | // } |
cholletisaik777 | 0:bcbd76c86cde | 330 | // |
cholletisaik777 | 0:bcbd76c86cde | 331 | // ~Long_tc(){} |
cholletisaik777 | 0:bcbd76c86cde | 332 | //}; |
cholletisaik777 | 0:bcbd76c86cde | 333 | |
cholletisaik777 | 0:bcbd76c86cde | 334 | //// TELEMETRY CLASS : |
cholletisaik777 | 0:bcbd76c86cde | 335 | // |
cholletisaik777 | 0:bcbd76c86cde | 336 | //// MASKS |
cholletisaik777 | 0:bcbd76c86cde | 337 | //#define SHORT_LONG_TM_MASK 0x10 |
cholletisaik777 | 0:bcbd76c86cde | 338 | //#define TMID_MASK 0x0F |
cholletisaik777 | 0:bcbd76c86cde | 339 | // |
cholletisaik777 | 0:bcbd76c86cde | 340 | //// PARENT CLASS |
cholletisaik777 | 0:bcbd76c86cde | 341 | //class Base_tm{ |
cholletisaik777 | 0:bcbd76c86cde | 342 | //protected: |
cholletisaik777 | 0:bcbd76c86cde | 343 | // uint8_t fields; |
cholletisaik777 | 0:bcbd76c86cde | 344 | //public: |
cholletisaik777 | 0:bcbd76c86cde | 345 | // uint8_t *TM_string; |
cholletisaik777 | 0:bcbd76c86cde | 346 | // Base_tm *next_node; |
cholletisaik777 | 0:bcbd76c86cde | 347 | // |
cholletisaik777 | 0:bcbd76c86cde | 348 | // short = 0, long = 1 |
cholletisaik777 | 0:bcbd76c86cde | 349 | // bool GETshort_or_long(){ |
cholletisaik777 | 0:bcbd76c86cde | 350 | // return (fields & SHORT_LONG_TM_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 351 | // } |
cholletisaik777 | 0:bcbd76c86cde | 352 | // void PUTshort_or_long(bool input){ |
cholletisaik777 | 0:bcbd76c86cde | 353 | // if(input){ |
cholletisaik777 | 0:bcbd76c86cde | 354 | // fields |= SHORT_LONG_TM_MASK; |
cholletisaik777 | 0:bcbd76c86cde | 355 | // } |
cholletisaik777 | 0:bcbd76c86cde | 356 | // else{ |
cholletisaik777 | 0:bcbd76c86cde | 357 | // fields &= ~(SHORT_LONG_TM_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 358 | // } |
cholletisaik777 | 0:bcbd76c86cde | 359 | // } |
cholletisaik777 | 0:bcbd76c86cde | 360 | // |
cholletisaik777 | 0:bcbd76c86cde | 361 | // uint8_t GETtmid(){ |
cholletisaik777 | 0:bcbd76c86cde | 362 | // return (fields & TMID_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 363 | // } |
cholletisaik777 | 0:bcbd76c86cde | 364 | // void PUTtmid(uint8_t input){ |
cholletisaik777 | 0:bcbd76c86cde | 365 | // fields &= ~(TMID_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 366 | // fields |= (input & TMID_MASK); |
cholletisaik777 | 0:bcbd76c86cde | 367 | // } |
cholletisaik777 | 0:bcbd76c86cde | 368 | // |
cholletisaik777 | 0:bcbd76c86cde | 369 | // virtual ~Base_tm(){} |
cholletisaik777 | 0:bcbd76c86cde | 370 | //}; |
cholletisaik777 | 0:bcbd76c86cde | 371 | |
cholletisaik777 | 0:bcbd76c86cde | 372 | |
cholletisaik777 | 0:bcbd76c86cde | 373 | //// DERIVED CLASS : Long tc [type 0] |
cholletisaik777 | 0:bcbd76c86cde | 374 | //// type 0 |
cholletisaik777 | 0:bcbd76c86cde | 375 | //class Long_tm : public Base_tm{ |
cholletisaik777 | 0:bcbd76c86cde | 376 | //private: |
cholletisaik777 | 0:bcbd76c86cde | 377 | // uint8_t fix_str[TM_LONG_SIZE]; |
cholletisaik777 | 0:bcbd76c86cde | 378 | //public: |
cholletisaik777 | 0:bcbd76c86cde | 379 | // Long_tm(){ |
cholletisaik777 | 0:bcbd76c86cde | 380 | // TM_string = fix_str; |
cholletisaik777 | 0:bcbd76c86cde | 381 | // // type 0 |
cholletisaik777 | 0:bcbd76c86cde | 382 | // fields = 0; |
cholletisaik777 | 0:bcbd76c86cde | 383 | // } |
cholletisaik777 | 0:bcbd76c86cde | 384 | // |
cholletisaik777 | 0:bcbd76c86cde | 385 | // ~Long_tm(){} |
cholletisaik777 | 0:bcbd76c86cde | 386 | //}; |
cholletisaik777 | 0:bcbd76c86cde | 387 | // |
cholletisaik777 | 0:bcbd76c86cde | 388 | //// DERIVED CLASS : Short tc [type 1] |
cholletisaik777 | 0:bcbd76c86cde | 389 | //// type 1 |
cholletisaik777 | 0:bcbd76c86cde | 390 | //class Short_tm : public Base_tm{ |
cholletisaik777 | 0:bcbd76c86cde | 391 | //private: |
cholletisaik777 | 0:bcbd76c86cde | 392 | // uint8_t fix_str[TM_SHORT_SIZE]; |
cholletisaik777 | 0:bcbd76c86cde | 393 | //public: |
cholletisaik777 | 0:bcbd76c86cde | 394 | // Short_tm(){ |
cholletisaik777 | 0:bcbd76c86cde | 395 | // TM_string = fix_str; |
cholletisaik777 | 0:bcbd76c86cde | 396 | // // type 1 |
cholletisaik777 | 0:bcbd76c86cde | 397 | // fields = 0x10; |
cholletisaik777 | 0:bcbd76c86cde | 398 | // } |
cholletisaik777 | 0:bcbd76c86cde | 399 | // |
cholletisaik777 | 0:bcbd76c86cde | 400 | // ~Short_tm(){} |
cholletisaik777 | 0:bcbd76c86cde | 401 | //}; |