mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 22:54:14 +08:00
Merge branch 'master' of ssh://dispatch.rtems.org/data/git/rtems
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
On-Line Applications Research Corporation (OAR) offers support,
|
||||
customization, and training for RTEMS. Custom RTEMS development services
|
||||
includes porting RTEMS to new processors and the development of custom board
|
||||
support packages and device drivers. In addition, OAR is available
|
||||
to assist in the development of your real-time embedded application.
|
||||
|
||||
For more information, email Joel Sherrill joel.sherrill@OARcorp.com
|
||||
or contact OAR at:
|
||||
|
||||
On-Line Applications Research Corporation
|
||||
7047 Old Madison Pike Suite 320
|
||||
Huntsville AL 35806
|
||||
Voice: (256) 722-9985
|
||||
Fax: (256) 722-0985
|
||||
|
||||
RTEMS maintenance and development is funded solely by RTEMS users.
|
||||
The future of RTEMS depends on its user base.
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#
|
||||
# This file is automatically generated -- DO NOT EDIT!!!
|
||||
#
|
||||
|
||||
RTEMS Version 4.10.99.0
|
||||
@@ -12,6 +12,7 @@ AC_DEFUN([RTEMS_CPU_SUBDIRS],
|
||||
case $RTEMS_CPU in
|
||||
_RTEMS_CPU_SUBDIR([arm],[$1]);;
|
||||
_RTEMS_CPU_SUBDIR([bfin],[$1]);;
|
||||
_RTEMS_CPU_SUBDIR([epiphany],[$1]);;
|
||||
_RTEMS_CPU_SUBDIR([avr],[$1]);;
|
||||
_RTEMS_CPU_SUBDIR([h8300],[$1]);;
|
||||
_RTEMS_CPU_SUBDIR([i386],[$1]);;
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -15,11 +15,12 @@
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/timecounter.h>
|
||||
#include <bsp.h>
|
||||
|
||||
#include <libcpu/omap_timer.h>
|
||||
|
||||
#ifdef ARM_MULTILIB_ARCH_V4
|
||||
static struct timecounter beagle_clock_tc;
|
||||
|
||||
static omap_timer_registers_t regs_v1 = {
|
||||
.TIDR = OMAP3_TIMER_TIDR,
|
||||
@@ -115,8 +116,6 @@ static struct omap_timer *timer = &am335x_timer;
|
||||
|
||||
#endif
|
||||
|
||||
static int done = 0;
|
||||
|
||||
#if IS_AM335X
|
||||
#define FRCLOCK_HZ (16*1500000)
|
||||
#endif
|
||||
@@ -181,20 +180,14 @@ omap3_frclock_init(void)
|
||||
/* Start timer, without prescaler */
|
||||
mmio_set(fr_timer->base + fr_timer->regs->TCLR,
|
||||
OMAP3_TCLR_OVF_TRG | OMAP3_TCLR_AR | OMAP3_TCLR_ST);
|
||||
done = 1;
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
read_frc(void)
|
||||
static uint32_t
|
||||
beagle_clock_get_timecount(struct timecounter *tc)
|
||||
{
|
||||
if (done == 0) {
|
||||
return 0;
|
||||
}
|
||||
return mmio_read(fr_timer->base + fr_timer->regs->TCRR);
|
||||
}
|
||||
|
||||
static uint32_t last_tick_nanoseconds;
|
||||
|
||||
static void
|
||||
beagle_clock_initialize(void)
|
||||
{
|
||||
@@ -262,12 +255,16 @@ beagle_clock_initialize(void)
|
||||
while(mmio_read(AM335X_WDT_BASE+AM335X_WDT_WWPS) != 0) ;
|
||||
#endif
|
||||
|
||||
/* Install timecounter */ \
|
||||
beagle_clock_tc.tc_get_timecount = beagle_clock_get_timecount;
|
||||
beagle_clock_tc.tc_counter_mask = 0xffffffff;
|
||||
beagle_clock_tc.tc_frequency = FRCLOCK_HZ;
|
||||
beagle_clock_tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
|
||||
rtems_timecounter_install(&beagle_clock_tc);
|
||||
}
|
||||
|
||||
static void beagle_clock_at_tick(void)
|
||||
{
|
||||
last_tick_nanoseconds = read_frc();
|
||||
|
||||
mmio_write(timer->base + timer->regs->TISR,
|
||||
OMAP3_TISR_MAT_IT_FLAG | OMAP3_TISR_OVF_IT_FLAG |
|
||||
OMAP3_TISR_TCAR_IT_FLAG);
|
||||
@@ -315,14 +312,6 @@ static void beagle_clock_cleanup(void)
|
||||
mmio_clear(fr_timer->base + fr_timer->regs->TCLR, OMAP3_TCLR_ST);
|
||||
}
|
||||
|
||||
static inline uint32_t beagle_clock_nanoseconds_since_last_tick(void)
|
||||
{
|
||||
/* this arithmetic also works if read_frc() wraps around, as long
|
||||
* as the subtraction wraps around too
|
||||
*/
|
||||
return (read_frc() - (uint64_t) last_tick_nanoseconds) * 1000000000 / FRCLOCK_HZ;
|
||||
}
|
||||
|
||||
#define Clock_driver_support_at_tick() beagle_clock_at_tick()
|
||||
#define Clock_driver_support_initialize_hardware() beagle_clock_initialize()
|
||||
#define Clock_driver_support_install_isr(isr, old_isr) \
|
||||
@@ -332,10 +321,6 @@ static inline uint32_t beagle_clock_nanoseconds_since_last_tick(void)
|
||||
} while (0)
|
||||
|
||||
#define Clock_driver_support_shutdown_hardware() beagle_clock_cleanup()
|
||||
#define Clock_driver_nanoseconds_since_last_tick \
|
||||
beagle_clock_nanoseconds_since_last_tick
|
||||
|
||||
/* Include shared source clock driver code */
|
||||
#include "../../shared/clockdrv_shell.h"
|
||||
|
||||
#endif /* ARM_MULTILIB_ARCH_V4 */
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -68,4 +68,6 @@ void Clock_isr(void * arg);
|
||||
assert(status == RTEMS_SUCCESSFUL); \
|
||||
} while (0)
|
||||
|
||||
#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
|
||||
|
||||
#include "../../../shared/clockdrv_shell.h"
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -Bstatic -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
|
||||
@@ -92,4 +92,6 @@ void Clock_driver_support_initialize_hardware(void)
|
||||
GBA_REG_TM3CNT = (0x00c0|GBA_TMCNT_PS);
|
||||
}
|
||||
|
||||
#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
|
||||
|
||||
#include "../../../shared/clockdrv_shell.h"
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -33,6 +33,7 @@ extern "C" {
|
||||
|
||||
#define LPC_CLOCK_INTERRUPT LPC176X_IRQ_TIMER_0
|
||||
#define LPC_CLOCK_TIMER_BASE TMR0_BASE_ADDR
|
||||
#define LPC_CLOCK_TIMECOUNTER_BASE TMR1_BASE_ADDR
|
||||
#define LPC_CLOCK_REFERENCE LPC176X_PCLK
|
||||
#define LPC_CLOCK_MODULE_ENABLE() \
|
||||
lpc176x_module_enable( LPC176X_MODULE_TIMER_0, LPC176X_MODULE_PCLK_DEFAULT )
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -35,6 +35,8 @@ extern "C" {
|
||||
|
||||
#define LPC_CLOCK_TIMER_BASE TMR0_BASE_ADDR
|
||||
|
||||
#define LPC_CLOCK_TIMECOUNTER_BASE TMR1_BASE_ADDR
|
||||
|
||||
#define LPC_CLOCK_REFERENCE LPC24XX_PCLK
|
||||
|
||||
#define LPC_CLOCK_MODULE_ENABLE() \
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -44,6 +44,8 @@ extern "C" {
|
||||
|
||||
#define LPC_CLOCK_TIMER_BASE LPC32XX_BASE_TIMER_0
|
||||
|
||||
#define LPC_CLOCK_TIMECOUNTER_BASE LPC32XX_BASE_TIMER_1
|
||||
|
||||
#define LPC_CLOCK_REFERENCE LPC32XX_PERIPH_CLK
|
||||
|
||||
#define LPC_CLOCK_MODULE_ENABLE()
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -81,4 +81,6 @@ void Clock_driver_support_initialize_hardware (void)
|
||||
TIMER_DATA (0) = TIMER_FREQ_64 ((uint16_t) freq);
|
||||
}
|
||||
|
||||
#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
|
||||
|
||||
#include "../../../shared/clockdrv_shell.h"
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -72,14 +72,6 @@ static void raspberrypi_clock_cleanup(void)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the nanoseconds since last tick
|
||||
*/
|
||||
static uint32_t raspberrypi_clock_nanoseconds_since_last_tick(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define Clock_driver_support_at_tick() raspberrypi_clock_at_tick()
|
||||
|
||||
#define Clock_driver_support_initialize_hardware() raspberrypi_clock_initialize()
|
||||
@@ -92,8 +84,6 @@ static uint32_t raspberrypi_clock_nanoseconds_since_last_tick(void)
|
||||
|
||||
#define Clock_driver_support_shutdown_hardware() raspberrypi_clock_cleanup()
|
||||
|
||||
#define Clock_driver_nanoseconds_since_last_tick \
|
||||
raspberrypi_clock_nanoseconds_since_last_tick
|
||||
|
||||
#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
|
||||
|
||||
#include "../../../shared/clockdrv_shell.h"
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved.
|
||||
* Copyright (c) 2013-2015 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
* embedded brains GmbH
|
||||
* Dornierstr. 4
|
||||
@@ -17,14 +17,11 @@
|
||||
#include <bsp/irq.h>
|
||||
#include <bsp/arm-a9mpcore-regs.h>
|
||||
#include <bsp/arm-a9mpcore-clock.h>
|
||||
#include <rtems/timecounter.h>
|
||||
|
||||
#define A9MPCORE_GT ((volatile a9mpcore_gt *) BSP_ARM_A9MPCORE_GT_BASE)
|
||||
|
||||
static uint64_t a9mpcore_clock_last_tick_k;
|
||||
|
||||
static uint32_t a9mpcore_clock_last_tick_cmpvallower;
|
||||
|
||||
static uint32_t a9mpcore_clock_autoinc;
|
||||
static struct timecounter a9mpcore_tc;
|
||||
|
||||
/* This is defined in clockdrv_shell.h */
|
||||
void Clock_isr(rtems_irq_hdl_param arg);
|
||||
@@ -39,13 +36,6 @@ static void a9mpcore_clock_at_tick(void)
|
||||
{
|
||||
volatile a9mpcore_gt *gt = A9MPCORE_GT;
|
||||
|
||||
/*
|
||||
* FIXME: Now the _TOD_Get_with_nanoseconds() yields wrong values until
|
||||
* _TOD_Tickle_ticks() managed to update the uptime. See also PR2180.
|
||||
*/
|
||||
a9mpcore_clock_last_tick_cmpvallower =
|
||||
gt->cmpvallower - a9mpcore_clock_autoinc;
|
||||
|
||||
gt->irqst = A9MPCORE_GT_IRQST_EFLG;
|
||||
}
|
||||
|
||||
@@ -80,6 +70,13 @@ static uint64_t a9mpcore_clock_get_counter(volatile a9mpcore_gt *gt)
|
||||
return ((uint64_t) cu2 << 32) | cl;
|
||||
}
|
||||
|
||||
static uint32_t a9mpcore_clock_get_timecount(struct timecounter *tc)
|
||||
{
|
||||
volatile a9mpcore_gt *gt = A9MPCORE_GT;
|
||||
|
||||
return gt->cntrlower;
|
||||
}
|
||||
|
||||
static void a9mpcore_clock_initialize(void)
|
||||
{
|
||||
volatile a9mpcore_gt *gt = A9MPCORE_GT;
|
||||
@@ -98,14 +95,16 @@ static void a9mpcore_clock_initialize(void)
|
||||
gt->cmpvalupper = (uint32_t) (cmpval >> 32);
|
||||
gt->autoinc = interval;
|
||||
|
||||
a9mpcore_clock_last_tick_k = (UINT64_C(1000000000) << 32) / periphclk;
|
||||
a9mpcore_clock_last_tick_cmpvallower = (uint32_t) cmpval - interval;
|
||||
a9mpcore_clock_autoinc = interval;
|
||||
|
||||
gt->ctrl = A9MPCORE_GT_CTRL_AUTOINC_EN
|
||||
| A9MPCORE_GT_CTRL_IRQ_EN
|
||||
| A9MPCORE_GT_CTRL_COMP_EN
|
||||
| A9MPCORE_GT_CTRL_TMR_EN;
|
||||
|
||||
a9mpcore_tc.tc_get_timecount = a9mpcore_clock_get_timecount;
|
||||
a9mpcore_tc.tc_counter_mask = 0xffffffff;
|
||||
a9mpcore_tc.tc_frequency = periphclk;
|
||||
a9mpcore_tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
|
||||
rtems_timecounter_install(&a9mpcore_tc);
|
||||
}
|
||||
|
||||
CPU_Counter_ticks _CPU_Counter_read(void)
|
||||
@@ -147,16 +146,6 @@ static void a9mpcore_clock_cleanup(void)
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t a9mpcore_clock_nanoseconds_since_last_tick(void)
|
||||
{
|
||||
volatile a9mpcore_gt *gt = A9MPCORE_GT;
|
||||
uint64_t k = a9mpcore_clock_last_tick_k;
|
||||
uint32_t n = a9mpcore_clock_last_tick_cmpvallower;
|
||||
uint32_t c = gt->cntrlower;
|
||||
|
||||
return (uint32_t) (((c - n) * k) >> 32);
|
||||
}
|
||||
|
||||
#define Clock_driver_support_at_tick() \
|
||||
a9mpcore_clock_at_tick()
|
||||
|
||||
@@ -165,15 +154,12 @@ static uint32_t a9mpcore_clock_nanoseconds_since_last_tick(void)
|
||||
|
||||
#define Clock_driver_support_install_isr(isr, old_isr) \
|
||||
do { \
|
||||
a9mpcore_clock_handler_install(); \
|
||||
a9mpcore_clock_handler_install(); \
|
||||
old_isr = NULL; \
|
||||
} while (0)
|
||||
|
||||
#define Clock_driver_support_shutdown_hardware() \
|
||||
a9mpcore_clock_cleanup()
|
||||
|
||||
#define Clock_driver_nanoseconds_since_last_tick \
|
||||
a9mpcore_clock_nanoseconds_since_last_tick
|
||||
|
||||
/* Include shared source clock driver code */
|
||||
#include "../../shared/clockdrv_shell.h"
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/timecounter.h>
|
||||
#include <rtems/score/armv7m.h>
|
||||
|
||||
#include <bsp.h>
|
||||
@@ -22,15 +23,35 @@
|
||||
/* This is defined in clockdrv_shell.h */
|
||||
static void Clock_isr(void *arg);
|
||||
|
||||
#define _ARMV7M_Systick_get_factor(freq) \
|
||||
((1000000000ULL << 32) / (freq))
|
||||
static rtems_timecounter_simple _ARMV7M_TC;
|
||||
|
||||
#ifdef BSP_ARMV7M_SYSTICK_FREQUENCY
|
||||
#define _ARMV7M_Systick_factor \
|
||||
_ARMV7M_Systick_get_factor(BSP_ARMV7M_SYSTICK_FREQUENCY)
|
||||
#else
|
||||
static uint64_t _ARMV7M_Systick_factor;
|
||||
#endif
|
||||
static uint32_t _ARMV7M_TC_get(rtems_timecounter_simple *tc)
|
||||
{
|
||||
volatile ARMV7M_Systick *systick = _ARMV7M_Systick;
|
||||
|
||||
return systick->cvr;
|
||||
}
|
||||
|
||||
static bool _ARMV7M_TC_is_pending(rtems_timecounter_simple *tc)
|
||||
{
|
||||
volatile ARMV7M_SCB *scb = _ARMV7M_SCB;
|
||||
|
||||
return ((scb->icsr & ARMV7M_SCB_ICSR_PENDSTSET) != 0);
|
||||
}
|
||||
|
||||
static uint32_t _ARMV7M_TC_get_timecount(struct timecounter *tc)
|
||||
{
|
||||
return rtems_timecounter_simple_downcounter_get(
|
||||
tc,
|
||||
_ARMV7M_TC_get,
|
||||
_ARMV7M_TC_is_pending
|
||||
);
|
||||
}
|
||||
|
||||
static void _ARMV7M_TC_tick(void)
|
||||
{
|
||||
rtems_timecounter_simple_downcounter_tick(&_ARMV7M_TC, _ARMV7M_TC_get);
|
||||
}
|
||||
|
||||
static void _ARMV7M_Systick_at_tick(void)
|
||||
{
|
||||
@@ -67,15 +88,18 @@ static void _ARMV7M_Systick_initialize(void)
|
||||
uint64_t us_per_tick = rtems_configuration_get_microseconds_per_tick();
|
||||
uint64_t interval = (freq * us_per_tick) / 1000000ULL;
|
||||
|
||||
#ifndef BSP_ARMV7M_SYSTICK_FREQUENCY
|
||||
_ARMV7M_Systick_factor = _ARMV7M_Systick_get_factor(freq);
|
||||
#endif
|
||||
|
||||
systick->rvr = (uint32_t) interval;
|
||||
systick->cvr = 0;
|
||||
systick->csr = ARMV7M_SYSTICK_CSR_ENABLE
|
||||
| ARMV7M_SYSTICK_CSR_TICKINT
|
||||
| ARMV7M_SYSTICK_CSR_CLKSOURCE;
|
||||
|
||||
rtems_timecounter_simple_install(
|
||||
&_ARMV7M_TC,
|
||||
freq,
|
||||
interval,
|
||||
_ARMV7M_TC_get_timecount
|
||||
);
|
||||
}
|
||||
|
||||
static void _ARMV7M_Systick_cleanup(void)
|
||||
@@ -85,19 +109,7 @@ static void _ARMV7M_Systick_cleanup(void)
|
||||
systick->csr = 0;
|
||||
}
|
||||
|
||||
static uint32_t _ARMV7M_Systick_nanoseconds_since_last_tick(void)
|
||||
{
|
||||
volatile ARMV7M_Systick *systick = _ARMV7M_Systick;
|
||||
volatile ARMV7M_SCB *scb = _ARMV7M_SCB;
|
||||
uint32_t rvr = systick->rvr;
|
||||
uint32_t c = rvr - systick->cvr;
|
||||
|
||||
if ((scb->icsr & ARMV7M_SCB_ICSR_PENDSTSET) != 0) {
|
||||
c = rvr - systick->cvr + rvr;
|
||||
}
|
||||
|
||||
return (uint32_t) ((c * _ARMV7M_Systick_factor) >> 32);
|
||||
}
|
||||
#define Clock_driver_timecounter_tick() _ARMV7M_TC_tick()
|
||||
|
||||
#define Clock_driver_support_at_tick() \
|
||||
_ARMV7M_Systick_at_tick()
|
||||
@@ -114,9 +126,6 @@ static uint32_t _ARMV7M_Systick_nanoseconds_since_last_tick(void)
|
||||
#define Clock_driver_support_shutdown_hardware() \
|
||||
_ARMV7M_Systick_cleanup()
|
||||
|
||||
#define Clock_driver_nanoseconds_since_last_tick \
|
||||
_ARMV7M_Systick_nanoseconds_since_last_tick
|
||||
|
||||
/* Include shared source clock driver code */
|
||||
#include "../../../../shared/clockdrv_shell.h"
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009-2012 embedded brains GmbH. All rights reserved.
|
||||
* Copyright (c) 2009-2015 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* Dornierstr. 4
|
||||
* 82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/timecounter.h>
|
||||
|
||||
#include <bsp/lpc-clock-config.h>
|
||||
#include <bsp/lpc-timer.h>
|
||||
@@ -33,6 +34,16 @@ void Clock_isr(rtems_irq_hdl_param arg);
|
||||
static volatile lpc_timer *const lpc_clock =
|
||||
(volatile lpc_timer *) LPC_CLOCK_TIMER_BASE;
|
||||
|
||||
static volatile lpc_timer *const lpc_timecounter =
|
||||
(volatile lpc_timer *) LPC_CLOCK_TIMECOUNTER_BASE;
|
||||
|
||||
static struct timecounter lpc_clock_tc;
|
||||
|
||||
static uint32_t lpc_clock_tc_get_timecount(struct timecounter *tc)
|
||||
{
|
||||
return lpc_timecounter->tc;
|
||||
}
|
||||
|
||||
static void lpc_clock_at_tick(void)
|
||||
{
|
||||
lpc_clock->ir = LPC_TIMER_IR_MR0;
|
||||
@@ -85,6 +96,13 @@ static void lpc_clock_initialize(void)
|
||||
|
||||
/* Enable timer */
|
||||
lpc_clock->tcr = LPC_TIMER_TCR_EN;
|
||||
|
||||
/* Install timecounter */
|
||||
lpc_clock_tc.tc_get_timecount = lpc_clock_tc_get_timecount;
|
||||
lpc_clock_tc.tc_counter_mask = 0xffffffff;
|
||||
lpc_clock_tc.tc_frequency = LPC_CLOCK_REFERENCE;
|
||||
lpc_clock_tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
|
||||
rtems_timecounter_install(&lpc_clock_tc);
|
||||
}
|
||||
|
||||
static void lpc_clock_cleanup(void)
|
||||
@@ -105,18 +123,6 @@ static void lpc_clock_cleanup(void)
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t lpc_clock_nanoseconds_since_last_tick(void)
|
||||
{
|
||||
uint64_t k = (1000000000ULL << 32) / LPC_CLOCK_REFERENCE;
|
||||
uint64_t c = lpc_clock->tc;
|
||||
|
||||
if ((lpc_clock->ir & LPC_TIMER_IR_MR0) != 0) {
|
||||
c = lpc_clock->tc + lpc_clock->mr0;
|
||||
}
|
||||
|
||||
return (uint32_t) ((c * k) >> 32);
|
||||
}
|
||||
|
||||
#define Clock_driver_support_at_tick() lpc_clock_at_tick()
|
||||
#define Clock_driver_support_initialize_hardware() lpc_clock_initialize()
|
||||
#define Clock_driver_support_install_isr(isr, old_isr) \
|
||||
@@ -126,8 +132,6 @@ static uint32_t lpc_clock_nanoseconds_since_last_tick(void)
|
||||
} while (0)
|
||||
|
||||
#define Clock_driver_support_shutdown_hardware() lpc_clock_cleanup()
|
||||
#define Clock_driver_nanoseconds_since_last_tick \
|
||||
lpc_clock_nanoseconds_since_last_tick
|
||||
|
||||
/* Include shared source clock driver code */
|
||||
#include "../../../../shared/clockdrv_shell.h"
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -EB }
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -30,13 +30,14 @@
|
||||
#include <bsp/irq.h>
|
||||
#include <bsp/tms570-rti.h>
|
||||
#include <rtems/counter.h>
|
||||
#include <rtems/timecounter.h>
|
||||
|
||||
/**
|
||||
* holds HW counter value since last interrupt event
|
||||
* sets in tms570_clock_driver_support_at_tick
|
||||
* used in tms570_clock_driver_nanoseconds_since_last_tick
|
||||
*/
|
||||
static uint32_t tms570_rti_last_tick_fcr0;
|
||||
static struct timecounter tms570_rti_tc;
|
||||
|
||||
static uint32_t tms570_rti_get_timecount(struct timecounter *tc)
|
||||
{
|
||||
return TMS570_RTI.RTIFRC0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize the HW peripheral for clock driver
|
||||
@@ -72,6 +73,12 @@ static void tms570_clock_driver_support_initialize_hardware( void )
|
||||
TMS570_RTI.RTISETINTENA = 0x1;
|
||||
/* enable timer */
|
||||
TMS570_RTI.RTIGCTRL = 1;
|
||||
/* set timecounter */
|
||||
tms570_rti_tc.tc_get_timecount = tms570_rti_get_timecount;
|
||||
tms570_rti_tc.tc_counter_mask = 0xffffffff;
|
||||
tms570_rti_tc.tc_frequency = BSP_PLL_OUT_CLOCK;
|
||||
tms570_rti_tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
|
||||
rtems_timecounter_install(&tms570_rti_tc);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +89,6 @@ static void tms570_clock_driver_support_initialize_hardware( void )
|
||||
static void tms570_clock_driver_support_at_tick( void )
|
||||
{
|
||||
TMS570_RTI.RTIINTFLAG = 0x00000001;
|
||||
tms570_rti_last_tick_fcr0 = TMS570_RTI.RTICOMP0 - TMS570_RTI.RTIUDCP0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,24 +130,6 @@ static void tms570_clock_driver_support_shutdown_hardware( void )
|
||||
TMS570_RTI.RTICLEARINTENA = 0x20000;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief returns the nanoseconds since last tick
|
||||
*
|
||||
* Return the nanoseconds since last tick
|
||||
*
|
||||
* @retval x nanoseconds
|
||||
*
|
||||
*/
|
||||
static uint32_t tms570_clock_driver_nanoseconds_since_last_tick( void )
|
||||
{
|
||||
uint32_t actual_fcr0 = TMS570_RTI.RTIFRC0;
|
||||
uint32_t usec_since_tick;
|
||||
|
||||
usec_since_tick = actual_fcr0 - tms570_rti_last_tick_fcr0;
|
||||
|
||||
return usec_since_tick * 1000;
|
||||
}
|
||||
|
||||
#define Clock_driver_support_initialize_hardware \
|
||||
tms570_clock_driver_support_initialize_hardware
|
||||
#define Clock_driver_support_at_tick \
|
||||
@@ -150,8 +138,6 @@ static uint32_t tms570_clock_driver_nanoseconds_since_last_tick( void )
|
||||
tms570_clock_driver_support_initialize_hardware
|
||||
#define Clock_driver_support_shutdown_hardware \
|
||||
tms570_clock_driver_support_shutdown_hardware
|
||||
#define Clock_driver_nanoseconds_since_last_tick \
|
||||
tms570_clock_driver_nanoseconds_since_last_tick
|
||||
|
||||
#define Clock_driver_support_install_isr(Clock_isr, Old_ticker ) \
|
||||
tms570_clock_driver_support_install_isr( Clock_isr )
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -10,4 +10,4 @@
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
%{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
ACLOCAL_AMFLAGS = -I ../../../aclocal
|
||||
## Descend into the @RTEMS_BSP_FAMILY@ directory
|
||||
## Currently, the shared directory is not explicitly
|
||||
## added but it is present in the source tree.
|
||||
SUBDIRS = @RTEMS_BSP_FAMILY@
|
||||
include $(srcdir)/preinstall.am
|
||||
include $(top_srcdir)/../../../automake/subdirs.am
|
||||
include $(top_srcdir)/../../../automake/local.am
|
||||
@@ -0,0 +1,10 @@
|
||||
# RTEMS_CHECK_BSPDIR(RTEMS_BSP_FAMILY)
|
||||
AC_DEFUN([RTEMS_CHECK_BSPDIR],
|
||||
[
|
||||
case "$1" in
|
||||
epiphany_sim )
|
||||
AC_CONFIG_SUBDIRS([epiphany_sim]);;
|
||||
*)
|
||||
AC_MSG_ERROR([Invalid BSP]);;
|
||||
esac
|
||||
])
|
||||
@@ -0,0 +1,19 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([rtems-c-src-lib-libbsp-epiphany],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
|
||||
AC_CONFIG_SRCDIR([epiphany_sim])
|
||||
RTEMS_TOP(../../../../..)
|
||||
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
AM_INIT_AUTOMAKE([no-define foreign subdir-objects 1.12.2])
|
||||
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
|
||||
@@ -0,0 +1,95 @@
|
||||
##
|
||||
#
|
||||
# @brief Makefile of LibBSP for the Epiphany simulator.
|
||||
#
|
||||
#
|
||||
ACLOCAL_AMFLAGS = -I ../../../../aclocal
|
||||
|
||||
include $(top_srcdir)/../../../../automake/compile.am
|
||||
|
||||
include_bspdir = $(includedir)/bsp
|
||||
include_libcpudir = $(includedir)/libcpu
|
||||
|
||||
dist_project_lib_DATA = bsp_specs
|
||||
|
||||
###############################################################################
|
||||
# Header #
|
||||
###############################################################################
|
||||
|
||||
include_HEADERS = include/bsp.h
|
||||
include_HEADERS += include/tm27.h
|
||||
include_HEADERS += ../../shared/include/coverhd.h
|
||||
|
||||
nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
|
||||
include_bsp_HEADERS = ../shared/include/linker-symbols.h
|
||||
|
||||
include_bsp_HEADERS += ../../../libbsp/shared/include/mm.h
|
||||
include_bsp_HEADERS += ../../shared/include/utility.h
|
||||
include_bsp_HEADERS += ../../shared/include/irq-generic.h
|
||||
include_bsp_HEADERS += ../../shared/include/irq-info.h
|
||||
include_bsp_HEADERS += ../../shared/include/stackalloc.h
|
||||
include_bsp_HEADERS += ../../shared/include/console-polled.h
|
||||
include_bsp_HEADERS += include/irq.h
|
||||
|
||||
nodist_include_HEADERS = include/bspopts.h
|
||||
|
||||
###############################################################################
|
||||
# Data #
|
||||
###############################################################################
|
||||
noinst_LIBRARIES = libbspstart.a
|
||||
|
||||
libbspstart_a_SOURCES = start/start.S
|
||||
|
||||
project_lib_DATA = start/start.$(OBJEXT)
|
||||
|
||||
project_lib_DATA += startup/linkcmds
|
||||
|
||||
###############################################################################
|
||||
# LibBSP #
|
||||
###############################################################################
|
||||
|
||||
noinst_LIBRARIES += libbsp.a
|
||||
|
||||
# Startup
|
||||
libbsp_a_SOURCES = ../../shared/bspreset.c
|
||||
libbsp_a_SOURCES += ../../shared/bspstart.c
|
||||
|
||||
# Shared
|
||||
libbsp_a_SOURCES += ../../shared/bootcard.c
|
||||
libbsp_a_SOURCES += ../../shared/bspclean.c
|
||||
libbsp_a_SOURCES += ../../shared/bsplibc.c
|
||||
libbsp_a_SOURCES += ../../shared/bsppost.c
|
||||
libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
|
||||
libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
|
||||
libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
|
||||
libbsp_a_SOURCES += ../../shared/sbrk.c
|
||||
libbsp_a_SOURCES += ../../shared/src/stackalloc.c
|
||||
libbsp_a_SOURCES += ../../shared/bspgetworkarea.c
|
||||
|
||||
# clock
|
||||
libbsp_a_SOURCES += ../../shared/clock_driver_simidle.c
|
||||
|
||||
# Timer
|
||||
libbsp_a_SOURCES += timer/timer.c
|
||||
|
||||
# console
|
||||
libbsp_a_SOURCES += ../../shared/console-polled.c
|
||||
|
||||
# IRQ
|
||||
libbsp_a_SOURCES += ../../shared/src/irq-default-handler.c
|
||||
libbsp_a_SOURCES += ../../shared/src/irq-generic.c
|
||||
libbsp_a_SOURCES += ../../shared/src/irq-info.c
|
||||
libbsp_a_SOURCES += irq/irq.c
|
||||
|
||||
# Cache
|
||||
libbsp_a_SOURCES += ../../../libcpu/shared/src/cache_manager.c
|
||||
libbsp_a_SOURCES += ../../shared/include/cache_.h
|
||||
libbsp_a_CPPFLAGS = -I$(srcdir)/../../shared/include
|
||||
|
||||
# debugio
|
||||
libbsp_a_SOURCES += console/console-io.c
|
||||
|
||||
DISTCLEANFILES = include/bspopts.h
|
||||
|
||||
include $(srcdir)/preinstall.am
|
||||
include $(top_srcdir)/../../../../automake/local.am
|
||||
@@ -0,0 +1,6 @@
|
||||
This BSP is intended to run on epiphany-*-run simulator.
|
||||
|
||||
From command line type:
|
||||
|
||||
$ epiphany-rtems4.11-run -e=on --memory-region 0x8e000000,0x2000000 \
|
||||
$PATH_TO_RTEMS_EXE
|
||||
@@ -0,0 +1,13 @@
|
||||
%rename endfile old_endfile
|
||||
%rename startfile old_startfile
|
||||
%rename link old_link
|
||||
|
||||
*startfile:
|
||||
%{!qrtems: %(old_startfile)} \
|
||||
%{!nostdlib: %{qrtems: start.o%s crti.o%s crtbegin.o%s -e _start}}
|
||||
|
||||
*link:
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: *(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
|
||||
@@ -0,0 +1,36 @@
|
||||
##
|
||||
#
|
||||
# @file
|
||||
#
|
||||
# @brief Configure script of LibBSP for epiphany_sim BSP.
|
||||
#
|
||||
|
||||
AC_PREREQ(2.69)
|
||||
AC_INIT([rtems-c-src-lib-libbsp-epiphany-sim],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
|
||||
AC_CONFIG_SRCDIR([bsp_specs])
|
||||
RTEMS_TOP(../../../../../..)
|
||||
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
AM_INIT_AUTOMAKE([no-define nostdinc foreign subdir-objects 1.12.2])
|
||||
RTEMS_BSP_CONFIGURE
|
||||
|
||||
RTEMS_BSPOPTS_SET([BSP_START_RESET_VECTOR],[*],[])
|
||||
RTEMS_BSPOPTS_HELP([BSP_START_RESET_VECTOR],[reset vector address for BSP
|
||||
start])
|
||||
|
||||
RTEMS_BSPOPTS_SET([BSP_EPIPHANY_PERIPHCLK],[*],[100000000U])
|
||||
RTEMS_BSPOPTS_HELP([BSP_EPIPHANY_PERIPHCLK],[epiphany PERIPHCLK clock
|
||||
frequency in Hz])
|
||||
|
||||
RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm])
|
||||
RTEMS_CANONICALIZE_TOOLS
|
||||
RTEMS_PROG_CCAS
|
||||
|
||||
RTEMS_CHECK_SMP
|
||||
AM_CONDITIONAL(HAS_SMP,[test "$rtems_cv_HAS_SMP" = "yes"])
|
||||
|
||||
RTEMS_BSP_CLEANUP_OPTIONS(0, 1)
|
||||
RTEMS_BSP_LINKCMDS
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (c) 2015 University of York.
|
||||
* Hesham ALMatary <hmka501@york.ac.uk>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
#include <bsp/console-polled.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static void outbyte_console( char );
|
||||
static char inbyte_console( void );
|
||||
|
||||
void console_initialize_hardware(void)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
|
||||
/* Epiphany simulator would handle this system call */
|
||||
static void outbyte_console(char c)
|
||||
{
|
||||
register int chan asm("r0") = STDOUT_FILENO;
|
||||
register void* addr asm("r1") = &c;
|
||||
register int len asm("r2") = 1;
|
||||
|
||||
/* Invoke write system call to be handled by Epiphany simulator */
|
||||
__asm__ __volatile__ ("trap 0" : : "r" (chan), "r" (addr), "r" (len));
|
||||
}
|
||||
|
||||
static char inbyte_console(void)
|
||||
{
|
||||
char c;
|
||||
register int chan asm("r0") = STDIN_FILENO;
|
||||
register void* addr asm("r1") = &c;
|
||||
register int len asm("r2") = 1;
|
||||
|
||||
/* Invoke read system call to be handled by Epiphany simulator */
|
||||
asm ("trap 1" :: "r" (chan), "r" (addr), "r" (len));
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
* console_outbyte_polled
|
||||
*
|
||||
* This routine transmits a character using polling.
|
||||
*/
|
||||
void console_outbyte_polled(
|
||||
int port,
|
||||
char ch
|
||||
)
|
||||
{
|
||||
outbyte_console( ch );
|
||||
}
|
||||
|
||||
/*
|
||||
* console_inbyte_nonblocking
|
||||
*
|
||||
* This routine polls for a character.
|
||||
*/
|
||||
|
||||
int console_inbyte_nonblocking(int port)
|
||||
{
|
||||
char c;
|
||||
|
||||
c = inbyte_console();
|
||||
if (!c)
|
||||
return -1;
|
||||
return (int) c;
|
||||
}
|
||||
|
||||
/*
|
||||
* To support printk
|
||||
*/
|
||||
|
||||
#include <rtems/bspIo.h>
|
||||
|
||||
static void Epiphany_output_char(char c) { console_outbyte_polled( 0, c ); }
|
||||
|
||||
BSP_output_char_function_type BSP_output_char = Epiphany_output_char;
|
||||
BSP_polling_getchar_function_type BSP_poll_char =
|
||||
(void *)console_inbyte_nonblocking;
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2015 University of York.
|
||||
* Hesham ALMatary <hmka501@york.ac.uk>
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LIBBSP_EPIPHANY_EPIPHANY_SIM_H
|
||||
#define LIBBSP_EPIPHANY_EPIPHANY_SIM_H
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/clockdrv.h>
|
||||
#include <rtems/console.h>
|
||||
|
||||
#include <bspopts.h>
|
||||
#include <bsp/default-initial-extension.h>
|
||||
|
||||
#include <rtems/devnull.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Constants */
|
||||
Thread clock_driver_sim_idle_body(uintptr_t);
|
||||
#define BSP_IDLE_TASK_BODY clock_driver_sim_idle_body
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBBSP_EPIPHANY_PARALLELLA_H */
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2015 University of York.
|
||||
* Hesham ALMatary <hmka501@york.ac.uk>
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* include/bspopts.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* If defined, then the BSP Framework will put a non-zero pattern into the
|
||||
RTEMS Workspace and C program heap. This should assist in finding code that
|
||||
assumes memory starts set to zero. */
|
||||
#undef BSP_DIRTY_MEMORY
|
||||
|
||||
/* If defined, print a message and wait until pressed before resetting board
|
||||
when application exits. */
|
||||
#undef BSP_PRESS_KEY_FOR_RESET
|
||||
|
||||
/* If defined, prints the exception context when an unexpected exception
|
||||
occurs. */
|
||||
#undef BSP_PRINT_EXCEPTION_CONTEXT
|
||||
|
||||
/* If defined, reset the board when the application exits. */
|
||||
#undef BSP_RESET_BOARD_AT_EXIT
|
||||
|
||||
/* reset vector address for BSP start */
|
||||
#undef BSP_START_RESET_VECTOR
|
||||
|
||||
/* 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 home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup Epiphany_IRQ
|
||||
*
|
||||
* @brief Interrupt definitions.
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2015 University of York.
|
||||
* Hesham ALMatary <hmka501@york.ac.uk>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LIBBSP_GENERIC_EPIPHANY_IRQ_H
|
||||
#define LIBBSP_GENERIC_EPIPHANY_IRQ_H
|
||||
|
||||
#ifndef ASM
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/irq.h>
|
||||
#include <rtems/irq-extension.h>
|
||||
|
||||
#define BSP_INTERRUPT_VECTOR_MIN 0x0
|
||||
#define BSP_INTERRUPT_VECTOR_MAX 0x24
|
||||
|
||||
#endif /* ASM */
|
||||
#endif /* LIBBSP_GENERIC_OR1K_IRQ_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user