1 /*
2 * Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6 
7 /**********************************************************************************************************************
8  * File Name    : rspi_iodefine.h
9  * Version      : 1.00
10  * Description  : IO define file for rspi.
11  *********************************************************************************************************************/
12 
13 /* ================================================================================================================= */
14 /* ================                              Device Specific Cluster Section                              ====== */
15 /* ================================================================================================================= */
16 
17 /* ================================================================================================================= */
18 /* ================                            Device Specific Peripheral Section                             ====== */
19 /* ================================================================================================================= */
20 
21 #ifndef RSPI_IODEFINE_H
22 #define RSPI_IODEFINE_H
23 
24 typedef struct
25 {
26     union
27     {
28         __IOM uint8_t SPCR;
29         struct
30         {
31             uint8_t              : 2;
32             __IOM uint8_t MODFEN : 1;
33             __IOM uint8_t MSTR   : 1;
34             __IOM uint8_t SPEIE  : 1;
35             __IOM uint8_t SPTIE  : 1;
36             __IOM uint8_t SPE    : 1;
37             __IOM uint8_t SPRIE  : 1;
38         } SPCR_b;
39     };
40 
41     union
42     {
43         __IOM uint8_t SSLP;
44         struct
45         {
46             __IOM uint8_t SSL0P : 1;
47             uint8_t             : 7;
48         } SSLP_b;
49     };
50 
51     union
52     {
53         __IOM uint8_t SPPCR;
54         struct
55         {
56             __IOM uint8_t SPLP  : 1;
57             uint8_t             : 3;
58             __IOM uint8_t MOIFV : 1;
59             __IOM uint8_t MOIFE : 1;
60             uint8_t             : 2;
61         } SPPCR_b;
62     };
63 
64     union
65     {
66         __IOM uint8_t SPSR;
67         struct
68         {
69             __IOM uint8_t OVRF : 1;
70             uint8_t            : 1;
71             __IOM uint8_t MODF : 1;
72             uint8_t            : 2;
73             __IM uint8_t SPTEF : 1;
74             __IM uint8_t TEND  : 1;
75             __IM uint8_t SPRF  : 1;
76         } SPSR_b;
77     };
78 
79     union
80     {
81         __IOM uint32_t SPDR;
82         struct
83         {
84             __IOM uint16_t L;
85             __IOM uint16_t H;
86         } SPDR_hword;
87         struct
88         {
89             __IOM uint8_t LL;
90             __IOM uint8_t LH;
91             __IOM uint8_t HL;
92             __IOM uint8_t HH;
93         } SPDR_byte;
94         struct
95         {
96             __IOM uint32_t SPD : 32;
97         } SPDR_b;
98     };
99 
100     union
101     {
102         __IOM uint8_t SPSCR;
103         struct
104         {
105             __IOM uint8_t SPSLN : 2;
106             uint8_t             : 6;
107         } SPSCR_b;
108     };
109 
110     union
111     {
112         __IM uint8_t SPSSR;
113         struct
114         {
115             __IM uint8_t SPCP : 2;
116             uint8_t           : 6;
117         } SPSSR_b;
118     };
119 
120     union
121     {
122         __IOM uint8_t SPBR;
123         struct
124         {
125             __IOM uint8_t SPR : 8;
126         } SPBR_b;
127     };
128 
129     union
130     {
131         __IOM uint8_t SPDCR;
132         struct
133         {
134             uint8_t             : 5;
135             __IOM uint8_t SPLW  : 2;
136             __IOM uint8_t TXDMY : 1;
137         } SPDCR_b;
138     };
139 
140     union
141     {
142         __IOM uint8_t SPCKD;
143         struct
144         {
145             __IOM uint8_t SCKDL : 3;
146             uint8_t             : 5;
147         } SPCKD_b;
148     };
149 
150     union
151     {
152         __IOM uint8_t SSLND;
153         struct
154         {
155             __IOM uint8_t SLNDL : 3;
156             uint8_t             : 5;
157         } SSLND_b;
158     };
159 
160     union
161     {
162         __IOM uint8_t SPND;
163         struct
164         {
165             __IOM uint8_t SPNDL : 3;
166             uint8_t             : 5;
167         } SPND_b;
168     };
169 
170     __IM uint8_t RESERVED[1];
171     union
172     {
173         __IOM uint16_t SPCMD0;
174         struct
175         {
176             __IOM uint16_t CPHA   : 1;
177             __IOM uint16_t CPOL   : 1;
178             __IOM uint16_t BRDV   : 2;
179             uint16_t              : 3;
180             __IOM uint16_t SSLKP  : 1;
181             __IOM uint16_t SPB    : 4;
182             __IOM uint16_t LSBF   : 1;
183             __IOM uint16_t SPNDEN : 1;
184             __IOM uint16_t SLNDEN : 1;
185             __IOM uint16_t SCKDEN : 1;
186         } SPCMD0_b;
187     };
188 
189     union
190     {
191         __IOM uint16_t SPCMD1;
192         struct
193         {
194             __IOM uint16_t CPHA   : 1;
195             __IOM uint16_t CPOL   : 1;
196             __IOM uint16_t BRDV   : 2;
197             uint16_t              : 3;
198             __IOM uint16_t SSLKP  : 1;
199             __IOM uint16_t SPB    : 4;
200             __IOM uint16_t LSBF   : 1;
201             __IOM uint16_t SPNDEN : 1;
202             __IOM uint16_t SLNDEN : 1;
203             __IOM uint16_t SCKDEN : 1;
204         } SPCMD1_b;
205     };
206 
207     union
208     {
209         __IOM uint16_t SPCMD2;
210         struct
211         {
212             __IOM uint16_t CPHA   : 1;
213             __IOM uint16_t CPOL   : 1;
214             __IOM uint16_t BRDV   : 2;
215             uint16_t              : 3;
216             __IOM uint16_t SSLKP  : 1;
217             __IOM uint16_t SPB    : 4;
218             __IOM uint16_t LSBF   : 1;
219             __IOM uint16_t SPNDEN : 1;
220             __IOM uint16_t SLNDEN : 1;
221             __IOM uint16_t SCKDEN : 1;
222         } SPCMD2_b;
223     };
224 
225     union
226     {
227         __IOM uint16_t SPCMD3;
228         struct
229         {
230             __IOM uint16_t CPHA   : 1;
231             __IOM uint16_t CPOL   : 1;
232             __IOM uint16_t BRDV   : 2;
233             uint16_t              : 3;
234             __IOM uint16_t SSLKP  : 1;
235             __IOM uint16_t SPB    : 4;
236             __IOM uint16_t LSBF   : 1;
237             __IOM uint16_t SPNDEN : 1;
238             __IOM uint16_t SLNDEN : 1;
239             __IOM uint16_t SCKDEN : 1;
240         } SPCMD3_b;
241     };
242 
243     __IM uint8_t RESERVED1[8];
244     union
245     {
246         __IOM uint8_t SPBFCR;
247         struct
248         {
249             __IOM uint8_t RXTRG : 3;
250             uint8_t             : 1;
251             __IOM uint8_t TXTRG : 2;
252             __IOM uint8_t RXRST : 1;
253             __IOM uint8_t TXRST : 1;
254         } SPBFCR_b;
255     };
256 
257     __IM uint8_t RESERVED2[1];
258     union
259     {
260         __IM uint16_t SPBFDR;
261         struct
262         {
263             __IM uint16_t R : 6;
264             uint16_t        : 2;
265             __IM uint16_t T : 4;
266             uint16_t        : 4;
267         } SPBFDR_b;
268     };
269 } R_RSPI0_Type;
270 
271 /* =========================================================================================================================== */
272 /* ================                          Device Specific Peripheral Address Map                           ================ */
273 /* =========================================================================================================================== */
274 
275 #define R_RSPI0_BASE    0x400AA000
276 #define R_RSPI1_BASE    0x400AA400
277 #define R_RSPI2_BASE    0x400AA800
278 #define R_RSPI3_BASE    0x400AAC00
279 #define R_RSPI4_BASE    0x400AB000
280 
281 /* =========================================================================================================================== */
282 /* ================                                  Peripheral declaration                                   ================ */
283 /* =========================================================================================================================== */
284 
285 #define R_RSPI0    ((R_RSPI0_Type *) R_RSPI0_BASE)
286 #define R_RSPI1    ((R_RSPI0_Type *) R_RSPI1_BASE)
287 #define R_RSPI2    ((R_RSPI0_Type *) R_RSPI2_BASE)
288 #define R_RSPI3    ((R_RSPI0_Type *) R_RSPI3_BASE)
289 #define R_RSPI4    ((R_RSPI0_Type *) R_RSPI4_BASE)
290 
291 #endif                                 /* RSPI_IODEFINE_H */
292