forked from Imagelibrary/rtems
2008-09-12 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac, startup/bspclean.c, startup/bspstart.c: Now support bsp_get_work_area() and used shared implementation of it and bsp_pretasking_hook.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2008-09-12 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* Makefile.am, configure.ac, startup/bspclean.c, startup/bspstart.c:
|
||||
Now support bsp_get_work_area() and used shared implementation of it
|
||||
and bsp_pretasking_hook.
|
||||
|
||||
2008-08-21 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* Makefile.am: No BSP should use exit.c as a file name. exit() is POSIX
|
||||
|
||||
@@ -26,9 +26,9 @@ project_lib_DATA = start.$(OBJEXT)
|
||||
dist_project_lib_DATA += startup/linkcmds
|
||||
|
||||
startup_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \
|
||||
../../shared/bsppredriverhook.c \
|
||||
startup/bspstart.c startup/bspclean.c startup/memmap.c \
|
||||
../../shared/bootcard.c ../../shared/sbrk.c \
|
||||
../../shared/bsppredriverhook.c ../shared/bspgetworkarea.c \
|
||||
../../shared/bsppretaskinghook.c startup/bspstart.c startup/bspclean.c \
|
||||
startup/memmap.c ../../shared/bootcard.c ../../shared/sbrk.c \
|
||||
../../shared/gnatinstallhandler.c
|
||||
console_SOURCES = console/uarts.c ../../shared/console.c
|
||||
abort_SOURCES = ../shared/abort/abort.c
|
||||
|
||||
@@ -18,6 +18,8 @@ RTEMS_PROG_CCAS
|
||||
RTEMS_CHECK_NETWORKING
|
||||
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
|
||||
|
||||
RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
|
||||
|
||||
# Explicitly list all Makefiles here
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <bsp.h>
|
||||
#include <rtems/bspIo.h>
|
||||
|
||||
@@ -34,92 +34,38 @@ extern void rtems_irq_mngt_init(void);
|
||||
void bsp_libc_init( void *, uint32_t, int );
|
||||
static void fix_mac_addr(void);
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* NAME: bsp_pretasking_hook - Function to setup system before startup */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function is called before drivers are initialized and used */
|
||||
/* to setup libc and BSP extensions. */
|
||||
/* */
|
||||
/* RESTRICTIONS/LIMITATIONS: */
|
||||
/* Since this function is setting up libc, it cannot use and libc */
|
||||
/* functions. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
void bsp_pretasking_hook(void)
|
||||
{
|
||||
uint32_t heap_start;
|
||||
uint32_t heap_size;
|
||||
|
||||
/*
|
||||
* Set up the heap.
|
||||
*/
|
||||
heap_start = free_mem_start;
|
||||
heap_size = free_mem_end - free_mem_start;
|
||||
|
||||
/* call rtems lib init - malloc stuff */
|
||||
bsp_libc_init((void *)heap_start, heap_size, 0);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* NAME: bsp_start_default - BSP initialization function */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function is called before RTEMS is initialized and used */
|
||||
/* adjust the kernel's configuration. */
|
||||
/* */
|
||||
/* This function also configures the CPU's memory protection unit. */
|
||||
/* */
|
||||
/* RESTRICTIONS/LIMITATIONS: */
|
||||
/* Since RTEMS is not configured, no RTEMS functions can be called. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
/*
|
||||
* bsp_start_default - BSP initialization function
|
||||
*
|
||||
* This function is called before RTEMS is initialized and used
|
||||
* adjust the kernel's configuration.
|
||||
*
|
||||
* This function also configures the CPU's memory protection unit.
|
||||
*
|
||||
* RESTRICTIONS/LIMITATIONS:
|
||||
* Since RTEMS is not configured, no RTEMS functions can be called.
|
||||
*/
|
||||
void bsp_start_default( void )
|
||||
{
|
||||
/* disable interrupts */
|
||||
AIC_CTL_REG(AIC_IDCR) = 0xffffffff;
|
||||
/* disable interrupts */
|
||||
AIC_CTL_REG(AIC_IDCR) = 0xffffffff;
|
||||
|
||||
/*
|
||||
* Some versions of the bootloader have the MAC address
|
||||
* reversed. This fixes it, if necessary.
|
||||
*/
|
||||
fix_mac_addr();
|
||||
/*
|
||||
* Some versions of the bootloader have the MAC address
|
||||
* reversed. This fixes it, if necessary.
|
||||
*/
|
||||
fix_mac_addr();
|
||||
|
||||
/* Place RTEMS workspace at beginning of free memory. */
|
||||
Configuration.work_space_start = (void *)&_bss_free_start;
|
||||
/*
|
||||
* Init rtems exceptions management
|
||||
*/
|
||||
rtems_exception_init_mngt();
|
||||
|
||||
/*
|
||||
* Init rtems interrupt management
|
||||
*/
|
||||
rtems_irq_mngt_init();
|
||||
|
||||
free_mem_start = ((uint32_t)&_bss_free_start +
|
||||
rtems_configuration_get_work_space_size());
|
||||
|
||||
free_mem_end = ((uint32_t)&_sdram_base + (uint32_t)&_sdram_size);
|
||||
|
||||
|
||||
/*
|
||||
* Init rtems exceptions management
|
||||
*/
|
||||
rtems_exception_init_mngt();
|
||||
|
||||
/*
|
||||
* Init rtems interrupt management
|
||||
*/
|
||||
rtems_irq_mngt_init();
|
||||
|
||||
/*
|
||||
* The following information is very useful when debugging.
|
||||
*/
|
||||
#if 0
|
||||
printk( "work_space_size = 0x%x\n\r",
|
||||
rtems_configuration_get_work_space_size() );
|
||||
printk( "microseconds_per_tick = 0x%x\n\r",
|
||||
rtems_configuration_get_microseconds_per_tick() );
|
||||
printk( "ticks_per_timeslice = 0x%x\n\r",
|
||||
rtems_configuration_get_ticks_per_timeslice() );
|
||||
printk( "work_space_size = 0x%x\n\r",
|
||||
rtems_configuration_get_work_space_size() );
|
||||
#endif
|
||||
} /* bsp_start */
|
||||
|
||||
/*
|
||||
@@ -129,26 +75,26 @@ void bsp_start_default( void )
|
||||
*/
|
||||
static void fix_mac_addr(void)
|
||||
{
|
||||
uint8_t addr[6];
|
||||
uint8_t addr[6];
|
||||
|
||||
/* Read the MAC address */
|
||||
addr[0] = (EMAC_REG(EMAC_SA1L) >> 0) & 0xff;
|
||||
addr[1] = (EMAC_REG(EMAC_SA1L) >> 8) & 0xff;
|
||||
addr[2] = (EMAC_REG(EMAC_SA1L) >> 16) & 0xff;
|
||||
addr[3] = (EMAC_REG(EMAC_SA1L) >> 24) & 0xff;
|
||||
addr[4] = (EMAC_REG(EMAC_SA1H) >> 0) & 0xff;
|
||||
addr[5] = (EMAC_REG(EMAC_SA1H) >> 8) & 0xff;
|
||||
/* Read the MAC address */
|
||||
addr[0] = (EMAC_REG(EMAC_SA1L) >> 0) & 0xff;
|
||||
addr[1] = (EMAC_REG(EMAC_SA1L) >> 8) & 0xff;
|
||||
addr[2] = (EMAC_REG(EMAC_SA1L) >> 16) & 0xff;
|
||||
addr[3] = (EMAC_REG(EMAC_SA1L) >> 24) & 0xff;
|
||||
addr[4] = (EMAC_REG(EMAC_SA1H) >> 0) & 0xff;
|
||||
addr[5] = (EMAC_REG(EMAC_SA1H) >> 8) & 0xff;
|
||||
|
||||
/* Check which 3 bytes have Cogent's OUI */
|
||||
if ((addr[5] == 0x00) && (addr[4] == 0x23) && (addr[3] == 0x31)) {
|
||||
EMAC_REG(EMAC_SA1L) = ((addr[5] << 0) |
|
||||
(addr[4] << 8) |
|
||||
(addr[3] << 16) |
|
||||
(addr[2] << 24));
|
||||
/* Check which 3 bytes have Cogent's OUI */
|
||||
if ((addr[5] == 0x00) && (addr[4] == 0x23) && (addr[3] == 0x31)) {
|
||||
EMAC_REG(EMAC_SA1L) = ((addr[5] << 0) |
|
||||
(addr[4] << 8) |
|
||||
(addr[3] << 16) |
|
||||
(addr[2] << 24));
|
||||
|
||||
EMAC_REG(EMAC_SA1H) = ((addr[1] << 0) |
|
||||
(addr[0] << 8));
|
||||
}
|
||||
EMAC_REG(EMAC_SA1H) = ((addr[1] << 0) |
|
||||
(addr[0] << 8));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +104,7 @@ static void fix_mac_addr(void)
|
||||
*/
|
||||
void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));
|
||||
|
||||
/**
|
||||
/*
|
||||
* Reset the system.
|
||||
*
|
||||
* This functions enables the watchdog and waits for it to
|
||||
@@ -166,12 +112,12 @@ void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));
|
||||
*/
|
||||
void bsp_reset(void)
|
||||
{
|
||||
rtems_interrupt_level level;
|
||||
rtems_interrupt_level level;
|
||||
|
||||
rtems_interrupt_disable(level);
|
||||
rtems_interrupt_disable(level);
|
||||
|
||||
/* Enable the watchdog timer, then wait for the world to end. */
|
||||
ST_REG(ST_WDMR) = ST_WDMR_RSTEN | 1;
|
||||
/* Enable the watchdog timer, then wait for the world to end. */
|
||||
ST_REG(ST_WDMR) = ST_WDMR_RSTEN | 1;
|
||||
|
||||
while(1);
|
||||
while(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user