forked from amescon/raspicomm-module
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplatform.h
33 lines (23 loc) · 978 Bytes
/
platform.h
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
#include <mach/platform.h> /* included for BCM2709 & BCM2708 definitions, e.g. BCM2708_PERI_BASE */
/* on newer kernel the following defines are defined in mach/platform.h
* on older kernels, the following defines are missing and we need to define them ourself */
#ifndef BCM2708_PERI_BASE
#define BCM2708_PERI_BASE 0x20000000
#define GPIO_BASE (BCM2708_PERI_BASE + 0x200000)
#define SPI0_BASE (BCM2708_PERI_BASE + 0x204000)
#endif
#define SPI0_CNTLSTAT *(Spi0 + 0)
#define SPI0_FIFO *(Spi0 + 1)
#define SPI0_CLKSPEED *(Spi0 + 2)
// SPI transfer done. WRT to CLR!
#define SPI0_CS_DONE 0x00010000
/* spi transfer active */
#define SPI0_TA 1 << 7
// Activate: be high before starting
#define SPI0_CS_ACTIVATE 0x00000080
#define SPI0_CS_CLRFIFOS 0x00000030
#define SPI0_CS_CHIPSEL0 0x00000000
#define SPI0_CS_CHIPSEL1 0x00000001
#define SPI0_CS_CHIPSEL2 0x00000002
#define SPI0_CS_CHIPSELN 0x00000003
#define SPI0_CS_CLRALL (SPI0_CS_CLRFIFOS | SPI0_CS_DONE)