mirror of
https://github.com/t-crest/rtems.git
synced 2025-11-16 12:34:47 +00:00
Removed spurious trap handler from the Patmos CPU.
Substituted the whole timer.c with the content retrieved from the no_cpu/no_bsp folder. Removed the timing test suite (times file) from the Pasim BSP. Added bsp_specs to the Pasim BSP.
This commit is contained in:
13
c/src/lib/libbsp/patmos/pasim/bsp_specs
Normal file
13
c/src/lib/libbsp/patmos/pasim/bsp_specs
Normal file
@@ -0,0 +1,13 @@
|
||||
%rename endfile old_endfile
|
||||
%rename startfile old_startfile
|
||||
%rename link old_link
|
||||
|
||||
*endfile:
|
||||
crtend.o%s crtn.o%s
|
||||
|
||||
*startfile:
|
||||
%{!qrtems: %(old_startfile)} \
|
||||
%{!nostdlib: %{qrtems: start.o%s crti.o%s crtbegin.o%s}}
|
||||
|
||||
*link:
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* PASIM Spurious Trap Handler
|
||||
*
|
||||
* This is just enough of a trap handler to let us know what
|
||||
* the likely source of the trap was.
|
||||
*
|
||||
* Project: T-CREST - Time-Predictable Multi-Core Architecture for Embedded Systems
|
||||
*
|
||||
* Copyright (C) GMVIS Skysoft S.A., 2013
|
||||
* @author André Rocha
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
|
||||
#include <rtems/bspIo.h>
|
||||
|
||||
/*
|
||||
* bsp_spurious_handler
|
||||
*
|
||||
* Print a message on the debug console and then die
|
||||
*/
|
||||
|
||||
rtems_isr bsp_spurious_handler(
|
||||
rtems_vector_number trap,
|
||||
CPU_Interrupt_frame *isf
|
||||
)
|
||||
{
|
||||
asm volatile( "mov 1, %g1; ta 0x0" );
|
||||
}
|
||||
|
||||
/*
|
||||
* bsp_spurious_initialize
|
||||
*
|
||||
* Install the spurious handler for most traps. Note that set_vector()
|
||||
* will unmask the corresponding asynchronous interrupt, so the initial
|
||||
* interrupt mask is restored after the handlers are installed.
|
||||
*/
|
||||
|
||||
void bsp_spurious_initialize()
|
||||
{
|
||||
}
|
||||
102
c/src/lib/libbsp/patmos/pasim/timer/timer.c
Normal file → Executable file
102
c/src/lib/libbsp/patmos/pasim/timer/timer.c
Normal file → Executable file
@@ -2,79 +2,81 @@
|
||||
*
|
||||
* This file implements a benchmark timer using timer 2.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Project: T-CREST - Time-Predictable Multi-Core Architecture for Embedded Systems
|
||||
*
|
||||
* Copyright (C) GMVIS Skysoft S.A., 2013
|
||||
* @author André Rocha
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Ported to LEON implementation of the SPARC by On-Line Applications
|
||||
* Research Corporation (OAR) under contract to the European Space
|
||||
* Agency (ESA).
|
||||
*
|
||||
* LEON modifications of respective RTEMS file: COPYRIGHT (c) 1995.
|
||||
* European Space Agency.
|
||||
*
|
||||
* $Id: timer.c,v 1.14 2009/11/29 15:33:27 ralf Exp $
|
||||
*/
|
||||
|
||||
|
||||
#include <rtems.h>
|
||||
#include <bsp.h>
|
||||
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
#define LEON3_TIMER_INDEX \
|
||||
((rtems_configuration_get_user_multiprocessing_table()) ? \
|
||||
(rtems_configuration_get_user_multiprocessing_table()->node) - 1 : 1)
|
||||
#else
|
||||
#define LEON3_TIMER_INDEX 0
|
||||
#endif
|
||||
|
||||
uint32_t Timer_interrupts;
|
||||
bool benchmark_timer_find_average_overhead;
|
||||
|
||||
bool benchmark_timer_is_initialized = false;
|
||||
|
||||
extern volatile LEON3_Timer_Regs_Map *LEON3_Timer_Regs;
|
||||
|
||||
void benchmark_timer_initialize(void)
|
||||
void benchmark_timer_initialize( void )
|
||||
{
|
||||
|
||||
/*
|
||||
* Timer runs long and accurate enough not to require an interrupt.
|
||||
* Timer has never overflowed. This may not be necessary on some
|
||||
* implemenations of timer but ....
|
||||
*/
|
||||
|
||||
Timer_interrupts = 0;
|
||||
|
||||
/*
|
||||
* Somehow start the timer
|
||||
*/
|
||||
if (LEON3_Timer_Regs) {
|
||||
if ( benchmark_timer_is_initialized == false ) {
|
||||
/* approximately 1 us per countdown */
|
||||
LEON3_Timer_Regs->timer[LEON3_TIMER_INDEX].reload = 0xffffff;
|
||||
LEON3_Timer_Regs->timer[LEON3_TIMER_INDEX].value = 0xffffff;
|
||||
} else {
|
||||
benchmark_timer_is_initialized = true;
|
||||
}
|
||||
LEON3_Timer_Regs->timer[LEON3_TIMER_INDEX].conf = LEON3_GPTIMER_EN | LEON3_GPTIMER_LD;
|
||||
}
|
||||
}
|
||||
|
||||
#define AVG_OVERHEAD 3 /* It typically takes 3.0 microseconds */
|
||||
/* to start/stop the timer. */
|
||||
#define LEAST_VALID 2 /* Don't trust a value lower than this */
|
||||
/*
|
||||
* The following controls the behavior of benchmark_timer_read().
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
int benchmark_timer_read(void)
|
||||
#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 benchmark_timer_read( void )
|
||||
{
|
||||
uint32_t total;
|
||||
uint32_t clicks;
|
||||
uint32_t total;
|
||||
|
||||
if (LEON3_Timer_Regs) {
|
||||
total = LEON3_Timer_Regs->timer[LEON3_TIMER_INDEX].value;
|
||||
/*
|
||||
* Read the timer and see how many clicks it has been since we started.
|
||||
*/
|
||||
|
||||
total = 0xffffff - total;
|
||||
clicks = 0; /* XXX: read some HW here */
|
||||
|
||||
if ( benchmark_timer_find_average_overhead == true )
|
||||
return total; /* in one microsecond units */
|
||||
/*
|
||||
* Total is calculated by taking into account the number of timer overflow
|
||||
* interrupts since the timer was initialized and clicks since the last
|
||||
* interrupts.
|
||||
*/
|
||||
|
||||
total = clicks * 0;
|
||||
|
||||
if ( benchmark_timer_find_average_overhead == true )
|
||||
return total; /* in XXX microsecond units */
|
||||
else {
|
||||
if ( total < LEAST_VALID )
|
||||
return 0; /* below timer resolution */
|
||||
|
||||
return total - AVG_OVERHEAD;
|
||||
}
|
||||
return 0;
|
||||
/*
|
||||
* Somehow convert total into microseconds
|
||||
*/
|
||||
return (total - AVG_OVERHEAD);
|
||||
}
|
||||
}
|
||||
|
||||
void benchmark_timer_disable_subtracting_average_overhead(
|
||||
|
||||
@@ -1,193 +0,0 @@
|
||||
#
|
||||
# Timing Test Suite Results for the SPARC Instruction Simulator BSP
|
||||
#
|
||||
# NOTE: The ERC32 is derived from the Cypress 601/602 chip set.
|
||||
#
|
||||
# $Id: times,v 1.2 2006/01/09 10:41:21 ralf Exp $
|
||||
#
|
||||
|
||||
Board: SPARC Instruction Simulator v1.8
|
||||
CPU: include coprocessor if applicable
|
||||
Clock Speed: 15 Mhz
|
||||
Memory Configuration:
|
||||
Wait States: 0
|
||||
|
||||
Times Reported in: microseconds
|
||||
Timer Source: on-CPU General Purpose Count Down Timer
|
||||
|
||||
Column A: 3.5.1 pre-release
|
||||
Column B: unused
|
||||
|
||||
# DESCRIPTION A B
|
||||
== ================================================================= ==== ====
|
||||
1 rtems_semaphore_create 20
|
||||
rtems_semaphore_delete 21
|
||||
rtems_semaphore_obtain: available 15
|
||||
rtems_semaphore_obtain: not available -- NO_WAIT 15
|
||||
rtems_semaphore_release: no waiting tasks 16
|
||||
|
||||
2 rtems_semaphore_obtain: not available -- caller blocks 62
|
||||
|
||||
3 rtems_semaphore_release: task readied -- preempts caller 55
|
||||
|
||||
4 rtems_task_restart: blocked task -- preempts caller 77
|
||||
rtems_task_restart: ready task -- preempts caller 70
|
||||
rtems_semaphore_release: task readied -- returns to caller 25
|
||||
rtems_task_create 57
|
||||
rtems_task_start 31
|
||||
rtems_task_restart: suspended task -- returns to caller 36
|
||||
rtems_task_delete: suspended task 47
|
||||
rtems_task_restart: ready task -- returns to caller 37
|
||||
rtems_task_restart: blocked task -- returns to caller 46
|
||||
rtems_task_delete: blocked task 50
|
||||
|
||||
5 rtems_task_suspend: calling task 51
|
||||
rtems_task_resume: task readied -- preempts caller 49
|
||||
|
||||
6 rtems_task_restart: calling task 59
|
||||
rtems_task_suspend: returns to caller 18
|
||||
rtems_task_resume: task readied -- returns to caller 19
|
||||
rtems_task_delete: ready task 50
|
||||
|
||||
7 rtems_task_restart: suspended task -- preempts caller 70
|
||||
|
||||
8 rtems_task_set_priority: obtain current priority 12
|
||||
rtems_task_set_priority: returns to caller 27
|
||||
rtems_task_mode: obtain current mode 5
|
||||
rtems_task_mode: no reschedule 5
|
||||
rtems_task_mode: reschedule -- returns to caller 8
|
||||
rtems_task_mode: reschedule -- preempts caller 39
|
||||
rtems_task_set_note 13
|
||||
rtems_task_get_note 13
|
||||
rtems_clock_set 33
|
||||
rtems_clock_get 3
|
||||
|
||||
9 rtems_message_queue_create 110
|
||||
rtems_message_queue_send: no waiting tasks 37
|
||||
rtems_message_queue_urgent: no waiting tasks 37
|
||||
rtems_message_queue_receive: available 31
|
||||
rtems_message_queue_flush: no messages flushed 12
|
||||
rtems_message_queue_flush: messages flushed 16
|
||||
rtems_message_queue_delete 26
|
||||
|
||||
10 rtems_message_queue_receive: not available -- NO_WAIT 15
|
||||
rtems_message_queue_receive: not available -- caller blocks 62
|
||||
|
||||
11 rtems_message_queue_send: task readied -- preempts caller 72
|
||||
|
||||
12 rtems_message_queue_send: task readied -- returns to caller 39
|
||||
|
||||
13 rtems_message_queue_urgent: task readied -- preempts caller 72
|
||||
|
||||
14 rtems_message_queue_urgent: task readied -- returns to caller 39
|
||||
|
||||
15 rtems_event_receive: obtain current events 1
|
||||
rtems_event_receive: not available -- NO_WAIT 12
|
||||
rtems_event_receive: not available -- caller blocks 56
|
||||
rtems_event_send: no task readied 12
|
||||
rtems_event_receive: available 12
|
||||
rtems_event_send: task readied -- returns to caller 24
|
||||
|
||||
16 rtems_event_send: task readied -- preempts caller 55
|
||||
|
||||
17 rtems_task_set_priority: preempts caller 62
|
||||
|
||||
18 rtems_task_delete: calling task 83
|
||||
|
||||
19 rtems_signal_catch 9
|
||||
rtems_signal_send: returns to caller 15
|
||||
rtems_signal_send: signal to self 18
|
||||
exit ASR overhead: returns to calling task 22
|
||||
exit ASR overhead: returns to preempting task 49
|
||||
|
||||
20 rtems_partition_create 35
|
||||
rtems_region_create 23
|
||||
rtems_partition_get_buffer: available 15
|
||||
rtems_partition_get_buffer: not available 13
|
||||
rtems_partition_return_buffer 18
|
||||
rtems_partition_delete 16
|
||||
rtems_region_get_segment: available 22
|
||||
rtems_region_get_segment: not available -- NO_WAIT 21
|
||||
rtems_region_return_segment: no waiting tasks 19
|
||||
rtems_region_get_segment: not available -- caller blocks 64
|
||||
rtems_region_return_segment: task readied -- preempts caller 74
|
||||
rtems_region_return_segment: task readied -- returns to caller 44
|
||||
rtems_region_delete 16
|
||||
rtems_io_initialize 2
|
||||
rtems_io_open 1
|
||||
rtems_io_close 1
|
||||
rtems_io_read 1
|
||||
rtems_io_write 1
|
||||
rtems_io_control 1
|
||||
|
||||
21 rtems_task_ident 149
|
||||
rtems_message_queue_ident 145
|
||||
rtems_semaphore_ident 156
|
||||
rtems_partition_ident 145
|
||||
rtems_region_ident 148
|
||||
rtems_port_ident 145
|
||||
rtems_timer_ident 145
|
||||
rtems_rate_monotonic_ident 145
|
||||
|
||||
22 rtems_message_queue_broadcast: task readied -- returns to caller 42
|
||||
rtems_message_queue_broadcast: no waiting tasks 17
|
||||
rtems_message_queue_broadcast: task readied -- preempts caller 78
|
||||
|
||||
23 rtems_timer_create 14
|
||||
rtems_timer_fire_after: inactive 22
|
||||
rtems_timer_fire_after: active 24
|
||||
rtems_timer_cancel: active 15
|
||||
rtems_timer_cancel: inactive 13
|
||||
rtems_timer_reset: inactive 21
|
||||
rtems_timer_reset: active 23
|
||||
rtems_timer_fire_when: inactive 34
|
||||
rtems_timer_fire_when: active 34
|
||||
rtems_timer_delete: active 19
|
||||
rtems_timer_delete: inactive 17
|
||||
rtems_task_wake_when 69
|
||||
|
||||
24 rtems_task_wake_after: yield -- returns to caller 9
|
||||
rtems_task_wake_after: yields -- preempts caller 45
|
||||
|
||||
25 rtems_clock_tick 4
|
||||
|
||||
26 _ISR_Disable 0
|
||||
_ISR_Flash 1
|
||||
_ISR_Enable 1
|
||||
_Thread_Disable_dispatch 0
|
||||
_Thread_Enable_dispatch 7
|
||||
_Thread_Set_state 11
|
||||
_Thread_Disptach (NO FP) 31
|
||||
context switch: no floating point contexts 21
|
||||
context switch: self 10
|
||||
context switch: to another task 10
|
||||
context switch: restore 1st FP task 25
|
||||
fp context switch: save idle, restore idle 31
|
||||
fp context switch: save idle, restore initialized 19
|
||||
fp context switch: save initialized, restore initialized 20
|
||||
_Thread_Resume 7
|
||||
_Thread_Unblock 7
|
||||
_Thread_Ready 9
|
||||
_Thread_Get 4
|
||||
_Semaphore_Get 2
|
||||
_Thread_Get: invalid id 0
|
||||
|
||||
27 interrupt entry overhead: returns to interrupted task 6
|
||||
interrupt exit overhead: returns to interrupted task 6
|
||||
interrupt entry overhead: returns to nested interrupt 6
|
||||
interrupt exit overhead: returns to nested interrupt 5
|
||||
interrupt entry overhead: returns to preempting task 7
|
||||
interrupt exit overhead: returns to preempting task 36
|
||||
|
||||
28 rtems_port_create 16
|
||||
rtems_port_external_to_internal 11
|
||||
rtems_port_internal_to_external 11
|
||||
rtems_port_delete 16
|
||||
|
||||
29 rtems_rate_monotonic_create 15
|
||||
rtems_rate_monotonic_period: initiate period -- returns to caller 21
|
||||
rtems_rate_monotonic_period: obtain status 13
|
||||
rtems_rate_monotonic_cancel 16
|
||||
rtems_rate_monotonic_delete: inactive 18
|
||||
rtems_rate_monotonic_delete: active 20
|
||||
rtems_rate_monotonic_period: conclude periods -- caller blocks 53
|
||||
Reference in New Issue
Block a user