SCAMP-5c SPI Interface  1.0.0
SCAMP-5c is connected to the flight computer via a SPI interface
oxu4_gpio.h
1 
2 #ifndef ARM_LINUX_GPIO_OXU4_H
3 #define ARM_LINUX_GPIO_OXU4_H
4 
5 #ifdef __cplusplus
6 extern "C"{
7 #endif
8 
9 #include <stdint.h>
10 #include <unistd.h>
11 
12 
14 
15 #define GPX_ADDRESS_BASE 0x13400000
16 
17 #define GPX1CON_OFFSET 0x0C20
18 #define GPX1DAT_OFFSET 0x0C24
19 #define GPX1PUD_OFFSET 0x0C28
20 
21 #define GPX2CON_OFFSET 0x0C40
22 #define GPX2DAT_OFFSET 0x0C44
23 #define GPX2PUD_OFFSET 0x0C48
24 
25 #define GPX3CON_OFFSET 0x0C60
26 #define GPX3DAT_OFFSET 0x0C64
27 #define GPX3PUD_OFFSET 0x0C68
28 
29 #define GPA_ADDRESS_BASE 0x14010000
30 
31 #define GPA0CON_OFFSET 0x0000
32 #define GPA0DAT_OFFSET 0x0004
33 #define GPA0PUD_OFFSET 0x0008
34 
35 #define GPA2CON_OFFSET 0x0040
36 #define GPA2DAT_OFFSET 0x0044
37 #define GPA2PUD_OFFSET 0x0048
38 
39 #define GPB_ADDRESS_BASE 0x14010000
40 
41 #define GPB3CON_OFFSET 0x00C0
42 #define GPB3DAT_OFFSET 0x00C4
43 #define GPB3PUD_OFFSET 0x00C8
44 
45 
47 
48 #define GPIO_CON_INPUT 0x00
49 #define GPIO_CON_OUTPUT 0x01
50 #define GPIO_CON_TRACE 0x04
51 #define GPIO_CON_ZERO 0x05
52 #define GPIO_CON_INT 0x0F
53 
54 
56 
57 #define GPIO_DAT_LOW 0x00
58 #define GPIO_DAT_HIGH 0x01
59 
60 
62 
63 #define GPIO_PUD_DISABLE 0x00
64 #define GPIO_PUD_ENABLE_PD 0x01
65 #define GPIO_PUD_ENABLE_PU 0x03
66 
67 
69 
70 extern volatile uint32_t* GPX1CON;
71 extern volatile uint32_t* GPX1DAT;
72 extern volatile uint32_t* GPX1PUD;
73 
74 extern volatile uint32_t* GPX2CON;
75 extern volatile uint32_t* GPX2DAT;
76 extern volatile uint32_t* GPX2PUD;
77 
78 extern volatile uint32_t* GPX3CON;
79 extern volatile uint32_t* GPX3DAT;
80 extern volatile uint32_t* GPX3PUD;
81 
82 extern volatile uint32_t* GPA0CON;
83 extern volatile uint32_t* GPA0DAT;
84 extern volatile uint32_t* GPA0PUD;
85 
86 extern volatile uint32_t* GPA2CON;
87 extern volatile uint32_t* GPA2DAT;
88 extern volatile uint32_t* GPA2PUD;
89 
90 extern volatile uint32_t* GPB3CON;
91 extern volatile uint32_t* GPB3DAT;
92 extern volatile uint32_t* GPB3PUD;
93 
94 #define SET_BIT(v,n) (v) |= (1<<(n))
95 #define CLR_BIT(v,n) (v) &= ~(1<<(n))
96 #define GET_BIT(v,n) (((v)&(1<<(n))>>n))
97 
98 int oxu4_gpio_open();
99 void oxu4_gpio_close();
100 
101 #ifdef __cplusplus
102 };
103 #endif
104 
105 #endif