1 /*
2  * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef _HARDWARE_STRUCTS_PIO_H
8 #define _HARDWARE_STRUCTS_PIO_H
9 
10 #include "hardware/address_mapped.h"
11 #include "hardware/platform_defs.h"
12 #include "hardware/regs/pio.h"
13 
14 typedef struct {
15     io_rw_32 ctrl;
16     io_ro_32 fstat;
17     io_rw_32 fdebug;
18     io_ro_32 flevel;
19     io_wo_32 txf[NUM_PIO_STATE_MACHINES];
20     io_ro_32 rxf[NUM_PIO_STATE_MACHINES];
21     io_rw_32 irq;
22     io_wo_32 irq_force;
23     io_rw_32 input_sync_bypass;
24     io_rw_32 dbg_padout;
25     io_rw_32 dbg_padoe;
26     io_rw_32 dbg_cfginfo;
27     io_wo_32 instr_mem[32];
28     struct pio_sm_hw {
29         io_rw_32 clkdiv;
30         io_rw_32 execctrl;
31         io_rw_32 shiftctrl;
32         io_ro_32 addr;
33         io_rw_32 instr;
34         io_rw_32 pinctrl;
35     } sm[NUM_PIO_STATE_MACHINES];
36     io_rw_32 intr;
37     io_rw_32 inte0;
38     io_rw_32 intf0;
39     io_ro_32 ints0;
40     io_rw_32 inte1;
41     io_rw_32 intf1;
42     io_ro_32 ints1;
43 } pio_hw_t;
44 
45 #define pio0_hw ((pio_hw_t *const)PIO0_BASE)
46 #define pio1_hw ((pio_hw_t *const)PIO1_BASE)
47 
48 #endif
49