-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefines.h
103 lines (79 loc) · 2.5 KB
/
defines.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
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
/********************************************************************
Copyright 2010-2017 K.C. Wang, <[email protected]>
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 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
NOTE: This header file is modified from its original contents to
facilitate the implementation of an interrupt-driven UART
driver.
********************************************************************/
// defines.h file
#ifndef DEFINES_H
#define DEFINES_H
// General type definitions
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
// GPIO
#define GPIO_BASE 0x20200000
#define GPIO_GPFSEL0 0
#define GPIO_GPFSEL1 1
#define GPIO_GPFSEL2 2
#define GPIO_GPFSEL3 3
#define GPIO_GPFSEL4 4
#define GPIO_GPFSEL5 5
#define GPIO_GPSET0 7
#define GPIO_GPSET1 8
#define GPIO_GPCLR0 10
#define GPIO_GPCLR1 11
#define GPIO_GPLEV0 13
#define GPIO_GPLEV1 14
#define GPIO_GPEDS0 16
#define GPIO_GPEDS1 17
#define GPIO_GPREN0 19
#define GPIO_GPREN1 20
#define GPIO_GPFEN0 22
#define GPIO_GPFEN1 23
#define GPIO_GPHEN0 25
#define GPIO_GPHEN1 26
#define GPIO_GPLEN0 28
#define GPIO_GPLEN1 29
#define GPIO_GPAREN0 31
#define GPIO_GPAREN1 32
#define GPIO_GPAFEN0 34
#define GPIO_GPAFEN1 35
#define GPIO_GPPUD 37
#define GPIO_GPPUDCLK0 38
#define GPIO_GPPUDCLK1 39
// Peripheral base address
#define PERIPHERAL_BASE 0x20000000UL
// UART
#define UDR 0x00
#define UDS 0x04
#define RXFE 0x10
#define UFR 0x18
#define TXFF 0x20
#define CNTL 0x2C
#define IMSC 0x38
#define MIS 0x40
#define SBUFSIZE 128
// I2C
#define I2C_BASE 0x20804000
/**#define I2C_CONTROL 0
#define I2C_STATUS 1
#define I2C_DLEN 2
#define I2C_SLAVE_ADDRESS 3
#define DATA_FIFO 4
#define CLOCK_DIVIDER 5
#define DATA_DELAY 6
#define CLOCK_STRETCH_TIMEOUT 7*/
// Interrupt register
#define IRQ2 0x85
#endif