source: rtems/c/src/lib/libbsp/arm/raspberrypi/include/raspberrypi.h @ c32b1ef

4.115
Last change on this file since c32b1ef was c32b1ef, checked in by Alan Cudmore <alan.cudmore@…>, on 03/23/13 at 18:13:07

bsp/raspberrypi: New BSP

  • Property mode set to 100644
File size: 5.4 KB
Line 
1
2/*
3 * raspberrypi.h
4 *
5 * Copyright (c) 2013 Alan Cudmore.
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *
10 *  http://www.rtems.com/license/LICENSE
11 *
12 */
13
14#ifndef LIBBSP_ARM_RASPBERRYPI_RASPBERRYPI_H
15#define LIBBSP_ARM_RASPBERRYPI_RASPBERRYPI_H
16
17#include <stdint.h>
18#include <bsp/utility.h>
19
20/**
21 * @defgroup raspberrypi_reg Register Definitions
22 *
23 * @ingroup raspberrypi
24 *
25 * @brief Register definitions.
26 *
27 * @{
28 */
29
30/**
31 * @name Register Macros
32 *
33 * @{
34 */
35
36#define BCM2835_REG(x)           (*(volatile uint32_t *)(x))
37#define BCM2835_BIT(n)           (1 << (n))
38
39/** @} */
40
41/**
42 * @name Internal ARM Timer Registers
43 *
44 * @{
45 */
46
47#define BCM2835_CLOCK_FREQ       250000000
48
49#define BCM2835_TIMER_BASE       (0x2000B400)
50
51#define BCM2835_TIMER_LOD        (BCM2835_TIMER_BASE+0x00)
52#define BCM2835_TIMER_VAL        (BCM2835_TIMER_BASE+0x04)
53#define BCM2835_TIMER_CTL        (BCM2835_TIMER_BASE+0x08)
54#define BCM2835_TIMER_CLI        (BCM2835_TIMER_BASE+0x0C)
55#define BCM2835_TIMER_RIS        (BCM2835_TIMER_BASE+0x10)
56#define BCM2835_TIMER_MIS        (BCM2835_TIMER_BASE+0x14)
57#define BCM2835_TIMER_RLD        (BCM2835_TIMER_BASE+0x18)
58#define BCM2835_TIMER_DIV        (BCM2835_TIMER_BASE+0x1C)
59#define BCM2835_TIMER_CNT        (BCM2835_TIMER_BASE+0x20)
60
61#define BCM2835_TIMER_PRESCALE    0xF9
62
63/** @} */
64
65/**
66 * @name GPIO Registers
67 *
68 * @{
69 */
70
71#define BCM2835_GPIO_REGS_BASE   (0x20200000)
72
73#define BCM2835_GPIO_GPFSEL1     (BCM2835_GPIO_REGS_BASE+0x04)
74#define BCM2835_GPIO_GPSET0      (BCM2835_GPIO_REGS_BASE+0x1C)
75#define BCM2835_GPIO_GPCLR0      (BCM2835_GPIO_REGS_BASE+0x28)
76#define BCM2835_GPIO_GPPUD       (BCM2835_GPIO_REGS_BASE+0x94)
77#define BCM2835_GPIO_GPPUDCLK0   (BCM2835_GPIO_REGS_BASE+0x98)
78
79/** @} */
80
81/**
82 * @name AUX Registers
83 *
84 * @{
85 */
86
87#define BCM2835_AUX_BASE         (0x20215000)
88
89#define AUX_ENABLES              (BCM2835_AUX_BASE+0x04)
90#define AUX_MU_IO_REG            (BCM2835_AUX_BASE+0x40)
91#define AUX_MU_IER_REG           (BCM2835_AUX_BASE+0x44)
92#define AUX_MU_IIR_REG           (BCM2835_AUX_BASE+0x48)
93#define AUX_MU_LCR_REG           (BCM2835_AUX_BASE+0x4C)
94#define AUX_MU_MCR_REG           (BCM2835_AUX_BASE+0x50)
95#define AUX_MU_LSR_REG           (BCM2835_AUX_BASE+0x54)
96#define AUX_MU_MSR_REG           (BCM2835_AUX_BASE+0x58)
97#define AUX_MU_SCRATCH           (BCM2835_AUX_BASE+0x5C)
98#define AUX_MU_CNTL_REG          (BCM2835_AUX_BASE+0x60)
99#define AUX_MU_STAT_REG          (BCM2835_AUX_BASE+0x64)
100#define AUX_MU_BAUD_REG          (BCM2835_AUX_BASE+0x68)
101
102/** @} */
103
104
105/**
106 * @name UART 0 (PL011) Registers
107 *
108 * @{
109 */
110
111
112#define BCM2835_UART0_BASE       (0x20201000)
113
114#define BCM2835_UART0_DR         (BCM2835_UART0_BASE+0x00)
115#define BCM2835_UART0_RSRECR     (BCM2835_UART0_BASE+0x04)
116#define BCM2835_UART0_FR         (BCM2835_UART0_BASE+0x18)
117#define BCM2835_UART0_ILPR       (BCM2835_UART0_BASE+0x20)
118#define BCM2835_UART0_IBRD       (BCM2835_UART0_BASE+0x24)
119#define BCM2835_UART0_FBRD       (BCM2835_UART0_BASE+0x28)
120#define BCM2835_UART0_LCRH       (BCM2835_UART0_BASE+0x2C)
121#define BCM2835_UART0_CR         (BCM2835_UART0_BASE+0x30)
122#define BCM2835_UART0_IFLS       (BCM2835_UART0_BASE+0x34)
123#define BCM2835_UART0_IMSC       (BCM2835_UART0_BASE+0x38)
124#define BCM2835_UART0_RIS        (BCM2835_UART0_BASE+0x3C)
125#define BCM2835_UART0_MIS        (BCM2835_UART0_BASE+0x40)
126#define BCM2835_UART0_ICR        (BCM2835_UART0_BASE+0x44)
127#define BCM2835_UART0_DMACR      (BCM2835_UART0_BASE+0x48)
128#define BCM2835_UART0_ITCR       (BCM2835_UART0_BASE+0x80)
129#define BCM2835_UART0_ITIP       (BCM2835_UART0_BASE+0x84)
130#define BCM2835_UART0_ITOP       (BCM2835_UART0_BASE+0x88)
131#define BCM2835_UART0_TDR        (BCM2835_UART0_BASE+0x8C)
132
133#define BCM2835_UART0_MIS_RX    0x10
134#define BCM2835_UART0_MIS_TX    0x20
135#define BCM2835_UART0_IMSC_RX   0x10
136#define BCM2835_UART0_IMSC_TX   0x20
137#define BCM2835_UART0_FR_RXFE   0x10
138#define BCM2835_UART0_FR_TXFF   0x20
139#define BCM2835_UART0_ICR_RX    0x10
140#define BCM2835_UART0_ICR_TX    0x20
141
142
143/** @} */
144
145
146/**
147 * @name IRQ Registers
148 *
149 * @{
150 */
151
152#define BCM2835_BASE_INTC         (0x2000B200)
153
154#define BCM2835_IRQ_BASIC         (BCM2835_BASE_INTC + 0x00)
155#define BCM2835_IRQ_PENDING1      (BCM2835_BASE_INTC + 0x04)
156#define BCM2835_IRQ_PENDING2      (BCM2835_BASE_INTC + 0x08)
157#define BCM2835_IRQ_FIQ_CTRL      (BCM2835_BASE_INTC + 0x0C)
158#define BCM2835_IRQ_ENABLE1       (BCM2835_BASE_INTC + 0x10)
159#define BCM2835_IRQ_ENABLE2       (BCM2835_BASE_INTC + 0x14)
160#define BCM2835_IRQ_ENABLE_BASIC  (BCM2835_BASE_INTC + 0x18)
161#define BCM2835_IRQ_DISABLE1      (BCM2835_BASE_INTC + 0x1C)
162#define BCM2835_IRQ_DISABLE2      (BCM2835_BASE_INTC + 0x20)
163#define BCM2835_IRQ_DISABLE_BASIC (BCM2835_BASE_INTC + 0x24)
164
165/** @} */
166
167
168/**
169 * @name GPU Timer Registers
170 *
171 * @{
172 */
173
174/**
175 * NOTE: The GPU uses Compare registers 0 and 2 for
176 *       it's own RTOS. 1 and 3 are available for use in
177 *       RTEMS.
178 */
179#define BCM2835_GPU_TIMER_BASE    (0x20003000)
180
181#define BCM2835_GPU_TIMER_CS      (BCM2835_TIMER_BASE+0x00)
182#define BCM2835_GPU_TIMER_CLO     (BCM2835_TIMER_BASE+0x04)
183#define BCM2835_GPU_TIMER_CHI     (BCM2835_TIMER_BASE+0x08)
184#define BCM2835_GPU_TIMER_C0      (BCM2835_TIMER_BASE+0x0C)
185#define BCM2835_GPU_TIMER_C1      (BCM2835_TIMER_BASE+0x10)
186#define BCM2835_GPU_TIMER_C2      (BCM2835_TIMER_BASE+0x14)
187#define BCM2835_GPU_TIMER_C3      (BCM2835_TIMER_BASE+0x18)
188
189/** @} */
190
191
192/** @} */
193
194#endif /* LIBBSP_ARM_RASPBERRYPI_RASPBERRYPI_H */
Note: See TracBrowser for help on using the repository browser.