summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/beagle/misc
diff options
context:
space:
mode:
authorBen Gras <beng@shrike-systems.com>2014-11-03 19:53:40 +0100
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-11-03 14:19:47 -0600
commit53dd6d6130c870d12351d8ca75e4ac9dcc834c86 (patch)
tree022804b833f8fdb47a15ab8940743f91726776b5 /c/src/lib/libbsp/arm/beagle/misc
parentAdded BeagleBoard BSP (diff)
downloadrtems-53dd6d6130c870d12351d8ca75e4ac9dcc834c86.tar.bz2
BSP for several Beagle products
Specifically the beagleboard, beagleboard xM, beaglebone, beaglebone black. More info on these targets: http://www.beagleboard.org/ This commit forms a basic BSP by combining Claas's work with . new clock and irq code and definitions for beagle targets (beagleboard and beaglebones), mostly reused from the Minix codebase, thus making irqs, ticks and non-polled console mode work too . new timer code for ns timing with high timer resolution, 24MHz on the AM335X and 13MHz on the DM37XX . select the console uart based on target at configure time . removing all the lpc32xx-specific macros and code and other unused code and definitions that the beagle bsp was based on . re-using some standard functions instead of lpc32xx versions . fixed some whitespace problem in preinstall.am . fixed some compile warnings . configure MMU: set 1MB sections directly in the TTBR, just to show the difference between cacheable RAM and non-cacheable device memory and invalid ranges; this lets us turn on caches and not rely on boot loader MMU configuration. Verified to work when MMU is initially either on or off when RTEMS gets control. Thanks for testing, commentary, improvements and fixes to Chris Johns, Brandon Matthews, Matt Carberry, Romain Bornet, AZ technology and others. Signed-Off-By: Ben Gras <beng@shrike-systems.com>
Diffstat (limited to 'c/src/lib/libbsp/arm/beagle/misc')
-rw-r--r--c/src/lib/libbsp/arm/beagle/misc/boot.c62
-rw-r--r--c/src/lib/libbsp/arm/beagle/misc/i2c.c2
-rw-r--r--c/src/lib/libbsp/arm/beagle/misc/restart.c32
-rw-r--r--c/src/lib/libbsp/arm/beagle/misc/system-clocks.c140
-rw-r--r--c/src/lib/libbsp/arm/beagle/misc/timer.c46
5 files changed, 1 insertions, 281 deletions
diff --git a/c/src/lib/libbsp/arm/beagle/misc/boot.c b/c/src/lib/libbsp/arm/beagle/misc/boot.c
deleted file mode 100644
index 771df7007d..0000000000
--- a/c/src/lib/libbsp/arm/beagle/misc/boot.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * @file
- *
- * @ingroup beagle_boot
- *
- * @brief Boot support implementation.
- */
-
-/*
- * Copyright (c) 2012 Claas Ziemke. All rights reserved.
- *
- * Claas Ziemke
- * Kernerstrasse 11
- * 70182 Stuttgart
- * Germany
- * <claas.ziemke@gmx.net>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- */
-
-#include <string.h>
-
-#include <bsp/boot.h>
-
-void beagle_setup_boot_block(
- beagle_boot_block *boot_block,
- uint8_t icr,
- uint8_t page_count
-)
-{
- memset(boot_block, 0, sizeof(*boot_block));
-
- ++page_count;
-
- boot_block->field.d0 = icr;
- boot_block->field.d2 = icr;
- boot_block->field.d4 = page_count;
- boot_block->field.d6 = page_count;
- boot_block->field.d8 = page_count;
- boot_block->field.d10 = page_count;
-
- icr = (uint8_t) ~((unsigned) icr);
- page_count = (uint8_t) ~((unsigned) page_count);
-
- boot_block->field.d1 = icr;
- boot_block->field.d3 = icr;
- boot_block->field.d5 = page_count;
- boot_block->field.d7 = page_count;
- boot_block->field.d9 = page_count;
- boot_block->field.d11 = page_count;
-
- boot_block->field.d12 = 0xaa;
-}
-
-void beagle_set_boot_block_bad(
- beagle_boot_block *boot_block
-)
-{
- boot_block->field.d12 = 0;
-}
diff --git a/c/src/lib/libbsp/arm/beagle/misc/i2c.c b/c/src/lib/libbsp/arm/beagle/misc/i2c.c
index 322c501d3c..ad23f3a2ac 100644
--- a/c/src/lib/libbsp/arm/beagle/misc/i2c.c
+++ b/c/src/lib/libbsp/arm/beagle/misc/i2c.c
@@ -1,7 +1,7 @@
/**
* @file
*
- * @ingroup beagle_i2c
+ * @ingroup arm_beagle
*
* @brief I2C support implementation.
*/
diff --git a/c/src/lib/libbsp/arm/beagle/misc/restart.c b/c/src/lib/libbsp/arm/beagle/misc/restart.c
deleted file mode 100644
index fe7775ae06..0000000000
--- a/c/src/lib/libbsp/arm/beagle/misc/restart.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * @file
- *
- * @ingroup beagle
- *
- * @brief Restart implementation.
- */
-
-/*
- * Copyright (c) 2012 Claas Ziemke. All rights reserved.
- *
- * Claas Ziemke
- * Kernerstrasse 11
- * 70182 Stuttgart
- * Germany
- * <claas.ziemke@gmx.net>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- */
-
-#include <rtems.h>
-
-#include <libcpu/arm-cp15.h>
-
-#include <bsp.h>
-
-void bsp_restart(void *addr)
-{
- BEAGLE_DO_RESTART(addr);
-}
diff --git a/c/src/lib/libbsp/arm/beagle/misc/system-clocks.c b/c/src/lib/libbsp/arm/beagle/misc/system-clocks.c
deleted file mode 100644
index 56b5d9aadb..0000000000
--- a/c/src/lib/libbsp/arm/beagle/misc/system-clocks.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/**
- * @file
- *
- * @ingroup beagle
- *
- * @brief System clocks.
- */
-
-/*
- * Copyright (c) 2012 Claas Ziemke. All rights reserved.
- *
- * Claas Ziemke
- * Kernerstrasse 11
- * 70182 Stuttgart
- * Germany
- * <claas.ziemke@gmx.net>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- */
-
-#include <bsp.h>
-#include <bsp/beagle.h>
-
-uint32_t beagle_sysclk(void)
-{
- uint32_t sysclk_ctrl = BEAGLE_SYSCLK_CTRL;
-
- return (sysclk_ctrl & 0x1) == 0 ?
- BEAGLE_OSCILLATOR_MAIN
- : (397 * BEAGLE_OSCILLATOR_RTC);
-}
-
-uint32_t beagle_hclkpll_clk(void)
-{
- uint32_t sysclk = beagle_sysclk();
- uint32_t hclkpll_ctrl = BEAGLE_HCLKPLL_CTRL;
- uint32_t m = HCLK_PLL_M_GET(hclkpll_ctrl) + 1;
- uint32_t n = HCLK_PLL_N_GET(hclkpll_ctrl) + 1;
- uint32_t p = 1U << HCLK_PLL_P_GET(hclkpll_ctrl);
- uint32_t hclkpll_clk = 0;
-
- if ((hclkpll_ctrl & HCLK_PLL_BYPASS) != 0) {
- if ((hclkpll_ctrl & HCLK_PLL_DIRECT) != 0) {
- hclkpll_clk = sysclk;
- } else {
- hclkpll_clk = sysclk / (2 * p);
- }
- } else {
- if ((hclkpll_ctrl & HCLK_PLL_DIRECT) != 0) {
- hclkpll_clk = (m * sysclk) / n;
- } else {
- if ((hclkpll_ctrl & HCLK_PLL_FBD_FCLKOUT) != 0) {
- hclkpll_clk = m * (sysclk / n);
- } else {
- hclkpll_clk = (m / (2 * p)) * (sysclk / n);
- }
- }
- }
-
- return hclkpll_clk;
-}
-
-uint32_t beagle_periph_clk(void)
-{
- uint32_t pwr_ctrl = BEAGLE_PWR_CTRL;
- uint32_t periph_clk = 0;
-
- if ((pwr_ctrl & PWR_NORMAL_RUN_MODE) != 0) {
- uint32_t hclkdiv_ctrl = BEAGLE_HCLKDIV_CTRL;
- uint32_t div = HCLK_DIV_PERIPH_CLK_GET(hclkdiv_ctrl) + 1;
-
- periph_clk = beagle_hclkpll_clk() / div;
- } else {
- periph_clk = beagle_sysclk();
- }
-
- return periph_clk;
-}
-
-uint32_t beagle_hclk(void)
-{
- uint32_t pwr_ctrl = BEAGLE_PWR_CTRL;
- uint32_t hclk = 0;
-
- if ((pwr_ctrl & PWR_HCLK_USES_PERIPH_CLK) != 0) {
- hclk = beagle_periph_clk();
- } else {
- if ((pwr_ctrl & PWR_NORMAL_RUN_MODE) != 0) {
- uint32_t hclkdiv_ctrl = BEAGLE_HCLKDIV_CTRL;
- uint32_t div = 1U << HCLK_DIV_HCLK_GET(hclkdiv_ctrl);
-
- hclk = beagle_hclkpll_clk() / div;
- } else {
- hclk = beagle_sysclk();
- }
- }
-
- return hclk;
-}
-
-uint32_t beagle_arm_clk(void)
-{
- uint32_t pwr_ctrl = BEAGLE_PWR_CTRL;
- uint32_t arm_clk = 0;
-
- if ((pwr_ctrl & PWR_HCLK_USES_PERIPH_CLK) != 0) {
- arm_clk = beagle_periph_clk();
- } else {
- if ((pwr_ctrl & PWR_NORMAL_RUN_MODE) != 0) {
- arm_clk = beagle_hclkpll_clk();
- } else {
- arm_clk = beagle_sysclk();
- }
- }
-
- return arm_clk;
-}
-
-uint32_t beagle_dram_clk(void)
-{
- uint32_t hclkdiv_ctrl = BEAGLE_HCLKDIV_CTRL;
- uint32_t div = HCLK_DIV_DDRAM_CLK_GET(hclkdiv_ctrl);
- uint32_t dram_clk = 0;
-
- if (div != 0) {
- uint32_t pwr_ctrl = BEAGLE_PWR_CTRL;
-
- if ((pwr_ctrl & PWR_NORMAL_RUN_MODE) != 0) {
- dram_clk = beagle_hclkpll_clk();
- } else {
- dram_clk = beagle_sysclk();
- }
-
- dram_clk /= div;
- }
-
- return dram_clk;
-}
diff --git a/c/src/lib/libbsp/arm/beagle/misc/timer.c b/c/src/lib/libbsp/arm/beagle/misc/timer.c
deleted file mode 100644
index 50570e0b00..0000000000
--- a/c/src/lib/libbsp/arm/beagle/misc/timer.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * @file
- *
- * @ingroup beagle
- *
- * @brief Benchmark timer support.
- */
-
-/*
- * Copyright (c) 2012 Claas Ziemke. All rights reserved.
- *
- * Claas Ziemke
- * Kernerstrasse 11
- * 70182 Stuttgart
- * Germany
- * <claas.ziemke@gmx.net>
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- */
-
-#include <rtems.h>
-#include <rtems/btimer.h>
-#include <rtems/timerdrv.h>
-
-#include <bsp.h>
-
-static uint32_t benchmark_timer_base;
-
-void benchmark_timer_initialize(void)
-{
- benchmark_timer_base = beagleboard_timer();
-}
-
-uint32_t benchmark_timer_read(void)
-{
- return beagleboard_timer() - benchmark_timer_base;
-}
-
-void benchmark_timer_disable_subtracting_average_overhead(
- bool find_average_overhead
-)
-{
- /* VOID */
-}