pl ack in tmtc
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of COM_MNG_TMTC_SIMPLE_pl123 by
Structures.h
00001 // TC TM 00002 #define TC_SHORT_SIZE 11 00003 #define TC_LONG_SIZE 135 00004 #define TM_LONG_SIZE 134 00005 #define TM_SHORT_SIZE 13 00006 00007 #define SHORT_TC_CODE 0 00008 #define LONG_TC_CODE 1 00009 00010 #define SHORT_TM_CODE 1 00011 #define LONG_TM_CODE 0 00012 00013 // COM_RX 00014 #define RX_BUFFER_LENGTH 60 00015 // 60+4 = 64 00016 00017 struct data_node{ 00018 uint8_t values[RX_BUFFER_LENGTH]; 00019 struct data_node* next_node; 00020 }; 00021 typedef struct data_node COM_RX_DATA_NODE; 00022 00023 //TELECOMMAND: 00024 00025 /* 00026 exec_status: 00027 0: unexecuted 00028 1: successfully executed 00029 2: Execution Failed 00030 3: Disabled 00031 4: Marked For retry 00032 */ 00033 #define TC_STATE_UNEXECUTED 0x00 00034 #define TC_STATE_SUCCESSFULLY_EXECUTED 0x01 00035 #define TC_STATE_EXECUTION_FAILED 0x02 00036 #define TC_STATE_DISABLED 0x04 00037 #define TC_STATE_MARKED_RETRY 0x05 00038 00039 //MASKS 00040 #define SHORT_LONG_TC_MASK 0x10 00041 #define CRC_MASK 0x08 00042 #define EXEC_STATUS_MASK 0x07 00043 00044 //USE ONLY THE BELOW MACROS TO MODIFY 'flags' VARIABLE 00045 //x should be a Base_tc pointer 00046 #define GETshort_or_long_tc(x) ( ( (x->flags) & SHORT_LONG_TC_MASK ) >> 4 ) 00047 #define GETcrc_pass(x) ( ( (x->flags) & CRC_MASK ) >> 3 ) 00048 #define GETabort_on_nack(x) ( ( (x->TC_string[1]) & 0x08 ) >> 3 ) 00049 #define GETapid(x) ( ( (x->TC_string[1]) & 0xC0 ) >> 6 ) 00050 #define GETexec_status(x) ( (x->flags) & EXEC_STATUS_MASK ) 00051 #define GETpacket_seq_count(x) (x->TC_string[0]) 00052 #define GETservice_type(x) ( (x->TC_string[2]) & 0xF0 ) 00053 #define GETservice_subtype(x) ( (x->TC_string[2]) & 0x0F ) 00054 #define GETpid(x) (x->TC_string[3]) 00055 00056 //x should be a Base_tc pointer 00057 //y should be a 8-bit number with relevant data in LSB 00058 //use in a seperate line with ; at the end: similar to a function 00059 #define PUTshort_or_long(x,y) x->flags = ( (x->flags) & ~(SHORT_LONG_TC_MASK)) | ( (y << 4) & SHORT_LONG_TC_MASK ) 00060 #define PUTcrc_pass(x,y) x->flags = ( (x->flags) & ~(CRC_MASK)) | ( (y << 3) & CRC_MASK) 00061 #define PUTexec_status(x,y) x->flags = ( (x->flags) & ~(EXEC_STATUS_MASK)) | ( y & EXEC_STATUS_MASK) 00062 00063 //PARENT TELECOMMAND CLASS 00064 class Base_tc{ 00065 public: 00066 uint8_t flags; 00067 uint8_t *TC_string; 00068 Base_tc *next_TC; 00069 00070 virtual ~Base_tc(){} 00071 }; 00072 00073 //DERIVED CLASS - SHORT TC 00074 class Short_tc : public Base_tc{ 00075 private: 00076 uint8_t fix_str[TC_SHORT_SIZE]; 00077 public: 00078 Short_tc(){ 00079 TC_string = fix_str; 00080 flags = 0; 00081 } 00082 00083 ~Short_tc(){} 00084 }; 00085 00086 //DERIVED CLASS - LONG TC 00087 class Long_tc : public Base_tc{ 00088 private: 00089 uint8_t fix_str[TC_LONG_SIZE]; 00090 public: 00091 Long_tc(){ 00092 TC_string = fix_str; 00093 flags = 0; 00094 } 00095 00096 ~Long_tc(){} 00097 }; 00098 00099 // TELEMETRY: 00100 // MASK 00101 #define SHORT_LONG_TM_MASK 0x80 00102 00103 //x should be 'Base tm' pointer 00104 #define GETshort_or_long_tm(x) ((x->TM_string[0] & SHORT_LONG_TM_MASK) >> 7) 00105 00106 // PARENT TELEMETRY CLASS 00107 class Base_tm{ 00108 public: 00109 uint8_t *TM_string; 00110 Base_tm *next_TM; 00111 00112 virtual ~Base_tm(){} 00113 }; 00114 00115 // DERIVED CLASS : Long tm [type 0] 00116 // type 0 00117 class Long_tm : public Base_tm{ 00118 private: 00119 uint8_t fix_str[TM_LONG_SIZE]; 00120 public: 00121 Long_tm(){ 00122 TM_string = fix_str; 00123 // type 0 00124 } 00125 00126 ~Long_tm(){} 00127 }; 00128 00129 // DERIVED CLASS : Short tm [type 1] 00130 // type 1 00131 class Short_tm : public Base_tm{ 00132 private: 00133 uint8_t fix_str[TM_SHORT_SIZE]; 00134 public: 00135 Short_tm(){ 00136 TM_string = fix_str; 00137 // type 1 00138 } 00139 00140 ~Short_tm(){} 00141 }; 00142 00143 00144 // CDMS HK 00145 00146 #define tstart -40 00147 #define tstep 8 //to be finalized by thermal team 00148 #define tstart_thermistor -40 00149 #define tstep_thermistor 8 00150 00151 typedef struct CDMS_HK_actual 00152 { 00153 float temp_actual[16]; 00154 float CDMS_temp_actual; 00155 00156 }CDMS_HK_actual; 00157 00158 typedef struct CDMS_HK_quant 00159 { 00160 char temp_quant[16]; 00161 char CDMS_temp_quant; 00162 00163 }CDMS_HK_quant; 00164 00165 typedef struct CDMS_HK_min_max 00166 { 00167 char temp_max[16]; 00168 char temp_min[16]; 00169 char CDMS_temp_min; 00170 char CDMS_temp_max; 00171 }CDMS_HK_min_max;
Generated on Wed Jul 20 2022 09:24:44 by 1.7.2