42#ifndef LIBBSP_ARM_BEAGLE_BSP_H
43#define LIBBSP_ARM_BEAGLE_BSP_H
64#include <libcpu/omap3.h>
65#include <libcpu/am335x.h>
69#define BSP_FEATURE_IRQ_EXTENSION
72#define UART_CLOCK 48000000
75#define mmio_read(a) (*(volatile uint32_t *)(a))
76#define mmio_write(a,v) (*(volatile uint32_t *)(a) = (v))
77#define mmio_set(a,v) mmio_write((a), mmio_read((a)) | (v))
78#define mmio_clear(a,v) mmio_write((a), mmio_read((a)) & ~(v))
80#define REG16(x)(*((volatile uint16_t *)(x)))
81#define REG(x)(*((volatile uint32_t *)(x)))
82#define BIT(x)(0x1 << (x))
84#define BITS(Start, End) (((1 << (End+1)) - 1) & ~((1 << (Start)) - 1))
86#define udelay(u) rtems_task_wake_after(1 + ((u)/rtems_configuration_get_microseconds_per_tick()))
92write32(uint32_t address, uint32_t value)
99read32(uint32_t address)
106set32(uint32_t address, uint32_t mask, uint32_t value)
109 val = read32(address);
113 val |= (value & mask);
114 write32(address, val);
119write16(uint32_t address, uint16_t value)
121 REG16(address) = value;
125static inline uint16_t
126read16(uint32_t address)
128 return REG16(address);
132static inline void dsb(
void)
134 __asm__
volatile(
"dsb" : : :
"memory");
138static inline void isb(
void)
140 __asm__
volatile(
"isb" : : :
"memory");
144static inline void flush_data_cache(
void)
148 "mcr p15, #0, r0, c7, c10, #4\n"
155#define __arch_getb(a) (*(volatile unsigned char *)(a))
156#define __arch_getw(a) (*(volatile unsigned short *)(a))
157#define __arch_getl(a) (*(volatile unsigned int *)(a))
159#define __arch_putb(v,a) (*(volatile unsigned char *)(a) = (v))
160#define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v))
161#define __arch_putl(v,a) (*(volatile unsigned int *)(a) = (v))
163#define writeb(v,c) ({ unsigned char __v = v; __arch_putb(__v,c); __v; })
164#define writew(v,c) ({ unsigned short __v = v; __arch_putw(__v,c); __v; })
165#define writel(v,c) ({ unsigned int __v = v; __arch_putl(__v,c); __v; })
167#define readb(c) ({ unsigned char __v = __arch_getb(c); __v; })
168#define readw(c) ({ unsigned short __v = __arch_getw(c); __v; })
169#define readl(c) ({ unsigned int __v = __arch_getl(c); __v; })
171#define SYSTEM_CLOCK_12 12000000
172#define SYSTEM_CLOCK_13 13000000
173#define SYSTEM_CLOCK_192 19200000
174#define SYSTEM_CLOCK_96 96000000
176#if !defined(IS_DM3730) && !defined(IS_AM335X)
177#error Unrecognized BSP configured.
181#define BSP_DEVICEMEM_START 0x48000000
182#define BSP_DEVICEMEM_END 0x5F000000
186#define BSP_DEVICEMEM_START 0x44000000
187#define BSP_DEVICEMEM_END 0x57000000
192#define BSP_CONSOLE_UART 1
193#define BSP_CONSOLE_UART_BASE BEAGLE_BASE_UART_1
194#define BSP_CONSOLE_UART_IRQ OMAP3_UART1_IRQ
195#define BEAGLE_BASE_UART_1 0x44E09000
196#define BEAGLE_BASE_UART_2 0x48022000
197#define BEAGLE_BASE_UART_3 0x48024000
202#define BSP_CONSOLE_UART 3
203#define BSP_CONSOLE_UART_BASE BEAGLE_BASE_UART_3
204#define BSP_CONSOLE_UART_IRQ OMAP3_UART3_IRQ
205#define BEAGLE_BASE_UART_1 0x4806A000
206#define BEAGLE_BASE_UART_2 0x4806C000
207#define BEAGLE_BASE_UART_3 0x49020000
212#define BSP_GPIO_PIN_COUNT 128
213#define BSP_GPIO_PINS_PER_BANK 32
217#define BSP_GPIO_PIN_COUNT 192
218#define BSP_GPIO_PINS_PER_BANK 32
221#if BSP_START_COPY_FDT_FROM_U_BOOT
222#define BSP_FDT_IS_SUPPORTED
243static inline uint32_t read_sctlr(
void)
247 __asm__
volatile(
"mrc p15, 0, %[ctl], c1, c0, 0 @ Read SCTLR\n\t"
253static inline void write_sctlr(uint32_t ctl)
255 __asm__
volatile(
"mcr p15, 0, %[ctl], c1, c0, 0 @ Write SCTLR\n\t"
256 : : [ctl]
"r" (ctl));
261static inline uint32_t read_actlr(
void)
265 __asm__
volatile(
"mrc p15, 0, %[ctl], c1, c0, 1 @ Read ACTLR\n\t"
271static inline void write_actlr(uint32_t ctl)
273 __asm__
volatile(
"mcr p15, 0, %[ctl], c1, c0, 1 @ Write ACTLR\n\t"
274 : : [ctl]
"r" (ctl));
279static inline void write_ttbcr(uint32_t bcr)
281 __asm__
volatile(
"mcr p15, 0, %[bcr], c2, c0, 2 @ Write TTBCR\n\t"
282 : : [bcr]
"r" (bcr));
288static inline uint32_t read_dacr(
void)
292 __asm__
volatile(
"mrc p15, 0, %[dacr], c3, c0, 0 @ Read DACR\n\t"
293 : [dacr]
"=r" (dacr));
300static inline void write_dacr(uint32_t dacr)
302 __asm__
volatile(
"mcr p15, 0, %[dacr], c3, c0, 0 @ Write DACR\n\t"
303 : : [dacr]
"r" (dacr));
308static inline void refresh_tlb(
void)
313 __asm__
volatile(
"mcr p15, 0, %[zero], c8, c7, 0 @ TLBIALL\n\t"
318 __asm__
volatile(
"mcr p15, 0, %[zero], c7, c5, 0"
322 __asm__
volatile(
"mcr p15, 0, %[zero], c7, c5, 6"
330static inline uint32_t read_ttbr0(
void)
334 __asm__
volatile(
"mrc p15, 0, %[bar], c2, c0, 0 @ Read TTBR0\n\t"
337 return bar & ARM_TTBR_ADDR_MASK;
342static inline uint32_t read_ttbr0_unmasked(
void)
346 __asm__
volatile(
"mrc p15, 0, %[bar], c2, c0, 0 @ Read TTBR0\n\t"
353static inline void write_ttbr0(uint32_t bar)
361 uint32_t v = (bar & ARM_TTBR_ADDR_MASK ) | ARM_TTBR_FLAGS_CACHED;
362 __asm__
volatile(
"mcr p15, 0, %[bar], c2, c0, 0 @ Write TTBR0\n\t"
BeagleBone Black BSP definitions.
This header file provides the default definition of BSP_INITIAL_EXTENSION.
BSP_START_TEXT_SECTION void beagle_setup_mmu_and_cache(void)
Beagleboard specific set up of the MMU.
Definition: bspstartmmu.c:49
This header file is provided for backward compatiblility.
uint32_t phandle_t
Definition: ofw.h:56
This header file defines the RTEMS Classic API.