forked from Imagelibrary/rtems
2000-09-13 Emmanuel Raguet <raguet@crf.canon.fr>
* vegaplus BSP submitted by Emmanuel Raguet <raguet@crf.canon.fr> and Eric Valette <valette@crf.canon.fr>. * vegaplus/bsp_specs, configure.in, console/Makefile.am, include/Makefile.am, include/bsp.h, include/registers.h, irq/Makefile.am, irq/bsp_irq_asm.S, irq/bsp_irq_init.c, irq/irq.c, irq/irq.h, start/Makefile.am, start/start.S, startup/Makefile.am, startup/bspstart.c, startup/exit.c, startup/linkcmds, wrapup/Makefile.am: New files.
This commit is contained in:
13
c/src/lib/libbsp/arm/vegaplus/.cvsignore
Normal file
13
c/src/lib/libbsp/arm/vegaplus/.cvsignore
Normal file
@@ -0,0 +1,13 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
config.cache
|
||||
config.guess
|
||||
config.log
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
depcomp
|
||||
install-sh
|
||||
missing
|
||||
mkinstalldirs
|
||||
4
c/src/lib/libbsp/arm/vegaplus/ChangeLog
Normal file
4
c/src/lib/libbsp/arm/vegaplus/ChangeLog
Normal file
@@ -0,0 +1,4 @@
|
||||
2000-09-13 Emmanuel Raguet <raguet@crf.canon.fr>
|
||||
|
||||
* vegaplus BSP submitted by Emmanuel Raguet <raguet@crf.canon.fr> and
|
||||
Eric Valette <valette@crf.canon.fr>.
|
||||
15
c/src/lib/libbsp/arm/vegaplus/Makefile.am
Normal file
15
c/src/lib/libbsp/arm/vegaplus/Makefile.am
Normal file
@@ -0,0 +1,15 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
|
||||
|
||||
# wrapup is the one that actually builds and installs the library
|
||||
# from the individual .rel files built in other directories
|
||||
SUBDIRS = . include console startup start irq wrapup
|
||||
|
||||
EXTRA_DIST = bsp_specs
|
||||
|
||||
include $(top_srcdir)/../../../../../../automake/subdirs.am
|
||||
include $(top_srcdir)/../../../../../../automake/local.am
|
||||
23
c/src/lib/libbsp/arm/vegaplus/bsp_specs
Normal file
23
c/src/lib/libbsp/arm/vegaplus/bsp_specs
Normal file
@@ -0,0 +1,23 @@
|
||||
%rename cpp old_cpp
|
||||
%rename lib old_lib
|
||||
%rename endfile old_endfile
|
||||
%rename startfile old_startfile
|
||||
%rename link old_link
|
||||
|
||||
*cpp:
|
||||
%(old_cpp) %{qrtems: -D__embedded__ -DUSE_ENHANCED_INTR_API} -Asystem(embedded)
|
||||
|
||||
*lib:
|
||||
%{!qrtems: %(old_lib)} %{qrtems: --start-group \
|
||||
%{!qrtems_debug: -lrtemsall} %{qrtems_debug: -lrtemsall_g} \
|
||||
-lc -lgcc --end-group \
|
||||
%{!qnolinkcmds: -T linkcmds%s}}
|
||||
|
||||
*startfile:
|
||||
%{!qrtems: %(old_startfile)} %{qrtems: \
|
||||
%{!qrtems_debug: start.o%s crtbegin.o%s} \
|
||||
%{qrtems_debug: start_g.o%s crtbegin.o%s}}
|
||||
|
||||
*link:
|
||||
%{!qrtems: %(old_link)} %{qrtems: -Qy -dp -Bstatic -T linkcmds%s -e _start}
|
||||
|
||||
43
c/src/lib/libbsp/arm/vegaplus/configure.in
Normal file
43
c/src/lib/libbsp/arm/vegaplus/configure.in
Normal file
@@ -0,0 +1,43 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
dnl $Id$
|
||||
|
||||
AC_PREREQ(2.13)
|
||||
AC_INIT(bsp_specs)
|
||||
RTEMS_TOP(../../../../../..)
|
||||
AC_CONFIG_AUX_DIR(../../../../../..)
|
||||
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
AM_INIT_AUTOMAKE(rtems-c-src-lib-libbsp-arm-vegaplus,$RTEMS_VERSION,no)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
RTEMS_PROG_CC_FOR_TARGET
|
||||
RTEMS_CANONICALIZE_TOOLS
|
||||
|
||||
RTEMS_ENV_RTEMSBSP
|
||||
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
|
||||
RTEMS_CHECK_BSP_CACHE(RTEMS_BSP)
|
||||
RTEMS_CHECK_NETWORKING
|
||||
RTEMS_CANONICAL_HOST
|
||||
|
||||
dnl if this is an i386, does gas have good code16 support?
|
||||
RTEMS_I386_GAS_CODE16
|
||||
AM_CONDITIONAL(RTEMS_GAS_CODE16,test "$RTEMS_GAS_CODE16" = "yes");
|
||||
|
||||
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
|
||||
|
||||
AC_CONFIG_SUBDIRS(tools)
|
||||
|
||||
AC_SUBST(RTEMS_BSP)
|
||||
|
||||
RTEMS_PROJECT_ROOT
|
||||
|
||||
# Explicitly list all Makefiles here
|
||||
AC_OUTPUT(
|
||||
Makefile
|
||||
console/Makefile
|
||||
include/Makefile
|
||||
irq/Makefile
|
||||
start/Makefile
|
||||
startup/Makefile
|
||||
wrapup/Makefile)
|
||||
2
c/src/lib/libbsp/arm/vegaplus/console/.cvsignore
Normal file
2
c/src/lib/libbsp/arm/vegaplus/console/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
32
c/src/lib/libbsp/arm/vegaplus/console/Makefile.am
Normal file
32
c/src/lib/libbsp/arm/vegaplus/console/Makefile.am
Normal file
@@ -0,0 +1,32 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
VPATH = @srcdir@/../../shared/comm:@srcdir@/../../shared/io
|
||||
|
||||
PGM = $(ARCH)/console.rel
|
||||
|
||||
C_FILES = uart.c console.c printk.c
|
||||
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
|
||||
|
||||
H_FILES = uart.h bspio.h
|
||||
|
||||
console_rel_OBJECTS = $(C_FILES:%.c=$(ARCH)/%.o)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../../../../../../automake/lib.am
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
$(PGM): $(console_rel_OBJECTS)
|
||||
$(make-rel)
|
||||
|
||||
all: $(ARCH) $(console_rel_OBJECTS) $(PGM)
|
||||
|
||||
.PRECIOUS: $(PGM)
|
||||
|
||||
include $(top_srcdir)/../../../../../../automake/local.am
|
||||
2
c/src/lib/libbsp/arm/vegaplus/include/.cvsignore
Normal file
2
c/src/lib/libbsp/arm/vegaplus/include/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
24
c/src/lib/libbsp/arm/vegaplus/include/Makefile.am
Normal file
24
c/src/lib/libbsp/arm/vegaplus/include/Makefile.am
Normal file
@@ -0,0 +1,24 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
H_FILES = bsp.h registers.h
|
||||
|
||||
$(PROJECT_INCLUDE):
|
||||
$(mkinstalldirs) $@
|
||||
|
||||
$(PROJECT_INCLUDE)/%.h: %.h
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
$(PROJECT_INCLUDE)/coverhd.h: $(top_srcdir)/../../shared/include/coverhd.h
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE) $(H_FILES:%.h=$(PROJECT_INCLUDE)/%.h)
|
||||
|
||||
all: $(PREINSTALL_FILES)
|
||||
|
||||
EXTRA_DIST = bspio.h bsp.h uart.h registers.h
|
||||
|
||||
include $(top_srcdir)/../../../../../../automake/local.am
|
||||
33
c/src/lib/libbsp/arm/vegaplus/include/bsp.h
Normal file
33
c/src/lib/libbsp/arm/vegaplus/include/bsp.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*-------------------------------------------------------------------------+
|
||||
| bsp.h - ARM BSP
|
||||
+--------------------------------------------------------------------------+
|
||||
| This include file contains definitions related to the ARM BSP.
|
||||
+--------------------------------------------------------------------------+
|
||||
|
|
||||
| Copyright (c) Canon Research France SA.]
|
||||
| Emmanuel Raguet, mailto:raguet@crf.canon.fr
|
||||
|
|
||||
| The license and distribution terms for this file may be
|
||||
| found in found in the file LICENSE in this distribution or at
|
||||
| http://www.OARcorp.com/rtems/license.html.
|
||||
|
|
||||
| $Id$
|
||||
+--------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifndef __BSP_H_
|
||||
#define __BSP_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems.h>
|
||||
#include <iosupp.h>
|
||||
#include <console.h>
|
||||
#include <clockdrv.h>
|
||||
|
||||
|
||||
#endif /* __BSP_H_ */
|
||||
/* end of include file */
|
||||
|
||||
1133
c/src/lib/libbsp/arm/vegaplus/include/registers.h
Normal file
1133
c/src/lib/libbsp/arm/vegaplus/include/registers.h
Normal file
File diff suppressed because it is too large
Load Diff
2
c/src/lib/libbsp/arm/vegaplus/irq/.cvsignore
Normal file
2
c/src/lib/libbsp/arm/vegaplus/irq/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
44
c/src/lib/libbsp/arm/vegaplus/irq/Makefile.am
Normal file
44
c/src/lib/libbsp/arm/vegaplus/irq/Makefile.am
Normal file
@@ -0,0 +1,44 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
VPATH = @srcdir@:@srcdir@/../../shared/irq
|
||||
|
||||
PGM = $(ARCH)/irq.rel
|
||||
|
||||
C_FILES = irq.c irq_init.c bsp_irq_init.c
|
||||
S_FILES = irq_asm.S bsp_irq_asm.S
|
||||
H_FILES = irq.h
|
||||
|
||||
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
|
||||
S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.o)
|
||||
|
||||
irq_rel_OBJECTS = $(C_O_FILES) $(S_O_FILES)
|
||||
|
||||
$(PROJECT_INCLUDE):
|
||||
$(mkinstalldirs) $@
|
||||
|
||||
$(PROJECT_INCLUDE)/%.h: %.h
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE) $(H_FILES:%.h=$(PROJECT_INCLUDE)/%.h)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../../../../../../automake/lib.am
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
$(PGM): $(startup_rel_OBJECTS)
|
||||
$(make-rel)
|
||||
|
||||
all: $(PREINSTALL_FILES) $(ARCH) $(irq_rel_OBJECTS) $(PGM)
|
||||
|
||||
.PRECIOUS: $(PGM)
|
||||
|
||||
EXTRA_DIST = irq.c bsp_irq_init.c bsp_irq_asm.S
|
||||
|
||||
include $(top_srcdir)/../../../../../../automake/local.am
|
||||
67
c/src/lib/libbsp/arm/vegaplus/irq/bsp_irq_asm.S
Normal file
67
c/src/lib/libbsp/arm/vegaplus/irq/bsp_irq_asm.S
Normal file
@@ -0,0 +1,67 @@
|
||||
/* bsp_irq_asm.S
|
||||
*
|
||||
* This file contains the implementation of the IRQ handler
|
||||
* for a specific BSP
|
||||
*
|
||||
* CopyRight (C) 2000 Canon Research France SA.
|
||||
* Emmanuel Raguet, mailto:raguet@crf.canon.fr
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
*/
|
||||
|
||||
#define __asm__
|
||||
#include <registers.h>
|
||||
|
||||
/*
|
||||
* Function to obtain, execute an IT handler and acknowledge the IT
|
||||
*/
|
||||
|
||||
.globl ExecuteITHandler
|
||||
|
||||
ExecuteITHandler :
|
||||
ldr r0, =INTPHAI3 /* read the vector number */
|
||||
ldr r0, [r0]
|
||||
ldr r0, [r0] /* extract the IT handler @ */
|
||||
|
||||
/*
|
||||
* re-enable interrupts at processor level as the current
|
||||
* interrupt source is now masked via VEGA logic
|
||||
*/
|
||||
mrs r1, cpsr
|
||||
and r1, r1, #0xFFFFFF3F
|
||||
msr cpsr, r1
|
||||
|
||||
stmdb sp!,{lr}
|
||||
ldr lr, =IRQ_return /* prepare the return from handler */
|
||||
mov pc, r0 /* EXECUTE INT HANDLER */
|
||||
|
||||
IRQ_return:
|
||||
ldmia sp!,{lr}
|
||||
ldr r2, =INTSTAT3 /* Ack the interrupt */
|
||||
ldr r2, [r2]
|
||||
ldr r1, =INTACK3
|
||||
str r2, [r1]
|
||||
/*
|
||||
* disable interrupts_again and switch back to SVC mode
|
||||
*/
|
||||
mrs r0, cpsr
|
||||
orr r0, r0, #0xc3
|
||||
msr cpsr, r0
|
||||
|
||||
b ReturnFromHandler /* return to ISR handler */
|
||||
|
||||
/*
|
||||
* Function to acknowledge the IT controller
|
||||
*/
|
||||
.globl AckControler
|
||||
|
||||
AckControler:
|
||||
ldr r0, =INTEOI3
|
||||
mov r1, #EOI
|
||||
str r1, [r0]
|
||||
|
||||
b ReturnFromAck /* return to ISR handler */
|
||||
|
||||
39
c/src/lib/libbsp/arm/vegaplus/irq/bsp_irq_init.c
Normal file
39
c/src/lib/libbsp/arm/vegaplus/irq/bsp_irq_init.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/* irq_init.c
|
||||
*
|
||||
* This file contains the implementation of rtems initialization
|
||||
* related to interrupt handling.
|
||||
*
|
||||
* CopyRight (C) 2000 Canon Research Centre France SA.
|
||||
* Emmanuel Raguet, mailto:raguet@crf.canon.fr
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
#include <irq.h>
|
||||
#include <bsp.h>
|
||||
#include <registers.h>
|
||||
|
||||
|
||||
void BSP_rtems_irq_mngt_init() {
|
||||
|
||||
/* Initialize the vector table address in internal RAM */
|
||||
Regs[INTTAB] = VECTOR_TABLE;
|
||||
|
||||
/* Initialize the GLOBAL INT CONTROL register */
|
||||
Regs[INTGCNTL] = 0x00;
|
||||
|
||||
/* Mask all the interrupts */
|
||||
Regs[INTMASK] = 0xFFFF;
|
||||
|
||||
/* Unmask the 2 arm interrupts IRQ and FIQ on the INT controller */
|
||||
Regs[INTMASKALL] = 0x0;
|
||||
|
||||
/* Ack pending interrupt */
|
||||
while ( ( Regs[INTSTAT] & 0xF433 ) != 0 ) {
|
||||
Regs[INTACK] = 0xFFFF;
|
||||
Regs[INTEOI] = EOI;
|
||||
}
|
||||
}
|
||||
137
c/src/lib/libbsp/arm/vegaplus/irq/irq.c
Normal file
137
c/src/lib/libbsp/arm/vegaplus/irq/irq.c
Normal file
@@ -0,0 +1,137 @@
|
||||
/* irq.c
|
||||
*
|
||||
* This file contains the implementation of the function described in irq.h
|
||||
*
|
||||
* CopyRight (C) 2000 Canon Research France SA.
|
||||
* Emmanuel Raguet, mailto:raguet@crf.canon.fr
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <bsp.h>
|
||||
#include <irq.h>
|
||||
#include <registers.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/apiext.h>
|
||||
|
||||
|
||||
/*
|
||||
* This function check that the value given for the irq line
|
||||
* is valid.
|
||||
*/
|
||||
|
||||
static int isValidInterrupt(int irq)
|
||||
{
|
||||
if ( (irq < 0) || (irq > BSP_MAX_INT))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------------------ RTEMS Single Irq Handler Mngt Routines ----------------
|
||||
*/
|
||||
|
||||
int BSP_install_rtems_irq_handler (const rtems_irq_connect_data* irq)
|
||||
{
|
||||
rtems_irq_hdl *HdlTable;
|
||||
|
||||
if (!isValidInterrupt(irq->name)) {
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Check if default handler is actually connected. If not issue an error.
|
||||
*/
|
||||
HdlTable = VECTOR_TABLE;
|
||||
if (*(HdlTable + irq->name) != default_int_handler) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
_CPU_ISR_Disable(level);
|
||||
|
||||
/*
|
||||
* store the new handler
|
||||
*/
|
||||
*(HdlTable + irq->name) = irq->hdl;
|
||||
|
||||
/*
|
||||
* initialize the control register for the concerned interrupt
|
||||
*/
|
||||
Regs[(INTCNTL0 + irq->name)] = (long)(irq->irqTrigger) | (long)(irq->irqLevel) ;
|
||||
|
||||
/*
|
||||
* ack pending interrupt
|
||||
*/
|
||||
Regs[INTACK] |= (long)(1 << irq->name);
|
||||
|
||||
/*
|
||||
* unmask at INT controler level level
|
||||
*/
|
||||
Regs[INTMASK] &= ~(long)(1 << irq->name);
|
||||
|
||||
/*
|
||||
* Enable interrupt on device
|
||||
*/
|
||||
irq->on(irq);
|
||||
|
||||
_CPU_ISR_Enable(level);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data* irq)
|
||||
{
|
||||
rtems_irq_hdl *HdlTable;
|
||||
|
||||
if (!isValidInterrupt(irq->name)) {
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Check if the handler is actually connected. If not issue an error.
|
||||
*/
|
||||
HdlTable = VECTOR_TABLE;
|
||||
if (*(HdlTable + irq->name) != irq->hdl) {
|
||||
return 0;
|
||||
}
|
||||
_CPU_ISR_Disable(level);
|
||||
|
||||
/*
|
||||
* mask at INT controller level
|
||||
*/
|
||||
Regs[INTMASK] |= (long)(1 << irq->name);
|
||||
|
||||
/*
|
||||
* Disable interrupt on device
|
||||
*/
|
||||
irq->off(irq);
|
||||
|
||||
/*
|
||||
* restore the default irq value
|
||||
*/
|
||||
*(HdlTable + irq->name) = default_int_handler;
|
||||
|
||||
_CPU_ISR_Enable(level);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _ThreadProcessSignalsFromIrq (CPU_Exception_frame* ctx)
|
||||
{
|
||||
/*
|
||||
* Process pending signals that have not already been
|
||||
* processed by _Thread_Displatch. This happens quite
|
||||
* unfrequently : the ISR must have posted an action
|
||||
* to the current running thread.
|
||||
*/
|
||||
if ( _Thread_Do_post_task_switch_extension ||
|
||||
_Thread_Executing->do_post_task_switch_extension ) {
|
||||
_Thread_Executing->do_post_task_switch_extension = FALSE;
|
||||
_API_extensions_Run_postswitch();
|
||||
}
|
||||
}
|
||||
193
c/src/lib/libbsp/arm/vegaplus/irq/irq.h
Normal file
193
c/src/lib/libbsp/arm/vegaplus/irq/irq.h
Normal file
@@ -0,0 +1,193 @@
|
||||
/* irq.h
|
||||
*
|
||||
* This include file describe the data structure and the functions implemented
|
||||
* by rtems to write interrupt handlers.
|
||||
*
|
||||
* Copyright (c) 2000 Canon Research Centre France SA.
|
||||
* Emmanuel Raguet, mailto:raguet@crf.canon.fr
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _IRQ_H_
|
||||
#define _IRQ_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Include some preprocessor value also used by assember code
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
extern void default_int_handler();
|
||||
/*-------------------------------------------------------------------------+
|
||||
| Constants
|
||||
+--------------------------------------------------------------------------*/
|
||||
|
||||
typedef enum {
|
||||
BSP_DECT_CORE = 0,
|
||||
BSP_PCM = 1,
|
||||
BSP_UART = 2,
|
||||
BSP_RESERVED1 = 3,
|
||||
BSP_TIMER_0 = 4,
|
||||
BSP_TIMER_1 = 5,
|
||||
BSP_RESERVED2 = 6,
|
||||
BSP_RESERVED3 = 7,
|
||||
BSP_LCD = 8,
|
||||
BSP_KPAD = 9,
|
||||
BSP_TAD = 10,
|
||||
BSP_ADC = 11,
|
||||
BSP_EXT_0 = 12,
|
||||
BSP_EXT_1 = 13,
|
||||
BSP_EXT_2 = 14,
|
||||
BSP_EXT_3 = 15,
|
||||
BSP_MAX_INT = 16
|
||||
} rtems_irq_symbolic_name;
|
||||
|
||||
#define LEVEL_EDGE_MASK 0xC0
|
||||
#define LEVEL_LOW 0x00
|
||||
#define LEVEL_HIGH 0x40
|
||||
#define EDGE_FALLING 0x80
|
||||
#define EDGE_RISING 0xC0
|
||||
|
||||
#define PRIO_MASK 0x07
|
||||
|
||||
#define LEVEL_MASK 0x07
|
||||
|
||||
#define MASKIRQ 0x80
|
||||
#define MASKFIQ 0x40
|
||||
|
||||
#define END_OF_INT 0x80
|
||||
|
||||
#define VECTOR_TABLE 0x40
|
||||
|
||||
/*
|
||||
* Type definition for RTEMS managed interrupts
|
||||
*/
|
||||
typedef unsigned char rtems_irq_level;
|
||||
typedef unsigned char rtems_irq_trigger;
|
||||
|
||||
struct __rtems_irq_connect_data__; /* forward declaratiuon */
|
||||
|
||||
typedef void (*rtems_irq_hdl) (void);
|
||||
typedef void (*rtems_irq_enable) (const struct __rtems_irq_connect_data__*);
|
||||
typedef void (*rtems_irq_disable) (const struct __rtems_irq_connect_data__*);
|
||||
typedef int (*rtems_irq_is_enabled) (const struct __rtems_irq_connect_data__*);
|
||||
|
||||
typedef struct __rtems_irq_connect_data__ {
|
||||
/*
|
||||
* IRQ line
|
||||
*/
|
||||
rtems_irq_symbolic_name name;
|
||||
/*
|
||||
* handler. See comment on handler properties below in function prototype.
|
||||
*/
|
||||
rtems_irq_hdl hdl;
|
||||
/*
|
||||
* function for enabling interrupts at device level (ONLY!).
|
||||
* The BSP code will automatically enable it at i8259s level.
|
||||
* RATIONALE : anyway such code has to exist in current driver code.
|
||||
* It is usually called immediately AFTER connecting the interrupt handler.
|
||||
* RTEMS may well need such a function when restoring normal interrupt
|
||||
* processing after a debug session.
|
||||
*
|
||||
*/
|
||||
rtems_irq_enable on;
|
||||
/*
|
||||
* function for disabling interrupts at device level (ONLY!).
|
||||
* The code will disable it at i8259s level. RATIONALE : anyway
|
||||
* such code has to exist for clean shutdown. It is usually called
|
||||
* BEFORE disconnecting the interrupt. RTEMS may well need such
|
||||
* a function when disabling normal interrupt processing for
|
||||
* a debug session. May well be a NOP function.
|
||||
*/
|
||||
rtems_irq_disable off;
|
||||
/*
|
||||
* function enabling to know what interrupt may currently occur
|
||||
* if someone manipulates the i8259s interrupt mask without care...
|
||||
*/
|
||||
rtems_irq_is_enabled isOn;
|
||||
/*
|
||||
* priority level at the vplus level
|
||||
*/
|
||||
rtems_irq_level irqLevel;
|
||||
/*
|
||||
* Trigger way : Rising or falling edge or High or low level
|
||||
*/
|
||||
rtems_irq_trigger irqTrigger;
|
||||
} rtems_irq_connect_data;
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| Function Prototypes.
|
||||
+--------------------------------------------------------------------------*/
|
||||
/*
|
||||
* ------------------------ RTEMS Single Irq Handler Mngt Routines ----------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* function to initialize the interrupt for a specific BSP
|
||||
*/
|
||||
void BSP_rtems_irq_mngt_init();
|
||||
|
||||
|
||||
/*
|
||||
* function to connect a particular irq handler. This hanlder will NOT be called
|
||||
* directly as the result of the corresponding interrupt. Instead, a RTEMS
|
||||
* irq prologue will be called that will :
|
||||
*
|
||||
* 1) save the C scratch registers,
|
||||
* 2) switch to a interrupt stack if the interrupt is not nested,
|
||||
* 3) store the current i8259s' interrupt masks
|
||||
* 4) modify them to disable the current interrupt at 8259 level (and may
|
||||
* be others depending on software priorities)
|
||||
* 5) aknowledge the i8259s',
|
||||
* 6) demask the processor,
|
||||
* 7) call the application handler
|
||||
*
|
||||
* As a result the hdl function provided
|
||||
*
|
||||
* a) can perfectly be written is C,
|
||||
* b) may also well directly call the part of the RTEMS API that can be used
|
||||
* from interrupt level,
|
||||
* c) It only responsible for handling the jobs that need to be done at
|
||||
* the device level including (aknowledging/re-enabling the interrupt at device,
|
||||
* level, getting the data,...)
|
||||
*
|
||||
* When returning from the function, the following will be performed by
|
||||
* the RTEMS irq epilogue :
|
||||
*
|
||||
* 1) masks the interrupts again,
|
||||
* 2) restore the original i8259s' interrupt masks
|
||||
* 3) switch back on the orinal stack if needed,
|
||||
* 4) perform rescheduling when necessary,
|
||||
* 5) restore the C scratch registers...
|
||||
* 6) restore initial execution flow
|
||||
*
|
||||
*/
|
||||
|
||||
int BSP_install_rtems_irq_handler (const rtems_irq_connect_data*);
|
||||
/*
|
||||
* function to get the current RTEMS irq handler for ptr->name. It enables to
|
||||
* define hanlder chain...
|
||||
*/
|
||||
int BSP_get_current_rtems_irq_handler (rtems_irq_connect_data* ptr);
|
||||
/*
|
||||
* function to get disconnect the RTEMS irq handler for ptr->name.
|
||||
* This function checks that the value given is the current one for safety reason.
|
||||
* The user can use the previous function to get it.
|
||||
*/
|
||||
int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data*);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _IRQ_H_ */
|
||||
/* end of include file */
|
||||
2
c/src/lib/libbsp/arm/vegaplus/start/.cvsignore
Normal file
2
c/src/lib/libbsp/arm/vegaplus/start/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
33
c/src/lib/libbsp/arm/vegaplus/start/Makefile.am
Normal file
33
c/src/lib/libbsp/arm/vegaplus/start/Makefile.am
Normal file
@@ -0,0 +1,33 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
PGMS = $(ARCH)/start.o
|
||||
|
||||
S_FILES = start.S
|
||||
S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.o)
|
||||
|
||||
OBJS = $(S_O_FILES)
|
||||
|
||||
TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../../../../../../automake/lib.am
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
LINKCMDS = $(top_srcdir)/startup/linkcmds
|
||||
|
||||
$(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o: $(ARCH)/start.o
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
|
||||
all: $(ARCH) $(OBJS) $(TMPINSTALL_FILES)
|
||||
|
||||
EXTRA_DIST = start.S
|
||||
|
||||
include $(top_srcdir)/../../../../../../automake/local.am
|
||||
251
c/src/lib/libbsp/arm/vegaplus/start/start.S
Normal file
251
c/src/lib/libbsp/arm/vegaplus/start/start.S
Normal file
@@ -0,0 +1,251 @@
|
||||
/*
|
||||
* start.S : RTEMS entry point
|
||||
*
|
||||
* Copyright (C) 2000 Canon Research Centre France SA.
|
||||
* Emmanuel Raguet, mailto:raguet@crf.canon.fr
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Register definition */
|
||||
|
||||
.equ CNTL_BASE_ADR, 0xF3000 /* Base address of registers */
|
||||
.equ PORTCNTL, 0x0C60
|
||||
.equ CSCNTL0_0, 0x0C00 /* Offset of CS0CNTL */
|
||||
.equ CSCNTL0_1, 0x0C04 /* Offset of CS0CNTL */
|
||||
.equ CSCNTL0_2, 0x0C08 /* Offset of CS0CNTL */
|
||||
.equ CSCNTL1_0, 0x0C20 /* Offset of CS0CNTL */
|
||||
.equ CSCNTL1_1, 0x0C24 /* Offset of CS0CNTL */
|
||||
.equ CSCNTL1_2, 0x0C28 /* Offset of CS0CNTL */
|
||||
.equ CNTL_CLK_ADR, 0xF2000 /* Base address of registers */
|
||||
.equ CLKCNTL, 0x08F4 /* Offset of CS0CNTL */
|
||||
.equ INTHPAI, 0x0800
|
||||
.equ INTEOI, 0x0808
|
||||
.equ EOI, 0x80
|
||||
|
||||
/* Some standard definitions...*/
|
||||
|
||||
.equ Mode_USR, 0x10
|
||||
.equ Mode_FIQ, 0x11
|
||||
.equ Mode_IRQ, 0x12
|
||||
.equ Mode_SVC, 0x13
|
||||
.equ Mode_ABT, 0x17
|
||||
.equ Mode_ABORT, 0x17
|
||||
.equ Mode_UNDEF, 0x1B
|
||||
.equ Mode_SYS, 0x1F /*only available on ARM Arch. v4*/
|
||||
|
||||
.equ I_Bit, 0x80
|
||||
.equ F_Bit, 0x40
|
||||
|
||||
|
||||
.equ Mode_SVC_MIRQ, Mode_SVC | I_Bit | F_Bit
|
||||
.equ Mode_SVC_UIRQ, Mode_SVC
|
||||
.equ Mode_IRQ_MIRQ, Mode_SVC | I_Bit | F_Bit
|
||||
|
||||
|
||||
.equ MARK_STACK, 0 /*Fill every stack with a pattern for debug (0 or 1)*/
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Definitions
|
||||
----------------------------------------------------------------------------*/
|
||||
.equ PID_RAM_Limit, 0x1800
|
||||
|
||||
/* stack size definition */
|
||||
.equ FIQ_StackSize, 0x400 /* FIQ stack size */
|
||||
.equ IRQ_StackSize, 0xE00 /* IRQ stack size */
|
||||
.equ SVC_StackSize, 0x200 /* SVC stack size */
|
||||
.equ ABORT_StackSize, 0x100 /* ABORT stack size */
|
||||
.equ UNDEF_StackSize, 0x100 /* UNDEF stack size */
|
||||
|
||||
/* sack size address */
|
||||
.equ Stack_Limit, PID_RAM_Limit
|
||||
.equ SVC_Stack, Stack_Limit
|
||||
.equ ABORT_Stack, Stack_Limit - SVC_StackSize
|
||||
.equ UNDEF_Stack, ABORT_Stack - ABORT_StackSize
|
||||
.equ IRQ_Stack, UNDEF_Stack - UNDEF_StackSize
|
||||
.equ FIQ_Stack, IRQ_Stack - IRQ_StackSize
|
||||
.equ END_FIQ, FIQ_Stack - FIQ_StackSize
|
||||
|
||||
.text
|
||||
.globl _start
|
||||
|
||||
/*
|
||||
* This "strange" code is used to switch the memory access
|
||||
* from 8 bits to 16 bits, because the vega plus accesses
|
||||
* the memory via 8 bits at reset time
|
||||
*/
|
||||
|
||||
_start:
|
||||
.long 0x00300010 /*LDR r3,0x18*/
|
||||
.long 0x00E5009F
|
||||
|
||||
.long 0x00400010
|
||||
.long 0x00E5009F
|
||||
|
||||
.long 0x004600B0
|
||||
.long 0x00E100C3
|
||||
|
||||
.long 0x00400002 /* CS0 = 16 bits*/
|
||||
.long 0x00E300A0
|
||||
|
||||
.long 0x004200B0
|
||||
.long 0x00E100C3
|
||||
|
||||
.long 0x00000009
|
||||
.long 0x00EA0000
|
||||
|
||||
.long 0x003C0000
|
||||
.long 0x0000000F
|
||||
|
||||
.long 0x00A60087
|
||||
.long 0x00000000
|
||||
|
||||
.code 32
|
||||
|
||||
/* --- Initialise external bus*/
|
||||
Real_start:
|
||||
MOV r0,#CNTL_BASE_ADR
|
||||
|
||||
/*Load timing configuration of CS0*/
|
||||
LDR r1, =0x0804
|
||||
STR r1, [r0,#CSCNTL0_0]
|
||||
LDR r1, =0xC432
|
||||
STR r1, [r0,#CSCNTL1_0]
|
||||
|
||||
/* Load timing configuration and access mode of CS1
|
||||
NOTE : Important for macro REGION_INIT of Region_init.s
|
||||
if initialisation of data in external RAM */
|
||||
LDR r1, =0x2200
|
||||
STR r1, [r0,#CSCNTL0_1]
|
||||
LDR r1, =0x8022
|
||||
STR r1, [r0,#CSCNTL1_1]
|
||||
|
||||
/* Load timing configuration and access mode of CS2 */
|
||||
LDR r1, =0x342
|
||||
STR r1, [r0,#CSCNTL0_2]
|
||||
LDR r1, =0xA2
|
||||
STR r1, [r0,#CSCNTL1_2]
|
||||
|
||||
|
||||
MOV r0,#CNTL_CLK_ADR
|
||||
/* Load clock mode 55 MHz */
|
||||
LDR r1, =0x0010
|
||||
STR r1, [r0,#CLKCNTL]
|
||||
|
||||
/* Copy data from FLASH to RAM */
|
||||
LDR r0, =_initdata /* load address of region */
|
||||
LDR r1, =0x400000 /* execution address of region */
|
||||
LDR r2, =_edata /* copy execution address into r2 */
|
||||
|
||||
copy:
|
||||
CMP r1, r2 /* loop whilst r1 < r2 */
|
||||
LDRLO r3, [r0], #4
|
||||
STRLO r3, [r1], #4
|
||||
BLO copy
|
||||
|
||||
/* zero the bss */
|
||||
LDR r1, =__bss_end__ /* get end of ZI region */
|
||||
LDR r0, =__bss_start__ /* load base address of ZI region */
|
||||
zi_init:
|
||||
MOV r2, #0
|
||||
CMP r0, r1 /* loop whilst r0 < r1 */
|
||||
STRLOT r2, [r0], #4
|
||||
BLO zi_init
|
||||
|
||||
|
||||
/* Load basic ARM7 interrupt table */
|
||||
VectorInit:
|
||||
MOV R8, #0
|
||||
ADR R9, Vector_Init_Block
|
||||
LDMIA R9!, {R0-R7} /* Copy the Vectors (8 words) */
|
||||
STMIA R8!, {R0-R7}
|
||||
LDMIA R9!, {R0-R7} /* Copy the .long'ed addresses (8 words) */
|
||||
STMIA R8!, {R0-R7}
|
||||
|
||||
B init2
|
||||
|
||||
/*******************************************************
|
||||
standard exception vectors table
|
||||
*** Must be located at address 0
|
||||
********************************************************/
|
||||
|
||||
Vector_Init_Block:
|
||||
LDR PC, Reset_Addr
|
||||
LDR PC, Undefined_Addr
|
||||
LDR PC, SWI_Addr
|
||||
LDR PC, Prefetch_Addr
|
||||
LDR PC, Abort_Addr
|
||||
NOP
|
||||
LDR PC, IRQ_Addr
|
||||
LDR PC, FIQ_Addr
|
||||
|
||||
.globl Reset_Addr
|
||||
Reset_Addr: .long _start
|
||||
Undefined_Addr: .long Undefined_Handler
|
||||
SWI_Addr: .long SWI_Handler
|
||||
Prefetch_Addr: .long Prefetch_Handler
|
||||
Abort_Addr: .long Abort_Handler
|
||||
.long 0
|
||||
IRQ_Addr: .long IRQ_Handler
|
||||
FIQ_Addr: .long FIQ_Handler
|
||||
|
||||
/* The following handlers do not do anything useful */
|
||||
.globl Undefined_Handler
|
||||
Undefined_Handler:
|
||||
B Undefined_Handler
|
||||
.globl SWI_Handler
|
||||
SWI_Handler:
|
||||
B SWI_Handler
|
||||
.globl Prefetch_Handler
|
||||
Prefetch_Handler:
|
||||
B Prefetch_Handler
|
||||
.globl Abort_Handler
|
||||
Abort_Handler:
|
||||
B Abort_Handler
|
||||
.globl IRQ_Handler
|
||||
IRQ_Handler:
|
||||
B IRQ_Handler
|
||||
.globl FIQ_Handler
|
||||
FIQ_Handler:
|
||||
B FIQ_Handler
|
||||
|
||||
init2 :
|
||||
/* --- Initialise stack pointer registers
|
||||
Set up the ABORT stack pointer last and stay in SVC mode */
|
||||
MOV r0, #(Mode_ABORT | I_Bit | F_Bit) /* No interrupts */
|
||||
MSR cpsr, r0
|
||||
LDR sp, =ABORT_Stack
|
||||
|
||||
/* Enter IRQ mode and set up the IRQ stack pointer */
|
||||
MOV r0, #Mode_IRQ | I_Bit | F_Bit /* No interrupts */
|
||||
MSR cpsr, r0
|
||||
LDR sp, =IRQ_Stack
|
||||
|
||||
/* Enter FIQ mode and set up the FIQ stack pointer */
|
||||
MOV r0, #Mode_FIQ | I_Bit | F_Bit /* No interrupts */
|
||||
MSR cpsr, r0
|
||||
LDR sp, =FIQ_Stack
|
||||
|
||||
/* Set up the SVC stack pointer last and stay in SVC mode */
|
||||
MOV r0, #Mode_SVC | I_Bit | F_Bit /* No interrupts */
|
||||
MSR cpsr, r0
|
||||
LDR sp, =SVC_Stack
|
||||
|
||||
/* --- Now we enter the C code */
|
||||
|
||||
B boot_card
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2
c/src/lib/libbsp/arm/vegaplus/startup/.cvsignore
Normal file
2
c/src/lib/libbsp/arm/vegaplus/startup/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
40
c/src/lib/libbsp/arm/vegaplus/startup/Makefile.am
Normal file
40
c/src/lib/libbsp/arm/vegaplus/startup/Makefile.am
Normal file
@@ -0,0 +1,40 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
VPATH = @srcdir@:@srcdir@/../../../shared
|
||||
|
||||
C_FILES = bsplibc.c bsppost.c bspstart.c exit.c bootcard.c main.c sbrk.c gnatinstallhandler.c
|
||||
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
|
||||
|
||||
S_FILES =
|
||||
S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.o)
|
||||
|
||||
startup_rel_OBJECTS = $(C_O_FILES) $(S_O_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../../../../../../automake/lib.am
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
|
||||
$(PGM): $(startup_rel_OBJECTS)
|
||||
$(make-rel)
|
||||
|
||||
$(PROJECT_RELEASE)/lib/linkcmds: linkcmds
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/linkcmds
|
||||
|
||||
all: $(ARCH) $(startup_rel_OBJECTS) $(PGM) $(TMPINSTALL_FILES)
|
||||
|
||||
.PRECIOUS: $(PGM)
|
||||
|
||||
EXTRA_DIST = linkcmds
|
||||
|
||||
include $(top_srcdir)/../../../../../../automake/local.am
|
||||
|
||||
160
c/src/lib/libbsp/arm/vegaplus/startup/bspstart.c
Normal file
160
c/src/lib/libbsp/arm/vegaplus/startup/bspstart.c
Normal file
@@ -0,0 +1,160 @@
|
||||
/*-------------------------------------------------------------------------+
|
||||
| This file contains the ARM BSP startup package. It includes application,
|
||||
| board, and monitor specific initialization and configuration. The generic CPU
|
||||
| dependent initialization has been performed before this routine is invoked.
|
||||
+--------------------------------------------------------------------------+
|
||||
|
|
||||
| Copyright (c) 2000 Canon Research Centre France SA.
|
||||
| Emmanuel Raguet, mailto:raguet@crf.canon.fr
|
||||
|
|
||||
| The license and distribution terms for this file may be
|
||||
| found in found in the file LICENSE in this distribution or at
|
||||
| http://www.OARcorp.com/rtems/license.html.
|
||||
|
|
||||
+--------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <bsp.h>
|
||||
#include <uart.h>
|
||||
#include <libcsupport.h>
|
||||
#include <rtems/libio.h>
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| Global Variables
|
||||
+--------------------------------------------------------------------------*/
|
||||
volatile unsigned long *Regs = (unsigned long*)0xF0000; /* Chip registers */
|
||||
|
||||
extern rtems_unsigned32 _end; /* End of BSS. Defined in 'linkcmds'. */
|
||||
/*
|
||||
* Size of heap if it is 0 it will be dynamically defined by memory size,
|
||||
* otherwise the value should be changed by binary patch
|
||||
*/
|
||||
rtems_unsigned32 _heap_size = 0;
|
||||
|
||||
/* Size of stack used during initialization. Defined in 'start.s'. */
|
||||
extern rtems_unsigned32 _stack_size;
|
||||
|
||||
rtems_unsigned32 rtemsFreeMemStart;
|
||||
/* Address of start of free memory - should be updated
|
||||
after creating new partitions or regions. */
|
||||
|
||||
/* The original BSP configuration table from the application and our copy of it
|
||||
with some changes. */
|
||||
|
||||
extern rtems_configuration_table Configuration;
|
||||
rtems_configuration_table BSP_Configuration;
|
||||
|
||||
rtems_cpu_table Cpu_table; /* CPU configuration table. */
|
||||
char *rtems_progname; /* Program name - from main(). */
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| External Prototypes
|
||||
+--------------------------------------------------------------------------*/
|
||||
extern void rtems_irq_mngt_init(void);
|
||||
void bsp_libc_init( void *, unsigned32, int );
|
||||
void bsp_postdriver_hook(void);
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| Function: bsp_pretasking_hook
|
||||
| Description: BSP pretasking hook. Called just before drivers are
|
||||
| initialized. Used to setup libc and install any BSP
|
||||
| extensions. NOTE: Must not use libc (to do io) from here,
|
||||
| since drivers are not yet initialized.
|
||||
| Global Variables: None.
|
||||
| Arguments: None.
|
||||
| Returns: Nothing.
|
||||
+--------------------------------------------------------------------------*/
|
||||
void bsp_pretasking_hook(void)
|
||||
{
|
||||
|
||||
if(_heap_size == 0)
|
||||
{
|
||||
_heap_size = 0x420000 - rtemsFreeMemStart;
|
||||
}
|
||||
|
||||
bsp_libc_init((void *)rtemsFreeMemStart, _heap_size, 0);
|
||||
|
||||
rtemsFreeMemStart += _heap_size; /* HEAP_SIZE in KBytes */
|
||||
|
||||
|
||||
#ifdef RTEMS_DEBUG
|
||||
|
||||
rtems_debug_enable(RTEMS_DEBUG_ALL_MASK);
|
||||
|
||||
#endif /* RTEMS_DEBUG */
|
||||
|
||||
} /* bsp_pretasking_hook */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| Function: bsp_start
|
||||
| Description: Called before main is invoked.
|
||||
| Global Variables: None.
|
||||
| Arguments: None.
|
||||
| Returns: Nothing.
|
||||
+--------------------------------------------------------------------------*/
|
||||
void bsp_start_default( void )
|
||||
{
|
||||
rtemsFreeMemStart = (rtems_unsigned32)(&_end); /* &_end+_stack_size;*/
|
||||
/* set the value of start of free memory. */
|
||||
|
||||
/* If we don't have command line arguments set default program name. */
|
||||
|
||||
Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
|
||||
Cpu_table.predriver_hook = NULL; /* use system's */
|
||||
Cpu_table.postdriver_hook = bsp_postdriver_hook;
|
||||
Cpu_table.idle_task = NULL;
|
||||
/* do not override system IDLE task */
|
||||
Cpu_table.do_zero_of_workspace = TRUE;
|
||||
Cpu_table.interrupt_stack_size = 4096;
|
||||
Cpu_table.extra_mpci_receive_server_stack = 0;
|
||||
|
||||
/* Place RTEMS workspace at beginning of free memory. */
|
||||
BSP_Configuration.work_space_start = (void *)rtemsFreeMemStart;
|
||||
|
||||
rtemsFreeMemStart += BSP_Configuration.work_space_size;
|
||||
|
||||
console_reserve_resources(&BSP_Configuration);
|
||||
|
||||
/*
|
||||
* 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", BSP_Configuration.work_space_size );
|
||||
printk( "maximum_extensions = 0x%x\n", BSP_Configuration.maximum_extensions );
|
||||
printk( "microseconds_per_tick = 0x%x\n",
|
||||
BSP_Configuration.microseconds_per_tick );
|
||||
printk( "ticks_per_timeslice = 0x%x\n",
|
||||
BSP_Configuration.ticks_per_timeslice );
|
||||
printk( "maximum_devices = 0x%x\n", BSP_Configuration.maximum_devices );
|
||||
printk( "number_of_device_drivers = 0x%x\n",
|
||||
BSP_Configuration.number_of_device_drivers );
|
||||
printk( "Device_driver_table = 0x%x\n",
|
||||
BSP_Configuration.Device_driver_table );
|
||||
|
||||
printk( "_heap_size = 0x%x\n", _heap_size );
|
||||
/* printk( "_stack_size = 0x%x\n", _stack_size );*/
|
||||
printk( "rtemsFreeMemStart = 0x%x\n", rtemsFreeMemStart );
|
||||
printk( "work_space_start = 0x%x\n", BSP_Configuration.work_space_start );
|
||||
printk( "work_space_size = 0x%x\n", BSP_Configuration.work_space_size );
|
||||
#endif
|
||||
|
||||
} /* bsp_start */
|
||||
|
||||
/*
|
||||
* By making this a weak alias for bsp_start_default, a brave soul
|
||||
* can override the actual bsp_start routine used.
|
||||
*/
|
||||
|
||||
void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));
|
||||
48
c/src/lib/libbsp/arm/vegaplus/startup/exit.c
Normal file
48
c/src/lib/libbsp/arm/vegaplus/startup/exit.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/*-------------------------------------------------------------------------+
|
||||
| exit.c - ARM BSP
|
||||
+--------------------------------------------------------------------------+
|
||||
| Routines to shutdown and reboot the BSP.
|
||||
+--------------------------------------------------------------------------+
|
||||
|
|
||||
| Copyright (c) 2000 Canon Research Centre France SA.
|
||||
| Emmanuel Raguet, mailto:raguet@crf.canon.fr
|
||||
|
|
||||
| The license and distribution terms for this file may be
|
||||
| found in found in the file LICENSE in this distribution or at
|
||||
| http://www.OARcorp.com/rtems/license.html.
|
||||
|
|
||||
+--------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <bsp.h>
|
||||
#include <bspio.h>
|
||||
#include <rtems/libio.h>
|
||||
|
||||
void rtemsReboot (void)
|
||||
{
|
||||
asm volatile ("b _start");
|
||||
}
|
||||
|
||||
void bsp_cleanup(void)
|
||||
{
|
||||
unsigned char ch;
|
||||
static char line[]="\nEXECUTIVE SHUTDOWN! Any key to reboot...";
|
||||
/*
|
||||
* AT this point, the console driver is disconnected => we must
|
||||
* use polled output/input. This is exactly what printk
|
||||
* does.
|
||||
*/
|
||||
printk("\n");
|
||||
printk(line);
|
||||
ch = BSP_poll_char();
|
||||
rtemsReboot();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
240
c/src/lib/libbsp/arm/vegaplus/startup/linkcmds
Normal file
240
c/src/lib/libbsp/arm/vegaplus/startup/linkcmds
Normal file
@@ -0,0 +1,240 @@
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
|
||||
"elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SEARCH_DIR(/usr/local/rtems-arm-dev-tools/arm-rtems/lib);
|
||||
MEMORY {
|
||||
FLASH (rx) : ORIGIN = 0x200000, LENGTH = 512K
|
||||
RAM (!rx) : ORIGIN = 0x400000, LENGTH = 128K
|
||||
}
|
||||
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
/* . = 0 + SIZEOF_HEADERS;*/
|
||||
.hash : { *(.hash) } > FLASH
|
||||
.dynsym : { *(.dynsym) } > FLASH
|
||||
.dynstr : { *(.dynstr) } > FLASH
|
||||
.gnu.version : { *(.gnu.version) } > FLASH
|
||||
.gnu.version_d : { *(.gnu.version_d) } > FLASH
|
||||
.gnu.version_r : { *(.gnu.version_r) } > FLASH
|
||||
.rel.init : { *(.rel.init) } > FLASH
|
||||
.rela.init : { *(.rela.init) } > FLASH
|
||||
.rel.text :
|
||||
{
|
||||
*(.rel.text)
|
||||
*(.rel.text.*)
|
||||
*(.rel.gnu.linkonce.t*)
|
||||
} > FLASH
|
||||
.rela.text :
|
||||
{
|
||||
*(.rela.text)
|
||||
*(.rela.text.*)
|
||||
*(.rela.gnu.linkonce.t*)
|
||||
} > FLASH
|
||||
.rel.fini : { *(.rel.fini) } > FLASH
|
||||
.rela.fini : { *(.rela.fini) } > FLASH
|
||||
.rel.rodata :
|
||||
{
|
||||
*(.rel.rodata)
|
||||
*(.rel.rodata.*)
|
||||
*(.rel.gnu.linkonce.r*)
|
||||
} > FLASH
|
||||
.rela.rodata :
|
||||
{
|
||||
*(.rela.rodata)
|
||||
*(.rela.rodata.*)
|
||||
*(.rela.gnu.linkonce.r*)
|
||||
} > FLASH
|
||||
.rel.data :
|
||||
{
|
||||
*(.rel.data)
|
||||
*(.rel.data.*)
|
||||
*(.rel.gnu.linkonce.d*)
|
||||
} > FLASH
|
||||
.rela.data :
|
||||
{
|
||||
*(.rela.data)
|
||||
*(.rela.data.*)
|
||||
*(.rela.gnu.linkonce.d*)
|
||||
} > FLASH
|
||||
.rel.ctors : { *(.rel.ctors) } > FLASH
|
||||
.rela.ctors : { *(.rela.ctors) } > FLASH
|
||||
.rel.dtors : { *(.rel.dtors) } > FLASH
|
||||
.rela.dtors : { *(.rela.dtors) } > FLASH
|
||||
.rel.got : { *(.rel.got) } > FLASH
|
||||
.rela.got : { *(.rela.got) } > FLASH
|
||||
.rel.sdata :
|
||||
{
|
||||
*(.rel.sdata)
|
||||
*(.rel.sdata.*)
|
||||
*(.rel.gnu.linkonce.s*)
|
||||
} > FLASH
|
||||
.rela.sdata :
|
||||
{
|
||||
*(.rela.sdata)
|
||||
*(.rela.sdata.*)
|
||||
*(.rela.gnu.linkonce.s*)
|
||||
} > FLASH
|
||||
.rel.sbss : { *(.rel.sbss) } > FLASH
|
||||
.rela.sbss : { *(.rela.sbss) } > FLASH
|
||||
.rel.bss : { *(.rel.bss) } > FLASH
|
||||
.rela.bss : { *(.rela.bss) } > FLASH
|
||||
.rel.plt : { *(.rel.plt) } > FLASH
|
||||
.rela.plt : { *(.rela.plt) } > FLASH
|
||||
.init :
|
||||
{
|
||||
KEEP (*(.init))
|
||||
} > FLASH /*=0*/
|
||||
.plt : { *(.plt) } > FLASH
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
*(.stub)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.gnu.linkonce.t*)
|
||||
*(.glue_7t) *(.glue_7)
|
||||
} > FLASH /*=0*/
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.fini :
|
||||
{
|
||||
KEEP (*(.fini))
|
||||
} > FLASH /*=0*/
|
||||
.rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) } > FLASH
|
||||
.rodata1 : { *(.rodata1) } > FLASH
|
||||
_erodata = ABSOLUTE(.);
|
||||
PROVIDE (erodata = ABSOLUTE(.));
|
||||
/* Adjust the address for the data segment. We want to adjust up to
|
||||
the same address within the page on the next page up. */
|
||||
. = ALIGN(256);
|
||||
_begdata = ALIGN(256);
|
||||
.arm_end_text :
|
||||
{
|
||||
. = ALIGN(256);
|
||||
_initdata = ALIGN(256);
|
||||
} > FLASH
|
||||
.data : AT (_begdata)
|
||||
{
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d*)
|
||||
SORT(CONSTRUCTORS)
|
||||
} > RAM
|
||||
.data1 : { *(.data1) } > RAM
|
||||
.eh_frame : { *(.eh_frame) } > RAM
|
||||
.gcc_except_table : { *(.gcc_except_table) } > RAM
|
||||
.ctors :
|
||||
{
|
||||
/* gcc uses crtbegin.o to find the start of
|
||||
the constructors, so we make sure it is
|
||||
first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not
|
||||
actually link against crtbegin.o; the
|
||||
linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it
|
||||
doesn't matter which directory crtbegin.o
|
||||
is in. */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
/* We don't want to include the .ctor section from
|
||||
from the crtend.o file until after the sorted ctors.
|
||||
The .ctor section from the crtend file contains the
|
||||
end of ctors marker and it must be last */
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
} > RAM
|
||||
.dtors :
|
||||
{
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
} > RAM
|
||||
.got : { *(.got.plt) *(.got) } > RAM
|
||||
.dynamic : { *(.dynamic) } > RAM
|
||||
/* We want the small data sections together, so single-instruction offsets
|
||||
can access them all, and initialized data all before uninitialized, so
|
||||
we can shorten the on-disk segment size. */
|
||||
.sdata :
|
||||
{
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
} > RAM
|
||||
.arm_data :
|
||||
{
|
||||
_edata = .;
|
||||
__bss_start = .;
|
||||
__bss_start__ = .;
|
||||
} > RAM
|
||||
.sbss :
|
||||
{
|
||||
*(.dynsbss)
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.scommon)
|
||||
} > RAM
|
||||
.bss :
|
||||
{
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(COMMON)
|
||||
/* Align here to ensure that the .bss section occupies space up to
|
||||
_end. Align after .bss to ensure correct alignment even if the
|
||||
.bss section disappears because there are no input sections. */
|
||||
. = ALIGN(32 / 8);
|
||||
} > RAM
|
||||
. = ALIGN(32 / 8);
|
||||
.arm_end :
|
||||
{
|
||||
_end = .;
|
||||
_bss_end__ = . ;
|
||||
__bss_end__ = . ;
|
||||
__end__ = . ;
|
||||
} > RAM
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/*.stack 0x80000 : { _stack = .; *(.stack) }*/
|
||||
/* These must appear regardless of . */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
2
c/src/lib/libbsp/arm/vegaplus/wrapup/.cvsignore
Normal file
2
c/src/lib/libbsp/arm/vegaplus/wrapup/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
32
c/src/lib/libbsp/arm/vegaplus/wrapup/Makefile.am
Normal file
32
c/src/lib/libbsp/arm/vegaplus/wrapup/Makefile.am
Normal file
@@ -0,0 +1,32 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.4
|
||||
|
||||
BSP_PIECES = console startup irq
|
||||
|
||||
# bummer; have to use $foreach since % pattern subst rules only replace 1x
|
||||
OBJS = $(foreach piece, $(BSP_PIECES), ../$(piece)/$(ARCH)/*.o)
|
||||
LIB = $(ARCH)/libbsp.a
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../../../../../../automake/lib.am
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
$(LIB): $(OBJS)
|
||||
$(make-library)
|
||||
|
||||
$(PROJECT_RELEASE)/lib/libbsp$(LIB_VARIANT).a: $(LIB)
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/libbsp$(LIB_VARIANT).a
|
||||
|
||||
all: $(ARCH) $(OBJS) $(LIB) $(TMPINSTALL_FILES)
|
||||
|
||||
.PRECIOUS: $(LIB)
|
||||
|
||||
include $(top_srcdir)/../../../../../../automake/local.am
|
||||
Reference in New Issue
Block a user