1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
/**************************************************************************
*
* BRIEF MODULE DESCRIPTION
* Serial Peripheral Interface register definitions.
*
* Copyright 2004 IDT Inc. (rischelp@idt.com)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
**************************************************************************
* May 2004 rkt, neb.
*
* Initial Release
*
*
*
**************************************************************************
*/
#ifndef __IDT_SPI_H__
#define __IDT_SPI_H__
enum
{
SPI0_PhysicalAddress = 0x18070000,
SPI_PhysicalAddress = SPI0_PhysicalAddress,
SPI0_VirtualAddress = 0xB8070000,
SPI_VirtualAddress = SPI0_VirtualAddress,
} ;
typedef struct
{
u32 spcp ; // prescalar. 0=off, * spiClk = sysClk/(2*(spcp+1)*SPR)
u32 spc ; // spi control reg use SPC_
u32 sps ; // spi status reg use SPS_
u32 spd ; // spi data reg use SPD_
u32 siofunc ; // serial IO function use SIOFUNC_
u32 siocfg ; // serial IO config use SIOCFG_
u32 siod; // serial IO data use SIOD_
} volatile *SPI_t ;
enum
{
SPCP_div_b = 0,
SPCP_div_m = 0x000000ff,
SPC_spr_b = 0,
SPC_spr_m = 0x00000003,
SPC_spr_div2_v = 0,
SPC_spr_div4_v = 1,
SPC_spr_div16_v = 2,
SPC_spr_div32_v = 3,
SPC_cpha_b = 2,
SPC_cpha_m = 0x00000004,
SPC_cpol_b = 3,
SPC_cpol_m = 0x00000008,
SPC_mstr_b = 4,
SPC_mstr_m = 0x00000010,
SPC_spe_b = 6,
SPC_spe_m = 0x00000040,
SPC_spie_b = 7,
SPC_spie_m = 0x00000080,
SPS_modf_b = 4,
SPS_modf_m = 0x00000010,
SPS_wcol_b = 6,
SPS_wcol_m = 0x00000040,
SPS_spif_b = 7,
SPS_spif_m = 0x00000070,
SPD_data_b = 0,
SPD_data_m = 0x000000ff,
SIOFUNC_sdo_b = 0,
SIOFUNC_sdo_m = 0x00000001,
SIOFUNC_sdi_b = 1,
SIOFUNC_sdi_m = 0x00000002,
SIOFUNC_sck_b = 2,
SIOFUNC_sck_m = 0x00000004,
SIOFUNC_pci_b = 3,
SIOFUNC_pci_m = 0x00000008,
SIOCFG_sdo_b = 0,
SIOCFG_sdo_m = 0x00000001,
SIOCFG_sdi_b = 1,
SIOCFG_sdi_m = 0x00000002,
SIOCFG_sck_b = 2,
SIOCFG_sck_m = 0x00000004,
SIOCFG_pci_b = 3,
SIOCFG_pci_m = 0x00000008,
SIOD_sdo_b = 0,
SIOD_sdo_m = 0x00000001,
SIOD_sdi_b = 1,
SIOD_sdi_m = 0x00000002,
SIOD_sck_b = 2,
SIOD_sck_m = 0x00000004,
SIOD_pci_b = 3,
SIOD_pci_m = 0x00000008,
} ;
#endif // __IDT_SPI_H__
|