XINU
spi.h
Go to the documentation of this file.
1 /* spi.h - SPI definitions */
2 
3 struct spi_csreg {
4  volatile uint32 rev; /* SPI revision */
5  volatile uint32 res1[67]; /* Reserved address space */
6  volatile uint32 sysconfig; /* System configuration register*/
7  volatile uint32 sysstatus; /* System status register */
8  volatile uint32 irqstatus; /* IRQ status register */
9  volatile uint32 irqenable; /* IRQ Enable register */
10  volatile uint32 res2; /* Reserved address space */
11  volatile uint32 syst; /* System test register */
12  volatile uint32 modulctrl; /* Module control register */
13  struct {
14  volatile uint32 chconf; /* Channel conf register */
15  volatile uint32 chstat; /* Channel status register */
16  volatile uint32 chctrl; /* Channel control register */
17  volatile uint32 chtx; /* Channel xmit register */
18  volatile uint32 chrx; /* Channel receive register */
19  } ch[3];
20  volatile uint32 xferlevel; /* Transfer level register */
21  volatile uint32 daftx; /* FIFO xmit register */
22  volatile uint32 dafrx; /* FIFO receive register */
23 };
24 
25 #define SPI_0_ADDR 0x48030000
26 #define SPI_1_ADDR 0x481A0000
27 
28 #define SPI_0_PADCTL_SCLK 0x44E10950
29 #define SPI_0_PADCTL_D0 0x44E10954
30 #define SPI_0_PADCTL_D1 0x44E10958
31 #define SPI_0_PADCTL_CS0 0x44E1095C
32 
33 #define SPI_1_PADCTL_SCLK 0x44E10990
34 #define SPI_1_PADCTL_D0 0x44E10994
35 #define SPI_1_PADCTL_D1 0x44E10998
36 #define SPI_1_PADCTL_CS0 0x44E1099C
37 
38 /* Bit definitions of SPI registers */
39 
40 #define SPI_SYSCONFIG_SOFTRESET 0x00000002
41 
42 #define SPI_SYSSTATUS_RESETDONE 0x00000001
43 
44 #define SPI_MODULCTRL_SINGLE 0x00000001
45 #define SPI_MODULCTRL_PIN34 0x00000002
46 #define SPI_MODULCTRL_MS 0x00000004
47 
48 #define SPI_CHCONF_PHA 0x00000001
49 #define SPI_CHCONF_POL 0x00000002
50 #define SPI_CHCONF_CLKD 0x0000003c
51 #define SPI_CHCONF_EPOL 0x00000040
52 #define SPI_CHCONF_WL 0x00000F80
53 #define SPI_CHCONF_TRM 0x00003000
54 #define SPI_CHCONF_DMAW 0x00004000
55 #define SPI_CHCONF_DMAR 0x00008000
56 #define SPI_CHCONF_DPE0 0x00010000
57 #define SPI_CHCONF_DPE1 0x00020000
58 #define SPI_CHCONF_IS 0x00040000
59 #define SPI_CHCONF_TURBO 0x00080000
60 #define SPI_CHCONF_FORCE 0x00100000
61 #define SPI_CHCONF_SBE 0x00800000
62 #define SPI_CHCONF_SBPOL 0x01000000
63 #define SPI_CHCONF_TCS 0x06000000
64 #define SPI_CHCONF_FFEW 0x08000000
65 #define SPI_CHCONF_FFER 0x10000000
66 #define SPI_CHCONF_CLKG 0x20000000
67 
68 #define SPI_CHCTRL_EN 0x00000001
69 
70 #define SPI_CHSTAT_RXS 0x00000001
71 #define SPI_CHSTAT_TXS 0x00000002
72 
73 struct spi_transfer {
74  byte *txbuf; /* Transmit buffer address */
75  byte *rxbuf; /* Receive buffer address */
76  int32 length; /* No. of bytes to transfer */
77 };
78 
79 #define SPI_CTRL_TRANSFER 1
struct spi_csreg::@14 ch[3]
volatile uint32 sysconfig
Definition: spi.h:6
unsigned char byte
符号なし8ビット値(unsigned char)
Definition: kernel.h:7
byte * txbuf
Definition: spi.h:74
volatile uint32 syst
Definition: spi.h:11
volatile uint32 res1[67]
Definition: spi.h:5
volatile uint32 chrx
Definition: spi.h:18
volatile uint32 chctrl
Definition: spi.h:16
volatile uint32 rev
Definition: spi.h:4
Definition: spi.h:3
byte * rxbuf
Definition: spi.h:75
int int32
符号あり32ビット整数(int)
Definition: kernel.h:11
volatile uint32 irqenable
Definition: spi.h:9
volatile uint32 xferlevel
Definition: spi.h:20
volatile uint32 modulctrl
Definition: spi.h:12
volatile uint32 res2
Definition: spi.h:10
volatile uint32 chtx
Definition: spi.h:17
volatile uint32 daftx
Definition: spi.h:21
volatile uint32 sysstatus
Definition: spi.h:7
unsigned int uint32
符号なし32ビット整数(unsigned int)
Definition: kernel.h:15
volatile uint32 chconf
Definition: spi.h:14
volatile uint32 irqstatus
Definition: spi.h:8
int32 length
Definition: spi.h:76
volatile uint32 chstat
Definition: spi.h:15
volatile uint32 dafrx
Definition: spi.h:22