summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/bfin
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-08-18 21:51:37 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-08-18 21:51:37 +0000
commitc553a233386c47a16029ef1de276be820f4d294e (patch)
treead8cb997ebdfe73ebd5d628632d33d0db66dea3b /c/src/lib/libbsp/bfin
parent2008-08-18 Allan Hessenflow <allanh@kallisti.com> (diff)
downloadrtems-c553a233386c47a16029ef1de276be820f4d294e.tar.bz2
2008-08-18 Allan Hessenflow <allanh@kallisti.com>
* shared/clock/clockdrv.c, shared/clock/rtc.c, shared/clock/tod.h, shared/console/console.c, shared/timer/timer.c: Removed.
Diffstat (limited to 'c/src/lib/libbsp/bfin')
-rw-r--r--c/src/lib/libbsp/bfin/ChangeLog5
-rw-r--r--c/src/lib/libbsp/bfin/shared/clock/clockdrv.c49
-rw-r--r--c/src/lib/libbsp/bfin/shared/clock/rtc.c192
-rw-r--r--c/src/lib/libbsp/bfin/shared/clock/tod.h63
-rw-r--r--c/src/lib/libbsp/bfin/shared/console/console.c233
-rw-r--r--c/src/lib/libbsp/bfin/shared/timer/timer.c106
6 files changed, 5 insertions, 643 deletions
diff --git a/c/src/lib/libbsp/bfin/ChangeLog b/c/src/lib/libbsp/bfin/ChangeLog
index 7afba1d7ff..af7b9161a6 100644
--- a/c/src/lib/libbsp/bfin/ChangeLog
+++ b/c/src/lib/libbsp/bfin/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-18 Allan Hessenflow <allanh@kallisti.com>
+
+ * shared/clock/clockdrv.c, shared/clock/rtc.c, shared/clock/tod.h,
+ shared/console/console.c, shared/timer/timer.c: Removed.
+
2008-08-18 Ralf Corsépius <ralf.corsepius@rtems.org>
* shared/clock/tod.h: Add missing prototypes.
diff --git a/c/src/lib/libbsp/bfin/shared/clock/clockdrv.c b/c/src/lib/libbsp/bfin/shared/clock/clockdrv.c
deleted file mode 100644
index 863795e315..0000000000
--- a/c/src/lib/libbsp/bfin/shared/clock/clockdrv.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* 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 * rtems_configuration_get_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"
-
diff --git a/c/src/lib/libbsp/bfin/shared/clock/rtc.c b/c/src/lib/libbsp/bfin/shared/clock/rtc.c
deleted file mode 100644
index aa24c36c28..0000000000
--- a/c/src/lib/libbsp/bfin/shared/clock/rtc.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/* 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
-
-/* The following are inside RTEMS -- we are violating visibility!!!
- * Perhaps an API could be defined to get days since 1 Jan.
- */
-extern const uint16_t _TOD_Days_to_date[2][13];
-
-/*
- * Prototypes and routines used below
- */
-int Leap_years_until_now (int year);
-
-void Init_RTC(void)
-{
- *((uint16_t*)RTC_PREN) = 0x0001; /* Enable Prescaler */
-}
-
-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;
-}
-
-/*
- * 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;
-
- return 0;
-}
-
- /*
- * 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));
-}
diff --git a/c/src/lib/libbsp/bfin/shared/clock/tod.h b/c/src/lib/libbsp/bfin/shared/clock/tod.h
deleted file mode 100644
index 18f257bebe..0000000000
--- a/c/src/lib/libbsp/bfin/shared/clock/tod.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* 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(void);
-
-/*
- * Read time from RTEMS' clock manager and set it to RTC
- */
-
-void setRealTimeFromRTEMS(void);
-
-/*
- * 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);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/c/src/lib/libbsp/bfin/shared/console/console.c b/c/src/lib/libbsp/bfin/shared/console/console.c
deleted file mode 100644
index b8cd15d822..0000000000
--- a/c/src/lib/libbsp/bfin/shared/console/console.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/* 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);
-}
diff --git a/c/src/lib/libbsp/bfin/shared/timer/timer.c b/c/src/lib/libbsp/bfin/shared/timer/timer.c
deleted file mode 100644
index 6c51384fc2..0000000000
--- a/c/src/lib/libbsp/bfin/shared/timer/timer.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* 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 uint32_t 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;
-}