Changeset 53dd6d61 in rtems


Ignore:
Timestamp:
Nov 3, 2014, 6:53:40 PM (6 years ago)
Author:
Ben Gras <beng@…>
Branches:
4.11, 5, master
Children:
a2e1e30d
Parents:
7a66986
git-author:
Ben Gras <beng@…> (11/03/14 18:53:40)
git-committer:
Joel Sherrill <joel.sherrill@…> (11/03/14 20:19:47)
Message:

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@…>

Location:
c/src/lib/libbsp/arm/beagle
Files:
11 added
11 deleted
13 edited
1 moved

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/beagle/Makefile.am

    r7a66986 r53dd6d61  
    2020
    2121include_HEADERS = include/bsp.h
     22include_HEADERS += ../../shared/include/tm27.h
    2223
    2324nodist_include_HEADERS = ../../shared/include/coverhd.h \
     
    3233include_bsp_HEADERS += ../../shared/include/stackalloc.h
    3334include_bsp_HEADERS += ../../shared/include/uart-output-char.h
    34 include_bsp_HEADERS += ../../shared/tod.h
     35include_bsp_HEADERS += ../shared/include/arm-a8core-start.h
     36include_bsp_HEADERS += ../shared/include/arm-cp15-start.h
     37include_bsp_HEADERS += ../shared/include/arm-errata.h
     38include_bsp_HEADERS += ../shared/include/arm-release-id.h
    3539include_bsp_HEADERS += ../shared/include/start.h
    3640include_bsp_HEADERS += include/irq.h
    37 include_bsp_HEADERS += include/beagle.h
    38 include_bsp_HEADERS += include/beagle-clock-config.h
    39 include_bsp_HEADERS += include/beagle-timer.h
    40 include_bsp_HEADERS += include/boot.h
    4141include_bsp_HEADERS += include/i2c.h
    4242
    43 include_libcpu_HEADERS = ../../../libcpu/arm/shared/include/arm-cp15.h
     43include_libcpu_HEADERS =
     44include_libcpu_HEADERS += ../../../libcpu/arm/shared/include/arm-cp15.h
     45include_libcpu_HEADERS += ../../../libcpu/arm/shared/include/omap3.h
     46include_libcpu_HEADERS += ../../../libcpu/arm/shared/include/am335x.h
     47include_libcpu_HEADERS += ../../../libcpu/arm/shared/include/omap_timer.h
    4448
    4549###############################################################################
     
    7983libbsp_a_SOURCES += ../../shared/sbrk.c
    8084libbsp_a_SOURCES += ../../shared/src/stackalloc.c
    81 libbsp_a_SOURCES += ../../shared/src/uart-output-char.c
     85libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
     86libbsp_a_SOURCES += ../../shared/timerstub.c
     87libbsp_a_SOURCES += ../../shared/cpucounterread.c
    8288libbsp_a_SOURCES += ../shared/abort/simple_abort.c
    8389libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
     90libbsp_a_SOURCES += ../shared/arm-cp15-set-exception-handler.c
    8491
    8592# Startup
    8693libbsp_a_SOURCES += startup/bspreset.c
    8794libbsp_a_SOURCES += startup/bspstart.c
     95libbsp_a_SOURCES += startup/bspstarthooks.c
     96libbsp_a_SOURCES += startup/bspstartmmu.c
    8897
    8998# IRQ
     
    94103libbsp_a_SOURCES += ../../shared/src/irq-server.c
    95104libbsp_a_SOURCES += ../../shared/src/irq-shell.c
    96 libbsp_a_SOURCES += irq/irq.c
     105libbsp_a_SOURCES += irq.c
    97106
    98107# Console
     
    104113        ../../shared/console_control.c
    105114
     115# I2C
     116libbsp_a_SOURCES += misc/i2c.c
     117
    106118# Clock
    107 libbsp_a_SOURCES += clock/beagle-clock-config.c
     119libbsp_a_SOURCES += clock.c
    108120libbsp_a_SOURCES += ../../shared/clockdrv_shell.h
    109 
    110 # RTC
    111 libbsp_a_SOURCES += ../../shared/tod.c \
    112   rtc/rtc-config.c
    113 
    114 # Misc
    115 libbsp_a_SOURCES += misc/boot.c
    116 libbsp_a_SOURCES += misc/i2c.c
    117 libbsp_a_SOURCES += misc/restart.c
    118 libbsp_a_SOURCES += misc/system-clocks.c
    119 libbsp_a_SOURCES += misc/timer.c
    120 
    121 # SSP
    122 
    123 # I2C
    124121
    125122# Cache
     
    127124libbsp_a_SOURCES += ../../../libcpu/arm/shared/include/cache_.h
    128125libbsp_a_CPPFLAGS += -I$(srcdir)/../../../libcpu/arm/shared/include
    129 
    130 # Start hooks
    131 libbsp_a_SOURCES += startup/bspstarthooks.c
    132 
    133 ###############################################################################
    134 #                  Network                                                    #
    135 ###############################################################################
    136126
    137127###############################################################################
  • c/src/lib/libbsp/arm/beagle/README

    r7a66986 r53dd6d61  
    1 Development board is a BeagleBoard Rev Cx.  Basic initialization via stage 1
    2 bootloader or U-Boot will be assumed.  Drivers:
     1BSP for beagleboard xm, beaglebone (original aka white), and beaglebone black.
    32
    4         o Standard UART 3, 4, 5, 6 (Console = 5, 115200N1)
    5         o Clock uses TIMER 0
    6         o Ethernet
     3original beagleboard isn't tested.
     4
     5wiki: http://www.rtems.org/wiki/index.php/Beagleboard
     6
     71.   *** CONFIGURING ************
     8
     9bsp-specific build options in the environment at build time:
     10CONSOLE_POLLED=1 use polled i/o for console, required to run testsuite
     11CONSOLE_BAUD=... override default console baud rate
     12
     13BSPs recognized are:
     14beagleboardorig  original beagleboard
     15beagleboardxm    beagleboard xm
     16beaglebonewhite  original beaglebone
     17beagleboneblack  beaglebone black
     18
     19Currently the only distinction in the BSP are between the beagleboards and
     20the beaglebones, but the 4 names are specified in case hardware-specific
     21distinctions are made in the future, so this can be done without changing the
     22usage.
     23
     24
     252.   *** BUILDING    ************
     26
     27To build BSPs for the beaglebone white and beagleboard xm, starting from
     28a directory in which you have this source tree in rtems-src:
     29
     30$ mkdir b-beagle
     31$ cd b-beagle
     32$ ../rtems-src/configure --target=arm-rtems4.11 --enable-rtemsbsp="beaglebonewhite beagleboardxm"
     33$ make all
     34
     35This should give you .exes somewhere.
     36
     37Then you need 'mkimage' to transform a .exe file to a u-boot image
     38file. first make a flat binary:
     39
     40$ arm-rtems4.11-objcopy $exe -O binary $exe.bin
     41$ gzip -9 $exe.bin
     42$ mkimage -A arm -O rtems -T kernel -a 0x80000000 -e 0x80000000 -n RTEMS -d $exe.bin.gz rtems-app.img
     43
     44All beagles have memory starting at 0x80000000 so the load & run syntax is the same.
     45
     463.   *** BOOTING     ************
     47
     48Then, boot the beaglebone with u-boot on an SD card and load rtems-app.img
     49from u-boot. Interrupt the u-boot boot to get a prompt.
     50
     51Set up a tftp server and a network connection for netbooting. And to
     52copy rtems-app.img to the tftp dir. Otherwise copy the .img to the FAT
     53partition on the SD card and make uboot load & run that.
     54
     554.   *** BEAGLEBONES ************
     56
     57(tested on both beaglebones)
     58
     59Beaglebone original (white) or beaglebone black netbooting:
     60
     61uboot# setenv ipaddr 192.168.12.20
     62uboot# setenv serverip 192.168.12.10
     63uboot# echo starting from TFTP
     64uboot# tftp 0x80800000 rtems-app.img
     65uboot# dcache off ; icache off
     66uboot# bootm 0x80800000
     67
     68Beaglebone original (white) or beaglebone black from a FAT partition:
     69
     70uboot# fatload mmc :1 0x80800000 ticker.img
     71uboot# dcache off ; icache off
     72uboot# bootm 0x80800000
     73
     744.   *** BEAGLEBOARD ************
     75
     76(tested on xm)
     77
     78For the beagleboard the necessary commands are a bit different because
     79of the ethernet over usb:
     80
     81uboot# setenv serverip 192.168.12.10
     82uboot# setenv ipaddr 192.168.12.62
     83uboot# setenv usbnet_devaddr e8:03:9a:24:f9:10
     84uboot# setenv usbethaddr e8:03:9a:24:f9:11
     85uboot# usb start
     86uboot# echo starting from TFTP
     87uboot# tftp 0x80800000 rtems-app.img
     88uboot# dcache off ; icache off
     89uboot# bootm 0x80800000
     90
     914.   *** SD CARD ****************
     92
     93There is a script here that automatically writes an SD card for any of
     94the beagle targets.
     95
     96Let's write one for the Beaglebone Black. Assuming your source tree is
     97at $HOME/development/rtems/rtems-src and your bsp is built and linked
     98with examples and installed at $HOME/development/rtems/4.11.
     99
     100    % cd $HOME/development/rtems/rtems-src/c/src/lib/libbsp/arm/beagle/simscripts
     101    % sh sdcard.sh $HOME/development/rtems/4.11 $HOME/development/rtems/b-beagle/arm-rtems4.11/c/beagleboneblack/testsuites/samples/hello/hello.exe
     102
     103The script should give you a whole bunch of output, ending in:
     104
     105    Result is in bone_hello.exe-sdcard.img.
     106
     107There you go. dd that to an SD card and boot!
     108
     109The script needs to know whether it's for a Beagleboard xM or one of the
     110Beaglebones. This is to know which uboot to use. It will detect this
     111from the path the executable is in (in the above example, it contains
     112'beagleboneblack'), so you have to specify the full path.
     113
     114
     115Good luck & enjoy!
     116
     117Ben Gras
     118beng@shrike-systems.com
  • c/src/lib/libbsp/arm/beagle/configure.ac

    r7a66986 r53dd6d61  
    1919RTEMS_PROG_CCAS
    2020
    21 RTEMS_CHECK_NETWORKING
    22 AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
     21RTEMS_BSPOPTS_SET([IS_DM3730],[beagleboard*],[1])
     22RTEMS_BSPOPTS_HELP([IS_DM3730],[true if SOC is DM3730])
    2323
    24 RTEMS_BSPOPTS_SET([BSP_SMALL_MEMORY],[beagle_mzx_stage_1],[1])
    25 RTEMS_BSPOPTS_SET([BSP_SMALL_MEMORY],[*],[])
    26 RTEMS_BSPOPTS_HELP([BSP_SMALL_MEMORY],[disable testsuite samples with high memory demands])
     24RTEMS_BSPOPTS_SET([IS_AM335X],[beaglebone*],[1])
     25RTEMS_BSPOPTS_HELP([IS_AM335X],[true if SOC is AM335X])
    2726
    28 RTEMS_BSPOPTS_SET([BEAGLE_OSCILLATOR_MAIN],[*],[13000000U])
    29 RTEMS_BSPOPTS_HELP([BEAGLE_OSCILLATOR_MAIN],[main oscillator frequency in Hz])
     27RTEMS_BSPOPTS_SET([CONSOLE_BAUD],[*],[115200])
     28RTEMS_BSPOPTS_HELP([CONSOLE_BAUD],[initial baud for console UART])
    3029
    31 RTEMS_BSPOPTS_SET([BEAGLE_OSCILLATOR_RTC],[*],[32768U])
    32 RTEMS_BSPOPTS_HELP([BEAGLE_OSCILLATOR_RTC],[RTC oscillator frequency in Hz])
    33 
    34 RTEMS_BSPOPTS_SET([BEAGLE_PERIPH_CLK],[*],[13000000U])
    35 RTEMS_BSPOPTS_HELP([BEAGLE_PERIPH_CLK],[peripheral clock in Hz])
    36 
    37 RTEMS_BSPOPTS_SET([BEAGLE_ETHERNET_RMII],[*],[1])
    38 RTEMS_BSPOPTS_HELP([BEAGLE_ETHERNET_RMII],[enable RMII for Ethernet])
    39 
    40 RTEMS_BSPOPTS_SET([BEAGLE_UART_1_BAUD],[*],[])
    41 RTEMS_BSPOPTS_HELP([BEAGLE_UART_1_BAUD],[baud for UART 1])
    42 
    43 RTEMS_BSPOPTS_SET([BEAGLE_UART_2_BAUD],[*],[])
    44 RTEMS_BSPOPTS_HELP([BEAGLE_UART_2_BAUD],[baud for UART 2])
    45 
    46 RTEMS_BSPOPTS_SET([BEAGLE_UART_7_BAUD],[*],[])
    47 RTEMS_BSPOPTS_HELP([BEAGLE_UART_7_BAUD],[baud for UART 7])
    48 
    49 RTEMS_BSPOPTS_SET([BEAGLE_CONFIG_U3CLK],[*],[])
    50 RTEMS_BSPOPTS_HELP([BEAGLE_CONFIG_U3CLK],[clock configuration for UART 3])
    51 
    52 RTEMS_BSPOPTS_SET([BEAGLE_CONFIG_U4CLK],[*],[])
    53 RTEMS_BSPOPTS_HELP([BEAGLE_CONFIG_U4CLK],[clock configuration for UART 4])
    54 
    55 RTEMS_BSPOPTS_SET([BEAGLE_CONFIG_U5CLK],[*],[0x00001386U])
    56 RTEMS_BSPOPTS_HELP([BEAGLE_CONFIG_U5CLK],[clock configuration for UART 5])
    57 
    58 RTEMS_BSPOPTS_SET([BEAGLE_CONFIG_U6CLK],[*],[])
    59 RTEMS_BSPOPTS_HELP([BEAGLE_CONFIG_U6CLK],[clock configuration for UART 6])
    60 
    61 RTEMS_BSPOPTS_SET([BEAGLE_CONFIG_UART_CLKMODE],[*],[0x00000200U])
    62 RTEMS_BSPOPTS_HELP([BEAGLE_CONFIG_UART_CLKMODE],[clock mode configuration for UARTs])
    63 
    64 RTEMS_BSPOPTS_SET([BEAGLE_DISABLE_MMU],[*],[])
    65 RTEMS_BSPOPTS_HELP([BEAGLE_DISABLE_MMU],[disable MMU])
    66 
    67 RTEMS_BSPOPTS_SET([BEAGLE_DISABLE_READ_WRITE_DATA_CACHE],[*],[])
    68 RTEMS_BSPOPTS_HELP([BEAGLE_DISABLE_READ_WRITE_DATA_CACHE],[disable cache for read-write data sections])
    69 
    70 RTEMS_BSPOPTS_SET([BEAGLE_DISABLE_READ_ONLY_PROTECTION],[*],[])
    71 RTEMS_BSPOPTS_HELP([BEAGLE_DISABLE_READ_ONLY_PROTECTION],[disable MMU protection of read-only sections])
    72 
    73 RTEMS_BSPOPTS_SET([BEAGLE_SCRATCH_AREA_SIZE],[beagle_mzx*],[4096])
    74 RTEMS_BSPOPTS_HELP([BEAGLE_SCRATCH_AREA_SIZE],[size of scratch area])
    75 
    76 RTEMS_BSPOPTS_SET([BEAGLE_STOP_GPDMA],[*],[1])
    77 RTEMS_BSPOPTS_HELP([BEAGLE_STOP_GPDMA],[stop general purpose DMA at start-up to avoid DMA interference])
    78 
    79 RTEMS_BSPOPTS_SET([BEAGLE_STOP_ETHERNET],[*],[1])
    80 RTEMS_BSPOPTS_HELP([BEAGLE_STOP_ETHERNET],[stop Ethernet controller at start-up to avoid DMA interference])
    81 
    82 RTEMS_BSPOPTS_SET([BEAGLE_STOP_USB],[*],[1])
    83 RTEMS_BSPOPTS_HELP([BEAGLE_STOP_USB],[stop USB controller at start-up to avoid DMA interference])
    84 
    85 RTEMS_BSPOPTS_SET([BEAGLE_ENABLE_WATCHDOG_RESET],[*],[1])
    86 RTEMS_BSPOPTS_HELP([BEAGLE_ENABLE_WATCHDOG_RESET],[bsp_reset() will use the watchdog to reset the chip])
    87 
    88 RTEMS_BSPOPTS_SET([BSP_START_RESET_VECTOR],[*],[])
    89 RTEMS_BSPOPTS_HELP([BSP_START_RESET_VECTOR],[reset vector address for BSP start])
    90 
    91 RTEMS_BSPOPTS_SET([TESTS_USE_PRINTK],[*],[1])
    92 RTEMS_BSPOPTS_HELP([TESTS_USE_PRINTK],[tests use printk() for output])
     30RTEMS_BSPOPTS_SET([CONSOLE_POLLED],[*],[0])
     31RTEMS_BSPOPTS_HELP([CONSOLE_POLLED],[polled console i/o (e.g. to run testsuite)])
    9332
    9433RTEMS_BSP_CLEANUP_OPTIONS(0, 0)
  • c/src/lib/libbsp/arm/beagle/console/console-config.c

    r7a66986 r53dd6d61  
    22 * @file
    33 *
    4  * @ingroup beagle
     4 * @ingroup arm_beagle
    55 *
    66 * @brief Console configuration.
     
    1919 * found in the file LICENSE in this distribution or at
    2020 * http://www.rtems.com/license/LICENSE.
     21 *
     22 * Modified by Ben Gras <beng@shrike-systems.com> to make
     23 * interrupt-driven uart i/o work for beagleboards; beaglebone support added.
    2124 */
    2225
     
    2528
    2629#include <bsp.h>
    27 #include <bsp/beagle.h>
    2830#include <bsp/irq.h>
     31#include <bsp/uart-output-char.h>
    2932
    30 #define UART3_THR (*(volatile unsigned int *)0x49020000)
    31 #define UART3_RHR (*(volatile unsigned int *)0x49020000)
    32 #define UART3_LSR (*(volatile unsigned int *)0x49020014)
     33#define CONSOLE_UART_THR (*(volatile unsigned int *)BSP_CONSOLE_UART_BASE)
     34#define CONSOLE_UART_RHR (*(volatile unsigned int *)BSP_CONSOLE_UART_BASE)
     35#define CONSOLE_UART_LSR (*(volatile unsigned int *)(BSP_CONSOLE_UART_BASE+0x14))
     36#define CONSOLE_SYSC (*(volatile uint32_t *) (BSP_CONSOLE_UART_BASE + 0x54))
     37#define CONSOLE_SYSS (*(volatile uint32_t *) (BSP_CONSOLE_UART_BASE + 0x58))
     38
    3339#define TX_FIFO_E (1<<5)
    3440#define RX_FIFO_E (1<<0)
    3541
    36 static uint8_t beagle_uart_get_register(uint32_t addr, uint8_t i)
     42static uint8_t beagle_uart_get_register(uintptr_t addr, uint8_t i)
    3743{
    38   volatile uint32_t *reg = (volatile uint32_t *) addr;
     44  uint8_t v;
     45  volatile uint32_t *reg_r = (volatile uint32_t *) addr + i;
    3946
    40   return (uint8_t) reg [i];
     47  if(reg_r == (uint32_t*) BSP_CONSOLE_UART_BASE /* reading RHR */ ) {
     48    /* check there should be anything in the RHR before accessing it */
     49    if(!(CONSOLE_UART_LSR & 0x01)) {
     50      return 0;
     51    }
     52  }
     53
     54  v = (uint8_t) *reg_r;
     55
     56  return v;
    4157}
    4258
    43 static void beagle_uart_set_register(uint32_t addr, uint8_t i, uint8_t val)
     59static void beagle_uart_set_register(uintptr_t addr, uint8_t i, uint8_t val)
    4460{
    4561  volatile uint32_t *reg = (volatile uint32_t *) addr;
     
    4864}
    4965
    50 /* FIXME: Console selection */
    51 
    5266console_tbl Console_Configuration_Ports [] = {
    53   #ifdef BEAGLE_CONFIG_U5CLK
    5467    {
    55       .sDeviceName = "/dev/ttyS5",
     68      .sDeviceName = "/dev/ttyS0",
    5669      .deviceType = SERIAL_NS16550,
     70#if CONSOLE_POLLED      /* option to facilitate running the tests */
    5771      .pDeviceFns = &ns16550_fns_polled,
    58       .deviceProbe = NULL,
    59       .pDeviceFlow = NULL,
     72#else
     73      .pDeviceFns = &ns16550_fns,
     74#endif
    6075      .ulMargin = 16,
    6176      .ulHysteresis = 8,
    62       .pDeviceParams = (void *) 1,
    63       .ulCtrlPort1 = BEAGLE_BASE_UART_5,
    64       .ulCtrlPort2 = 0,
    65       .ulDataPort = BEAGLE_BASE_UART_5,
     77      .pDeviceParams = (void *) CONSOLE_BAUD,
     78      .ulCtrlPort1 = BSP_CONSOLE_UART_BASE,
     79      .ulDataPort = BSP_CONSOLE_UART_BASE,
     80      .ulIntVector = BSP_CONSOLE_UART_IRQ,
    6681      .getRegister = beagle_uart_get_register,
    6782      .setRegister = beagle_uart_set_register,
    68       .getData = NULL,
    69       .setData = NULL,
    70       .ulClock = 16,
    71       .ulIntVector = BEAGLE_IRQ_UART_5
     83      .ulClock = UART_CLOCK,  /* 48MHz base clock */
    7284    },
    73   #endif
    74   #ifdef BEAGLE_CONFIG_U3CLK
    75     {
    76       .sDeviceName = "/dev/ttyS3",
    77       .deviceType = SERIAL_NS16550,
    78       .pDeviceFns = &ns16550_fns,
    79       .deviceProbe = NULL,
    80       .pDeviceFlow = NULL,
    81       .ulMargin = 16,
    82       .ulHysteresis = 8,
    83       .pDeviceParams = (void *) 1,
    84       .ulCtrlPort1 = BEAGLE_BASE_UART_3,
    85       .ulCtrlPort2 = 0,
    86       .ulDataPort = BEAGLE_BASE_UART_3,
    87       .getRegister = beagle_uart_get_register,
    88       .setRegister = beagle_uart_set_register,
    89       .getData = NULL,
    90       .setData = NULL,
    91       .ulClock = 16,
    92       .ulIntVector = BEAGLE_IRQ_UART_3
    93     },
    94   #endif
    95   #ifdef BEAGLE_CONFIG_U4CLK
    96     {
    97       .sDeviceName = "/dev/ttyS4",
    98       .deviceType = SERIAL_NS16550,
    99       .pDeviceFns = &ns16550_fns,
    100       .deviceProbe = NULL,
    101       .pDeviceFlow = NULL,
    102       .ulMargin = 16,
    103       .ulHysteresis = 8,
    104       .pDeviceParams = (void *) 1,
    105       .ulCtrlPort1 = BEAGLE_BASE_UART_4,
    106       .ulCtrlPort2 = 0,
    107       .ulDataPort = BEAGLE_BASE_UART_4,
    108       .getRegister = beagle_uart_get_register,
    109       .setRegister = beagle_uart_set_register,
    110       .getData = NULL,
    111       .setData = NULL,
    112       .ulClock = 16,
    113       .ulIntVector = BEAGLE_IRQ_UART_4
    114     },
    115   #endif
    116   #ifdef BEAGLE_CONFIG_U6CLK
    117     {
    118       .sDeviceName = "/dev/ttyS6",
    119       .deviceType = SERIAL_NS16550,
    120       .pDeviceFns = &ns16550_fns,
    121       .deviceProbe = NULL,
    122       .pDeviceFlow = NULL,
    123       .ulMargin = 16,
    124       .ulHysteresis = 8,
    125       .pDeviceParams = (void *) 1,
    126       .ulCtrlPort1 = BEAGLE_BASE_UART_6,
    127       .ulCtrlPort2 = 0,
    128       .ulDataPort = BEAGLE_BASE_UART_6,
    129       .getRegister = beagle_uart_get_register,
    130       .setRegister = beagle_uart_set_register,
    131       .getData = NULL,
    132       .setData = NULL,
    133       .ulClock = 16,
    134       .ulIntVector = BEAGLE_IRQ_UART_6
    135     },
    136   #endif
    137   #ifdef BEAGLE_UART_1_BAUD
    138     {
    139       .sDeviceName = "/dev/ttyS1",
    140       .deviceType = SERIAL_CUSTOM,
    141       .pDeviceFns = &ns16550_fns,
    142       .deviceProbe = NULL,
    143       .pDeviceFlow = NULL,
    144       .ulMargin = 16,
    145       .ulHysteresis = 8,
    146       .pDeviceParams = (void *) BEAGLE_UART_1_BAUD,
    147       .ulCtrlPort1 = BEAGLE_BASE_UART_1,
    148       .ulCtrlPort2 = 0,
    149       .ulDataPort = 0,
    150       .getRegister = NULL,
    151       .setRegister = NULL,
    152       .getData = NULL,
    153       .setData = NULL,
    154       .ulClock = 16,
    155       .ulIntVector = BEAGLE_IRQ_UART_1
    156     },
    157   #endif
    158   #ifdef BEAGLE_UART_2_BAUD
    159     {
    160       .sDeviceName = "/dev/ttyS2",
    161       .deviceType = SERIAL_CUSTOM,
    162       .pDeviceFns = &ns16550_fns,
    163       .deviceProbe = NULL,
    164       .pDeviceFlow = NULL,
    165       .ulMargin = 16,
    166       .ulHysteresis = 8,
    167       .pDeviceParams = (void *) BEAGLE_UART_2_BAUD,
    168       .ulCtrlPort1 = BEAGLE_BASE_UART_2,
    169       .ulCtrlPort2 = 0,
    170       .ulDataPort = 0,
    171       .getRegister = NULL,
    172       .setRegister = NULL,
    173       .getData = NULL,
    174       .setData = NULL,
    175       .ulClock = 16,
    176       .ulIntVector = BEAGLE_IRQ_UART_2
    177     },
    178   #endif
    179   #ifdef BEAGLE_UART_7_BAUD
    180     {
    181       .sDeviceName = "/dev/ttyS7",
    182       .deviceType = SERIAL_CUSTOM,
    183       .pDeviceFns = &ns16550_fns,
    184       .deviceProbe = NULL,
    185       .pDeviceFlow = NULL,
    186       .ulMargin = 16,
    187       .ulHysteresis = 8,
    188       .pDeviceParams = (void *) BEAGLE_UART_7_BAUD,
    189       .ulCtrlPort1 = BEAGLE_BASE_UART_7,
    190       .ulCtrlPort2 = 0,
    191       .ulDataPort = 0,
    192       .getRegister = NULL,
    193       .setRegister = NULL,
    194       .getData = NULL,
    195       .setData = NULL,
    196       .ulClock = 16,
    197       .ulIntVector = BEAGLE_IRQ_UART_7
    198     },
    199   #endif
    20085};
    20186
    202 #define BEAGLE_UART_COUNT \
    203   (sizeof(Console_Configuration_Ports) / \
    204   sizeof(Console_Configuration_Ports [0]))
     87unsigned long Console_Configuration_Count = 1;
    20588
    206 unsigned long Console_Configuration_Count = BEAGLE_UART_COUNT;
     89static int init_needed = 1; // don't rely on bss being 0
    20790
    208 static void uart_write_polled( char c ) {
    209   // wait until TX-Buffer is empty
    210   while( ( UART3_LSR & TX_FIFO_E ) == 0 )
    211   ;
     91static void beagle_console_init(void)
     92{
     93  if(init_needed) {
     94    const uint32_t div = UART_CLOCK / 16 / CONSOLE_BAUD;
     95    CONSOLE_SYSC = 2;
     96    while ((CONSOLE_SYSS & 1) == 0)
     97      ;
     98    if ((CONSOLE_LSR & (CONSOLE_LSR_THRE | CONSOLE_LSR_TEMT)) == CONSOLE_LSR_THRE) {
     99      CONSOLE_LCR = 0x83;
     100      CONSOLE_DLL = div;
     101      CONSOLE_DLM = (div >> 8) & 0xff;
     102      CONSOLE_LCR = 0x03;
     103      CONSOLE_ACR = 0x00;
     104    }
    212105
    213   // send character
    214   UART3_THR = c;
    215   return c;
     106    while ((CONSOLE_LSR & CONSOLE_LSR_TEMT) == 0)
     107      ;
     108
     109    CONSOLE_LCR = 0x80 | 0x03;
     110    CONSOLE_DLL = 0x00;
     111    CONSOLE_DLM = 0x00;
     112    CONSOLE_LCR = 0x03;
     113    CONSOLE_MCR = 0x03;
     114    CONSOLE_FCR = 0x07;
     115    CONSOLE_LCR = 0x83;
     116    CONSOLE_DLL = div;
     117    CONSOLE_DLM = (div >> 8) & 0xff;
     118    CONSOLE_LCR = 0x03;
     119    CONSOLE_ACR = 0x00;
     120    init_needed = 0;
     121  }
    216122}
    217123
     124#define CONSOLE_THR8 (*(volatile uint8_t *) (BSP_CONSOLE_UART_BASE + 0x00))
    218125
    219 /*
    220 * Write a character to the console. This is used by printk() and
    221 * maybe other low level functions. It should not use interrupts or any
    222 * RTEMS system calls. It needs to be very simple
    223 */
     126static void uart_write_polled( char c )
     127{
     128  if(init_needed) beagle_console_init();
     129
     130  while( ( CONSOLE_LSR & TX_FIFO_E ) == 0 )
     131    ;
     132  CONSOLE_THR8 = c;
     133}
     134
    224135static void _BSP_put_char( char c ) {
    225136   uart_write_polled( c );
     
    229140}
    230141
     142static int _BSP_get_char(void)
     143{
     144  if ((CONSOLE_LSR & CONSOLE_LSR_RDR) != 0) {
     145    return CONSOLE_RBR;
     146  } else {
     147    return -1;
     148  }
     149}
     150
    231151BSP_output_char_function_type BSP_output_char = _BSP_put_char;
     152
     153BSP_polling_getchar_function_type BSP_poll_char = _BSP_get_char;
  • c/src/lib/libbsp/arm/beagle/include/bsp.h

    r7a66986 r53dd6d61  
    22 * @file
    33 *
    4  * @ingroup beagle
     4 * @ingroup arm_beagle
    55 *
    66 * @brief Global BSP definitions.
     
    1919 * found in the file LICENSE in this distribution or at
    2020 * http://www.rtems.com/license/LICENSE.
     21 *
     22 * Modified by Ben Gras <beng@shrike-systems.com> to add lots
     23 * of beagleboard/beaglebone definitions, delete lpc32xx specific
     24 * ones, and merge with some other header files.
    2125 */
    2226
     
    2529
    2630#include <bspopts.h>
     31#include <stdint.h>
     32#include <bsp/start.h>
     33#include <bsp/default-initial-extension.h>
    2734
    2835#include <rtems.h>
    29 //#include <rtems/console.h>
    30 //#include <rtems/clockdrv.h>
    31 
    32 #include <bsp/beagle.h>
    33 
    34 #ifdef __cplusplus
    35 extern "C" {
    36 #endif /* __cplusplus */
     36#include <rtems/irq-extension.h>
     37
     38#include <libcpu/omap3.h>
     39#include <libcpu/am335x.h>
    3740
    3841#define BSP_FEATURE_IRQ_EXTENSION
    3942
    40 #ifndef ASM
    41 
    42 struct rtems_bsdnet_ifconfig;
     43/* UART base clock frequency */
     44#define UART_CLOCK     48000000
     45
     46/* Access memory-mapped I/O devices */
     47#define mmio_read(a)    (*(volatile uint32_t *)(a))
     48#define mmio_write(a,v) (*(volatile uint32_t *)(a) = (v))
     49#define mmio_set(a,v)   mmio_write((a), mmio_read((a)) | (v))
     50#define mmio_clear(a,v) mmio_write((a), mmio_read((a)) & ~(v))
     51
     52#define REG16(x)(*((volatile uint16_t *)(x)))
     53#define REG(x)(*((volatile uint32_t *)(x)))
     54#define BIT(x)(0x1 << x)
     55
     56#define udelay(u) rtems_task_wake_after(1 + ((u)/rtems_configuration_get_microseconds_per_tick()))
     57
     58/* Write a uint32_t value to a memory address. */
     59static inline void
     60write32(uint32_t address, uint32_t value)
     61{
     62    REG(address) = value;
     63}
     64
     65/* Read an uint32_t from a memory address */
     66static inline uint32_t
     67read32(uint32_t address)
     68{
     69    return REG(address);
     70}
     71
     72/* Set a 32 bits value depending on a mask */
     73static inline void
     74set32(uint32_t address, uint32_t mask, uint32_t value)
     75{
     76    uint32_t val;
     77    val = read32(address);
     78    /* clear the bits */
     79    val &= ~(mask);
     80    /* apply the value using the mask */
     81    val |= (value & mask);
     82    write32(address, val);
     83}
     84
     85/* Write a uint16_t value to a memory address. */
     86static inline void
     87write16(uint32_t address, uint16_t value)
     88{
     89    REG16(address) = value;
     90}
     91
     92/* Read an uint16_t from a memory address */
     93static inline uint16_t
     94read16(uint32_t address)
     95{
     96    return REG16(address);
     97}
     98
     99/* Data synchronization barrier */
     100static inline void dsb(void)
     101{
     102    asm volatile("dsb" : : : "memory");
     103}
     104
     105/* Instruction synchronization barrier */
     106static inline void isb(void)
     107{
     108    asm volatile("isb" : : : "memory");
     109}
     110
     111/* flush data cache */
     112static inline void flush_data_cache(void)
     113{
     114    asm volatile("mov r0, #0; mcr p15, #0, r0, c7, c10, #4" : : : "memory");
     115}
     116
     117
     118#define TIMER_FREQ  1000    /* clock frequency for OMAP timer (1ms) */
     119#define TIMER_COUNT(freq) (TIMER_FREQ/(freq)) /* initial value for counter*/
     120
     121#define __arch_getb(a)      (*(volatile unsigned char *)(a))
     122#define __arch_getw(a)      (*(volatile unsigned short *)(a))
     123#define __arch_getl(a)      (*(volatile unsigned int *)(a))
     124
     125#define __arch_putb(v,a)    (*(volatile unsigned char *)(a) = (v))
     126#define __arch_putw(v,a)    (*(volatile unsigned short *)(a) = (v))
     127#define __arch_putl(v,a)    (*(volatile unsigned int *)(a) = (v))
     128
     129#define writeb(v,c) ({ unsigned char  __v = v; __arch_putb(__v,c); __v; })
     130#define writew(v,c) ({ unsigned short __v = v; __arch_putw(__v,c); __v; })
     131#define writel(v,c) ({ unsigned int __v = v; __arch_putl(__v,c); __v; })
     132
     133#define readb(c)  ({ unsigned char  __v = __arch_getb(c); __v; })
     134#define readw(c)  ({ unsigned short __v = __arch_getw(c); __v; })
     135#define readl(c)  ({ unsigned int __v = __arch_getl(c); __v; })
     136
     137#define SYSTEM_CLOCK_12       12000000
     138#define SYSTEM_CLOCK_13       13000000
     139#define SYSTEM_CLOCK_192      19200000
     140#define SYSTEM_CLOCK_96       96000000
     141
     142#if !defined(IS_DM3730) && !defined(IS_AM335X)
     143#error Unrecognized BSP configured.
     144#endif
     145
     146#if IS_DM3730
     147#define BSP_DEVICEMEM_START 0x48000000
     148#define BSP_DEVICEMEM_END   0x5F000000
     149#endif
     150
     151#if IS_AM335X
     152#define BSP_DEVICEMEM_START 0x44000000
     153#define BSP_DEVICEMEM_END   0x57000000
     154#endif
     155
     156/* per-target uart config */
     157#if IS_AM335X
     158#define BSP_CONSOLE_UART        1
     159#define BSP_CONSOLE_UART_BASE   BEAGLE_BASE_UART_1
     160#define BSP_CONSOLE_UART_IRQ    OMAP3_UART1_IRQ
     161#define BEAGLE_BASE_UART_1      0x44E09000
     162#define BEAGLE_BASE_UART_2      0x48022000
     163#define BEAGLE_BASE_UART_3      0x48024000
     164#endif
     165
     166/* per-target uart config */
     167#if IS_DM3730
     168#define BSP_CONSOLE_UART        3
     169#define BSP_CONSOLE_UART_BASE   BEAGLE_BASE_UART_3
     170#define BSP_CONSOLE_UART_IRQ    OMAP3_UART3_IRQ
     171#define BEAGLE_BASE_UART_1      0x4806A000
     172#define BEAGLE_BASE_UART_2      0x4806C000
     173#define BEAGLE_BASE_UART_3      0x49020000
     174#endif
     175
     176/* i2c stuff */
     177typedef struct {
     178    uint32_t rx_or_tx;
     179    uint32_t stat;
     180    uint32_t ctrl;
     181    uint32_t clk_hi;
     182    uint32_t clk_lo;
     183    uint32_t adr;
     184    uint32_t rxfl;
     185    uint32_t txfl;
     186    uint32_t rxb;
     187    uint32_t txb;
     188    uint32_t s_tx;
     189    uint32_t s_txfl;
     190} beagle_i2c;
     191
     192/* sctlr */
     193/* Read System Control Register */
     194static inline uint32_t read_sctlr()
     195{
     196    uint32_t ctl;
     197
     198    asm volatile("mrc p15, 0, %[ctl], c1, c0, 0 @ Read SCTLR\n\t"
     199        : [ctl] "=r" (ctl));
     200    return ctl;
     201}
     202
     203/* Write System Control Register */
     204static inline void write_sctlr(uint32_t ctl)
     205{
     206    asm volatile("mcr p15, 0, %[ctl], c1, c0, 0 @ Write SCTLR\n\t"
     207        : : [ctl] "r" (ctl));
     208    isb();
     209}
     210
     211/* Read Auxiliary Control Register */
     212static inline uint32_t read_actlr()
     213{
     214    uint32_t ctl;
     215
     216    asm volatile("mrc p15, 0, %[ctl], c1, c0, 1 @ Read ACTLR\n\t"
     217            : [ctl] "=r" (ctl));
     218    return ctl;
     219}
     220
     221/* Write Auxiliary Control Register */
     222static inline void write_actlr(uint32_t ctl)
     223{
     224    asm volatile("mcr p15, 0, %[ctl], c1, c0, 1 @ Write ACTLR\n\t"
     225        : : [ctl] "r" (ctl));
     226    isb();
     227}
     228
     229/* Write Translation Table Base Control Register */
     230static inline void write_ttbcr(uint32_t bcr)
     231{
     232        asm volatile("mcr p15, 0, %[bcr], c2, c0, 2 @ Write TTBCR\n\t"
     233                        : : [bcr] "r" (bcr));
     234
     235        isb();
     236}
     237
     238/* Read Domain Access Control Register */
     239static inline uint32_t read_dacr()
     240{
     241        uint32_t dacr;
     242
     243        asm volatile("mrc p15, 0, %[dacr], c3, c0, 0 @ Read DACR\n\t"
     244                        : [dacr] "=r" (dacr));
     245
     246        return dacr;
     247}
     248
     249
     250/* Write Domain Access Control Register */
     251static inline void write_dacr(uint32_t dacr)
     252{
     253        asm volatile("mcr p15, 0, %[dacr], c3, c0, 0 @ Write DACR\n\t"
     254                        : : [dacr] "r" (dacr));
     255
     256        isb();
     257}
     258
     259static inline void refresh_tlb(void)
     260{
     261    dsb();
     262
     263    /* Invalidate entire unified TLB */
     264    asm volatile("mcr p15, 0, %[zero], c8, c7, 0 @ TLBIALL\n\t"
     265        : : [zero] "r" (0));
     266
     267    /* Invalidate all instruction caches to PoU.
     268     * Also flushes branch target cache. */
     269    asm volatile("mcr p15, 0, %[zero], c7, c5, 0"
     270        : : [zero] "r" (0));
     271
     272    /* Invalidate entire branch predictor array */
     273    asm volatile("mcr p15, 0, %[zero], c7, c5, 6"
     274        : : [zero] "r" (0)); /* flush BTB */
     275
     276    dsb();
     277    isb();
     278}
     279
     280/* Read Translation Table Base Register 0 */
     281static inline uint32_t read_ttbr0()
     282{
     283    uint32_t bar;
     284
     285    asm volatile("mrc p15, 0, %[bar], c2, c0, 0 @ Read TTBR0\n\t"
     286        : [bar] "=r" (bar));
     287
     288    return bar & ARM_TTBR_ADDR_MASK;
     289}
     290
     291
     292/* Read Translation Table Base Register 0 */
     293static inline uint32_t read_ttbr0_unmasked()
     294{
     295    uint32_t bar;
     296
     297    asm volatile("mrc p15, 0, %[bar], c2, c0, 0 @ Read TTBR0\n\t"
     298        : [bar] "=r" (bar));
     299
     300    return bar;
     301}
     302
     303/* Write Translation Table Base Register 0 */
     304static inline void write_ttbr0(uint32_t bar)
     305{
     306    dsb();
     307    isb();
     308    /* In our setup TTBR contains the base address *and* the flags
     309       but other pieces of the kernel code expect ttbr to be the
     310       base address of the l1 page table. We therefore add the
     311       flags here and remove them in the read_ttbr0 */
     312    uint32_t v  =  (bar  & ARM_TTBR_ADDR_MASK ) | ARM_TTBR_FLAGS_CACHED;
     313    asm volatile("mcr p15, 0, %[bar], c2, c0, 0 @ Write TTBR0\n\t"
     314        : : [bar] "r" (v));
     315
     316    refresh_tlb();
     317}
     318
     319/* Behaviour on fatal error; default: test-friendly.
     320 * set breakpoint to bsp_fatal_extension.
     321 */
     322/* Enabling BSP_PRESS_KEY_FOR_RESET prevents noninteractive testing */
     323/*#define  BSP_PRESS_KEY_FOR_RESET     1 */
     324#define    BSP_PRINT_EXCEPTION_CONTEXT 1
     325    /* human-readable exception info */
     326#define    BSP_RESET_BOARD_AT_EXIT 1
     327    /* causes qemu to exit, signaling end of test */
     328
    43329
    44330/**
    45  * @defgroup beagle BEAGLE Support
    46  *
    47  * @ingroup bsp_kit
    48  *
    49  * @brief BEAGLE support package.
    50  *
    51  * @{
     331 * @defgroup arm_beagle Beaglebone, Beagleboard Support
     332 *
     333 * @ingroup bsp_arm
     334 *
     335 * @brief Beaglebones and beagleboards support package
     336 *
    52337 */
    53338
    54339/**
    55  * @brief Network driver attach and detach function.
    56  */
    57 int beagle_eth_attach_detach(
    58   struct rtems_bsdnet_ifconfig *config,
    59   int attaching
    60 );
    61 
    62 /**
    63  * @brief Standard network driver attach and detach function.
    64  */
    65 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH beagle_eth_attach_detach
    66 
    67 /**
    68  * @brief Standard network driver name.
    69  */
    70 #define RTEMS_BSP_NETWORK_DRIVER_NAME "eth0"
    71 
    72 /**
    73  * @brief Optimized idle task.
    74  *
    75  * This idle task sets the power mode to idle.  This causes the processor clock
    76  * to be stopped, while on-chip peripherals remain active.  Any enabled
    77  * interrupt from a peripheral or an external interrupt source will cause the
    78  * processor to resume execution.
    79  *
    80  * To enable the idle task use the following in the system configuration:
    81  *
    82  * @code
    83  * #include <bsp.h>
    84  *
    85  * #define CONFIGURE_INIT
    86  *
    87  * #define CONFIGURE_IDLE_TASK_BODY beagle_idle
    88  *
    89  * #include <confdefs.h>
    90  * @endcode
    91  */
    92 void *beagleboard_idle(uintptr_t ignored);
    93 
    94 #define BEAGLE_STANDARD_TIMER (&beagle.timer_1)
    95 
    96 static inline unsigned beagleboard_timer(void)
    97 {
    98   volatile beagle_timer *timer = BEAGLE_STANDARD_TIMER;
    99 
    100   return timer->tc;
    101 }
    102 
    103 static inline void beagleboard_micro_seconds_delay(unsigned us)
    104 {
    105   unsigned start = beagleboard_timer();
    106   unsigned delay = us * (BEAGLE_PERIPH_CLK / 1000000);
    107   unsigned elapsed = 0;
    108 
    109   do {
    110     elapsed = beagleboard_timer() - start;
    111   } while (elapsed < delay);
    112 }
    113 
    114 #if BEAGLE_OSCILLATOR_MAIN == 13000000U
    115   #define BEAGLE_HCLKPLL_CTRL_INIT_VALUE \
    116     (HCLK_PLL_POWER | HCLK_PLL_DIRECT | HCLK_PLL_M(16 - 1))
    117   #define BEAGLE_HCLKDIV_CTRL_INIT_VALUE \
    118     (HCLK_DIV_HCLK(2 - 1) | \
    119     HCLK_DIV_PERIPH_CLK(16 - 1) | \
    120     HCLK_DIV_DDRAM_CLK(1))
    121 #else
    122   #error "unexpected main oscillator frequency"
    123 #endif
    124 
    125 bool beagleboard_start_pll_setup(
    126   uint32_t hclkpll_ctrl,
    127   uint32_t hclkdiv_ctrl,
    128   bool force
    129 );
    130 
    131 uint32_t beagleboard__sysclk(void);
    132 
    133 uint32_t beagleboard_hclkpll_clk(void);
    134 
    135 uint32_t beagleboard_periph_clk(void);
    136 
    137 uint32_t beagleboard_hclk(void);
    138 
    139 uint32_t beagleboard_arm_clk(void);
    140 
    141 uint32_t beagleboard_dram_clk(void);
    142 
    143 void bsp_restart(void *addr);
    144 
    145 #define BSP_CONSOLE_UART_BASE BEAGLE_BASE_UART_5
    146 
    147 /**
    148  * @brief Begin of magic zero area.
    149  *
    150  * A read from this area returns zero.  Writes have no effect.
    151  */
    152 //extern uint32_t beagle_magic_zero_begin [];
    153 
    154 /**
    155  * @brief End of magic zero area.
    156  *
    157  * A read from this area returns zero.  Writes have no effect.
    158  */
    159 //extern uint32_t beagle_magic_zero_end [];
    160 
    161 /**
    162  * @brief Size of magic zero area.
    163  *
    164  * A read from this area returns zero.  Writes have no effect.
    165  */
    166 //extern uint32_t beagle_magic_zero_size [];
    167 
    168 #ifdef BEAGLE_SCRATCH_AREA_SIZE
    169   /**
    170    * @rief Scratch area.
    171    *
    172    * The usage is application specific.
    173    */
    174   //extern uint8_t beagle_scratch_area [BEAGLE_SCRATCH_AREA_SIZE];
    175 #endif
    176 
    177 #define BEAGLE_DO_STOP_GPDMA \
    178   do { \
    179     if ((BEAGLE_DMACLK_CTRL & 0x1) != 0) { \
    180       if ((beagle.dma.cfg & DMA_CFG_E) != 0) { \
    181         int i = 0; \
    182         for (i = 0; i < 8; ++i) { \
    183           beagle.dma.channels [i].cfg = 0; \
    184         } \
    185         beagle.dma.cfg &= ~DMA_CFG_E; \
    186       } \
    187       BEAGLE_DMACLK_CTRL = 0; \
    188     } \
    189   } while (0)
    190 
    191 #define BEAGLE_DO_STOP_ETHERNET \
    192   do { \
    193     if ((BEAGLE_MAC_CLK_CTRL & 0x7) == 0x7) { \
    194       beagle.eth.command = 0x38; \
    195       beagle.eth.mac1 = 0xcf00; \
    196       beagle.eth.mac1 = 0; \
    197       BEAGLE_MAC_CLK_CTRL = 0; \
    198     } \
    199   } while (0)
    200 
    201 #define BEAGLE_DO_STOP_USB \
    202   do { \
    203     if ((BEAGLE_USB_CTRL & 0x010e8000) != 0) { \
    204       BEAGLE_OTG_CLK_CTRL = 0; \
    205       BEAGLE_USB_CTRL = 0x80000; \
    206     } \
    207   } while (0)
    208 
    209 #define BEAGLE_DO_RESTART(addr) \
    210   do { \
    211     ARM_SWITCH_REGISTERS; \
    212     rtems_interrupt_level level; \
    213     uint32_t ctrl = 0; \
    214   \
    215     rtems_interrupt_disable(level); \
    216   \
    217     arm_cp15_data_cache_test_and_clean(); \
    218     arm_cp15_instruction_cache_invalidate(); \
    219   \
    220     ctrl = arm_cp15_get_control(); \
    221     ctrl &= ~(ARM_CP15_CTRL_I | ARM_CP15_CTRL_C | ARM_CP15_CTRL_M); \
    222     arm_cp15_set_control(ctrl); \
    223   \
    224     __asm__ volatile ( \
    225       ARM_SWITCH_TO_ARM \
    226       "mov pc, %[addr]\n" \
    227       ARM_SWITCH_BACK \
    228       : ARM_SWITCH_OUTPUT \
    229       : [addr] "r" (addr) \
    230     ); \
    231   } while (0)
    232 
    233 /** @} */
    234 
    235 /**
    236  * @defgroup beagle BEAGLE Support
    237  *
    238  * @ingroup beagle
    239  *
    240  * @brief BEAGLE support package.
    241  */
    242 
    243 #endif /* ASM */
    244 
    245 #ifdef __cplusplus
    246 }
    247 #endif /* __cplusplus */
     340 * @brief Beagleboard specific set up of the MMU.
     341 *
     342 * Provide in the application to override.
     343 */
     344BSP_START_TEXT_SECTION void beagle_setup_mmu_and_cache(void);
    248345
    249346#endif /* LIBBSP_ARM_BEAGLE_BSP_H */
  • c/src/lib/libbsp/arm/beagle/include/i2c.h

    r7a66986 r53dd6d61  
    22 * @file
    33 *
    4  * @ingroup beagle_i2c
     4 * @ingroup arm_beagle
    55 *
    66 * @brief I2C support API.
     
    2626#include <rtems.h>
    2727
    28 #include <bsp/beagle.h>
     28#include <bsp.h>
    2929
    3030#ifdef __cplusplus
     
    216216
    217217/**
    218  * @defgroup beagle_i2c I2C Support
    219  *
    220  * @ingroup beagle
    221  *
    222  * @brief I2C Support
    223  *
    224  * All writes and reads will be performed in master mode.  Exclusive bus access
    225  * will be assumed.
    226  *
    227  * @{
    228  */
    229 
    230 /**
    231  * @name I2C Clock Control Register (I2CCLK_CTRL)
    232  *
    233  * @{
    234  */
    235 
    236 //#define I2CCLK_1_EN BSP_BIT32(0)
    237 //#define I2CCLK_2_EN BSP_BIT32(1)
    238 //#define I2CCLK_1_HIGH_DRIVE BSP_BIT32(2)
    239 //#define I2CCLK_2_HIGH_DRIVE BSP_BIT32(3)
    240 //#define I2CCLK_USB_HIGH_DRIVE BSP_BIT32(4)
    241 
    242 /** @} */
    243 
    244 /**
    245  * @name I2C TX Data FIFO Register (I2Cn_TX)
    246  *
    247  * @{
    248  */
    249 
    250 //#define I2C_TX_READ BSP_BIT32(0)
    251 //#define I2C_TX_ADDR(val) BSP_FLD32(val, 1, 7)
    252 //#define I2C_TX_START BSP_BIT32(8)
    253 //#define I2C_TX_STOP BSP_BIT32(9)
    254 
    255 /** @} */
    256 
    257 /**
    258  * @name I2C Status Register (I2Cn_STAT)
    259  *
    260  * @{
    261  */
    262 
    263 //#define I2C_STAT_TDI BSP_BIT32(0)
    264 //#define I2C_STAT_AFI BSP_BIT32(1)
    265 //#define I2C_STAT_NAI BSP_BIT32(2)
    266 //#define I2C_STAT_DRMI BSP_BIT32(3)
    267 //#define I2C_STAT_DRSI BSP_BIT32(4)
    268 //#define I2C_STAT_ACTIVE BSP_BIT32(5)
    269 //#define I2C_STAT_SCL BSP_BIT32(6)
    270 //#define I2C_STAT_SDA BSP_BIT32(7)
    271 //#define I2C_STAT_RFF BSP_BIT32(8)
    272 //#define I2C_STAT_RFE BSP_BIT32(9)
    273 //#define I2C_STAT_TFF BSP_BIT32(10)
    274 //#define I2C_STAT_TFE BSP_BIT32(11)
    275 //#define I2C_STAT_TFFS BSP_BIT32(12)
    276 //#define I2C_STAT_TFES BSP_BIT32(13)
    277 
    278 /** @} */
    279 
    280 /**
    281  * @name I2C Control Register (I2Cn_CTRL)
    282  *
    283  * @{
    284  */
    285 
    286 //#define I2C_CTRL_TDIE BSP_BIT32(0)
    287 //#define I2C_CTRL_AFIE BSP_BIT32(1)
    288 //#define I2C_CTRL_NAIE BSP_BIT32(2)
    289 //#define I2C_CTRL_DRMIE BSP_BIT32(3)
    290 //#define I2C_CTRL_DRSIE BSP_BIT32(4)
    291 //#define I2C_CTRL_RFFIE BSP_BIT32(5)
    292 //#define I2C_CTRL_RFDAIE BSP_BIT32(6)
    293 //#define I2C_CTRL_TFFIO BSP_BIT32(7)
    294 //#define I2C_CTRL_RESET BSP_BIT32(8)
    295 //#define I2C_CTRL_SEVEN BSP_BIT32(9)
    296 //#define I2C_CTRL_TFFSIE BSP_BIT32(10)
    297 
    298 /** @} */
    299 
    300 /**
    301218 * @brief Initializes the I2C module @a i2c.
    302219 *
     
    445362}
    446363
    447 /** @} */
    448 
    449364#ifdef __cplusplus
    450365}
  • c/src/lib/libbsp/arm/beagle/include/irq.h

    r7a66986 r53dd6d61  
    22 * @file
    33 *
    4  * @ingroup bsp_interrupt
     4 * @ingroup arm_beagle
    55 *
    6  * @brief Interrupt definitions.
    7  */
    8 
    9 /*
    10  * Copyright (c) 2012 Claas Ziemke. All rights reserved.
    11  *
    12  *  Claas Ziemke
    13  *  Kernerstrasse 11
    14  *  70182 Stuttgart
    15  *  Germany
    16  *  <claas.ziemke@gmx.net>
    17  *
    18  * The license and distribution terms for this file may be
    19  * found in the file LICENSE in this distribution or at
    20  * http://www.rtems.com/license/LICENSE.
     6 * @brief Basic BSP IRQ info.
    217 */
    228
     
    3016#include <rtems/irq-extension.h>
    3117
    32 #ifdef __cplusplus
    33 extern "C" {
    34 #endif /* __cplusplus */
    35 
    36 /**
    37  * @addtogroup bsp_interrupt
    38  *
    39  * @{
    40  */
    41 
    42 #define BEAGLE_IRQ_INDEX(module, subindex) ((module) + (subindex))
    43 
    44 #define BEAGLE_IRQ_MODULE_MIC 0U
    45 #define BEAGLE_IRQ_MODULE_SIC_1 32U
    46 #define BEAGLE_IRQ_MODULE_SIC_2 64U
    47 #define BEAGLE_IRQ_MODULE_COUNT 3U
    48 
    49 /* MIC interrupts */
    50 #define BEAGLE_IRQ_SIC_1_IRQ BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 0)
    51 #define BEAGLE_IRQ_SIC_2_IRQ BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 1)
    52 #define BEAGLE_IRQ_TIMER_4_OR_MCPWM BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 3)
    53 #define BEAGLE_IRQ_TIMER_5 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 4)
    54 #define BEAGLE_IRQ_TIMER_HS BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 5)
    55 #define BEAGLE_IRQ_WDG BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 6)
    56 
    57 #define BEAGLE_IRQ_UART_3 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 7)
    58 #define BEAGLE_IRQ_UART_4 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 8)
    59 #define BEAGLE_IRQ_UART_5 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 9)
    60 #define BEAGLE_IRQ_UART_6 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 10)
    61 
    62 #define BEAGLE_IRQ_NAND_FLASH BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 11)
    63 #define BEAGLE_IRQ_SDCARD_1 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 13)
    64 #define BEAGLE_IRQ_LCD BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 14)
    65 #define BEAGLE_IRQ_SDCARD_2 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 15)
    66 #define BEAGLE_IRQ_TIMER_0 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 16)
    67 #define BEAGLE_IRQ_TIMER_1 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 17)
    68 #define BEAGLE_IRQ_TIMER_2 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 18)
    69 #define BEAGLE_IRQ_TIMER_3 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 19)
    70 #define BEAGLE_IRQ_SSP_0 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 20)
    71 #define BEAGLE_IRQ_SSP_1 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 21)
    72 #define BEAGLE_IRQ_I2S_0 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 22)
    73 #define BEAGLE_IRQ_I2S_1 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 23)
    74 
    75 #define BEAGLE_IRQ_UART_7 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 24)
    76 #define BEAGLE_IRQ_UART_2 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 25)
    77 #define BEAGLE_IRQ_UART_1 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 26)
    78 
    79 #define BEAGLE_IRQ_TIMER_MS BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 27)
    80 #define BEAGLE_IRQ_DMA BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 28)
    81 #define BEAGLE_IRQ_ETHERNET BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 29)
    82 #define BEAGLE_IRQ_SIC_1_FIQ BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 30)
    83 #define BEAGLE_IRQ_SIC_2_FIQ BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_MIC, 31)
    84 
    85 /* SIC 1 interrupts */
    86 #define BEAGLE_IRQ_JTAG_COMM_TX BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 1)
    87 #define BEAGLE_IRQ_JTAG_COMM_RX BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 2)
    88 #define BEAGLE_IRQ_GPI_28 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 4)
    89 #define BEAGLE_IRQ_TS_P BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 6)
    90 #define BEAGLE_IRQ_TS_IRQ_OR_ADC BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 7)
    91 #define BEAGLE_IRQ_TS_AUX BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 8)
    92 #define BEAGLE_IRQ_SPI_2 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 12)
    93 #define BEAGLE_IRQ_PLL_USB BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 13)
    94 #define BEAGLE_IRQ_PLL_HCLK BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 14)
    95 #define BEAGLE_IRQ_PLL_397 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 17)
    96 #define BEAGLE_IRQ_I2C_2 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 18)
    97 #define BEAGLE_IRQ_I2C_1 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 19)
    98 #define BEAGLE_IRQ_RTC BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 20)
    99 #define BEAGLE_IRQ_KEYSCAN BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 22)
    100 #define BEAGLE_IRQ_SPI_1 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 23)
    101 #define BEAGLE_IRQ_SW BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 24)
    102 #define BEAGLE_IRQ_USB_OTG_TIMER BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 25)
    103 #define BEAGLE_IRQ_USB_OTG_ATX BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 26)
    104 #define BEAGLE_IRQ_USB_HOST BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 27)
    105 #define BEAGLE_IRQ_USB_DEV_DMA BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 28)
    106 #define BEAGLE_IRQ_USB_DEV_LP BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 29)
    107 #define BEAGLE_IRQ_USB_DEV_HP BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 30)
    108 #define BEAGLE_IRQ_USB_I2C BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_1, 31)
    109 
    110 /* SIC 2 interrupts */
    111 #define BEAGLE_IRQ_GPIO_0 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 0)
    112 #define BEAGLE_IRQ_GPIO_1 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 1)
    113 #define BEAGLE_IRQ_GPIO_2 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 2)
    114 #define BEAGLE_IRQ_GPIO_3 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 3)
    115 #define BEAGLE_IRQ_GPIO_4 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 4)
    116 #define BEAGLE_IRQ_GPIO_5 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 5)
    117 #define BEAGLE_IRQ_SPI_2_DATAIN BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 6)
    118 
    119 #define BEAGLE_IRQ_UART_2_HCTS BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 7)
    120 
    121 #define BEAGLE_IRQ_GPIO_P0_P1_IRQ BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 8)
    122 #define BEAGLE_IRQ_GPI_8 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 9)
    123 #define BEAGLE_IRQ_GPI_9 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 10)
    124 #define BEAGLE_IRQ_GPI_19 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 11)
    125 
    126 #define BEAGLE_IRQ_UART_7_HCTS BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 12)
    127 
    128 #define BEAGLE_IRQ_GPI_7 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 15)
    129 #define BEAGLE_IRQ_SDIO BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 18)
    130 
    131 #define BEAGLE_IRQ_UART_5_RX BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 19)
    132 
    133 #define BEAGLE_IRQ_SPI_1_DATAIN BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 20)
    134 #define BEAGLE_IRQ_GPI_0 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 22)
    135 #define BEAGLE_IRQ_GPI_1 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 23)
    136 #define BEAGLE_IRQ_GPI_2 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 24)
    137 #define BEAGLE_IRQ_GPI_3 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 25)
    138 #define BEAGLE_IRQ_GPI_4 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 26)
    139 #define BEAGLE_IRQ_GPI_5 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 27)
    140 #define BEAGLE_IRQ_GPI_6 BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 28)
    141 #define BEAGLE_IRQ_SYSCLK BEAGLE_IRQ_INDEX(BEAGLE_IRQ_MODULE_SIC_2, 31)
    142 
    143 #define BEAGLE_IRQ_PRIORITY_VALUE_MIN 0U
    144 #define BEAGLE_IRQ_PRIORITY_VALUE_MAX 15U
    145 #define BEAGLE_IRQ_PRIORITY_COUNT (BEAGLE_IRQ_PRIORITY_VALUE_MAX + 1U)
    146 #define BEAGLE_IRQ_PRIORITY_HIGHEST BEAGLE_IRQ_PRIORITY_VALUE_MIN
    147 #define BEAGLE_IRQ_PRIORITY_LOWEST BEAGLE_IRQ_PRIORITY_VALUE_MAX
    148 
    149 #define BSP_INTERRUPT_VECTOR_MIN BEAGLE_IRQ_SIC_1_IRQ
    150 #define BSP_INTERRUPT_VECTOR_MAX BEAGLE_IRQ_SYSCLK
    151 
    152 #define BEAGLE_IRQ_COUNT (BSP_INTERRUPT_VECTOR_MAX + 1)
    153 
    154 void beagle_irq_set_priority(rtems_vector_number vector, unsigned priority);
    155 
    156 unsigned beagle_irq_get_priority(rtems_vector_number vector);
    157 
    158 typedef enum {
    159   BEAGLE_IRQ_ACTIVE_LOW_OR_FALLING_EDGE,
    160   BEAGLE_IRQ_ACTIVE_HIGH_OR_RISING_EDGE
    161 } beagle_irq_activation_polarity;
    162 
    163 void beagle_irq_set_activation_polarity(
    164   rtems_vector_number vector,
    165   beagle_irq_activation_polarity activation_polarity
    166 );
    167 
    168 beagle_irq_activation_polarity beagle_irq_get_activation_polarity(
    169   rtems_vector_number vector
    170 );
    171 
    172 typedef enum {
    173   BEAGLE_IRQ_LEVEL_SENSITIVE,
    174   BEAGLE_IRQ_EDGE_SENSITIVE
    175 } beagle_irq_activation_type;
    176 
    177 void beagle_irq_set_activation_type(
    178   rtems_vector_number vector,
    179   beagle_irq_activation_type activation_type
    180 );
    181 
    182 beagle_irq_activation_type beagle_irq_get_activation_type(
    183   rtems_vector_number vector
    184 );
    185 
    186 void beagle_set_exception_handler(
    187   Arm_symbolic_exception_name exception,
    188   void (*handler)(void)
    189 );
    190 
    191 /** @} */
    192 
    193 #ifdef __cplusplus
    194 }
    195 #endif /* __cplusplus */
     18#define BSP_INTERRUPT_VECTOR_MIN 0
     19#define BSP_INTERRUPT_VECTOR_MAX 127
    19620
    19721#endif /* ASM */
  • c/src/lib/libbsp/arm/beagle/make/custom/beagleboardxm.cfg

    r7a66986 r53dd6d61  
    1 #
    2 #  Config file for BeagleBoard
    3 #
    4 
     1#  Config file for BeagleBoard XM
    52include $(RTEMS_ROOT)/make/custom/beagle.inc
  • c/src/lib/libbsp/arm/beagle/misc/i2c.c

    r7a66986 r53dd6d61  
    22 * @file
    33 *
    4  * @ingroup beagle_i2c
     4 * @ingroup arm_beagle
    55 *
    66 * @brief I2C support implementation.
  • c/src/lib/libbsp/arm/beagle/preinstall.am

    r7a66986 r53dd6d61  
    99DISTCLEANFILES += $(PREINSTALL_DIRS)
    1010
     11all-am: $(PREINSTALL_FILES)
     12
     13PREINSTALL_FILES =
     14CLEANFILES = $(PREINSTALL_FILES)
     15
    1116all-local: $(TMPINSTALL_FILES)
    1217
    1318TMPINSTALL_FILES =
    14 CLEANFILES = $(TMPINSTALL_FILES)
    15 
    16 all-am: $(PREINSTALL_FILES)
    17 
    18 PREINSTALL_FILES =
    19 CLEANFILES += $(PREINSTALL_FILES)
     19CLEANFILES += $(TMPINSTALL_FILES)
    2020
    2121$(PROJECT_LIB)/$(dirstamp):
     
    4646        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h
    4747PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h
     48
     49$(PROJECT_INCLUDE)/tm27.h: ../../shared/include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
     50        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
     51PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h
    4852
    4953$(PROJECT_INCLUDE)/coverhd.h: ../../shared/include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
     
    7983PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/uart-output-char.h
    8084
    81 $(PROJECT_INCLUDE)/bsp/tod.h: ../../shared/tod.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
    82         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/tod.h
    83 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/tod.h
     85$(PROJECT_INCLUDE)/bsp/arm-a8core-start.h: ../shared/include/arm-a8core-start.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     86        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/arm-a8core-start.h
     87PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/arm-a8core-start.h
     88
     89$(PROJECT_INCLUDE)/bsp/arm-cp15-start.h: ../shared/include/arm-cp15-start.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     90        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/arm-cp15-start.h
     91PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/arm-cp15-start.h
     92
     93$(PROJECT_INCLUDE)/bsp/arm-errata.h: ../shared/include/arm-errata.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     94        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/arm-errata.h
     95PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/arm-errata.h
     96
     97$(PROJECT_INCLUDE)/bsp/arm-release-id.h: ../shared/include/arm-release-id.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     98        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/arm-release-id.h
     99PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/arm-release-id.h
    84100
    85101$(PROJECT_INCLUDE)/bsp/start.h: ../shared/include/start.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     
    91107PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
    92108
    93 $(PROJECT_INCLUDE)/bsp/beagle.h: include/beagle.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
    94         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/beagle.h
    95 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/beagle.h
    96 
    97 $(PROJECT_INCLUDE)/bsp/beagle-clock-config.h: include/beagle-clock-config.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
    98         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/beagle-clock-config.h
    99 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/beagle-clock-config.h
    100 
    101 $(PROJECT_INCLUDE)/bsp/beagle-timer.h: include/beagle-timer.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
    102         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/beagle-timer.h
    103 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/beagle-timer.h
    104 
    105 $(PROJECT_INCLUDE)/bsp/boot.h: include/boot.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
    106         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/boot.h
    107 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/boot.h
    108 
    109109$(PROJECT_INCLUDE)/bsp/i2c.h: include/i2c.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
    110110        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/i2c.h
     
    114114        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/arm-cp15.h
    115115PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/arm-cp15.h
     116
     117$(PROJECT_INCLUDE)/libcpu/omap3.h: ../../../libcpu/arm/shared/include/omap3.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
     118        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/omap3.h
     119PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/omap3.h
     120
     121$(PROJECT_INCLUDE)/libcpu/am335x.h: ../../../libcpu/arm/shared/include/am335x.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
     122        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/am335x.h
     123PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/am335x.h
     124
     125$(PROJECT_INCLUDE)/libcpu/omap_timer.h: ../../../libcpu/arm/shared/include/omap_timer.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
     126        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/omap_timer.h
     127PREINSTALL_FILES += $(PROJECT_INCLUDE)/libcpu/omap_timer.h
    116128
    117129$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
  • c/src/lib/libbsp/arm/beagle/startup/bspreset.c

    r7a66986 r53dd6d61  
    1 /**
    2  * @file
    3  *
    4  * @ingroup beagle
    5  *
    6  * @brief Reset code.
    7  */
    8 
    91/*
    10  * Copyright (c) 2012 Claas Ziemke. All rights reserved.
    11  *
    12  *  Claas Ziemke
    13  *  Kernerstrasse 11
    14  *  70182 Stuttgart
    15  *  Germany
    16  *  <claas.ziemke@gmx.net>
     2 * Copyright (c) 2014 Ben Gras <beng@shrike-systems.com>. All rights reserved.
    173 *
    184 * The license and distribution terms for this file may be
    195 * found in the file LICENSE in this distribution or at
    20  * http://www.rtems.com/license/LICENSE.
     6 * http://www.rtems.org/license/LICENSE.
    217 */
    228
    23 #include <stdbool.h>
     9#include <bsp.h>
     10#include <bsp/bootcard.h>
    2411
    25 #include <bspopts.h>
    26 #include <bsp/bootcard.h>
    27 #include <bsp/beagle.h>
     12#define AM335X_CM_BASE 0x44E00000
     13#define AM335X_CM_SIZE 0x1000
    2814
    29 static void watchdog_reset(void)
     15#define AM335X_PRM_DEVICE_OFFSET 0xf00
     16#define AM335X_PRM_RSTCTRL_REG 0x00
     17#define AM335X_RST_GLOBAL_WARM_SW_BIT 0
     18
     19#define DM37XX_CM_BASE 0x48307000
     20#define DM37XX_CM_SIZE 0x1000
     21#define DM37XX_PRM_RSTCTRL_REG 0x250
     22#define DM37XX_RST_DPLL3_BIT 2
     23
     24void bsp_reset(void)
    3025{
    31   #ifdef BEAGLE_ENABLE_WATCHDOG_RESET
    32     //BEAGLE_TIMCLK_CTRL |= TIMCLK_CTRL_WDT;
    33     //beagle.wdt.mctrl |= WDTTIM_MCTRL_M_RES1 | WDTTIM_MCTRL_M_RES2;
    34     //beagle.wdt.emr = WDTTIM_EMR_MATCH_CTRL_SET(beagle.wdt.emr, 0x2);
    35     //beagle.wdt.ctrl |= WDTTIM_CTRL_COUNT_ENAB;
    36     //beagle.wdt.match0 = 1;
    37     //beagle.wdt.counter = 0;
    38   #endif
     26#if IS_DM3730
     27  static uint32_t reset_base = DM37XX_CM_BASE;
     28  while (true) {
     29    mmio_set((reset_base + DM37XX_PRM_RSTCTRL_REG),
     30             (1 << DM37XX_RST_DPLL3_BIT));
     31  }
     32#endif
     33
     34#if IS_AM335X
     35  static uint32_t reset_base = AM335X_CM_BASE;
     36  while (true) {
     37    mmio_set((reset_base + AM335X_PRM_DEVICE_OFFSET +
     38              AM335X_PRM_RSTCTRL_REG),
     39             (1 << AM335X_RST_GLOBAL_WARM_SW_BIT));
     40  }
     41#endif
    3942}
    40 
    41 void bsp_reset( void)
    42 {
    43   watchdog_reset();
    44 
    45   while (true) {
    46     /* Do nothing */
    47   }
    48 }
  • c/src/lib/libbsp/arm/beagle/startup/bspstart.c

    r7a66986 r53dd6d61  
    1 /**
    2  * @file
     1/*
     2 * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
    33 *
    4  * @ingroup beagle
    5  *
    6  * @brief Startup code.
    7  */
    8 
    9 /*
    10  * Copyright (c) 2012 Claas Ziemke. All rights reserved.
    11  *
    12  *  Claas Ziemke
    13  *  Kernerstrasse 11
    14  *  70182 Stuttgart
     4 *  embedded brains GmbH
     5 *  Dornierstr. 4
     6 *  82178 Puchheim
    157 *  Germany
    16  *  <claas.ziemke@gmx.net>
     8 *  <info@embedded-brains.de>
    179 *
    1810 * The license and distribution terms for this file may be
    1911 * found in the file LICENSE in this distribution or at
    20  * http://www.rtems.com/license/LICENSE.
     12 * http://www.rtems.org/license/LICENSE.
    2113 */
    2214
     
    2416#include <bsp/bootcard.h>
    2517#include <bsp/irq-generic.h>
    26 #include <bsp/irq.h>
    27 #include <bsp/linker-symbols.h>
    28 #include <bsp/beagle.h>
    2918
    3019void bsp_start(void)
    3120{
     21#if IS_DM3730
     22  const char* type = "dm3730-based";
     23#endif
     24#if IS_AM335X
     25  const char* type = "am335x-based";
     26#endif
    3227  bsp_interrupt_initialize();
     28  printk("\nRTEMS Beagleboard: %s\n", type);
    3329}
  • c/src/lib/libbsp/arm/beagle/startup/bspstarthooks.c

    r7a66986 r53dd6d61  
    1 /**
    2  * @file
     1/*
     2 * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
    33 *
    4  * @ingroup beagle
    5  *
    6  * @brief Startup code.
    7  */
    8 
    9 /*
    10  * Copyright (c) 2012 Claas Ziemke. All rights reserved.
    11  *
    12  *  Claas Ziemke
    13  *  Kernerstrasse 11
    14  *  70182 Stuttgart
     4 *  embedded brains GmbH
     5 *  Dornierstr. 4
     6 *  82178 Puchheim
    157 *  Germany
    16  *  <claas.ziemke@gmx.net>
     8 *  <info@embedded-brains.de>
    179 *
    1810 * The license and distribution terms for this file may be
    1911 * found in the file LICENSE in this distribution or at
    20  * http://www.rtems.com/license/LICENSE.
     12 * http://www.rtems.org/license/LICENSE.
    2113 */
    2214
    2315#include <bsp.h>
    2416#include <bsp/start.h>
    25 #include <bsp/beagle.h>
    26 #include <bsp/linker-symbols.h>
     17#include <bsp/arm-cp15-start.h>
     18#include <bsp/arm-a8core-start.h>
     19
    2720#include <bsp/uart-output-char.h>
    28 #include <libcpu/arm-cp15.h>
    29 
    30 #ifdef BEAGLE_DISABLE_READ_WRITE_DATA_CACHE
    31   #define BEAGLE_MMU_READ_WRITE_DATA BEAGLE_MMU_READ_WRITE
    32 #else
    33   #define BEAGLE_MMU_READ_WRITE_DATA BEAGLE_MMU_READ_WRITE_CACHED
    34 #endif
    35 
    36 #ifdef BEAGLE_DISABLE_READ_ONLY_PROTECTION
    37   #define BEAGLE_MMU_READ_ONLY_DATA BEAGLE_MMU_READ_WRITE_CACHED
    38   #define BEAGLE_MMU_CODE BEAGLE_MMU_READ_WRITE_CACHED
    39 #else
    40   #define BEAGLE_MMU_READ_ONLY_DATA BEAGLE_MMU_READ_ONLY_CACHED
    41   #define BEAGLE_MMU_CODE BEAGLE_MMU_READ_ONLY_CACHED
    42 #endif
    43 
    44 //LINKER_SYMBOL(beagle_translation_table_base);
    45 
    46 static BSP_START_TEXT_SECTION void clear_bss(void)
    47 {
    48   const int *end = (const int *) bsp_section_bss_end;
    49   int *out = (int *) bsp_section_bss_begin;
    50 
    51   /* Clear BSS */
    52   while (out != end) {
    53     *out = 0;
    54     ++out;
    55   }
    56 }
    57 
    58 /*#ifndef BEAGLE_DISABLE_MMU
    59   typedef struct {
    60     uint32_t begin;
    61     uint32_t end;
    62     uint32_t flags;
    63   } beagle_mmu_config;
    64 
    65   static const BSP_START_DATA_SECTION beagle_mmu_config
    66     beagle_mmu_config_table [] = {
    67     {
    68       .begin = (uint32_t) bsp_section_fast_text_begin,
    69       .end = (uint32_t) bsp_section_fast_text_end,
    70       .flags = BEAGLE_MMU_CODE
    71     }, {
    72       .begin = (uint32_t) bsp_section_fast_data_begin,
    73       .end = (uint32_t) bsp_section_fast_data_end,
    74       .flags = BEAGLE_MMU_READ_WRITE_DATA
    75 #ifdef BEAGLE_SCRATCH_AREA_SIZE
    76     }, {
    77       .begin = (uint32_t) &beagle_scratch_area [0],
    78       .end = (uint32_t) &beagle_scratch_area [BEAGLE_SCRATCH_AREA_SIZE],
    79       .flags = BEAGLE_MMU_READ_ONLY_DATA
    80 #endif
    81     }, {
    82       .begin = (uint32_t) bsp_section_start_begin,
    83       .end = (uint32_t) bsp_section_start_end,
    84       .flags = BEAGLE_MMU_CODE
    85     }, {
    86       .begin = (uint32_t) bsp_section_vector_begin,
    87       .end = (uint32_t) bsp_section_vector_end,
    88       .flags = BEAGLE_MMU_READ_WRITE_CACHED
    89     }, {
    90       .begin = (uint32_t) bsp_section_text_begin,
    91       .end = (uint32_t) bsp_section_text_end,
    92       .flags = BEAGLE_MMU_CODE
    93     }, {
    94       .begin = (uint32_t) bsp_section_rodata_begin,
    95       .end = (uint32_t) bsp_section_rodata_end,
    96       .flags = BEAGLE_MMU_READ_ONLY_DATA
    97     }, {
    98       .begin = (uint32_t) bsp_section_data_begin,
    99       .end = (uint32_t) bsp_section_data_end,
    100       .flags = BEAGLE_MMU_READ_WRITE_DATA
    101     }, {
    102       .begin = (uint32_t) bsp_section_bss_begin,
    103       .end = (uint32_t) bsp_section_bss_end,
    104       .flags = BEAGLE_MMU_READ_WRITE_DATA
    105     }, {
    106       .begin = (uint32_t) bsp_section_work_begin,
    107       .end = (uint32_t) bsp_section_work_end,
    108       .flags = BEAGLE_MMU_READ_WRITE_DATA
    109     }, {
    110       .begin = (uint32_t) bsp_section_stack_begin,
    111       .end = (uint32_t) bsp_section_stack_end,
    112       .flags = BEAGLE_MMU_READ_WRITE_DATA
    113     }, {
    114       .begin = 0x0U,
    115       .end = 0x100000U,
    116       .flags = BEAGLE_MMU_READ_ONLY_CACHED
    117     }, {
    118       .begin = 0x20000000U,
    119       .end = 0x200c0000U,
    120       .flags = BEAGLE_MMU_READ_WRITE
    121     }, {
    122       .begin = 0x30000000U,
    123       .end = 0x32000000U,
    124       .flags = BEAGLE_MMU_READ_WRITE
    125     }, {
    126       .begin = 0x40000000U,
    127       .end = 0x40100000U,
    128       .flags = BEAGLE_MMU_READ_WRITE
    129     }, {
    130       .begin = (uint32_t) beagle_magic_zero_begin,
    131       .end = (uint32_t) beagle_magic_zero_end,
    132       .flags = BEAGLE_MMU_READ_WRITE_DATA
    133     }
    134   };
    135 
    136   static BSP_START_TEXT_SECTION void set_translation_table_entries(
    137     uint32_t *ttb,
    138     const beagle_mmu_config *config
    139   )
    140   {
    141     uint32_t i = ARM_MMU_SECT_GET_INDEX(config->begin);
    142     uint32_t iend =
    143       ARM_MMU_SECT_GET_INDEX(ARM_MMU_SECT_MVA_ALIGN_UP(config->end));
    144 
    145     if (config->begin != config->end) {
    146       while (i < iend) {
    147         ttb [i] = (i << ARM_MMU_SECT_BASE_SHIFT) | config->flags;
    148         ++i;
    149       }
    150     }
    151   }
    152 
    153   static BSP_START_TEXT_SECTION void
    154     setup_translation_table_and_enable_mmu(uint32_t ctrl)
    155   {
    156     uint32_t const dac =
    157       ARM_CP15_DAC_DOMAIN(BEAGLE_MMU_CLIENT_DOMAIN, ARM_CP15_DAC_CLIENT);
    158     uint32_t *const ttb = (uint32_t *) beagle_translation_table_base;
    159     size_t const config_entry_count =
    160       sizeof(beagle_mmu_config_table) / sizeof(beagle_mmu_config_table [0]);
    161     size_t i = 0;
    162 
    163     arm_cp15_set_domain_access_control(dac);
    164     arm_cp15_set_translation_table_base(ttb);
    165 
    166     // Initialize translation table with invalid entries
    167     for (i = 0; i < ARM_MMU_TRANSLATION_TABLE_ENTRY_COUNT; ++i) {
    168       ttb [i] = 0;
    169     }
    170 
    171     for (i = 0; i < config_entry_count; ++i) {
    172       set_translation_table_entries(ttb, &beagle_mmu_config_table [i]);
    173     }
    174 
    175     // Enable MMU and cache
    176     ctrl |= ARM_CP15_CTRL_I | ARM_CP15_CTRL_C | ARM_CP15_CTRL_M;
    177     arm_cp15_set_control(ctrl);
    178   }
    179 #endif*/
    180 
    181 /*static BSP_START_TEXT_SECTION void setup_mmu_and_cache(void)
    182 {
    183   uint32_t ctrl = 0;
    184 
    185   // Disable MMU and cache, basic settings
    186   ctrl = arm_cp15_get_control();
    187   ctrl &= ~(ARM_CP15_CTRL_I | ARM_CP15_CTRL_R | ARM_CP15_CTRL_C
    188     | ARM_CP15_CTRL_V | ARM_CP15_CTRL_M);
    189   ctrl |= ARM_CP15_CTRL_S | ARM_CP15_CTRL_A;
    190   arm_cp15_set_control(ctrl);
    191 
    192   arm_cp15_cache_invalidate();
    193   arm_cp15_tlb_invalidate();
    194 
    195   #ifndef BEAGLE_DISABLE_MMU
    196     //setup_translation_table_and_enable_mmu(ctrl);
    197   #endif
    198 }*/
    199 
    200 /*BSP_START_TEXT_SECTION bool beagle_start_pll_setup(
    201   uint32_t hclkpll_ctrl,
    202   uint32_t hclkdiv_ctrl,
    203   bool force
    204 )
    205 {
    206   uint32_t pwr_ctrl = BEAGLE_PWR_CTRL;
    207   bool settings_ok =
    208     ((BEAGLE_HCLKPLL_CTRL ^ hclkpll_ctrl) & BSP_MSK32(1, 16)) == 0
    209       && ((BEAGLE_HCLKDIV_CTRL ^ hclkdiv_ctrl) & BSP_MSK32(0, 8)) == 0;
    210 
    211   if ((pwr_ctrl & PWR_NORMAL_RUN_MODE) == 0 || (!settings_ok && force)) {
    212     // Disable HCLK PLL output
    213     BEAGLE_PWR_CTRL = pwr_ctrl & ~PWR_NORMAL_RUN_MODE;
    214 
    215     // Configure HCLK PLL
    216     BEAGLE_HCLKPLL_CTRL = hclkpll_ctrl;
    217     while ((BEAGLE_HCLKPLL_CTRL & HCLK_PLL_LOCK) == 0) {
    218       // Wait
    219     }
    220 
    221     // Setup HCLK divider
    222     BEAGLE_HCLKDIV_CTRL = hclkdiv_ctrl;
    223 
    224     // Enable HCLK PLL output
    225     BEAGLE_PWR_CTRL = pwr_ctrl | PWR_NORMAL_RUN_MODE;
    226   }
    227 
    228   return settings_ok;
    229 }*/
    230 
    231 #if BEAGLE_OSCILLATOR_MAIN != 13000000U
    232   #error "unexpected main oscillator frequency"
    233 #endif
    234 
    235 /*static BSP_START_TEXT_SECTION void setup_pll(void)
    236 {
    237   uint32_t hclkpll_ctrl = BEAGLE_HCLKPLL_CTRL_INIT_VALUE;
    238   uint32_t hclkdiv_ctrl = BEAGLE_HCLKDIV_CTRL_INIT_VALUE;
    239 
    240   beagle_start_pll_setup(hclkpll_ctrl, hclkdiv_ctrl, false);
    241 }*/
    24221
    24322BSP_START_TEXT_SECTION void bsp_start_hook_0(void)
    24423{
    245   //setup_pll();
    246   //setup_mmu_and_cache();
    24724}
    248 
    249 /*static BSP_START_TEXT_SECTION void stop_dma_activities(void)
    250 {
    251   #ifdef BEAGLE_STOP_GPDMA
    252     BEAGLE_DO_STOP_GPDMA;
    253   #endif
    254 
    255   #ifdef BEAGLE_STOP_ETHERNET
    256     BEAGLE_DO_STOP_ETHERNET;
    257   #endif
    258 
    259   #ifdef BEAGLE_STOP_USB
    260     BEAGLE_DO_STOP_USB;
    261   #endif
    262 }*/
    263 
    264 static BSP_START_TEXT_SECTION void setup_uarts(void)
    265 {
    266   uint32_t uartclk_ctrl = 0;
    267 
    268   #ifdef BEAGLE_CONFIG_U3CLK
    269     uartclk_ctrl |= 1U << 0;
    270     BEAGLE_U3CLK = BEAGLE_CONFIG_U3CLK;
    271   #endif
    272   #ifdef BEAGLE_CONFIG_U4CLK
    273     uartclk_ctrl |= 1U << 1;
    274     BEAGLE_U4CLK = BEAGLE_CONFIG_U4CLK;
    275   #endif
    276   #ifdef BEAGLE_CONFIG_U5CLK
    277     uartclk_ctrl |= 1U << 2;
    278     BEAGLE_U5CLK = BEAGLE_CONFIG_U5CLK;
    279   #endif
    280   #ifdef BEAGLE_CONFIG_U6CLK
    281     uartclk_ctrl |= 1U << 3;
    282     BEAGLE_U6CLK = BEAGLE_CONFIG_U6CLK;
    283   #endif
    284 
    285   #ifdef BEAGLE_CONFIG_UART_CLKMODE
    286     BEAGLE_UART_CLKMODE = BEAGLE_CONFIG_UART_CLKMODE;
    287   #endif
    288 
    289   BEAGLE_UARTCLK_CTRL = uartclk_ctrl;
    290   BEAGLE_UART_CTRL = 0x0;
    291   BEAGLE_UART_LOOP = 0x0;
    292 
    293   #ifdef BEAGLE_CONFIG_U5CLK
    294     // Clock is already set in BEAGLE_U5CLK
    295     BSP_CONSOLE_UART_INIT(0x01);
    296   #endif
    297 }
    298 
    299 /*static BSP_START_TEXT_SECTION void setup_timer(void)
    300 {
    301   volatile beagle_timer *timer = BEAGLE_STANDARD_TIMER;
    302 
    303   BEAGLE_TIMCLK_CTRL1 = (1U << 2) | (1U << 3);
    304 
    305   timer->tcr = BEAGLE_TIMER_TCR_RST;
    306   timer->ctcr = 0x0;
    307   timer->pr = 0x0;
    308   timer->ir = 0xff;
    309   timer->mcr = 0x0;
    310   timer->ccr = 0x0;
    311   timer->tcr = BEAGLE_TIMER_TCR_EN;
    312 }*/
    31325
    31426BSP_START_TEXT_SECTION void bsp_start_hook_1(void)
    31527{
    316   //stop_dma_activities();
    317   setup_uarts();
    318   //setup_timer();
    319 
    320   // Copy .text section
    321   arm_cp15_instruction_cache_invalidate();
    322   bsp_start_memcpy(
    323     (int *) bsp_section_text_begin,
    324     (const int *) bsp_section_text_load_begin,
    325     (size_t) bsp_section_text_size
    326   );
    327 
    328   // Copy .rodata section
    329   arm_cp15_instruction_cache_invalidate();
    330   bsp_start_memcpy(
    331     (int *) bsp_section_rodata_begin,
    332     (const int *) bsp_section_rodata_load_begin,
    333     (size_t) bsp_section_rodata_size
    334   );
    335 
    336   // Copy .data section
    337   arm_cp15_instruction_cache_invalidate();
    338   bsp_start_memcpy(
    339     (int *) bsp_section_data_begin,
    340     (const int *) bsp_section_data_load_begin,
    341     (size_t) bsp_section_data_size
    342   );
    343 
    344   // Copy .fast_text section
    345   arm_cp15_instruction_cache_invalidate();
    346   bsp_start_memcpy(
    347     (int *) bsp_section_fast_text_begin,
    348     (const int *) bsp_section_fast_text_load_begin,
    349     (size_t) bsp_section_fast_text_size
    350   );
    351 
    352   // Copy .fast_data section
    353   arm_cp15_instruction_cache_invalidate();
    354   bsp_start_memcpy(
    355     (int *) bsp_section_fast_data_begin,
    356     (const int *) bsp_section_fast_data_load_begin,
    357     (size_t) bsp_section_fast_data_size
    358   );
    359 
    360   // Clear .bss section
    361   clear_bss();
    362 
    363 
    364 
    365   // At this point we can use objects outside the .start section
     28  arm_a8core_start_hook_1();
     29  bsp_start_copy_sections();
     30  beagle_setup_mmu_and_cache();
     31  bsp_start_clear_bss();
    36632}
  • c/src/lib/libbsp/arm/beagle/startup/linkcmds.beagle

    r7a66986 r53dd6d61  
    22 * @file
    33 *
    4  * @ingroup beagle_linker
     4 * @ingroup  arm_beagle
    55 *
    6  * @brief Memory map.
    7  */
    8 
    9 /**
    10  * @defgroup beagle_linker BeagleBoard Application Memory Map
    11  *
    12  * @ingroup bsp_linker
    13  *
    14  * @brief BeagleBoard application memory map.
    15  *
     6 * @brief Linker script for beagles.
    167 */
    178
    189MEMORY {
    19   RAM : ORIGIN = 0x80000000, LENGTH = 32M
    20   NIRVANA : ORIGIN = 0, LENGTH = 0
     10  /* Beagleboards and beaglebones all
     11   * have either 256M or 512M memory. We just
     12   * use 256M for all.
     13   */
     14  RAM      : ORIGIN = 0x80000000, LENGTH = 256M - 4M
     15  RAM_MMU  : ORIGIN = 0x80000000 + 256M - 4M, LENGTH = 16k
    2116}
    2217
    23 REGION_ALIAS ("REGION_START", RAM);
    24 REGION_ALIAS ("REGION_VECTOR", RAM);
    25 REGION_ALIAS ("REGION_TEXT", RAM);
    26 REGION_ALIAS ("REGION_TEXT_LOAD", RAM);
    27 REGION_ALIAS ("REGION_RODATA", RAM);
    28 REGION_ALIAS ("REGION_RODATA_LOAD", RAM);
    29 REGION_ALIAS ("REGION_DATA", RAM);
    30 REGION_ALIAS ("REGION_DATA_LOAD", RAM);
    31 REGION_ALIAS ("REGION_FAST_TEXT", RAM);
     18REGION_ALIAS ("REGION_START",          RAM);
     19REGION_ALIAS ("REGION_VECTOR",         RAM);
     20REGION_ALIAS ("REGION_TEXT",           RAM);
     21REGION_ALIAS ("REGION_TEXT_LOAD",      RAM);
     22REGION_ALIAS ("REGION_RODATA",         RAM);
     23REGION_ALIAS ("REGION_RODATA_LOAD",    RAM);
     24REGION_ALIAS ("REGION_DATA",           RAM);
     25REGION_ALIAS ("REGION_DATA_LOAD",      RAM);
     26REGION_ALIAS ("REGION_FAST_TEXT",      RAM);
    3227REGION_ALIAS ("REGION_FAST_TEXT_LOAD", RAM);
    33 REGION_ALIAS ("REGION_FAST_DATA", RAM);
     28REGION_ALIAS ("REGION_FAST_DATA",      RAM);
    3429REGION_ALIAS ("REGION_FAST_DATA_LOAD", RAM);
    35 REGION_ALIAS ("REGION_BSS", RAM);
    36 REGION_ALIAS ("REGION_WORK", RAM);
    37 REGION_ALIAS ("REGION_STACK", RAM);
    38 
    39 //beagle_scratch_area = ORIGIN (RAM_SCRATCH);
     30REGION_ALIAS ("REGION_BSS",            RAM);
     31REGION_ALIAS ("REGION_WORK",           RAM);
     32REGION_ALIAS ("REGION_STACK",          RAM);
    4033
    4134bsp_stack_irq_size = DEFINED (bsp_stack_irq_size) ? bsp_stack_irq_size : 4096;
     
    4437bsp_section_rwbarrier_align = DEFINED (bsp_section_rwbarrier_align) ? bsp_section_rwbarrier_align : 1M;
    4538
    46 beagle = 0x20020000;
     39bsp_vector_table_in_start_section = 1;
    4740
    48 beagle_magic_zero_begin = 0x05000000;
    49 beagle_magic_zero_end = 0x07000000;
    50 beagle_magic_zero_size = beagle_magic_zero_end - beagle_magic_zero_end;
     41bsp_translation_table_base = ORIGIN (RAM_MMU);
     42bsp_translation_table_end = ORIGIN (RAM_MMU) + LENGTH (RAM_MMU);
    5143
    5244INCLUDE linkcmds.armv4
Note: See TracChangeset for help on using the changeset viewer.