VSF Documented
i_reg_spi.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __I_REG_SPI_H__
19#define __I_REG_SPI_H__
20
21/*============================ INCLUDES ======================================*/
22
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33/*============================ MACROS ========================================*/
34
35#ifndef __AIC8800_SPI_USE_BIT_FIELD
36# define __AIC8800_SPI_USE_BIT_FIELD DISABLED
37#endif
38
39#define SPI0_BASE_ADDRESS (0X40105000ul)
40
41#define REG_SPI0 ((REG_SPI_T *)SPI0_BASE_ADDRESS)
42
43/* Define structure member permissions : read only */
44#ifndef __IM
45# define __IM const
46#endif
47
48/* Define structure member permissions : write only */
49#ifndef __OM
50# define __OM
51#endif
52
53/* Define structure member permissions : read or write */
54#ifndef __IOM
55# define __IOM
56#endif
57
58/*============================ MACROFIED FUNCTIONS ===========================*/
59
60#if __AIC8800_SPI_USE_BIT_FIELD == ENABLED
61# define DEF_SPI_REG(__NAME, __TOTAL_SIZE, ...) \
62 union { \
63 reg##__TOTAL_SIZE##_t VALUE; \
64 struct { \
65 __VA_ARGS__ \
66 }; \
67 } __NAME
68#else
69# define DEF_SPI_REG(__NAME, __TOTAL_SIZE, ...) \
70 __VA_ARGS__ reg##__TOTAL_SIZE##_t __NAME
71#endif
72
73#define SPI_DR_DIV 0
74#define SPI_DR_DIV_MASK ((reg32_t)(0xFFFF << SPI_DR_DIV))
75
76/*============================ TYPES =========================================*/
77
78typedef struct REG_SPI_T {
79 union {
81 DEF_SPI_REG(IOR, 32, __IOM);
82 };
85 DEF_SPI_REG(IER, 32, __IOM);
86 DEF_SPI_REG(ICLR, 32, __IOM);
87 DEF_SPI_REG(IRSR, 32, __IM);
88 DEF_SPI_REG(IMSR, 32, __IM);
92 DEF_SPI_REG(MR0, 32, __IOM);
94 DEF_SPI_REG(MR1, 32, __IOM);
95 DEF_SPI_REG(OCR, 32, __IOM);
97 DEF_SPI_REG(ICR, 32, __IOM);
98 DEF_SPI_REG(TCR, 32, __IOM);
100
101#ifdef __cplusplus
102}
103#endif
104#endif
105/* EOF */
volatile uint32_t reg32_t
Definition i_io_systick.h:120
#define REG_RSVD_U32
Definition i_io_systick.h:138
#define REG_RSVD_U32N(__N)
Definition i_io_systick.h:142
#define DEF_SPI_REG(__NAME, __TOTAL_SIZE,...)
Definition i_reg_spi.h:61
#define __IM
Definition i_reg_spi.h:45
#define __IOM
Definition i_reg_spi.h:55
Definition i_reg_spi.h:78
DEF_SPI_REG(ICLR, 32, __IOM)
DEF_SPI_REG(IER, 32, __IOM)
reg32_t CR[6]
Definition i_reg_spi.h:84
DEF_SPI_REG(IMSR, 32, __IM)
__IM reg32_t BASE_ADDR
Definition i_reg_spi.h:80
DEF_SPI_REG(IRSR, 32, __IM)
DEF_SPI_REG(DR, 32, __IOM)
REG_RSVD_U32 DEF_SPI_REG(SR, 32, __IOM)