PHiLIP
PHiLIP_typedef.h
Go to the documentation of this file.
1 
13 #ifndef PHILIP_TYPEDEF_H
14 #define PHILIP_TYPEDEF_H
15 
16 
17 #include <stdint.h>
18 
19 #pragma pack(1)
20 
21 typedef struct {
22  uint8_t init : 1;
23  uint8_t dut_rst : 1;
24  uint8_t res : 6;
25 } sys_mode_t;
26 
28 typedef struct {
29  uint8_t update : 1;
30  uint8_t board : 1;
31  uint8_t res : 6;
32 } sys_status_t;
33 
35 typedef struct {
36  uint8_t init : 1;
37  uint8_t disable : 1;
38  uint8_t addr_10_bit : 1;
39  uint8_t general_call : 1;
40  uint8_t no_clk_stretch : 1;
41  uint8_t reg_16_bit : 1;
42  uint8_t reg_16_big_endian : 1;
43  uint8_t nack_data : 1;
44 } i2c_mode_t;
45 
47 typedef struct {
48  uint8_t ovr : 1;
49  uint8_t af : 1;
50  uint8_t berr : 1;
51  uint8_t gencall : 1;
52  uint8_t busy : 1;
53  uint8_t rsr : 1;
54  uint8_t res : 2;
55 } i2c_status_t;
56 
58 typedef struct {
59  uint8_t init : 1;
60  uint8_t disable : 1;
61  uint8_t cpha : 1;
62  uint8_t cpol : 1;
63  uint8_t if_type : 2;
64  uint8_t reg_16_bit : 1;
65  uint8_t reg_16_big_endian : 1;
66 } spi_mode_t;
67 
69 typedef struct {
70  uint8_t bsy : 1;
71  uint8_t ovr : 1;
72  uint8_t modf : 1;
73  uint8_t udr : 1;
74  uint8_t clk : 1;
75  uint8_t start_clk : 1;
76  uint8_t end_clk : 1;
77  uint8_t index_err : 1;
78 } spi_status_t;
79 
81 typedef struct {
82  uint16_t init : 1;
83  uint16_t disable : 1;
84  uint16_t if_type : 2;
85  uint16_t stop_bits : 1;
86  uint16_t parity : 2;
87  uint16_t rts : 1;
88  uint16_t data_bits : 1;
89  uint16_t res : 7;
90 } uart_mode_t;
91 
93 typedef struct {
94  uint8_t cts : 1;
95  uint8_t pe : 1;
96  uint8_t fe : 1;
97  uint8_t nf : 1;
98  uint8_t ore : 1;
99  uint8_t res : 3;
100 } uart_status_t;
101 
103 typedef struct {
104  uint16_t init : 1;
105  uint16_t io_type : 2;
106  uint16_t level : 1;
107  uint16_t pull : 2;
108  uint16_t tick_div : 5;
109  uint16_t res : 5;
110 } gpio_mode_t;
111 
113 typedef struct {
114  uint8_t io_type : 2;
115  uint8_t pull : 2;
116  uint8_t set_level : 1;
117  uint8_t level : 1;
118  uint8_t res : 2;
119 } basic_gpio_t;
120 
122 typedef struct {
123  uint8_t level : 1;
124  uint8_t res : 7;
125 } gpio_status_t;
126 
128 typedef struct {
129  uint8_t init : 1;
130  uint8_t disable : 1;
131  uint8_t fast_sample : 1;
132  uint8_t res : 5;
133 } adc_mode_t;
134 
136 typedef struct {
137  uint8_t init : 1;
138  uint8_t disable : 1;
139  uint8_t trig_edge : 2;
140  uint8_t res : 4;
141 } tmr_mode_t;
142 
144 typedef struct {
145  uint8_t init : 1;
146  uint8_t disable : 1;
147  uint8_t res : 6;
148 } basic_mode_t;
149 
151 typedef union {
152  struct {
153  uint8_t second;
154  uint8_t minute;
155  uint8_t hour;
156  uint8_t day_of_month;
157  uint8_t day_of_week;
158  uint8_t month;
159  uint8_t year;
160  uint8_t res[1];
161  };
162  uint8_t data8[8];
163 } timestamp_t;
164 
166 typedef union {
167  struct {
168  uint8_t sn[12];
169  uint8_t fw_rev[4];
170  uint8_t if_rev[4];
171  uint64_t tick;
173  uint32_t device_num;
174  uint32_t sys_clk;
177  uint8_t res[18];
178  };
179  uint8_t data8[64];
180 } sys_t;
181 
183 typedef union {
184  struct {
187  basic_gpio_t dut_sda;
188  basic_gpio_t dut_scl;
189  uint16_t clk_stretch_delay;
190  uint16_t slave_addr_1;
191  uint16_t slave_addr_2;
192  uint16_t state;
193  uint16_t reg_index;
194  uint16_t start_reg_index;
195  uint8_t r_count;
196  uint8_t w_count;
197  uint32_t r_ticks;
198  uint32_t w_ticks;
199  uint32_t s_ticks;
200  uint32_t f_r_ticks;
201  uint32_t f_w_ticks;
202  uint8_t res[26];
203  };
204  uint8_t data8[64];
205 } i2c_t;
206 
208 typedef union {
209  struct {
212  basic_gpio_t dut_mosi;
213  basic_gpio_t dut_miso;
214  basic_gpio_t dut_sck;
215  basic_gpio_t dut_nss;
216  uint16_t state;
217  uint16_t reg_index;
218  uint16_t start_reg_index;
219  uint8_t r_count;
220  uint8_t w_count;
221  uint8_t transfer_count;
222  uint32_t frame_ticks;
223  uint32_t byte_ticks;
224  uint32_t prev_ticks;
225  uint8_t res[5];
226  };
227  uint8_t data8[32];
228 } spi_t;
229 
231 typedef union {
232  struct {
234  basic_gpio_t dut_rx;
235  basic_gpio_t dut_tx;
236  basic_gpio_t dut_cts;
237  basic_gpio_t dut_rts;
238  uint32_t baud;
239  uint8_t mask_msb;
240  uint16_t rx_count;
241  uint16_t tx_count;
243  };
244  uint8_t data8[16];
245 } uart_t;
246 
248 typedef union {
249  struct {
251  basic_gpio_t dut_adc;
252  uint32_t num_of_samples;
253  uint32_t index;
254  uint16_t sample;
255  uint32_t sum;
256  uint32_t current_sum;
257  uint8_t counter;
258  uint8_t res[11];
259  };
260  uint8_t data8[32];
261 } adc_t;
262 
264 typedef union {
265  struct {
267  basic_gpio_t dut_pwm;
268  uint16_t duty_cycle;
269  uint32_t period;
270  uint32_t h_ticks;
271  uint32_t l_ticks;
272  uint8_t res[16];
273  };
274  uint8_t data8[32];
275 } pwm_t;
276 
278 typedef union {
279  struct {
281  basic_gpio_t dut_dac;
282  uint16_t level;
283  uint8_t res[12];
284  };
285  uint8_t data8[16];
286 } dac_t;
287 
289 typedef union {
290  struct {
292  basic_gpio_t dut_ic;
293  uint16_t min_holdoff;
294  uint32_t min_tick;
295  uint32_t max_tick;
296  };
297  uint8_t data8[12];
298 } tmr_t;
299 
301 typedef union {
302  struct {
304  uint8_t second;
305  uint8_t minute;
306  uint8_t hour;
307  uint16_t day;
308  uint8_t set_second;
309  uint8_t set_minute;
310  uint8_t set_hour;
311  uint16_t set_day;
312  uint8_t res[5];
313  };
314  uint8_t data8[16];
315 } rtc_t;
316 
318 typedef union {
319  struct {
322  uint8_t res[1];
323  };
324  uint8_t data8[4];
325 } gpio_t;
326 
328 typedef union {
329  struct {
330  uint32_t index;
331  uint8_t tick_div[128];
332  uint8_t source[128];
333  uint16_t value[128];
334  uint32_t tick[128];
335  };
336  uint8_t data8[1028];
337 } trace_t;
338 
340 typedef union {
341  struct {
342  uint8_t user_reg[256];
346  uart_t uart;
352  gpio_t gpio[3];
354  uint8_t res[468];
355  };
356  uint8_t data8[2048];
357 } map_t;
358 
359 #pragma pack()
360 #endif /* PHILIP_TYPEDEF_H */
361 
basic_mode_t mode
Definition: PHiLIP_typedef.h:303
uint16_t min_holdoff
Definition: PHiLIP_typedef.h:293
uint32_t baud
Definition: PHiLIP_typedef.h:238
spi_mode_t mode
Definition: PHiLIP_typedef.h:210
sys_t sys
Definition: PHiLIP_typedef.h:343
uint8_t day_of_week
Definition: PHiLIP_typedef.h:157
Controls the RTC.
Definition: PHiLIP_typedef.h:301
uint32_t sum
Definition: PHiLIP_typedef.h:255
uint16_t state
Definition: PHiLIP_typedef.h:192
uint32_t max_tick
Definition: PHiLIP_typedef.h:295
uint8_t hour
Definition: PHiLIP_typedef.h:155
sys_mode_t mode
Definition: PHiLIP_typedef.h:176
uint8_t second
Definition: PHiLIP_typedef.h:153
uint16_t rx_count
Definition: PHiLIP_typedef.h:240
uint8_t set_second
Definition: PHiLIP_typedef.h:308
uint16_t slave_addr_1
Definition: PHiLIP_typedef.h:190
Controls DAC values.
Definition: PHiLIP_typedef.h:278
Controls and provides information for the uart.
Definition: PHiLIP_typedef.h:231
Controls GPIO settings.
Definition: PHiLIP_typedef.h:318
uint32_t l_ticks
Definition: PHiLIP_typedef.h:271
Basic mode settings.
Definition: PHiLIP_typedef.h:144
Time and date.
Definition: PHiLIP_typedef.h:151
uint16_t start_reg_index
Definition: PHiLIP_typedef.h:194
uint32_t prev_ticks
Definition: PHiLIP_typedef.h:224
uint32_t index
Definition: PHiLIP_typedef.h:253
uint32_t device_num
Definition: PHiLIP_typedef.h:173
UART status.
Definition: PHiLIP_typedef.h:93
uint8_t w_count
Definition: PHiLIP_typedef.h:220
i2c_t i2c
Definition: PHiLIP_typedef.h:344
uint8_t month
Definition: PHiLIP_typedef.h:158
uint16_t clk_stretch_delay
Definition: PHiLIP_typedef.h:189
SPI status.
Definition: PHiLIP_typedef.h:69
timestamp_t build_time
Definition: PHiLIP_typedef.h:172
uint8_t mask_msb
Definition: PHiLIP_typedef.h:239
System settings for the device.
Definition: PHiLIP_typedef.h:183
gpio_mode_t mode
Definition: PHiLIP_typedef.h:320
IO pin mode control.
Definition: PHiLIP_typedef.h:103
SPI mode settings.
Definition: PHiLIP_typedef.h:58
Controls and calculates PWM values.
Definition: PHiLIP_typedef.h:264
uint32_t w_ticks
Definition: PHiLIP_typedef.h:198
i2c_status_t status
Definition: PHiLIP_typedef.h:186
Controls timer input capture values.
Definition: PHiLIP_typedef.h:289
gpio_status_t status
Definition: PHiLIP_typedef.h:321
trace_t trace
Definition: PHiLIP_typedef.h:353
uint64_t tick
Definition: PHiLIP_typedef.h:171
tmr_mode_t mode
Definition: PHiLIP_typedef.h:291
adc_t adc
Definition: PHiLIP_typedef.h:348
IO pin status.
Definition: PHiLIP_typedef.h:122
uart_status_t status
Definition: PHiLIP_typedef.h:242
basic_mode_t mode
Definition: PHiLIP_typedef.h:266
uint16_t day
Definition: PHiLIP_typedef.h:307
uint32_t min_tick
Definition: PHiLIP_typedef.h:294
Simplified GPIO for periph GPIO control.
Definition: PHiLIP_typedef.h:113
tmr_t tmr
Definition: PHiLIP_typedef.h:351
uint16_t state
Definition: PHiLIP_typedef.h:216
uint32_t num_of_samples
Definition: PHiLIP_typedef.h:252
uint32_t f_w_ticks
Definition: PHiLIP_typedef.h:201
uint8_t year
Definition: PHiLIP_typedef.h:159
uint16_t set_day
Definition: PHiLIP_typedef.h:311
System status.
Definition: PHiLIP_typedef.h:28
uint8_t counter
Definition: PHiLIP_typedef.h:257
Controls and reads the ADC.
Definition: PHiLIP_typedef.h:248
I2C mode settings.
Definition: PHiLIP_typedef.h:35
The memory map.
Definition: PHiLIP_typedef.h:340
uint8_t r_count
Definition: PHiLIP_typedef.h:195
uart_mode_t mode
Definition: PHiLIP_typedef.h:233
ADC mode settings.
Definition: PHiLIP_typedef.h:128
System settings for PHiLIP.
Definition: PHiLIP_typedef.h:166
spi_t spi
Definition: PHiLIP_typedef.h:345
uint32_t r_ticks
Definition: PHiLIP_typedef.h:197
uint16_t level
Definition: PHiLIP_typedef.h:282
uint16_t tx_count
Definition: PHiLIP_typedef.h:241
I2C status.
Definition: PHiLIP_typedef.h:47
adc_mode_t mode
Definition: PHiLIP_typedef.h:250
uint8_t minute
Definition: PHiLIP_typedef.h:305
spi_status_t status
Definition: PHiLIP_typedef.h:211
dac_t dac
Definition: PHiLIP_typedef.h:350
uint8_t day_of_month
Definition: PHiLIP_typedef.h:156
uint32_t byte_ticks
Definition: PHiLIP_typedef.h:223
uint32_t current_sum
Definition: PHiLIP_typedef.h:256
uint32_t period
Definition: PHiLIP_typedef.h:269
uint8_t second
Definition: PHiLIP_typedef.h:304
uint32_t f_r_ticks
Definition: PHiLIP_typedef.h:200
rtc_t rtc
Definition: PHiLIP_typedef.h:347
uint32_t s_ticks
Definition: PHiLIP_typedef.h:199
pwm_t pwm
Definition: PHiLIP_typedef.h:349
uint8_t transfer_count
Definition: PHiLIP_typedef.h:221
uint8_t minute
Definition: PHiLIP_typedef.h:154
uint8_t set_minute
Definition: PHiLIP_typedef.h:309
uint32_t h_ticks
Definition: PHiLIP_typedef.h:270
sys_status_t status
Definition: PHiLIP_typedef.h:175
uint16_t reg_index
Definition: PHiLIP_typedef.h:193
uint8_t hour
Definition: PHiLIP_typedef.h:306
Controls and provides information for the spi.
Definition: PHiLIP_typedef.h:208
uint16_t sample
Definition: PHiLIP_typedef.h:254
uint32_t index
Definition: PHiLIP_typedef.h:330
uint32_t sys_clk
Definition: PHiLIP_typedef.h:174
Timer mode settings.
Definition: PHiLIP_typedef.h:136
uint8_t set_hour
Definition: PHiLIP_typedef.h:310
i2c_mode_t mode
Definition: PHiLIP_typedef.h:185
uint8_t w_count
Definition: PHiLIP_typedef.h:196
uint16_t duty_cycle
Definition: PHiLIP_typedef.h:268
uint16_t slave_addr_2
Definition: PHiLIP_typedef.h:191
UART mode settings.
Definition: PHiLIP_typedef.h:81
basic_mode_t mode
Definition: PHiLIP_typedef.h:280
Saved timestamps and events.
Definition: PHiLIP_typedef.h:328
uint32_t frame_ticks
Definition: PHiLIP_typedef.h:222
uint8_t r_count
Definition: PHiLIP_typedef.h:219
uint16_t start_reg_index
Definition: PHiLIP_typedef.h:218
System mode settings.
Definition: PHiLIP_typedef.h:21
uint16_t reg_index
Definition: PHiLIP_typedef.h:217