forked from Imagelibrary/rtems
2006-10-23 Joel Sherrill <joel@OARcorp.com>
* bfin/ChangeLog, bfin/Makefile.am, bfin/acinclude.m4, bfin/configure.ac, bfin/eZKit533/.cvsignore, bfin/eZKit533/ChangeLog, bfin/eZKit533/Makefile.am, bfin/eZKit533/README, bfin/eZKit533/bsp_specs, bfin/eZKit533/configure, bfin/eZKit533/configure.ac, bfin/eZKit533/preinstall.am, bfin/eZKit533/times, bfin/eZKit533/console/console-io.c, bfin/eZKit533/include/.cvsignore, bfin/eZKit533/include/bsp.h, bfin/eZKit533/include/bspopts.h.in, bfin/eZKit533/include/coverhd.h, bfin/eZKit533/include/tm27.h, bfin/eZKit533/startup/bspstart.c, bfin/eZKit533/startup/linkcmds, bfin/shared/clock/clockdrv.c, bfin/shared/clock/rtc.c, bfin/shared/clock/tod.h, bfin/shared/console/console.c, bfin/shared/start/start.S, bfin/shared/timer/timer.c: New files.
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
2006-10-23 Joel Sherrill <joel@OARcorp.com>
|
||||
|
||||
* bfin/ChangeLog, bfin/Makefile.am, bfin/acinclude.m4,
|
||||
bfin/configure.ac, bfin/eZKit533/.cvsignore, bfin/eZKit533/ChangeLog,
|
||||
bfin/eZKit533/Makefile.am, bfin/eZKit533/README,
|
||||
bfin/eZKit533/bsp_specs, bfin/eZKit533/configure,
|
||||
bfin/eZKit533/configure.ac, bfin/eZKit533/preinstall.am,
|
||||
bfin/eZKit533/times, bfin/eZKit533/console/console-io.c,
|
||||
bfin/eZKit533/include/.cvsignore, bfin/eZKit533/include/bsp.h,
|
||||
bfin/eZKit533/include/bspopts.h.in, bfin/eZKit533/include/coverhd.h,
|
||||
bfin/eZKit533/include/tm27.h, bfin/eZKit533/startup/bspstart.c,
|
||||
bfin/eZKit533/startup/linkcmds, bfin/shared/clock/clockdrv.c,
|
||||
bfin/shared/clock/rtc.c, bfin/shared/clock/tod.h,
|
||||
bfin/shared/console/console.c, bfin/shared/start/start.S,
|
||||
bfin/shared/timer/timer.c: New files.
|
||||
|
||||
2006-01-11 Ralf Corsepius <ralf.corsepius@freenet.de>
|
||||
|
||||
* bspstart.am: Remove.
|
||||
|
||||
3
c/src/lib/libbsp/bfin/ChangeLog
Normal file
3
c/src/lib/libbsp/bfin/ChangeLog
Normal file
@@ -0,0 +1,3 @@
|
||||
2006-06-05 Alain Schaefer <alani@easc.ch>
|
||||
|
||||
* all files : Initial copy and port from no_cpu
|
||||
11
c/src/lib/libbsp/bfin/Makefile.am
Normal file
11
c/src/lib/libbsp/bfin/Makefile.am
Normal file
@@ -0,0 +1,11 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
ACLOCAL_AMFLAGS = -I ../../../aclocal
|
||||
|
||||
# Descend into the @RTEMS_BSP_FAMILY@ directory
|
||||
SUBDIRS = @RTEMS_BSP_FAMILY@
|
||||
|
||||
include $(top_srcdir)/../../../automake/subdirs.am
|
||||
include $(top_srcdir)/../../../automake/local.am
|
||||
10
c/src/lib/libbsp/bfin/acinclude.m4
Normal file
10
c/src/lib/libbsp/bfin/acinclude.m4
Normal file
@@ -0,0 +1,10 @@
|
||||
# RTEMS_CHECK_BSPDIR(RTEMS_BSP_FAMILY)
|
||||
AC_DEFUN([RTEMS_CHECK_BSPDIR],
|
||||
[
|
||||
case "$1" in
|
||||
eZKit533 )
|
||||
AC_CONFIG_SUBDIRS([eZKit533]);;
|
||||
*)
|
||||
AC_MSG_ERROR([Invalid BSP]);;
|
||||
esac
|
||||
])
|
||||
21
c/src/lib/libbsp/bfin/configure.ac
Normal file
21
c/src/lib/libbsp/bfin/configure.ac
Normal file
@@ -0,0 +1,21 @@
|
||||
## Process this file with autoconf to produce a configure script.
|
||||
##
|
||||
## $Id$
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT([rtems-c-src-lib-libbsp-bfin],[_RTEMS_VERSION],[rtems-bugs@rtems.com])
|
||||
AC_CONFIG_SRCDIR([../bfin])
|
||||
RTEMS_TOP(../../../../..)
|
||||
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
AM_INIT_AUTOMAKE([no-define foreign 1.9])
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
RTEMS_ENV_RTEMSBSP
|
||||
RTEMS_PROJECT_ROOT
|
||||
|
||||
RTEMS_CHECK_BSPDIR([$RTEMS_BSP_FAMILY])
|
||||
|
||||
# Explicitly list all Makefiles here
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
14
c/src/lib/libbsp/bfin/eZKit533/.cvsignore
Normal file
14
c/src/lib/libbsp/bfin/eZKit533/.cvsignore
Normal file
@@ -0,0 +1,14 @@
|
||||
aclocal.m4
|
||||
autom4te*.cache
|
||||
config.cache
|
||||
config.guess
|
||||
config.log
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
depcomp
|
||||
install-sh
|
||||
Makefile
|
||||
Makefile.in
|
||||
missing
|
||||
mkinstalldirs
|
||||
3
c/src/lib/libbsp/bfin/eZKit533/ChangeLog
Normal file
3
c/src/lib/libbsp/bfin/eZKit533/ChangeLog
Normal file
@@ -0,0 +1,3 @@
|
||||
2006-06-05 Alain Schaefer <alani@easc.ch>
|
||||
|
||||
* all files : Initial copy and port from no_cpu
|
||||
59
c/src/lib/libbsp/bfin/eZKit533/Makefile.am
Normal file
59
c/src/lib/libbsp/bfin/eZKit533/Makefile.am
Normal file
@@ -0,0 +1,59 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
ACLOCAL_AMFLAGS = -I ../../../../aclocal
|
||||
|
||||
include $(top_srcdir)/../../../../automake/compile.am
|
||||
include $(top_srcdir)/../../bsp.am
|
||||
|
||||
dist_project_lib_DATA = bsp_specs
|
||||
|
||||
include_HEADERS = include/bsp.h
|
||||
include_HEADERS += include/tm27.h
|
||||
|
||||
nodist_include_HEADERS = include/bspopts.h
|
||||
DISTCLEANFILES = include/bspopts.h
|
||||
|
||||
noinst_PROGRAMS =
|
||||
|
||||
include_HEADERS += ../../shared/include/coverhd.h
|
||||
|
||||
EXTRA_DIST = ../shared/start/start.S
|
||||
start.$(OBJEXT): ../shared/start/start.S
|
||||
$(CPPASCOMPILE) -DASM -o $@ -c $<
|
||||
project_lib_DATA = start.$(OBJEXT)
|
||||
|
||||
dist_project_lib_DATA += startup/linkcmds
|
||||
|
||||
noinst_PROGRAMS += startup.rel
|
||||
startup_rel_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \
|
||||
startup/bspstart.c ../../shared/bspclean.c ../../shared/sbrk.c ../../shared/setvec.c \
|
||||
../../shared/bootcard.c ../../shared/main.c \
|
||||
../../shared/gnatinstallhandler.c
|
||||
startup_rel_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
startup_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
|
||||
|
||||
noinst_PROGRAMS += clock.rel
|
||||
clock_rel_SOURCES = ../shared/clock/clockdrv.c ../shared/clock/rtc.c
|
||||
clock_rel_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
|
||||
|
||||
noinst_PROGRAMS += console.rel
|
||||
console_rel_SOURCES = console/console-io.c ../shared/console/console.c
|
||||
console_rel_CPPFLAGS =
|
||||
console_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
|
||||
|
||||
noinst_PROGRAMS += timer.rel
|
||||
timer_rel_SOURCES = ../shared/timer/timer.c
|
||||
timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
|
||||
|
||||
noinst_LIBRARIES = libbsp.a
|
||||
libbsp_a_SOURCES =
|
||||
libbsp_a_LIBADD = startup.rel clock.rel console.rel timer.rel
|
||||
|
||||
EXTRA_DIST += times
|
||||
|
||||
include $(srcdir)/preinstall.am
|
||||
include $(top_srcdir)/../../../../automake/local.am
|
||||
40
c/src/lib/libbsp/bfin/eZKit533/README
Normal file
40
c/src/lib/libbsp/bfin/eZKit533/README
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
BSP NAME: eZKit533
|
||||
BOARD: ADSP-BF533 EzKit Lite
|
||||
CPU FAMILY: Blackfin
|
||||
CPU: Blackfin 533
|
||||
MODE: 32 bit mode
|
||||
|
||||
DEBUG MONITOR: ICEBear
|
||||
SIMULATOR: Skyeye
|
||||
|
||||
PERIPHERALS
|
||||
===========
|
||||
TIMERS: internal
|
||||
RESOLUTION: 1 milisecond
|
||||
SERIAL PORTS: internal UART (polled/interrupt)
|
||||
REAL-TIME CLOCK: internal
|
||||
DMA: internal
|
||||
VIDEO: none
|
||||
SCSI: none
|
||||
NETWORKING: none
|
||||
|
||||
DRIVER INFORMATION
|
||||
==================
|
||||
CLOCK DRIVER: internal
|
||||
TIMER DRIVER: internal
|
||||
|
||||
STDIO
|
||||
=====
|
||||
PORT: Console port 0
|
||||
ELECTRICAL: RS-232
|
||||
BAUD: 57600
|
||||
BITS PER CHARACTER: 8
|
||||
PARITY: None
|
||||
STOP BITS: 1
|
||||
|
||||
NOTES
|
||||
=====
|
||||
11
c/src/lib/libbsp/bfin/eZKit533/bsp_specs
Normal file
11
c/src/lib/libbsp/bfin/eZKit533/bsp_specs
Normal file
@@ -0,0 +1,11 @@
|
||||
%rename endfile old_endfile
|
||||
%rename startfile old_startfile
|
||||
%rename link old_link
|
||||
|
||||
*startfile:
|
||||
%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems: \
|
||||
%{!qrtems_debug:start.o%s} \
|
||||
%{qrtems_debug: start_g.o%s}}}
|
||||
|
||||
*link:
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e __start}
|
||||
5355
c/src/lib/libbsp/bfin/eZKit533/configure
vendored
Executable file
5355
c/src/lib/libbsp/bfin/eZKit533/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
25
c/src/lib/libbsp/bfin/eZKit533/configure.ac
Normal file
25
c/src/lib/libbsp/bfin/eZKit533/configure.ac
Normal file
@@ -0,0 +1,25 @@
|
||||
## Process this file with autoconf to produce a configure script.
|
||||
##
|
||||
## $Id$
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT([rtems-c-src-lib-libbsp-bfin-eZKit533],[_RTEMS_VERSION],[rtems-bugs@rtems.com])
|
||||
AC_CONFIG_SRCDIR([bsp_specs])
|
||||
RTEMS_TOP(../../../../../..)
|
||||
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.9])
|
||||
RTEMS_BSP_CONFIGURE
|
||||
|
||||
RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm])
|
||||
RTEMS_CANONICALIZE_TOOLS
|
||||
RTEMS_PROG_CCAS
|
||||
|
||||
## bsp-specific options
|
||||
RTEMS_BSPOPTS_SET([CONSOLE_USE_INTERRUPTS],[*],[0])
|
||||
RTEMS_BSPOPTS_HELP([CONSOLE_USE_INTERRUPTS],
|
||||
[The console driver can operate in either polled or interrupt mode.])
|
||||
|
||||
# Explicitly list all Makefiles here
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
248
c/src/lib/libbsp/bfin/eZKit533/console/console-io.c
Normal file
248
c/src/lib/libbsp/bfin/eZKit533/console/console-io.c
Normal file
@@ -0,0 +1,248 @@
|
||||
/* console-io.c
|
||||
*
|
||||
* This file contains the hardware specific portions of the TTY driver
|
||||
* for the serial ports for ezkit533.
|
||||
*
|
||||
* Copyright (c) 2006 by Atos Automacao Industrial Ltda.
|
||||
* written by Alain Schaefer <alain.schaefer@easc.ch>
|
||||
* and Antonio Giovanini <antonio@atos.com.br>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <bsp.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
/*
|
||||
* console_initialize_hardware
|
||||
*
|
||||
* This routine initializes the console hardware.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* console_initialize_hardware does not compile with optimizations.
|
||||
* Makefile.am has been changed to compile the console driver with -O0.
|
||||
*/
|
||||
void console_initialize_hardware(void)
|
||||
{
|
||||
unsigned int divisor;
|
||||
|
||||
/* Set DLAB to access divisor registers */
|
||||
*((uint16_t*)UART_LCR) = DLAB;
|
||||
|
||||
/* Set divisor registers
|
||||
* BAUDRATE = SCLK/(16xDIVISOR)
|
||||
*/
|
||||
divisor = SCLK/(BAUDRATE*16); /* 1300000/(16x57600) */
|
||||
*((uint16_t*)UART_DLL) = (divisor & 0x00ff);
|
||||
*((uint16_t*)UART_DLH) = ((divisor >> 8) & 0x00ff);
|
||||
|
||||
/* Set Control Register - 8 bits, no parity, 1 stop bit*/
|
||||
*((uint16_t*)UART_LCR) = WORD_8BITS;
|
||||
|
||||
/* Enable Serial Clocks */
|
||||
*((uint16_t*)UART_GCTL) = UCEN;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* console_outbyte_polled
|
||||
*
|
||||
* This routine transmits a character using polling.
|
||||
*/
|
||||
|
||||
void console_outbyte_polled(
|
||||
int port,
|
||||
char ch
|
||||
)
|
||||
{
|
||||
while (!((*((uint16_t*)UART_LSR))&THRE)){} /* Wait for sending last byte */
|
||||
*((uint16_t*)UART_THR) = ch;
|
||||
}
|
||||
|
||||
/*
|
||||
* console_inbyte_nonblocking
|
||||
*
|
||||
* This routine polls for a character.
|
||||
*/
|
||||
|
||||
int console_inbyte_nonblocking(
|
||||
int port
|
||||
)
|
||||
{
|
||||
char c;
|
||||
|
||||
if ( *((uint16_t*)UART_LSR) & DR){
|
||||
c = *((uint16_t*)UART_RBR);
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
#if (CONSOLE_USE_INTERRUPTS)
|
||||
|
||||
#include <rtems/ringbuf.h>
|
||||
|
||||
Ring_buffer_t TX_Buffer[ 1 ];
|
||||
boolean Is_TX_active[ 1 ];
|
||||
|
||||
extern void *console_termios_data[ 1 ];
|
||||
/*
|
||||
* console_isr
|
||||
*
|
||||
* This routine is the console interrupt handler for Channel A.
|
||||
*
|
||||
* Input parameters:
|
||||
* vector - vector number
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* Return values: NONE
|
||||
*/
|
||||
rtems_isr console_isr(
|
||||
rtems_vector_number vector
|
||||
)
|
||||
{
|
||||
char ch;
|
||||
uint16_t UStat;
|
||||
|
||||
UStat = *((uint16_t*)UART_IIR);
|
||||
|
||||
if ( ((UStat&0x06) == 0x04) && ( (*((uint16_t*)UART_LSR)) & DR)) {
|
||||
ch = *((uint16_t*)UART_RBR);
|
||||
rtems_termios_enqueue_raw_characters( console_termios_data[ 0 ], &ch, 1 );
|
||||
}
|
||||
|
||||
if ( ((UStat&0x06) == 0x02) && ((*((uint16_t*)UART_LSR))&THRE) ) {
|
||||
if ( !Ring_buffer_Is_empty( &TX_Buffer[ 0 ] ) ) {
|
||||
Ring_buffer_Remove_character( &TX_Buffer[ 0 ], ch );
|
||||
*((uint16_t*)UART_THR) = ch;
|
||||
} else {
|
||||
Is_TX_active[ 0 ] = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* console_exit
|
||||
*
|
||||
* This routine allows the console to exit by masking its associated interrupt
|
||||
* vectors.
|
||||
*
|
||||
* Input parameters: NONE
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* Return values: NONE
|
||||
*/
|
||||
void console_exit()
|
||||
{
|
||||
uint32_t port;
|
||||
uint16_t ch;
|
||||
|
||||
/*
|
||||
* Although the interrupts for the UART are unmasked, the PIL is set to
|
||||
* disable all external interrupts. So we might as well do this first.
|
||||
*/
|
||||
|
||||
/* Disable UART interruptions */
|
||||
*((uint16_t*)UART_IER) = 0x0000;
|
||||
*((uint16_t*)SIC_IMASK) &= 0xFFFF3FBF;
|
||||
|
||||
while ( !Ring_buffer_Is_empty( &TX_Buffer[ port ] ) ) {
|
||||
Ring_buffer_Remove_character( &TX_Buffer[ port ], ch );
|
||||
console_outbyte_polled( port, ch );
|
||||
}
|
||||
|
||||
/*
|
||||
* Now wait for all the data to actually get out ... the send register
|
||||
* should be empty.
|
||||
*/
|
||||
|
||||
while ( !((*((uint16_t*)UART_LSR))&THRE) );
|
||||
}
|
||||
|
||||
/*
|
||||
* console_initialize_interrupts
|
||||
*
|
||||
* This routine initializes the console's receive and transmit
|
||||
* ring buffers and loads the appropriate vectors to handle the interrupts.
|
||||
*
|
||||
* Input parameters: NONE
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* Return values: NONE
|
||||
*/
|
||||
|
||||
/*#ifdef RDB_BREAK_IN
|
||||
extern uint32_t trap_table[];
|
||||
#endif*/
|
||||
|
||||
void console_initialize_interrupts( void )
|
||||
{
|
||||
Ring_buffer_Initialize( &TX_Buffer[ 0 ] );
|
||||
|
||||
Is_TX_active[ 0 ] = FALSE;
|
||||
|
||||
atexit( console_exit );
|
||||
|
||||
/* Setting priority - IVG10*/
|
||||
*((uint32_t*)SIC_IAR0) &= 0xF0FFFFFF;
|
||||
*((uint32_t*)SIC_IAR0) |= 0x03000000;
|
||||
*((uint32_t*)SIC_IAR1) &= 0x00FFFFFF;
|
||||
*((uint32_t*)SIC_IAR1) |= 0x33000000;
|
||||
|
||||
/* System Interrupt Mask */
|
||||
*((uint32_t*)SIC_IMASK) |= 0x0000C040;
|
||||
|
||||
set_vector( console_isr, UART_VECTOR, 1 );
|
||||
|
||||
/* Enable UART Interruption
|
||||
* ELSI - RX error interrupt
|
||||
* ETBEI - TX buffer empty
|
||||
* ERBFI - RX buffer full
|
||||
*/
|
||||
*((uint16_t*)UART_IER) = ELSI | ETBEI | ERBFI;
|
||||
}
|
||||
|
||||
void console_outbyte_interrupt(
|
||||
int port,
|
||||
char ch
|
||||
)
|
||||
{
|
||||
/*
|
||||
* If this is the first character then we need to prime the pump
|
||||
*/
|
||||
|
||||
if ( Is_TX_active[ port ] == FALSE ) {
|
||||
Is_TX_active[ port ] = TRUE;
|
||||
console_outbyte_polled( port, ch );
|
||||
return;
|
||||
}
|
||||
|
||||
while ( Ring_buffer_Is_full( &TX_Buffer[ port ] ) );
|
||||
|
||||
Ring_buffer_Add_character( &TX_Buffer[ port ], ch );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#include <rtems/bspIo.h>
|
||||
|
||||
void bfsim_BSP_output_char(char c) { console_outbyte_polled( 0, c ); }
|
||||
|
||||
BSP_output_char_function_type BSP_output_char = bfsim_BSP_output_char;
|
||||
BSP_polling_getchar_function_type BSP_poll_char = NULL;
|
||||
5
c/src/lib/libbsp/bfin/eZKit533/include/.cvsignore
Normal file
5
c/src/lib/libbsp/bfin/eZKit533/include/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
bspopts.h
|
||||
bspopts.h.in
|
||||
coverhd.h
|
||||
stamp-h
|
||||
stamp-h.in
|
||||
152
c/src/lib/libbsp/bfin/eZKit533/include/bsp.h
Normal file
152
c/src/lib/libbsp/bfin/eZKit533/include/bsp.h
Normal file
@@ -0,0 +1,152 @@
|
||||
/* bsp.h
|
||||
*
|
||||
* This include file contains all board IO definitions for eZKit533.
|
||||
*
|
||||
* Copyright (c) 2006 by Atos Automacao Industrial Ltda.
|
||||
* written by Alain Schaefer <alain.schaefer@easc.ch>
|
||||
* and Antonio Giovanini <antonio@atos.com.br>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _BSP_H
|
||||
#define _BSP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bspopts.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/console.h>
|
||||
#include <rtems/clockdrv.h>
|
||||
#include <rtems/score/bfin.h>
|
||||
|
||||
|
||||
#define CLOCK_DRIVER_USE_FAST_IDLE
|
||||
|
||||
/*
|
||||
* PLL and clock setup values:
|
||||
*/
|
||||
|
||||
/*
|
||||
* PLL configuration for ezkit533
|
||||
*
|
||||
* XTL = 27 MHz
|
||||
* CLKIN = 13 MHz
|
||||
* VCO = 391 MHz
|
||||
* CCLK = 391 MHz
|
||||
* SCLK = 130 MHz
|
||||
*/
|
||||
|
||||
#define PLL_CSEL 0x0000 /* CCLK = VCO */
|
||||
#define PLL_SSEL 0x0003 /* SCLK = CCLK/3 */
|
||||
#define PLL_MSEL 0x3A00 /* VCO = 29xCLKIN */
|
||||
#define PLL_DF 0x0001 /* CLKIN = XTL/2 */
|
||||
|
||||
#define CCLK 391000000 /* CORE CLOCK */
|
||||
#define SCLK 130000000 /* SYSTEM CLOCK */
|
||||
|
||||
/*
|
||||
* UART setup values
|
||||
*/
|
||||
#define BAUDRATE 57600 /* Console Baudrate */
|
||||
#define WORD_5BITS 0x00 /* 5 bits word */
|
||||
#define WORD_6BITS 0x01 /* 6 bits word */
|
||||
#define WORD_7BITS 0x02 /* 7 bits word */
|
||||
#define WORD_8BITS 0x03 /* 8 bits word */
|
||||
#define EVEN_PARITY 0x18 /* Enable EVEN parity */
|
||||
#define ODD_PARITY 0x08 /* Enable ODD parity */
|
||||
#define TWO_STP_BIT 0x04 /* 2 stop bits */
|
||||
|
||||
/*
|
||||
* Ezkit flash ports
|
||||
*/
|
||||
#define FlashA_PortB_Dir 0x20270007
|
||||
#define FlashA_PortB_Data 0x20270005
|
||||
|
||||
// Blackfin environment memory map
|
||||
//
|
||||
#define L1_DATA_SRAM_A 0xff800000
|
||||
|
||||
#define FIFOLENGTH 0x100
|
||||
|
||||
#ifndef LO
|
||||
#define LO(con32) ((con32) & 0xFFFF)
|
||||
#endif
|
||||
#ifndef HI
|
||||
#define HI(con32) (((con32) >> 16) & 0xFFFF)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* confdefs.h overrides for this BSP:
|
||||
* - number of termios serial ports (defaults to 1)
|
||||
* - Interrupt stack space is not minimum if defined.
|
||||
*/
|
||||
|
||||
/* #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2 */
|
||||
#define CONFIGURE_INTERRUPT_STACK_MEMORY (4 * 1024)
|
||||
|
||||
/*
|
||||
* Simple spin delay in microsecond units for device drivers.
|
||||
* This is very dependent on the clock speed of the target.
|
||||
*/
|
||||
|
||||
#define rtems_bsp_delay( microseconds ) \
|
||||
{ \
|
||||
}
|
||||
|
||||
/* Constants */
|
||||
|
||||
#define RAM_START 0
|
||||
#define RAM_END 0x100000
|
||||
|
||||
/* miscellaneous stuff assumed to exist */
|
||||
|
||||
extern rtems_configuration_table BSP_Configuration;
|
||||
|
||||
/*
|
||||
* Device Driver Table Entries
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE: Use the standard Console driver entry
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE: Use the standard Clock driver entry
|
||||
*/
|
||||
|
||||
/* functions */
|
||||
|
||||
/*
|
||||
* Helper Function to use the EzKits LEDS.
|
||||
* Can be used by the Application.
|
||||
*/
|
||||
void setLED (char value);
|
||||
|
||||
/*
|
||||
* Helper Function to use the EzKits LEDS
|
||||
*/
|
||||
char getLED (void);
|
||||
|
||||
void bsp_cleanup( void );
|
||||
|
||||
rtems_isr_entry set_vector( /* returns old vector */
|
||||
rtems_isr_entry handler, /* isr routine */
|
||||
rtems_vector_number vector, /* vector number */
|
||||
int type /* RTEMS or RAW intr */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
19
c/src/lib/libbsp/bfin/eZKit533/include/bspopts.h.in
Normal file
19
c/src/lib/libbsp/bfin/eZKit533/include/bspopts.h.in
Normal file
@@ -0,0 +1,19 @@
|
||||
/* include/bspopts.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* The console driver can operate in either polled or interrupt mode. */
|
||||
#undef CONSOLE_USE_INTERRUPTS
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
103
c/src/lib/libbsp/bfin/eZKit533/include/coverhd.h
Normal file
103
c/src/lib/libbsp/bfin/eZKit533/include/coverhd.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/* coverhd.h
|
||||
*
|
||||
* This include file has defines to represent the overhead associated
|
||||
* with calling a particular directive from C on this target.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __COVERHD_h
|
||||
#define __COVERHD_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 0
|
||||
#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 0
|
||||
#define CALLING_OVERHEAD_TASK_CREATE 0
|
||||
#define CALLING_OVERHEAD_TASK_IDENT 0
|
||||
#define CALLING_OVERHEAD_TASK_START 0
|
||||
#define CALLING_OVERHEAD_TASK_RESTART 0
|
||||
#define CALLING_OVERHEAD_TASK_DELETE 0
|
||||
#define CALLING_OVERHEAD_TASK_SUSPEND 0
|
||||
#define CALLING_OVERHEAD_TASK_RESUME 0
|
||||
#define CALLING_OVERHEAD_TASK_SET_PRIORITY 0
|
||||
#define CALLING_OVERHEAD_TASK_MODE 0
|
||||
#define CALLING_OVERHEAD_TASK_GET_NOTE 0
|
||||
#define CALLING_OVERHEAD_TASK_SET_NOTE 0
|
||||
#define CALLING_OVERHEAD_TASK_WAKE_WHEN 0
|
||||
#define CALLING_OVERHEAD_TASK_WAKE_AFTER 0
|
||||
#define CALLING_OVERHEAD_INTERRUPT_CATCH 0
|
||||
#define CALLING_OVERHEAD_CLOCK_GET 0
|
||||
#define CALLING_OVERHEAD_CLOCK_SET 0
|
||||
#define CALLING_OVERHEAD_CLOCK_TICK 0
|
||||
|
||||
#define CALLING_OVERHEAD_TIMER_CREATE 0
|
||||
#define CALLING_OVERHEAD_TIMER_IDENT 0
|
||||
#define CALLING_OVERHEAD_TIMER_DELETE 0
|
||||
#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 0
|
||||
#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 0
|
||||
#define CALLING_OVERHEAD_TIMER_RESET 0
|
||||
#define CALLING_OVERHEAD_TIMER_CANCEL 0
|
||||
#define CALLING_OVERHEAD_SEMAPHORE_CREATE 0
|
||||
#define CALLING_OVERHEAD_SEMAPHORE_DELETE 0
|
||||
#define CALLING_OVERHEAD_SEMAPHORE_IDENT 0
|
||||
#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 0
|
||||
#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 0
|
||||
#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 0
|
||||
|
||||
#define CALLING_OVERHEAD_EVENT_SEND 0
|
||||
#define CALLING_OVERHEAD_EVENT_RECEIVE 0
|
||||
#define CALLING_OVERHEAD_SIGNAL_CATCH 0
|
||||
#define CALLING_OVERHEAD_SIGNAL_SEND 0
|
||||
#define CALLING_OVERHEAD_PARTITION_CREATE 0
|
||||
#define CALLING_OVERHEAD_PARTITION_IDENT 0
|
||||
#define CALLING_OVERHEAD_PARTITION_DELETE 0
|
||||
#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 0
|
||||
#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 0
|
||||
#define CALLING_OVERHEAD_REGION_CREATE 0
|
||||
#define CALLING_OVERHEAD_REGION_IDENT 0
|
||||
#define CALLING_OVERHEAD_REGION_DELETE 0
|
||||
#define CALLING_OVERHEAD_REGION_GET_SEGMENT 0
|
||||
#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 0
|
||||
#define CALLING_OVERHEAD_PORT_CREATE 0
|
||||
#define CALLING_OVERHEAD_PORT_IDENT 0
|
||||
#define CALLING_OVERHEAD_PORT_DELETE 0
|
||||
#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 0
|
||||
#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 0
|
||||
|
||||
#define CALLING_OVERHEAD_IO_INITIALIZE 0
|
||||
#define CALLING_OVERHEAD_IO_OPEN 0
|
||||
#define CALLING_OVERHEAD_IO_CLOSE 0
|
||||
#define CALLING_OVERHEAD_IO_READ 0
|
||||
#define CALLING_OVERHEAD_IO_WRITE 0
|
||||
#define CALLING_OVERHEAD_IO_CONTROL 0
|
||||
#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 0
|
||||
#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 0
|
||||
#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 0
|
||||
#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 0
|
||||
#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 0
|
||||
#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 0
|
||||
#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
35
c/src/lib/libbsp/bfin/eZKit533/include/tm27.h
Normal file
35
c/src/lib/libbsp/bfin/eZKit533/include/tm27.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* tm27.h
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_TMTEST27
|
||||
#error "This is an RTEMS internal file you must not include directly."
|
||||
#endif
|
||||
|
||||
#ifndef __tm27_h
|
||||
#define __tm27_h
|
||||
|
||||
/*
|
||||
* Define the interrupt mechanism for Time Test 27
|
||||
*/
|
||||
|
||||
#define MUST_WAIT_FOR_INTERRUPT 0
|
||||
|
||||
#define Install_tm27_vector(handler) \
|
||||
{ \
|
||||
set_vector( handler, 0x06, 1 ); \
|
||||
}
|
||||
|
||||
#define Cause_tm27_intr() asm volatile("raise 0x06;" : :);
|
||||
|
||||
#define Clear_tm27_intr() /* empty */
|
||||
|
||||
#define Lower_tm27_intr() /* empty */
|
||||
|
||||
#endif
|
||||
58
c/src/lib/libbsp/bfin/eZKit533/preinstall.am
Normal file
58
c/src/lib/libbsp/bfin/eZKit533/preinstall.am
Normal file
@@ -0,0 +1,58 @@
|
||||
## Automatically generated by ampolish3 - Do not edit
|
||||
|
||||
if AMPOLISH3
|
||||
$(srcdir)/preinstall.am: Makefile.am
|
||||
$(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
|
||||
endif
|
||||
|
||||
PREINSTALL_DIRS =
|
||||
DISTCLEANFILES += $(PREINSTALL_DIRS)
|
||||
|
||||
all-local: $(TMPINSTALL_FILES)
|
||||
|
||||
TMPINSTALL_FILES =
|
||||
CLEANFILES = $(TMPINSTALL_FILES)
|
||||
|
||||
all-am: $(PREINSTALL_FILES)
|
||||
|
||||
PREINSTALL_FILES =
|
||||
CLEANFILES += $(PREINSTALL_FILES)
|
||||
|
||||
$(PROJECT_LIB)/$(dirstamp):
|
||||
@$(mkdir_p) $(PROJECT_LIB)
|
||||
@: > $(PROJECT_LIB)/$(dirstamp)
|
||||
PREINSTALL_DIRS += $(PROJECT_LIB)/$(dirstamp)
|
||||
|
||||
$(PROJECT_INCLUDE)/$(dirstamp):
|
||||
@$(mkdir_p) $(PROJECT_INCLUDE)
|
||||
@: > $(PROJECT_INCLUDE)/$(dirstamp)
|
||||
PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
|
||||
|
||||
$(PROJECT_LIB)/bsp_specs: bsp_specs $(PROJECT_LIB)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_LIB)/bsp_specs
|
||||
PREINSTALL_FILES += $(PROJECT_LIB)/bsp_specs
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp.h: include/bsp.h $(PROJECT_INCLUDE)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h
|
||||
|
||||
$(PROJECT_INCLUDE)/tm27.h: include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h
|
||||
|
||||
$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h
|
||||
|
||||
$(PROJECT_INCLUDE)/coverhd.h: include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
|
||||
|
||||
$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT)
|
||||
TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT)
|
||||
|
||||
$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
|
||||
PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
|
||||
|
||||
221
c/src/lib/libbsp/bfin/eZKit533/startup/bspstart.c
Normal file
221
c/src/lib/libbsp/bfin/eZKit533/startup/bspstart.c
Normal file
@@ -0,0 +1,221 @@
|
||||
/* bspstart.c for eZKit533
|
||||
*
|
||||
* This routine starts the application. 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) 2006 by Atos Automacao Industrial Ltda.
|
||||
* written by Alain Schaefer <alain.schaefer@easc.ch>
|
||||
* and Antonio Giovanini <antonio@atos.com.br>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <bsp.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems/libcsupport.h>
|
||||
|
||||
|
||||
/*
|
||||
* The original 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;
|
||||
|
||||
char *rtems_progname;
|
||||
|
||||
/*
|
||||
* Use the shared implementations of the following routines
|
||||
*/
|
||||
|
||||
void bsp_postdriver_hook(void);
|
||||
void bsp_libc_init( void *, uint32_t, int );
|
||||
void Init_PLL (void);
|
||||
void Init_EBIU (void);
|
||||
void Init_Flags(void);
|
||||
void Init_RTC (void);
|
||||
|
||||
void null_isr(void);
|
||||
|
||||
/*
|
||||
* Function: bsp_pretasking_hook
|
||||
* Created: 95/03/10
|
||||
*
|
||||
* Description:
|
||||
* BSP pretasking hook. Called just before drivers are initialized.
|
||||
* Used to setup libc and install any BSP extensions.
|
||||
*
|
||||
* NOTES:
|
||||
* Must not use libc (to do io) from here, since drivers are
|
||||
* not yet initialized.
|
||||
*
|
||||
*/
|
||||
|
||||
void bsp_pretasking_hook(void)
|
||||
{
|
||||
extern int HeapBase;
|
||||
extern int HeapSize;
|
||||
void *heapStart = &HeapBase;
|
||||
unsigned long heapSize = (unsigned long)&HeapSize;
|
||||
|
||||
bsp_libc_init(heapStart, heapSize, 0);
|
||||
|
||||
#ifdef RTEMS_DEBUG
|
||||
rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* bsp_start
|
||||
*
|
||||
* This routine does the bulk of the system initialization.
|
||||
*/
|
||||
|
||||
void bsp_start( void )
|
||||
{
|
||||
|
||||
extern void * _WorkspaceBase;
|
||||
extern void *_RamSize;
|
||||
|
||||
/* BSP Hardware Initialization*/
|
||||
Init_RTC(); /* Blackfin Real Time Clock initialization */
|
||||
Init_PLL(); /* PLL initialization */
|
||||
Init_EBIU(); /* EBIU initialization */
|
||||
Init_Flags(); /* GPIO initialization */
|
||||
|
||||
|
||||
/*extern unsigned long _M68k_Ramsize;
|
||||
_M68k_Ramsize = (unsigned long)&_RamSize;*/ /* RAM size set in linker script */
|
||||
|
||||
/*
|
||||
* Allocate the memory for the RTEMS Work Space. This can come from
|
||||
* a variety of places: hard coded address, malloc'ed from outside
|
||||
* RTEMS world (e.g. simulator or primitive memory manager), or (as
|
||||
* typically done by stock BSPs) by subtracting the required amount
|
||||
* of work space from the last physical address on the CPU board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Need to "allocate" the memory for the RTEMS Workspace and
|
||||
* tell the RTEMS configuration where it is. This memory is
|
||||
* not malloc'ed. It is just "pulled from the air".
|
||||
*/
|
||||
|
||||
BSP_Configuration.work_space_start = (void *) &_WorkspaceBase;
|
||||
|
||||
/*
|
||||
* initialize the CPU table for this BSP
|
||||
*/
|
||||
|
||||
Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
|
||||
Cpu_table.postdriver_hook = bsp_postdriver_hook;
|
||||
|
||||
/*
|
||||
* SIS does zero out memory BUT only when IT begins execution. Thus
|
||||
* if we want to have a clean slate in the workspace each time we
|
||||
* begin execution of OUR application, then we must zero the workspace.
|
||||
*/
|
||||
Cpu_table.do_zero_of_workspace = TRUE;
|
||||
|
||||
|
||||
Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
|
||||
|
||||
int i=0;
|
||||
for (i=5;i<16;i++) {
|
||||
set_vector(null_isr, i, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Init_PLL
|
||||
*
|
||||
* Routine to initialize the PLL. The Ezkit uses a 27 Mhz XTAL.
|
||||
* See "../eZKit533/include/bsp.h" for more information.
|
||||
*/
|
||||
|
||||
void Init_PLL (void)
|
||||
{
|
||||
|
||||
unsigned int n;
|
||||
|
||||
/* Configure PLL registers */
|
||||
*((uint16_t*)PLL_LOCKCNT) = 0x1000;
|
||||
*((uint16_t*)PLL_DIV) = PLL_CSEL|PLL_SSEL;
|
||||
*((uint16_t*)PLL_CTL) = PLL_MSEL|PLL_DF;
|
||||
|
||||
/* Commands to set PLL values */
|
||||
asm("cli r0;");
|
||||
asm("idle;");
|
||||
asm("sti r0;");
|
||||
|
||||
/* Delay for PLL stabilization */
|
||||
for (n=0; n<200; n++) {}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Init_EBIU
|
||||
*
|
||||
* Configure extern memory
|
||||
*/
|
||||
|
||||
void Init_EBIU (void)
|
||||
{
|
||||
/* Configure FLASH */
|
||||
*((uint16_t*)EBIU_AMBCTL0) = 0x7bb07bb0;
|
||||
*((uint16_t*)EBIU_AMBCTL1) = 0x7bb07bb0;
|
||||
*((uint16_t*)EBIU_AMGCTL) = 0x000f;
|
||||
|
||||
/* Configure SDRAM
|
||||
*((uint16_t*)EBIU_SDGCTL) = 0x0091998d;
|
||||
*((uint16_t*)EBIU_SDBCTL) = 0x0013;
|
||||
*((uint16_t*)EBIU_SDRRC) = 0x0817;
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Init_Flags
|
||||
*
|
||||
* Enable LEDs port
|
||||
*/
|
||||
void Init_Flags(void)
|
||||
{
|
||||
*((uint16_t*)FIO_INEN) = 0x0100;
|
||||
*((uint16_t*)FIO_DIR) = 0x0000;
|
||||
*((uint16_t*)FIO_EDGE) = 0x0100;
|
||||
*((uint16_t*)FIO_MASKA_D) = 0x0100;
|
||||
|
||||
*((uint8_t*)FlashA_PortB_Dir) = 0x3f;
|
||||
*((uint8_t*)FlashA_PortB_Data) = 0x00;
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper Function to use the EzKits LEDS.
|
||||
* Can be used by the Application.
|
||||
*/
|
||||
void setLED (char value)
|
||||
{
|
||||
*((uint8_t*)FlashA_PortB_Data) = value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper Function to use the EzKits LEDS
|
||||
*/
|
||||
char getLED (void)
|
||||
{
|
||||
return *((uint8_t*)FlashA_PortB_Data);
|
||||
}
|
||||
153
c/src/lib/libbsp/bfin/eZKit533/startup/linkcmds
Normal file
153
c/src/lib/libbsp/bfin/eZKit533/startup/linkcmds
Normal file
@@ -0,0 +1,153 @@
|
||||
OUTPUT_FORMAT("elf32-bfin", "elf32-bfin",
|
||||
"elf32-bfin")
|
||||
|
||||
OUTPUT_ARCH(bfin)
|
||||
ENTRY(__start)
|
||||
|
||||
/*
|
||||
* Declare some sizes.
|
||||
*/
|
||||
_RamBase = DEFINED(_RamBase) ? _RamBase : 0x0;
|
||||
_RamSize = DEFINED(_RamSize) ? _RamSize : 0x01000000;
|
||||
_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000;
|
||||
_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
l1code(rwx) : ORIGIN = 0xffa08000, LENGTH = 0x00008000
|
||||
l1data(rwx) : ORIGIN = 0xff804000, LENGTH = 0x00004000
|
||||
sdram(rwx) : ORIGIN = 0x00001000, LENGTH = 0x01000000
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
.l1code :
|
||||
{
|
||||
/*jump.o (.text)*/
|
||||
} > l1code
|
||||
|
||||
.init :
|
||||
{
|
||||
KEEP (*(.init))
|
||||
} > sdram /*=0*/
|
||||
|
||||
.text :
|
||||
{
|
||||
CREATE_OBJECT_SYMBOLS
|
||||
*(.text)
|
||||
*(.rodata*)
|
||||
*(.gnu.linkonce.r*)
|
||||
|
||||
/*
|
||||
* Special FreeBSD sysctl sections.
|
||||
*/
|
||||
. = ALIGN (16);
|
||||
__start_set_sysctl_set = .;
|
||||
*(set_sysctl_*);
|
||||
__stop_set_sysctl_set = ABSOLUTE(.);
|
||||
*(set_domain_*);
|
||||
*(set_pseudo_*);
|
||||
|
||||
_etext = .;
|
||||
|
||||
___CTOR_LIST__ = .;
|
||||
LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2)
|
||||
*(.ctors)
|
||||
LONG(0)
|
||||
___CTOR_END__ = .;
|
||||
___DTOR_LIST__ = .;
|
||||
LONG((___DTOR_END__ - ___DTOR_LIST__) / 4 - 2)
|
||||
*(.dtors)
|
||||
LONG(0)
|
||||
___DTOR_END__ = .;
|
||||
} > sdram
|
||||
|
||||
.fini :
|
||||
{
|
||||
KEEP (*(.fini))
|
||||
} > ram /*=0*/
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.jcr)
|
||||
*(.gnu.linkonce.d*)
|
||||
CONSTRUCTORS
|
||||
_edata = .;
|
||||
} > sdram
|
||||
|
||||
.eh_frame : { *(.eh_frame) } > sdram
|
||||
.data1 : { *(.data1) } > sdram
|
||||
.eh_frame : { *(.eh_frame) } > sdram
|
||||
.gcc_except_table : { *(.gcc_except_table) } > sdram
|
||||
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r*)
|
||||
} > sdram
|
||||
|
||||
|
||||
.bss :
|
||||
{
|
||||
_bss_start = .;
|
||||
_clear_start = .;
|
||||
*(.bss)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN (64);
|
||||
_stack_init = .;
|
||||
. += _StackSize;
|
||||
_clear_end = .;
|
||||
_WorkspaceBase = .;
|
||||
. += 512K; /* reserve some memory for workspace */
|
||||
_HeapBase = .;
|
||||
. += _HeapSize; /* reserve some memory for heap */
|
||||
_end = .;
|
||||
__end = .;
|
||||
} > sdram
|
||||
|
||||
/* Debugging stuff follows */
|
||||
|
||||
/* 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 . */
|
||||
}
|
||||
|
||||
__HeapBase = _HeapBase;
|
||||
__HeapSize = _HeapSize;
|
||||
__WorkspaceBase = _WorkspaceBase;
|
||||
193
c/src/lib/libbsp/bfin/eZKit533/times
Normal file
193
c/src/lib/libbsp/bfin/eZKit533/times
Normal file
@@ -0,0 +1,193 @@
|
||||
#
|
||||
# Timing Test Suite Results for the Ezkit533
|
||||
#
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
Board:
|
||||
CPU: Blackfin 533
|
||||
Clock Speed: 400 MHz
|
||||
Memory Configuration: SDRAM 133 MHz
|
||||
Wait States:
|
||||
|
||||
Times Reported in: microseconds
|
||||
Timer Source: on-CPU cycle counter
|
||||
|
||||
Column A: -o0 optimization
|
||||
Column B: -o2 optimization
|
||||
Column C: -o4 optimization
|
||||
|
||||
# DESCRIPTION A B C
|
||||
== ================================================================= ==== ==== ====
|
||||
1 rtems_semaphore_create 42 17 17
|
||||
rtems_semaphore_delete 34 17 16
|
||||
rtems_semaphore_obtain: available 13 5 5
|
||||
rtems_semaphore_obtain: not available -- NO_WAIT 13 5 5
|
||||
rtems_semaphore_release: no waiting tasks 21 12 12
|
||||
|
||||
2 rtems_semaphore_obtain: not available -- caller blocks 86 39 37
|
||||
|
||||
3 rtems_semaphore_release: task readied -- preempts caller NC
|
||||
|
||||
4 rtems_task_restart: blocked task -- preempts caller NC
|
||||
rtems_task_restart: ready task -- preempts caller NC
|
||||
rtems_semaphore_release: task readied -- returns to caller NC
|
||||
rtems_task_create NC
|
||||
rtems_task_start NC
|
||||
rtems_task_restart: suspended task -- returns to caller NC
|
||||
rtems_task_delete: suspended task NC
|
||||
rtems_task_restart: ready task -- returns to caller NC
|
||||
rtems_task_restart: blocked task -- returns to caller NC
|
||||
rtems_task_delete: blocked task NC
|
||||
|
||||
5 rtems_task_suspend: calling task NC
|
||||
rtems_task_resume: task readied -- preempts caller NC
|
||||
|
||||
6 rtems_task_restart: calling task NC
|
||||
rtems_task_suspend: returns to caller NC
|
||||
rtems_task_resume: task readied -- returns to caller NC
|
||||
rtems_task_delete: ready task NC
|
||||
|
||||
7 rtems_task_restart: suspended task -- preempts caller NC 50 49
|
||||
|
||||
8 rtems_task_set_priority: obtain current priority NC 8 8
|
||||
rtems_task_set_priority: returns to caller NC 17 16
|
||||
rtems_task_mode: obtain current mode NC 6 6
|
||||
rtems_task_mode: no reschedule NC 6 6
|
||||
rtems_task_mode: reschedule -- returns to caller NC 8 8
|
||||
rtems_task_mode: reschedule -- preempts caller NC 31 30
|
||||
rtems_task_set_note NC 8 8
|
||||
rtems_task_get_note NC 9 8
|
||||
rtems_clock_set NC 25 25
|
||||
rtems_clock_get NC 2 2
|
||||
|
||||
9 rtems_message_queue_create NC 63
|
||||
rtems_message_queue_send: no waiting tasks NC 20
|
||||
rtems_message_queue_urgent: no waiting tasks NC 20
|
||||
rtems_message_queue_receive: available NC 20
|
||||
rtems_message_queue_flush: no messages flushed NC 8
|
||||
rtems_message_queue_flush: messages flushed NC 11
|
||||
rtems_message_queue_delete NC 28
|
||||
|
||||
10 rtems_message_queue_receive: not available -- NO_WAIT NC 11
|
||||
rtems_message_queue_receive: not available -- caller blocks NC 40
|
||||
|
||||
11 rtems_message_queue_send: task readied -- preempts caller NC
|
||||
|
||||
12 rtems_message_queue_send: task readied -- returns to caller NC
|
||||
|
||||
13 rtems_message_queue_urgent: task readied -- preempts caller NC
|
||||
|
||||
14 rtems_message_queue_urgent: task readied -- returns to caller NC
|
||||
|
||||
15 rtems_event_receive: obtain current events NC 1
|
||||
rtems_event_receive: not available -- NO_WAIT NC 7
|
||||
rtems_event_receive: not available -- caller blocks NC 33
|
||||
rtems_event_send: no task readied NC 6
|
||||
rtems_event_receive: available NC 9
|
||||
rtems_event_send: task readied -- returns to caller NC 13
|
||||
|
||||
16 rtems_event_send: task readied -- preempts caller NC
|
||||
|
||||
17 rtems_task_set_priority: preempts caller NC 38
|
||||
|
||||
18 rtems_task_delete: calling task NC 109
|
||||
|
||||
19 rtems_signal_catch NC 6
|
||||
rtems_signal_send: returns to caller NC 10
|
||||
rtems_signal_send: signal to self NC 18
|
||||
exit ASR overhead: returns to calling task NC 14
|
||||
exit ASR overhead: returns to preempting task NC
|
||||
|
||||
20 rtems_partition_create NC 4
|
||||
rtems_region_create NC 3
|
||||
rtems_partition_get_buffer: available NC 8
|
||||
rtems_partition_get_buffer: not available NC
|
||||
rtems_partition_return_buffer NC
|
||||
rtems_partition_delete NC
|
||||
rtems_region_get_segment: available NC
|
||||
rtems_region_get_segment: not available -- NO_WAIT NC
|
||||
rtems_region_return_segment: no waiting tasks NC
|
||||
rtems_region_get_segment: not available -- caller blocks NC
|
||||
rtems_region_return_segment: task readied -- preempts caller NC
|
||||
rtems_region_return_segment: task readied -- returns to caller NC
|
||||
rtems_region_delete NC
|
||||
rtems_io_initialize NC
|
||||
rtems_io_open NC
|
||||
rtems_io_close NC
|
||||
rtems_io_read NC
|
||||
rtems_io_write NC
|
||||
rtems_io_control NC
|
||||
|
||||
21 rtems_task_ident NC
|
||||
rtems_message_queue_ident NC
|
||||
rtems_semaphore_ident NC
|
||||
rtems_partition_ident NC
|
||||
rtems_region_ident NC
|
||||
rtems_port_ident NC
|
||||
rtems_timer_ident NC
|
||||
rtems_rate_monotonic_ident NC
|
||||
|
||||
22 rtems_message_queue_broadcast: task readied -- returns to caller NC 25
|
||||
rtems_message_queue_broadcast: no waiting tasks NC
|
||||
rtems_message_queue_broadcast: task readied -- preempts caller NC
|
||||
|
||||
23 rtems_timer_create NC 10 9
|
||||
rtems_timer_fire_after: inactive NC 16 15
|
||||
rtems_timer_fire_after: active NC 17 17
|
||||
rtems_timer_cancel: active NC 10 9
|
||||
rtems_timer_cancel: inactive NC 8 7
|
||||
rtems_timer_reset: inactive NC 15 14
|
||||
rtems_timer_reset: active NC 16 16
|
||||
rtems_timer_fire_when: inactive NC 22 22
|
||||
rtems_timer_fire_when: active NC 23 22
|
||||
rtems_timer_delete: active NC 13 13
|
||||
rtems_timer_delete: inactive NC 12 11
|
||||
rtems_task_wake_when NC 44 43
|
||||
|
||||
24 rtems_task_wake_after: yield -- returns to caller NC 6
|
||||
rtems_task_wake_after: yields -- preempts caller NC 27
|
||||
|
||||
25 rtems_clock_tick NC 6
|
||||
|
||||
26 _ISR_Disable NC
|
||||
_ISR_Flash NC
|
||||
_ISR_Enable NC
|
||||
_Thread_Disable_dispatch NC
|
||||
_Thread_Enable_dispatch NC
|
||||
_Thread_Set_state NC
|
||||
_Thread_Disptach (NO FP) NC
|
||||
context switch: no floating point contexts NC
|
||||
context switch: self NC
|
||||
context switch: to another task NC
|
||||
context switch: restore 1st FP task NC
|
||||
fp context switch: save idle, restore idle NC
|
||||
fp context switch: save idle, restore initialized NC
|
||||
fp context switch: save initialized, restore initialized NC
|
||||
_Thread_Resume NC
|
||||
_Thread_Unblock NC
|
||||
_Thread_Ready NC
|
||||
_Thread_Get NC
|
||||
_Semaphore_Get NC
|
||||
_Thread_Get: invalid id NC
|
||||
|
||||
27 interrupt entry overhead: returns to interrupted task NC 0
|
||||
interrupt exit overhead: returns to interrupted task NC 0
|
||||
interrupt entry overhead: returns to nested interrupt NC 0
|
||||
interrupt exit overhead: returns to nested interrupt NC 0
|
||||
interrupt entry overhead: returns to preempting task NC 0
|
||||
interrupt exit overhead: returns to preempting task NC
|
||||
|
||||
28 rtems_port_create NC 12
|
||||
rtems_port_external_to_internal NC 7
|
||||
rtems_port_internal_to_external NC 7
|
||||
rtems_port_delete NC 11
|
||||
|
||||
29 rtems_rate_monotonic_create 27 12 12
|
||||
rtems_rate_monotonic_period: initiate period -- returns to caller 30 15 15
|
||||
rtems_rate_monotonic_period: obtain status 14 9 9
|
||||
rtems_rate_monotonic_cancel 21 12 11
|
||||
rtems_rate_monotonic_delete: inactive 26 14 14
|
||||
rtems_rate_monotonic_delete: active 32 15 15
|
||||
rtems_rate_monotonic_period: conclude periods -- caller blocks NC
|
||||
49
c/src/lib/libbsp/bfin/shared/clock/clockdrv.c
Normal file
49
c/src/lib/libbsp/bfin/shared/clock/clockdrv.c
Normal file
@@ -0,0 +1,49 @@
|
||||
/* Clock Driver for eZKit533.
|
||||
*
|
||||
* Instantiate the clock driver shell blackfin core timer.
|
||||
*
|
||||
* Copyright (c) 2006 by Atos Automacao Industrial Ltda.
|
||||
* written by Alain Schaefer <alain.schaefer@easc.ch>
|
||||
* and Antonio Giovanini <antonio@atos.com.br>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <rtems.h>
|
||||
#include <bsp.h>
|
||||
#include <rtems/libio.h>
|
||||
|
||||
/*
|
||||
* If defined, speed up the clock ticks while the idle task is running so
|
||||
* time spent in the idle task is minimized. This significantly reduces
|
||||
* the wall time required to execute the RTEMS test suites.
|
||||
*/
|
||||
|
||||
/* #define CLOCK_DRIVER_USE_FAST_IDLE */
|
||||
|
||||
#define CLOCK_VECTOR 6
|
||||
|
||||
|
||||
#define Clock_driver_support_install_isr( _new, _old ) \
|
||||
do { \
|
||||
_old = (rtems_isr_entry) set_vector( _new, CLOCK_VECTOR, 1 ); \
|
||||
} while(0)
|
||||
|
||||
#define Clock_driver_support_initialize_hardware() \
|
||||
*((uint32_t*)TCNTL) = TAUTORLD|TMREN|TMPWR; \
|
||||
*((uint32_t*)TPERIOD) = CCLK / 1000000 * BSP_Configuration.microseconds_per_tick; \
|
||||
*((uint32_t*)TSCALE) = 0; \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
#define Clock_driver_support_at_tick()
|
||||
|
||||
#define Clock_driver_support_shutdown_hardware()
|
||||
|
||||
#include "../../../shared/clockdrv_shell.c"
|
||||
|
||||
177
c/src/lib/libbsp/bfin/shared/clock/rtc.c
Normal file
177
c/src/lib/libbsp/bfin/shared/clock/rtc.c
Normal file
@@ -0,0 +1,177 @@
|
||||
/* Real Time Clock Driver for eZKit533.
|
||||
*
|
||||
* Copyright (c) 2006 by Atos Automacao Industrial Ltda.
|
||||
* written by Alain Schaefer <alain.schaefer@easc.ch>
|
||||
* and Antonio Giovanini <antonio@atos.com.br>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <rtems.h>
|
||||
#include <bsp.h>
|
||||
#include "tod.h"
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems/score/tod.h>
|
||||
#include <rtems/rtems/types.h>
|
||||
|
||||
#define MSK_DAY 0xFFFE0000
|
||||
#define MSK_HOUR 0x0001F000
|
||||
#define MSK_MINUTE 0x00000FC0
|
||||
#define MSK_SECOND 0x0000003F
|
||||
#define SHF_DAY 17
|
||||
#define SHF_HOUR 12
|
||||
#define SHF_MINUTE 6
|
||||
#define SHF_SECOND 0
|
||||
|
||||
|
||||
rtems_device_driver rtc_initialize(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor_arg,
|
||||
void *arg
|
||||
)
|
||||
{
|
||||
rtems_status_code status;
|
||||
|
||||
/*
|
||||
* Register and initialize the primary RTC's
|
||||
*/
|
||||
|
||||
status = rtems_io_register_name( "/dev/rtc", major, 0 );
|
||||
if (status != RTEMS_SUCCESSFUL) {
|
||||
rtems_fatal_error_occurred(status);
|
||||
}
|
||||
|
||||
Init_RTC();
|
||||
|
||||
setRealTimeToRTEMS();
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
void Init_RTC(void)
|
||||
{
|
||||
*((uint16_t*)RTC_PREN) = 0x0001; /* Enable Prescaler */
|
||||
}
|
||||
|
||||
int Leap_years_until_now (int year);
|
||||
|
||||
/*
|
||||
* Read time from RTEMS' clock manager and set it to RTC
|
||||
*/
|
||||
|
||||
void setRealTimeFromRTEMS (void)
|
||||
{
|
||||
rtems_time_of_day time_buffer;
|
||||
rtems_status_code status;
|
||||
|
||||
status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time_buffer );
|
||||
if (status == RTEMS_SUCCESSFUL){
|
||||
setRealTime(&time_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Read real time from RTC and set it to RTEMS' clock manager
|
||||
*/
|
||||
|
||||
void setRealTimeToRTEMS (void)
|
||||
{
|
||||
rtems_time_of_day time_buffer;
|
||||
|
||||
getRealTime(&time_buffer);
|
||||
rtems_clock_set( &time_buffer );
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the RTC time
|
||||
*/
|
||||
int setRealTime(
|
||||
rtems_time_of_day *tod
|
||||
)
|
||||
{
|
||||
uint32_t days;
|
||||
rtems_time_of_day tod_temp;
|
||||
|
||||
tod_temp = *tod;
|
||||
|
||||
days = (tod_temp.year - TOD_BASE_YEAR)*365 + _TOD_Days_to_date[0][tod_temp.month] + tod_temp.day - 1;
|
||||
if (tod_temp.month < 3) days += Leap_years_until_now (tod_temp.year - 1);
|
||||
else days += Leap_years_until_now (tod_temp.year);
|
||||
|
||||
*((uint32_t*)RTC_STAT) = (days << SHF_DAY)|(tod_temp.hour << SHF_HOUR)|(tod_temp.minute << SHF_MINUTE)|tod_temp.second;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the time from the RTC.
|
||||
*/
|
||||
|
||||
void getRealTime(
|
||||
rtems_time_of_day *tod
|
||||
)
|
||||
{
|
||||
uint32_t days, rtc_reg;
|
||||
rtems_time_of_day tod_temp;
|
||||
int n, Leap_year;
|
||||
|
||||
rtc_reg = *((uint32_t*)RTC_STAT);
|
||||
|
||||
days = (rtc_reg >> SHF_DAY) + 1;
|
||||
|
||||
/* finding year */
|
||||
tod_temp.year = days/365 + TOD_BASE_YEAR;
|
||||
if (days%365 > Leap_years_until_now (tod_temp.year - 1)){
|
||||
days = (days%365) - Leap_years_until_now (tod_temp.year - 1);
|
||||
}else{
|
||||
tod_temp.year--;
|
||||
days = (days%365) + 365 - Leap_years_until_now (tod_temp.year - 1);
|
||||
}
|
||||
|
||||
/* finding month and day */
|
||||
Leap_year = (((!(tod_temp.year%4)) && (tod_temp.year%100)) || (!(tod_temp.year%400)))?1:0;
|
||||
for (n=1; n<=12; n++)
|
||||
{
|
||||
if (days <= _TOD_Days_to_date[Leap_year][n+1])
|
||||
{
|
||||
tod_temp.month = n;
|
||||
tod_temp.day = days - _TOD_Days_to_date[Leap_year][n];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tod_temp.hour = (rtc_reg & MSK_HOUR) >> SHF_HOUR;
|
||||
tod_temp.minute = (rtc_reg & MSK_MINUTE) >> SHF_MINUTE;
|
||||
tod_temp.second = (rtc_reg & MSK_SECOND);
|
||||
tod_temp.ticks = 0;
|
||||
*tod = tod_temp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the difference between RTC and RTEMS' clock manager time in minutes.
|
||||
* If the difference is greater than 1 day, this returns 9999.
|
||||
*/
|
||||
|
||||
int checkRealTime (void)
|
||||
{
|
||||
rtems_time_of_day rtems_tod;
|
||||
rtems_time_of_day rtc_tod;
|
||||
uint32_t rtems_time;
|
||||
uint32_t rtc_time;
|
||||
|
||||
rtems_clock_get( RTEMS_CLOCK_GET_TOD, &rtems_tod );
|
||||
getRealTime ( &rtc_tod );
|
||||
|
||||
rtems_time = _TOD_To_seconds( &rtems_tod );
|
||||
rtc_time = _TOD_To_seconds( &rtc_tod );
|
||||
|
||||
return rtems_time - rtc_time;
|
||||
}
|
||||
|
||||
int Leap_years_until_now (int year)
|
||||
{
|
||||
return ((year/4 - year/100 + year/400) - ((TOD_BASE_YEAR - 1)/4 - (TOD_BASE_YEAR - 1)/100 + (TOD_BASE_YEAR - 1)/400));
|
||||
}
|
||||
63
c/src/lib/libbsp/bfin/shared/clock/tod.h
Normal file
63
c/src/lib/libbsp/bfin/shared/clock/tod.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/* tod.h
|
||||
*
|
||||
* Real Time Clock definitions for eZKit533.
|
||||
*
|
||||
* Copyright (c) 2006 by Atos Automacao Industrial Ltda.
|
||||
* written by Alain Schaefer <alain.schaefer@easc.ch>
|
||||
* and Antonio Giovanini <antonio@atos.com.br>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TOD_H
|
||||
#define TOD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set the RTC.
|
||||
*/
|
||||
|
||||
int setRealTime(
|
||||
rtems_time_of_day *tod
|
||||
);
|
||||
|
||||
/*
|
||||
* Get the time from the RTC.
|
||||
*/
|
||||
|
||||
void getRealTime(
|
||||
rtems_time_of_day *tod
|
||||
);
|
||||
|
||||
/*
|
||||
* Read real time from RTC and set it to RTEMS' clock manager
|
||||
*/
|
||||
|
||||
void setRealTimeToRTEMS();
|
||||
|
||||
/*
|
||||
* Read time from RTEMS' clock manager and set it to RTC
|
||||
*/
|
||||
|
||||
void setRealTimeFromRTEMS();
|
||||
|
||||
/*
|
||||
* Return the difference between RTC and RTEMS' clock manager time in minutes.
|
||||
* If the difference is greater than 1 day, this returns 9999.
|
||||
*/
|
||||
|
||||
int checkRealTime();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
233
c/src/lib/libbsp/bfin/shared/console/console.c
Normal file
233
c/src/lib/libbsp/bfin/shared/console/console.c
Normal file
@@ -0,0 +1,233 @@
|
||||
/* Console Driver for eZKit533
|
||||
*
|
||||
* Copyright (c) 2006 by Atos Automacao Industrial Ltda.
|
||||
* written by Alain Schaefer <alain.schaefer@easc.ch>
|
||||
* and Antonio Giovanini <antonio@atos.com.br>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <bsp.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
/*
|
||||
* console_outbyte_polled
|
||||
*
|
||||
* This routine transmits a character using polling.
|
||||
*/
|
||||
|
||||
void console_outbyte_polled(int port, char ch);
|
||||
|
||||
/* body is in console-io.c */
|
||||
|
||||
/*
|
||||
* console_inbyte_nonblocking
|
||||
*
|
||||
* This routine polls for a character.
|
||||
*/
|
||||
|
||||
int console_inbyte_nonblocking( int port );
|
||||
/* body is in console-io.c */
|
||||
|
||||
/*
|
||||
*
|
||||
* This routine initialize uart hardware
|
||||
*/
|
||||
|
||||
void console_initialize_hardware(void);
|
||||
|
||||
/* body is in console-io.c */
|
||||
|
||||
/*
|
||||
* Interrupt driven console IO
|
||||
*/
|
||||
|
||||
#if (CONSOLE_USE_INTERRUPTS)
|
||||
|
||||
/*
|
||||
* Buffers between task and ISRs
|
||||
*/
|
||||
|
||||
#include <rtems/ringbuf.h>
|
||||
|
||||
void *console_termios_data[ 1 ];
|
||||
|
||||
/*
|
||||
* console_initialize_interrupts
|
||||
*
|
||||
* This routine initializes the console's receive and transmit
|
||||
* ring buffers and loads the appropriate vectors to handle the interrupts.
|
||||
*
|
||||
* Input parameters: NONE
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* Return values: NONE
|
||||
*/
|
||||
void console_initialize_interrupts( void );
|
||||
/* body is in console-io.c */
|
||||
|
||||
/*
|
||||
* console_outbyte_interrupt
|
||||
*
|
||||
* This routine transmits a character out.
|
||||
*
|
||||
* Input parameters:
|
||||
* port - port to transmit character to
|
||||
* ch - character to be transmitted
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* Return values: NONE
|
||||
*/
|
||||
|
||||
void console_outbyte_interrupt(int port, char ch);
|
||||
|
||||
#endif /* CONSOLE_USE_INTERRUPTS */
|
||||
|
||||
/*
|
||||
* Console Termios Support Entry Points
|
||||
*
|
||||
*/
|
||||
|
||||
int console_write_support (int minor, const char *buf, int len)
|
||||
{
|
||||
int nwrite = 0;
|
||||
|
||||
while (nwrite < len) {
|
||||
#if (CONSOLE_USE_INTERRUPTS)
|
||||
console_outbyte_interrupt( minor, *buf++ );
|
||||
#else
|
||||
console_outbyte_polled( minor, *buf++ );
|
||||
#endif
|
||||
nwrite++;
|
||||
}
|
||||
return nwrite;
|
||||
}
|
||||
|
||||
/*
|
||||
* Console Device Driver Entry Points
|
||||
*
|
||||
*/
|
||||
|
||||
rtems_device_driver console_initialize(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *arg
|
||||
)
|
||||
{
|
||||
rtems_status_code status;
|
||||
|
||||
rtems_termios_initialize();
|
||||
|
||||
/*
|
||||
* Register Device Names
|
||||
*/
|
||||
|
||||
status = rtems_io_register_name( "/dev/console", major, 0 );
|
||||
if (status != RTEMS_SUCCESSFUL)
|
||||
rtems_fatal_error_occurred(status);
|
||||
|
||||
/*
|
||||
* Initialize Hardware
|
||||
*/
|
||||
|
||||
#if (CONSOLE_USE_INTERRUPTS)
|
||||
console_initialize_interrupts();
|
||||
#endif
|
||||
|
||||
console_initialize_hardware();
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_device_driver console_open(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
#if (CONSOLE_USE_INTERRUPTS)
|
||||
rtems_libio_open_close_args_t *args = arg;
|
||||
static const rtems_termios_callbacks intrCallbacks = {
|
||||
NULL, /* firstOpen */
|
||||
NULL, /* lastClose */
|
||||
NULL, /* pollRead */
|
||||
console_write_support, /* write */
|
||||
NULL, /* setAttributes */
|
||||
NULL, /* stopRemoteTx */
|
||||
NULL, /* startRemoteTx */
|
||||
0 /* outputUsesInterrupts */
|
||||
};
|
||||
#else
|
||||
static const rtems_termios_callbacks pollCallbacks = {
|
||||
NULL, /* firstOpen */
|
||||
NULL, /* lastClose */
|
||||
console_inbyte_nonblocking, /* pollRead */
|
||||
console_write_support, /* write */
|
||||
NULL, /* setAttributes */
|
||||
NULL, /* stopRemoteTx */
|
||||
NULL, /* startRemoteTx */
|
||||
0 /* outputUsesInterrupts */
|
||||
};
|
||||
#endif
|
||||
|
||||
assert( minor <= 1 );
|
||||
if ( minor > 2 )
|
||||
return RTEMS_INVALID_NUMBER;
|
||||
|
||||
#if (CONSOLE_USE_INTERRUPTS)
|
||||
sc = rtems_termios_open (major, minor, arg, &intrCallbacks);
|
||||
|
||||
console_termios_data[ minor ] = args->iop->data1;
|
||||
#else
|
||||
sc = rtems_termios_open (major, minor, arg, &pollCallbacks);
|
||||
#endif
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_device_driver console_close(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
return rtems_termios_close (arg);
|
||||
}
|
||||
|
||||
rtems_device_driver console_read(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
return rtems_termios_read (arg);
|
||||
}
|
||||
|
||||
rtems_device_driver console_write(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
return rtems_termios_write (arg);
|
||||
}
|
||||
|
||||
rtems_device_driver console_control(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
return rtems_termios_ioctl (arg);
|
||||
}
|
||||
71
c/src/lib/libbsp/bfin/shared/start/start.S
Normal file
71
c/src/lib/libbsp/bfin/shared/start/start.S
Normal file
@@ -0,0 +1,71 @@
|
||||
|
||||
|
||||
#include <rtems/score/bfin.h>
|
||||
.section .init
|
||||
.globl __init
|
||||
.type __init,@function
|
||||
__init:
|
||||
.section .fini
|
||||
.globl __fini
|
||||
.type __fini,@function
|
||||
__fini:
|
||||
|
||||
|
||||
.text
|
||||
.align 2
|
||||
|
||||
.global __start
|
||||
__start:
|
||||
|
||||
/* Start by setting up a stack */
|
||||
sp.h = 0xFFB0;
|
||||
sp.l = 0x0F00;
|
||||
|
||||
/* Maybe we should zero the memory in the .bss section. */
|
||||
|
||||
/* This changes to the supervisor mode */
|
||||
p0.l = START;
|
||||
p0.h = START;
|
||||
p1.l = LO(EVT15);
|
||||
p1.h = HI(EVT15);
|
||||
|
||||
[P1] = P0;
|
||||
|
||||
P0.h = HI(IMASK);
|
||||
P0.l = LO(IMASK);
|
||||
R0 = [P0];
|
||||
/* R1.l = EVT_IVG15 & 0xFFFF; */
|
||||
R1.l = 0x8000;
|
||||
|
||||
R0 = R0 | R1;
|
||||
|
||||
[P0] = R0;
|
||||
|
||||
RAISE 15;
|
||||
|
||||
PO.l = WAIT;
|
||||
P0.h = WAIT;
|
||||
|
||||
RETI = P0;
|
||||
RTI;
|
||||
|
||||
/* endless loop to wait */
|
||||
WAIT:
|
||||
jump WAIT;
|
||||
|
||||
START:
|
||||
[--SP] = RETI;
|
||||
p0.l = _boot_card;
|
||||
p0.h = _boot_card;
|
||||
|
||||
call (p0);
|
||||
|
||||
p0.l = _exit;
|
||||
p0.h = _exit;
|
||||
P3 = P4;
|
||||
jump (p0) /* Should not return. */
|
||||
|
||||
.global _null_isr
|
||||
_null_isr:
|
||||
rti;
|
||||
|
||||
106
c/src/lib/libbsp/bfin/shared/timer/timer.c
Normal file
106
c/src/lib/libbsp/bfin/shared/timer/timer.c
Normal file
@@ -0,0 +1,106 @@
|
||||
/* bspstart.c for eZKit533
|
||||
*
|
||||
* This file manages the benchmark timer used by the RTEMS Timing Test
|
||||
* Suite. Each measured time period is demarcated by calls to
|
||||
* Timer_initialize() and Read_timer(). Read_timer() usually returns
|
||||
* the number of microseconds since Timer_initialize() exitted.
|
||||
*
|
||||
* Copyright (c) 2006 by Atos Automacao Industrial Ltda.
|
||||
* written by Alain Schaefer <alain.schaefer@easc.ch>
|
||||
* and Antonio Giovanini <antonio@atos.com.br>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <rtems.h>
|
||||
#include <bsp.h>
|
||||
|
||||
|
||||
uint32_t Timer_interrupts;
|
||||
rtems_boolean Timer_driver_Find_average_overhead;
|
||||
|
||||
/*
|
||||
* Timer_initialize
|
||||
*
|
||||
* Blackfin processor has a counter for clock cycles.
|
||||
*/
|
||||
void Timer_initialize( void )
|
||||
{
|
||||
|
||||
/*reset counters*/
|
||||
asm ("R2 = 0;");
|
||||
asm ("CYCLES = R2;");
|
||||
asm ("CYCLES2 = R2;");
|
||||
/*start counters*/
|
||||
asm ("R2 = SYSCFG;");
|
||||
asm ("BITSET(R2,1);");
|
||||
asm ("SYSCFG = R2");
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* The following controls the behavior of Read_timer().
|
||||
*
|
||||
* AVG_OVEREHAD is the overhead for starting and stopping the timer. It
|
||||
* is usually deducted from the number returned.
|
||||
*
|
||||
* LEAST_VALID is the lowest number this routine should trust. Numbers
|
||||
* below this are "noise" and zero is returned.
|
||||
*/
|
||||
|
||||
#define AVG_OVERHEAD 0 /* It typically takes X.X microseconds */
|
||||
/* (Y countdowns) to start/stop the timer. */
|
||||
/* This value is in microseconds. */
|
||||
#define LEAST_VALID 1 /* Don't trust a clicks value lower than this */
|
||||
|
||||
int Read_timer( void )
|
||||
{
|
||||
uint32_t clicks;
|
||||
uint32_t total;
|
||||
register int *cycles asm ("R2");
|
||||
|
||||
/* stop counter */
|
||||
asm("R2 = SYSCFG;");
|
||||
asm("BITCLR(R2,1);");
|
||||
asm("SYSCFG = R2;");
|
||||
asm("R2 = CYCLES;");
|
||||
|
||||
|
||||
clicks = cycles; /* Clock cycles */
|
||||
|
||||
/* converting to microseconds */
|
||||
total = clicks / (CCLK/1000000);
|
||||
|
||||
if ( Timer_driver_Find_average_overhead == 1 )
|
||||
return total; /* in XXX microsecond units */
|
||||
else {
|
||||
if ( total < LEAST_VALID )
|
||||
return 0; /* below timer resolution */
|
||||
/*
|
||||
* Somehow convert total into microseconds
|
||||
*/
|
||||
return (total - AVG_OVERHEAD);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Empty function call used in loops to measure basic cost of looping
|
||||
* in Timing Test Suite.
|
||||
*/
|
||||
|
||||
rtems_status_code Empty_function( void )
|
||||
{
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
void Set_find_average_overhead(
|
||||
rtems_boolean find_flag
|
||||
)
|
||||
{
|
||||
Timer_driver_Find_average_overhead = find_flag;
|
||||
}
|
||||
Reference in New Issue
Block a user