forked from Imagelibrary/rtems
score: Add CPU counter support
Add a CPU counter interface to allow access to a free-running counter. It is useful to measure short time intervals. This can be used for example to enable profiling of critical low-level functions. Add two busy wait functions rtems_counter_delay_ticks() and rtems_counter_delay_nanoseconds() implemented via the CPU counter.
This commit is contained in:
@@ -33,6 +33,8 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c ../../shared/bsppost.c \
|
|||||||
../../shared/bsppredriverhook.c startup/bspstart.c ../../shared/bspclean.c \
|
../../shared/bsppredriverhook.c startup/bspstart.c ../../shared/bspclean.c \
|
||||||
../../shared/bspreset.c startup/memmap.c ../../shared/bootcard.c \
|
../../shared/bspreset.c startup/memmap.c ../../shared/bootcard.c \
|
||||||
../../shared/sbrk.c ../../shared/gnatinstallhandler.c
|
../../shared/sbrk.c ../../shared/gnatinstallhandler.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterread.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
# console
|
# console
|
||||||
libbsp_a_SOURCES += console/uart.c
|
libbsp_a_SOURCES += console/uart.c
|
||||||
# abort
|
# abort
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ libbsp_a_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \
|
|||||||
../../shared/bspclean.c startup/bspreset.c \
|
../../shared/bspclean.c startup/bspreset.c \
|
||||||
startup/memmap.c ../../shared/bootcard.c ../../shared/sbrk.c \
|
startup/memmap.c ../../shared/bootcard.c ../../shared/sbrk.c \
|
||||||
../../shared/gnatinstallhandler.c
|
../../shared/gnatinstallhandler.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterread.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
# console
|
# console
|
||||||
libbsp_a_SOURCES += ../../shared/console.c console/uarts.c \
|
libbsp_a_SOURCES += ../../shared/console.c console/uarts.c \
|
||||||
../../shared/console_select.c ../../shared/console_control.c \
|
../../shared/console_select.c ../../shared/console_control.c \
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ libbsp_a_SOURCES += ../../shared/bsppost.c ../../shared/bsplibc.c \
|
|||||||
../../shared/bsppredriverhook.c startup/bspstart.c \
|
../../shared/bsppredriverhook.c startup/bspstart.c \
|
||||||
../../shared/bspclean.c ../../shared/bootcard.c ../../shared/sbrk.c \
|
../../shared/bspclean.c ../../shared/bootcard.c ../../shared/sbrk.c \
|
||||||
startup/bspreset.c ../../shared/gnatinstallhandler.c
|
startup/bspreset.c ../../shared/gnatinstallhandler.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterread.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
|
|
||||||
# clock
|
# clock
|
||||||
libbsp_a_SOURCES += clock/clockdrv.c
|
libbsp_a_SOURCES += clock/clockdrv.c
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c ../../shared/bsppost.c \
|
|||||||
startup/bspreset.c ../../shared/bootcard.c ../../shared/sbrk.c \
|
startup/bspreset.c ../../shared/bootcard.c ../../shared/sbrk.c \
|
||||||
../../shared/gnatinstallhandler.c \
|
../../shared/gnatinstallhandler.c \
|
||||||
startup/bspstart.c
|
startup/bspstart.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterread.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
# clock
|
# clock
|
||||||
libbsp_a_SOURCES += clock/clockdrv.c
|
libbsp_a_SOURCES += clock/clockdrv.c
|
||||||
libbsp_a_SOURCES += ../../shared/clockdrv_shell.h
|
libbsp_a_SOURCES += ../../shared/clockdrv_shell.h
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c ../../shared/bsppost.c \
|
|||||||
../../shared/bsppredriverhook.c ../../shared/bspstart.c \
|
../../shared/bsppredriverhook.c ../../shared/bspstart.c \
|
||||||
../../shared/bspclean.c startup/bspreset.c ../../shared/bootcard.c \
|
../../shared/bspclean.c startup/bspreset.c ../../shared/bootcard.c \
|
||||||
../../shared/sbrk.c ../../shared/gnatinstallhandler.c startup/syscalls.c
|
../../shared/sbrk.c ../../shared/gnatinstallhandler.c startup/syscalls.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterread.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
# console
|
# console
|
||||||
libbsp_a_SOURCES += ../../shared/console-polled.c console/console-io.c
|
libbsp_a_SOURCES += ../../shared/console-polled.c console/console-io.c
|
||||||
# clock
|
# clock
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c ../../shared/bsppost.c \
|
|||||||
../../shared/bspclean.c startup/bspreset.c \
|
../../shared/bspclean.c startup/bspreset.c \
|
||||||
startup/memmap.c ../../shared/bootcard.c ../../shared/sbrk.c \
|
startup/memmap.c ../../shared/bootcard.c ../../shared/sbrk.c \
|
||||||
../../shared/gnatinstallhandler.c
|
../../shared/gnatinstallhandler.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterread.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
# console
|
# console
|
||||||
libbsp_a_SOURCES += console/uart.c ../../shared/console.c \
|
libbsp_a_SOURCES += console/uart.c ../../shared/console.c \
|
||||||
../../shared/console_select.c ../../shared/console_control.c \
|
../../shared/console_select.c ../../shared/console_control.c \
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c ../../shared/bsppost.c \
|
|||||||
../../shared/bootcard.c ../../shared/sbrk.c \
|
../../shared/bootcard.c ../../shared/sbrk.c \
|
||||||
../../shared/gnatinstallhandler.c ../../shared/bsppretaskinghook.c \
|
../../shared/gnatinstallhandler.c ../../shared/bsppretaskinghook.c \
|
||||||
../../shared/bspclean.c startup/bspstart.c startup/bspreset.c startup/memmap.c
|
../../shared/bspclean.c startup/bspstart.c startup/bspreset.c startup/memmap.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterread.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
|
|
||||||
#console
|
#console
|
||||||
libbsp_a_SOURCES += console/uarts.c ../../shared/console.c \
|
libbsp_a_SOURCES += console/uarts.c ../../shared/console.c \
|
||||||
|
|||||||
@@ -68,6 +68,8 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c
|
|||||||
libbsp_a_SOURCES += ../../shared/bsppost.c
|
libbsp_a_SOURCES += ../../shared/bsppost.c
|
||||||
libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
|
libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
|
||||||
libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
|
libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterread.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
|
libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
|
||||||
libbsp_a_SOURCES += ../../shared/sbrk.c
|
libbsp_a_SOURCES += ../../shared/sbrk.c
|
||||||
libbsp_a_SOURCES += ../../shared/src/stackalloc.c
|
libbsp_a_SOURCES += ../../shared/src/stackalloc.c
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ libbsp_a_SOURCES += ../../shared/bootcard.c \
|
|||||||
../../shared/sbrk.c \
|
../../shared/sbrk.c \
|
||||||
../../shared/src/stackalloc.c \
|
../../shared/src/stackalloc.c \
|
||||||
../../shared/src/uart-output-char.c
|
../../shared/src/uart-output-char.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
|
|
||||||
# Startup
|
# Startup
|
||||||
libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
|
libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008-2012 embedded brains GmbH. All rights reserved.
|
* Copyright (c) 2008-2014 embedded brains GmbH. All rights reserved.
|
||||||
*
|
*
|
||||||
* embedded brains GmbH
|
* embedded brains GmbH
|
||||||
* Obere Lagerstr. 30
|
* Obere Lagerstr. 30
|
||||||
@@ -20,6 +20,8 @@
|
|||||||
* http://www.rtems.com/license/LICENSE.
|
* http://www.rtems.com/license/LICENSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#include <bsp/lpc24xx.h>
|
#include <bsp/lpc24xx.h>
|
||||||
#include <bsp/system-clocks.h>
|
#include <bsp/system-clocks.h>
|
||||||
@@ -59,6 +61,13 @@ void lpc24xx_timer_initialize(void)
|
|||||||
|
|
||||||
/* Start timer */
|
/* Start timer */
|
||||||
T1TCR = TCR_EN;
|
T1TCR = TCR_EN;
|
||||||
|
|
||||||
|
rtems_counter_initialize_converter(LPC24XX_PCLK);
|
||||||
|
}
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read(void)
|
||||||
|
{
|
||||||
|
return lpc24xx_timer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lpc24xx_micro_seconds_delay(unsigned us)
|
void lpc24xx_micro_seconds_delay(unsigned us)
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c
|
|||||||
libbsp_a_SOURCES += ../../shared/bsppost.c
|
libbsp_a_SOURCES += ../../shared/bsppost.c
|
||||||
libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
|
libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
|
||||||
libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
|
libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
|
libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
|
||||||
libbsp_a_SOURCES += ../../shared/sbrk.c
|
libbsp_a_SOURCES += ../../shared/sbrk.c
|
||||||
libbsp_a_SOURCES += ../../shared/src/stackalloc.c
|
libbsp_a_SOURCES += ../../shared/src/stackalloc.c
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009-2012 embedded brains GmbH. All rights reserved.
|
* Copyright (c) 2009-2014 embedded brains GmbH. All rights reserved.
|
||||||
*
|
*
|
||||||
* embedded brains GmbH
|
* embedded brains GmbH
|
||||||
* Obere Lagerstr. 30
|
* Obere Lagerstr. 30
|
||||||
@@ -20,14 +20,19 @@
|
|||||||
* http://www.rtems.com/license/LICENSE.
|
* http://www.rtems.com/license/LICENSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#include <bsp/bootcard.h>
|
#include <bsp/bootcard.h>
|
||||||
#include <bsp/irq-generic.h>
|
#include <bsp/irq-generic.h>
|
||||||
#include <bsp/irq.h>
|
|
||||||
#include <bsp/linker-symbols.h>
|
CPU_Counter_ticks _CPU_Counter_read(void)
|
||||||
#include <bsp/lpc32xx.h>
|
{
|
||||||
|
return lpc32xx_timer();
|
||||||
|
}
|
||||||
|
|
||||||
void bsp_start(void)
|
void bsp_start(void)
|
||||||
{
|
{
|
||||||
|
rtems_counter_initialize_converter(LPC32XX_PERIPH_CLK);
|
||||||
bsp_interrupt_initialize();
|
bsp_interrupt_initialize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ startup_rel_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \
|
|||||||
startup/bspstart.c ../../shared/bspclean.c startup/bspreset.c \
|
startup/bspstart.c ../../shared/bspclean.c startup/bspreset.c \
|
||||||
../../shared/bspgetworkarea.c ../../shared/bsppredriverhook.c \
|
../../shared/bspgetworkarea.c ../../shared/bsppredriverhook.c \
|
||||||
../../shared/bsppretaskinghook.c ../../shared/bootcard.c
|
../../shared/bsppretaskinghook.c ../../shared/bootcard.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterread.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
startup_rel_CPPFLAGS = $(AM_CPPFLAGS) -DARM9 -I$(srcdir)/libnds/include
|
startup_rel_CPPFLAGS = $(AM_CPPFLAGS) -DARM9 -I$(srcdir)/libnds/include
|
||||||
startup_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
|
startup_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c
|
|||||||
libbsp_a_SOURCES += ../../shared/bsppost.c
|
libbsp_a_SOURCES += ../../shared/bsppost.c
|
||||||
libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
|
libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
|
||||||
libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
|
libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterread.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
|
libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
|
||||||
libbsp_a_SOURCES += ../../shared/sbrk.c
|
libbsp_a_SOURCES += ../../shared/sbrk.c
|
||||||
libbsp_a_SOURCES += ../../shared/src/stackalloc.c
|
libbsp_a_SOURCES += ../../shared/src/stackalloc.c
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c
|
|||||||
libbsp_a_SOURCES += ../../shared/bsppost.c
|
libbsp_a_SOURCES += ../../shared/bsppost.c
|
||||||
libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
|
libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
|
||||||
libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
|
libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
|
libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
|
||||||
libbsp_a_SOURCES += ../../shared/sbrk.c
|
libbsp_a_SOURCES += ../../shared/sbrk.c
|
||||||
libbsp_a_SOURCES += ../../shared/timerstub.c
|
libbsp_a_SOURCES += ../../shared/timerstub.c
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c ../../shared/bsppost.c \
|
|||||||
../../shared/bspclean.c startup/bspreset.c \
|
../../shared/bspclean.c startup/bspreset.c \
|
||||||
../../shared/bootcard.c ../../shared/sbrk.c \
|
../../shared/bootcard.c ../../shared/sbrk.c \
|
||||||
../../shared/gnatinstallhandler.c
|
../../shared/gnatinstallhandler.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterread.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
# console
|
# console
|
||||||
libbsp_a_SOURCES += ../../shared/console.c \
|
libbsp_a_SOURCES += ../../shared/console.c \
|
||||||
../../shared/console_select.c ../../shared/console_control.c \
|
../../shared/console_select.c ../../shared/console_control.c \
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
* http://www.rtems.com/license/LICENSE.
|
* http://www.rtems.com/license/LICENSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#include <bsp/irq.h>
|
#include <bsp/irq.h>
|
||||||
#include <bsp/arm-a9mpcore-regs.h>
|
#include <bsp/arm-a9mpcore-regs.h>
|
||||||
@@ -94,6 +96,15 @@ static void a9mpcore_clock_initialize(void)
|
|||||||
| A9MPCORE_GT_CTRL_IRQ_EN
|
| A9MPCORE_GT_CTRL_IRQ_EN
|
||||||
| A9MPCORE_GT_CTRL_COMP_EN
|
| A9MPCORE_GT_CTRL_COMP_EN
|
||||||
| A9MPCORE_GT_CTRL_TMR_EN;
|
| A9MPCORE_GT_CTRL_TMR_EN;
|
||||||
|
|
||||||
|
rtems_counter_initialize_converter((uint32_t) periphclk);
|
||||||
|
}
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read(void)
|
||||||
|
{
|
||||||
|
volatile a9mpcore_gt *gt = A9MPCORE_GT;
|
||||||
|
|
||||||
|
return gt->cntrlower;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void a9mpcore_clock_cleanup(void)
|
static void a9mpcore_clock_cleanup(void)
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c ../../shared/bsppost.c \
|
|||||||
../../shared/bsppretaskinghook.c \
|
../../shared/bsppretaskinghook.c \
|
||||||
../../shared/bsppredriverhook.c ../../shared/bspgetworkarea.c \
|
../../shared/bsppredriverhook.c ../../shared/bspgetworkarea.c \
|
||||||
../../shared/gnatinstallhandler.c
|
../../shared/gnatinstallhandler.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterread.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
# console
|
# console
|
||||||
libbsp_a_SOURCES += ../gp32/console/uart.c ../../shared/console.c \
|
libbsp_a_SOURCES += ../gp32/console/uart.c ../../shared/console.c \
|
||||||
../../shared/console_select.c \
|
../../shared/console_select.c \
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c
|
|||||||
libbsp_a_SOURCES += ../../shared/bsppost.c
|
libbsp_a_SOURCES += ../../shared/bsppost.c
|
||||||
libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
|
libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
|
||||||
libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
|
libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterread.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
|
libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
|
||||||
libbsp_a_SOURCES += ../../shared/sbrk.c
|
libbsp_a_SOURCES += ../../shared/sbrk.c
|
||||||
libbsp_a_SOURCES += ../../shared/src/stackalloc.c
|
libbsp_a_SOURCES += ../../shared/src/stackalloc.c
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c
|
|||||||
libbsp_a_SOURCES += ../../shared/bsppost.c
|
libbsp_a_SOURCES += ../../shared/bsppost.c
|
||||||
libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
|
libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
|
||||||
libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
|
libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
|
||||||
libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
|
libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
|
||||||
libbsp_a_SOURCES += ../../shared/sbrk.c
|
libbsp_a_SOURCES += ../../shared/sbrk.c
|
||||||
libbsp_a_SOURCES += ../../shared/timerstub.c
|
libbsp_a_SOURCES += ../../shared/timerstub.c
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include <rtems/libio.h>
|
#include <rtems/libio.h>
|
||||||
#include <rtems/libcsupport.h>
|
#include <rtems/libcsupport.h>
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
#include <rtems/powerpc/powerpc.h>
|
#include <rtems/powerpc/powerpc.h>
|
||||||
/*#include <bsp/consoleIo.h>*/
|
/*#include <bsp/consoleIo.h>*/
|
||||||
#include <libcpu/spr.h> /* registers.h is included here */
|
#include <libcpu/spr.h> /* registers.h is included here */
|
||||||
@@ -337,6 +338,9 @@ void bsp_start( void )
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
bsp_clicks_per_usec = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
|
bsp_clicks_per_usec = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
|
||||||
|
rtems_counter_initialize_converter(
|
||||||
|
BSP_bus_frequency / (BSP_time_base_divisor / 1000)
|
||||||
|
);
|
||||||
|
|
||||||
#ifdef SHOW_MORE_INIT_SETTINGS
|
#ifdef SHOW_MORE_INIT_SETTINGS
|
||||||
printk(
|
printk(
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <libcpu/cpuIdent.h>
|
#include <libcpu/cpuIdent.h>
|
||||||
#include <bsp/vectors.h>
|
#include <bsp/vectors.h>
|
||||||
#include <rtems/powerpc/powerpc.h>
|
#include <rtems/powerpc/powerpc.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
extern unsigned long __bss_start[], __SBSS_START__[], __SBSS_END__[];
|
extern unsigned long __bss_start[], __SBSS_START__[], __SBSS_END__[];
|
||||||
extern unsigned long __SBSS2_START__[], __SBSS2_END__[];
|
extern unsigned long __SBSS2_START__[], __SBSS2_END__[];
|
||||||
@@ -300,6 +301,9 @@ void bsp_start( void )
|
|||||||
Read_ep1a_config_registers( myCpu );
|
Read_ep1a_config_registers( myCpu );
|
||||||
|
|
||||||
bsp_clicks_per_usec = BSP_processor_frequency/(BSP_time_base_divisor * 1000);
|
bsp_clicks_per_usec = BSP_processor_frequency/(BSP_time_base_divisor * 1000);
|
||||||
|
rtems_counter_initialize_converter(
|
||||||
|
BSP_processor_frequency / (BSP_time_base_divisor / 1000)
|
||||||
|
);
|
||||||
|
|
||||||
ShowBATS();
|
ShowBATS();
|
||||||
#if 0 /* XXX - Add back in cache enable when we get this up and running!! */
|
#if 0 /* XXX - Add back in cache enable when we get this up and running!! */
|
||||||
|
|||||||
@@ -95,6 +95,7 @@
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
#include <libcpu/powerpc-utility.h>
|
#include <libcpu/powerpc-utility.h>
|
||||||
|
|
||||||
@@ -164,6 +165,7 @@ void bsp_start(void)
|
|||||||
|
|
||||||
bsp_time_base_frequency = XLB_CLOCK / 4;
|
bsp_time_base_frequency = XLB_CLOCK / 4;
|
||||||
bsp_clicks_per_usec = (XLB_CLOCK/4000000);
|
bsp_clicks_per_usec = (XLB_CLOCK/4000000);
|
||||||
|
rtems_counter_initialize_converter(bsp_time_base_frequency);
|
||||||
|
|
||||||
/* Initialize exception handler */
|
/* Initialize exception handler */
|
||||||
ppc_exc_cache_wb_check = 0;
|
ppc_exc_cache_wb_check = 0;
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
* http://www.rtems.com/license/LICENSE.
|
* http://www.rtems.com/license/LICENSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
#include <libchip/serial.h>
|
#include <libchip/serial.h>
|
||||||
|
|
||||||
#include <libcpu/powerpc-utility.h>
|
#include <libcpu/powerpc-utility.h>
|
||||||
@@ -117,6 +119,7 @@ void bsp_start( void)
|
|||||||
#endif /* HAS_UBOOT */
|
#endif /* HAS_UBOOT */
|
||||||
bsp_time_base_frequency = BSP_bus_frequency / 4;
|
bsp_time_base_frequency = BSP_bus_frequency / 4;
|
||||||
bsp_clicks_per_usec = bsp_time_base_frequency / 1000000;
|
bsp_clicks_per_usec = bsp_time_base_frequency / 1000000;
|
||||||
|
rtems_counter_initialize_converter(bsp_time_base_frequency);
|
||||||
|
|
||||||
/* Initialize some console parameters */
|
/* Initialize some console parameters */
|
||||||
for (i = 0; i < Console_Configuration_Count; ++i) {
|
for (i = 0; i < Console_Configuration_Count; ++i) {
|
||||||
|
|||||||
@@ -59,6 +59,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#include <bsp/uart.h>
|
#include <bsp/uart.h>
|
||||||
#include <bsp/irq.h>
|
#include <bsp/irq.h>
|
||||||
@@ -194,6 +196,7 @@ void bsp_start( void )
|
|||||||
/* Set globals visible to clock.c */
|
/* Set globals visible to clock.c */
|
||||||
/* timebase register ticks/microsecond = CPU Clk in MHz */
|
/* timebase register ticks/microsecond = CPU Clk in MHz */
|
||||||
bsp_clicks_per_usec = 400;
|
bsp_clicks_per_usec = 400;
|
||||||
|
rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);
|
||||||
|
|
||||||
bsp_timer_internal_clock = TRUE;
|
bsp_timer_internal_clock = TRUE;
|
||||||
bsp_timer_average_overhead = 2;
|
bsp_timer_average_overhead = 2;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#include <bsp/irq.h>
|
#include <bsp/irq.h>
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
#include <libcpu/cpuIdent.h>
|
#include <libcpu/cpuIdent.h>
|
||||||
#include <libcpu/spr.h>
|
#include <libcpu/spr.h>
|
||||||
#include <rtems/powerpc/powerpc.h>
|
#include <rtems/powerpc/powerpc.h>
|
||||||
@@ -142,6 +143,7 @@ void bsp_start(void)
|
|||||||
#else
|
#else
|
||||||
bsp_clicks_per_usec = 1; /* for 4MHz extclk */
|
bsp_clicks_per_usec = 1; /* for 4MHz extclk */
|
||||||
#endif
|
#endif
|
||||||
|
rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);
|
||||||
|
|
||||||
bsp_serial_per_sec = 10000000;
|
bsp_serial_per_sec = 10000000;
|
||||||
bsp_serial_external_clock = true;
|
bsp_serial_external_clock = true;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
#include <rtems/config.h>
|
#include <rtems/config.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
#include <libcpu/powerpc-utility.h>
|
#include <libcpu/powerpc-utility.h>
|
||||||
#include <bsp/vectors.h>
|
#include <bsp/vectors.h>
|
||||||
@@ -103,6 +104,7 @@ void bsp_start(void)
|
|||||||
|
|
||||||
/* Time reference value */
|
/* Time reference value */
|
||||||
bsp_clicks_per_usec = bsp_clock_speed / 1000000;
|
bsp_clicks_per_usec = bsp_clock_speed / 1000000;
|
||||||
|
rtems_counter_initialize_converter(bsp_clock_speed);
|
||||||
|
|
||||||
/* Initialize exceptions */
|
/* Initialize exceptions */
|
||||||
ppc_exc_initialize_with_vector_base(
|
ppc_exc_initialize_with_vector_base(
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
#include <rtems/powerpc/powerpc.h>
|
#include <rtems/powerpc/powerpc.h>
|
||||||
|
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
#include <bsp/irq.h>
|
#include <bsp/irq.h>
|
||||||
#include <libcpu/cpuIdent.h>
|
#include <libcpu/cpuIdent.h>
|
||||||
#include <libcpu/spr.h>
|
#include <libcpu/spr.h>
|
||||||
@@ -208,6 +209,7 @@ void bsp_start(void)
|
|||||||
bsp_timer_average_overhead = 3;
|
bsp_timer_average_overhead = 3;
|
||||||
bsp_timer_least_valid = 3;
|
bsp_timer_least_valid = 3;
|
||||||
bsp_clock_speed = 40000000;
|
bsp_clock_speed = 40000000;
|
||||||
|
rtems_counter_initialize_converter(bsp_clock_speed);
|
||||||
|
|
||||||
#ifdef REV_0_2
|
#ifdef REV_0_2
|
||||||
/* set up some board specific registers */
|
/* set up some board specific registers */
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
#include <libcpu/spr.h>
|
#include <libcpu/spr.h>
|
||||||
#include <libcpu/io.h>
|
#include <libcpu/io.h>
|
||||||
#include <libcpu/e500_mmu.h>
|
#include <libcpu/e500_mmu.h>
|
||||||
@@ -384,6 +385,9 @@ VpdBufRec vpdData [] = {
|
|||||||
_BSP_clear_hostbridge_errors(0 /* enableMCP */, 0/*quiet*/);
|
_BSP_clear_hostbridge_errors(0 /* enableMCP */, 0/*quiet*/);
|
||||||
|
|
||||||
bsp_clicks_per_usec = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
|
bsp_clicks_per_usec = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
|
||||||
|
rtems_counter_initialize_converter(
|
||||||
|
BSP_bus_frequency / (BSP_time_base_divisor / 1000)
|
||||||
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initalize RTEMS IRQ system
|
* Initalize RTEMS IRQ system
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include <bsp/bspException.h>
|
#include <bsp/bspException.h>
|
||||||
|
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
#include <rtems/sptables.h>
|
#include <rtems/sptables.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -287,6 +288,9 @@ void bsp_start( void )
|
|||||||
/* P94 : 7455 TB/DECR is clocked by the system bus clock frequency */
|
/* P94 : 7455 TB/DECR is clocked by the system bus clock frequency */
|
||||||
|
|
||||||
bsp_clicks_per_usec = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
|
bsp_clicks_per_usec = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
|
||||||
|
rtems_counter_initialize_converter(
|
||||||
|
BSP_bus_frequency / (BSP_time_base_divisor / 1000)
|
||||||
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initalize RTEMS IRQ system
|
* Initalize RTEMS IRQ system
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <bsp/bootcard.h>
|
#include <bsp/bootcard.h>
|
||||||
#include <bsp/linker-symbols.h>
|
#include <bsp/linker-symbols.h>
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
#include <rtems/powerpc/powerpc.h>
|
#include <rtems/powerpc/powerpc.h>
|
||||||
|
|
||||||
#include <libcpu/cpuIdent.h>
|
#include <libcpu/cpuIdent.h>
|
||||||
@@ -92,6 +93,7 @@ void bsp_start( void )
|
|||||||
BSP_bus_frequency = (unsigned int)PSIM_INSTRUCTIONS_PER_MICROSECOND;
|
BSP_bus_frequency = (unsigned int)PSIM_INSTRUCTIONS_PER_MICROSECOND;
|
||||||
bsp_clicks_per_usec = BSP_bus_frequency;
|
bsp_clicks_per_usec = BSP_bus_frequency;
|
||||||
BSP_time_base_divisor = 1;
|
BSP_time_base_divisor = 1;
|
||||||
|
rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize default raw exception handlers.
|
* Initialize default raw exception handlers.
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
#include <libcpu/bat.h>
|
#include <libcpu/bat.h>
|
||||||
#include <libcpu/spr.h>
|
#include <libcpu/spr.h>
|
||||||
#include <libcpu/powerpc-utility.h>
|
#include <libcpu/powerpc-utility.h>
|
||||||
@@ -79,6 +81,7 @@ void bsp_start( void )
|
|||||||
BSP_bus_frequency = 20;
|
BSP_bus_frequency = 20;
|
||||||
bsp_time_base_frequency = 20000000;
|
bsp_time_base_frequency = 20000000;
|
||||||
bsp_clicks_per_usec = BSP_bus_frequency;
|
bsp_clicks_per_usec = BSP_bus_frequency;
|
||||||
|
rtems_counter_initialize_converter(bsp_time_base_frequency);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the interrupt related settings.
|
* Initialize the interrupt related settings.
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
#include <rtems/config.h>
|
#include <rtems/config.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
#include <libchip/serial.h>
|
#include <libchip/serial.h>
|
||||||
|
|
||||||
@@ -89,6 +90,7 @@ void bsp_start(void)
|
|||||||
BSP_bus_frequency = bsp_uboot_board_info.bi_busfreq;
|
BSP_bus_frequency = bsp_uboot_board_info.bi_busfreq;
|
||||||
bsp_clicks_per_usec = bsp_uboot_board_info.bi_busfreq / 8000000;
|
bsp_clicks_per_usec = bsp_uboot_board_info.bi_busfreq / 8000000;
|
||||||
#endif /* HAS_UBOOT */
|
#endif /* HAS_UBOOT */
|
||||||
|
rtems_counter_initialize_converter(BSP_bus_frequency / 8);
|
||||||
|
|
||||||
/* Initialize some console parameters */
|
/* Initialize some console parameters */
|
||||||
for (i = 0; i < Console_Configuration_Count; ++i) {
|
for (i = 0; i < Console_Configuration_Count; ++i) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <rtems/libio.h>
|
#include <rtems/libio.h>
|
||||||
#include <rtems/libcsupport.h>
|
#include <rtems/libcsupport.h>
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
#include <libcpu/cpuIdent.h>
|
#include <libcpu/cpuIdent.h>
|
||||||
#include <bsp/irq.h>
|
#include <bsp/irq.h>
|
||||||
|
|
||||||
@@ -210,6 +211,7 @@ void bsp_start( void )
|
|||||||
printk("bsp_start: set clicks poer usec\n");
|
printk("bsp_start: set clicks poer usec\n");
|
||||||
#endif
|
#endif
|
||||||
bsp_clicks_per_usec = 66 / 4;
|
bsp_clicks_per_usec = 66 / 4;
|
||||||
|
rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);
|
||||||
|
|
||||||
#if BSP_DATA_CACHE_ENABLED
|
#if BSP_DATA_CACHE_ENABLED
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
#include <bsp/consoleIo.h>
|
#include <bsp/consoleIo.h>
|
||||||
#include <libcpu/spr.h>
|
#include <libcpu/spr.h>
|
||||||
#include <bsp/residual.h>
|
#include <bsp/residual.h>
|
||||||
@@ -342,6 +343,9 @@ void bsp_start( void )
|
|||||||
* initialize the device driver parameters
|
* initialize the device driver parameters
|
||||||
*/
|
*/
|
||||||
bsp_clicks_per_usec = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
|
bsp_clicks_per_usec = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
|
||||||
|
rtems_counter_initialize_converter(
|
||||||
|
BSP_bus_frequency / (BSP_time_base_divisor / 1000)
|
||||||
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initalize RTEMS IRQ system
|
* Initalize RTEMS IRQ system
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#warning The interrupt disable mask is now stored in SPRG0, please verify that this is compatible to this BSP (see also bootcard.c).
|
#warning The interrupt disable mask is now stored in SPRG0, please verify that this is compatible to this BSP (see also bootcard.c).
|
||||||
|
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
#include <rtems/powerpc/powerpc.h>
|
#include <rtems/powerpc/powerpc.h>
|
||||||
|
|
||||||
#include <libcpu/cpuIdent.h>
|
#include <libcpu/cpuIdent.h>
|
||||||
@@ -108,6 +109,7 @@ void bsp_start(void)
|
|||||||
bsp_clock_speed = BSP_CLOCK_HZ; /* for SCI baud rate generator */
|
bsp_clock_speed = BSP_CLOCK_HZ; /* for SCI baud rate generator */
|
||||||
bsp_timer_least_valid = 0;
|
bsp_timer_least_valid = 0;
|
||||||
bsp_timer_average_overhead = 0;
|
bsp_timer_average_overhead = 0;
|
||||||
|
rtems_counter_initialize_converter(BSP_CRYSTAL_HZ / 4);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initalize RTEMS IRQ system
|
* Initalize RTEMS IRQ system
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <rtems/config.h>
|
#include <rtems/config.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#include <bsp/vectors.h>
|
#include <bsp/vectors.h>
|
||||||
@@ -63,6 +64,8 @@ void bsp_start(void)
|
|||||||
get_ppc_cpu_type();
|
get_ppc_cpu_type();
|
||||||
get_ppc_cpu_revision();
|
get_ppc_cpu_revision();
|
||||||
|
|
||||||
|
rtems_counter_initialize_converter(bsp_time_base_frequency);
|
||||||
|
|
||||||
/* Initialize exception handler */
|
/* Initialize exception handler */
|
||||||
ppc_exc_initialize_with_vector_base(
|
ppc_exc_initialize_with_vector_base(
|
||||||
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
|
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
#include <libcpu/powerpc-utility.h>
|
#include <libcpu/powerpc-utility.h>
|
||||||
|
|
||||||
@@ -179,6 +180,7 @@ void bsp_start( void)
|
|||||||
bsp_clicks_per_usec = bsp_time_base_frequency / 1000000;
|
bsp_clicks_per_usec = bsp_time_base_frequency / 1000000;
|
||||||
bsp_timer_least_valid = 3;
|
bsp_timer_least_valid = 3;
|
||||||
bsp_timer_average_overhead = 3;
|
bsp_timer_average_overhead = 3;
|
||||||
|
rtems_counter_initialize_converter(bsp_time_base_frequency);
|
||||||
|
|
||||||
/* Initialize exception handler */
|
/* Initialize exception handler */
|
||||||
ppc_exc_initialize(
|
ppc_exc_initialize(
|
||||||
|
|||||||
@@ -54,6 +54,8 @@
|
|||||||
* Modifications for PPC405GP by Dennis Ehlin
|
* Modifications for PPC405GP by Dennis Ehlin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#include <bsp/irq.h>
|
#include <bsp/irq.h>
|
||||||
#include <bsp/irq-generic.h>
|
#include <bsp/irq-generic.h>
|
||||||
@@ -87,6 +89,8 @@ void bsp_start( void )
|
|||||||
get_ppc_cpu_type();
|
get_ppc_cpu_type();
|
||||||
get_ppc_cpu_revision();
|
get_ppc_cpu_revision();
|
||||||
|
|
||||||
|
rtems_counter_initialize_converter(bsp_time_base_frequency);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize default raw exception handlers.
|
* Initialize default raw exception handlers.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -57,6 +57,7 @@
|
|||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
#include <rtems/config.h>
|
#include <rtems/config.h>
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
#include <rtems/libio.h>
|
#include <rtems/libio.h>
|
||||||
#include <rtems/libcsupport.h>
|
#include <rtems/libcsupport.h>
|
||||||
|
|
||||||
@@ -199,6 +200,7 @@ void bsp_start(void)
|
|||||||
bsp_timer_internal_clock = true;
|
bsp_timer_internal_clock = true;
|
||||||
bsp_timer_average_overhead = 2;
|
bsp_timer_average_overhead = 2;
|
||||||
bsp_timer_least_valid = 3;
|
bsp_timer_least_valid = 3;
|
||||||
|
rtems_counter_initialize_converter(bsp_clicks_per_usec * 1000000);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the interrupt related settings.
|
* Initialize the interrupt related settings.
|
||||||
|
|||||||
@@ -57,6 +57,7 @@
|
|||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
#include <rtems/config.h>
|
#include <rtems/config.h>
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
#include <rtems/libio.h>
|
#include <rtems/libio.h>
|
||||||
#include <rtems/libcsupport.h>
|
#include <rtems/libcsupport.h>
|
||||||
|
|
||||||
@@ -214,6 +215,9 @@ void bsp_start(void)
|
|||||||
|
|
||||||
/* Timebase register ticks/microsecond; The application may override these */
|
/* Timebase register ticks/microsecond; The application may override these */
|
||||||
bsp_clicks_per_usec = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
|
bsp_clicks_per_usec = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
|
||||||
|
rtems_counter_initialize_converter(
|
||||||
|
BSP_bus_frequency / (BSP_time_base_divisor / 1000)
|
||||||
|
);
|
||||||
bsp_timer_internal_clock = true;
|
bsp_timer_internal_clock = true;
|
||||||
bsp_timer_average_overhead = 2;
|
bsp_timer_average_overhead = 2;
|
||||||
bsp_timer_least_valid = 3;
|
bsp_timer_least_valid = 3;
|
||||||
|
|||||||
23
c/src/lib/libbsp/shared/cpucounterdiff.c
Normal file
23
c/src/lib/libbsp/shared/cpucounterdiff.c
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 embedded brains GmbH. All rights reserved.
|
||||||
|
*
|
||||||
|
* embedded brains GmbH
|
||||||
|
* Dornierstr. 4
|
||||||
|
* 82178 Puchheim
|
||||||
|
* Germany
|
||||||
|
* <rtems@embedded-brains.de>
|
||||||
|
*
|
||||||
|
* 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 <rtems/score/cpu.h>
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
27
c/src/lib/libbsp/shared/cpucounterread.c
Normal file
27
c/src/lib/libbsp/shared/cpucounterread.c
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 embedded brains GmbH. All rights reserved.
|
||||||
|
*
|
||||||
|
* embedded brains GmbH
|
||||||
|
* Dornierstr. 4
|
||||||
|
* 82178 Puchheim
|
||||||
|
* Germany
|
||||||
|
* <rtems@embedded-brains.de>
|
||||||
|
*
|
||||||
|
* 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 <rtems/score/cpu.h>
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void )
|
||||||
|
{
|
||||||
|
static CPU_Counter_ticks counter;
|
||||||
|
|
||||||
|
CPU_Counter_ticks snapshot;
|
||||||
|
|
||||||
|
snapshot = counter;
|
||||||
|
counter = snapshot + 1;
|
||||||
|
|
||||||
|
return snapshot;
|
||||||
|
}
|
||||||
@@ -35,6 +35,7 @@ libbsp_a_SOURCES += ../../shared/bspclean.c ../../shared/bsplibc.c \
|
|||||||
../../shared/sbrk.c startup/setvec.c startup/spurious.c \
|
../../shared/sbrk.c startup/setvec.c startup/spurious.c \
|
||||||
startup/erc32mec.c startup/boardinit.S startup/bspidle.c \
|
startup/erc32mec.c startup/boardinit.S startup/bspidle.c \
|
||||||
startup/bspdelay.c ../../sparc/shared/startup/early_malloc.c
|
startup/bspdelay.c ../../sparc/shared/startup/early_malloc.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterread.c
|
||||||
# ISR Handler
|
# ISR Handler
|
||||||
libbsp_a_SOURCES += ../../sparc/shared/irq_asm.S
|
libbsp_a_SOURCES += ../../sparc/shared/irq_asm.S
|
||||||
# gnatsupp
|
# gnatsupp
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ libbsp_a_SOURCES += ../../shared/bspclean.c ../../shared/bsplibc.c \
|
|||||||
../../shared/sbrk.c startup/setvec.c startup/spurious.c startup/bspidle.c \
|
../../shared/sbrk.c startup/setvec.c startup/spurious.c startup/bspidle.c \
|
||||||
../../shared/bspinit.c startup/bspdelay.c \
|
../../shared/bspinit.c startup/bspdelay.c \
|
||||||
../../sparc/shared/startup/early_malloc.c
|
../../sparc/shared/startup/early_malloc.c
|
||||||
|
libbsp_a_SOURCES += ../../shared/cpucounterread.c
|
||||||
# ISR Handler
|
# ISR Handler
|
||||||
libbsp_a_SOURCES += ../../sparc/shared/irq_asm.S
|
libbsp_a_SOURCES += ../../sparc/shared/irq_asm.S
|
||||||
# gnatsupp
|
# gnatsupp
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ libbsp_a_SOURCES += ../../shared/bspclean.c ../../shared/bsplibc.c \
|
|||||||
../../sparc/shared/startup/bspgetworkarea.c ../../shared/sbrk.c startup/setvec.c \
|
../../sparc/shared/startup/bspgetworkarea.c ../../shared/sbrk.c startup/setvec.c \
|
||||||
startup/spurious.c startup/bspidle.S startup/bspdelay.c \
|
startup/spurious.c startup/bspidle.S startup/bspdelay.c \
|
||||||
../../shared/bspinit.c ../../sparc/shared/startup/early_malloc.c
|
../../shared/bspinit.c ../../sparc/shared/startup/early_malloc.c
|
||||||
|
libbsp_a_SOURCES += startup/cpucounter.c
|
||||||
|
|
||||||
# ISR Handler
|
# ISR Handler
|
||||||
libbsp_a_SOURCES += ../../sparc/shared/irq_asm.S
|
libbsp_a_SOURCES += ../../sparc/shared/irq_asm.S
|
||||||
|
|||||||
@@ -209,6 +209,10 @@ extern void BSP_shared_interrupt_unmask(int irq);
|
|||||||
*/
|
*/
|
||||||
extern void BSP_shared_interrupt_mask(int irq);
|
extern void BSP_shared_interrupt_mask(int irq);
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LEON3_FATAL_CPU_COUNTER_INIT
|
||||||
|
} leon3_fatal_code;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -317,6 +317,8 @@ int apbuart_inbyte_nonblocking(struct apbuart_regs *regs);
|
|||||||
*/
|
*/
|
||||||
void leon3_secondary_cpu_initialize(uint32_t cpu);
|
void leon3_secondary_cpu_initialize(uint32_t cpu);
|
||||||
|
|
||||||
|
void leon3_cpu_counter_initialize(void);
|
||||||
|
|
||||||
void bsp_debug_uart_init(void);
|
void bsp_debug_uart_init(void);
|
||||||
|
|
||||||
#endif /* !ASM */
|
#endif /* !ASM */
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ void bsp_start( void )
|
|||||||
* interrupt support
|
* interrupt support
|
||||||
*/
|
*/
|
||||||
amba_initialize();
|
amba_initialize();
|
||||||
|
leon3_cpu_counter_initialize();
|
||||||
|
|
||||||
/* find debug UART for printk() */
|
/* find debug UART for printk() */
|
||||||
bsp_debug_uart_init();
|
bsp_debug_uart_init();
|
||||||
|
|||||||
63
c/src/lib/libbsp/sparc/leon3/startup/cpucounter.c
Normal file
63
c/src/lib/libbsp/sparc/leon3/startup/cpucounter.c
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 embedded brains GmbH. All rights reserved.
|
||||||
|
*
|
||||||
|
* embedded brains GmbH
|
||||||
|
* Dornierstr. 4
|
||||||
|
* 82178 Puchheim
|
||||||
|
* Germany
|
||||||
|
* <rtems@embedded-brains.de>
|
||||||
|
*
|
||||||
|
* 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 <leon.h>
|
||||||
|
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
|
static volatile struct gptimer_regs *leon3_cpu_counter_gpt;
|
||||||
|
|
||||||
|
void leon3_cpu_counter_initialize(void)
|
||||||
|
{
|
||||||
|
struct ambapp_dev *adev;
|
||||||
|
int idx = 1;
|
||||||
|
volatile struct gptimer_regs *gpt;
|
||||||
|
unsigned new_prescaler = 8;
|
||||||
|
unsigned prescaler;
|
||||||
|
uint32_t frequency;
|
||||||
|
|
||||||
|
adev = (void *) ambapp_for_each(
|
||||||
|
&ambapp_plb,
|
||||||
|
OPTIONS_ALL | OPTIONS_APB_SLVS,
|
||||||
|
VENDOR_GAISLER,
|
||||||
|
GAISLER_GPTIMER,
|
||||||
|
ambapp_find_by_idx,
|
||||||
|
&idx
|
||||||
|
);
|
||||||
|
if (adev == NULL) {
|
||||||
|
rtems_fatal(RTEMS_FATAL_SOURCE_BSP_SPECIFIC, LEON3_FATAL_CPU_COUNTER_INIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
gpt = (volatile struct gptimer_regs *) DEV_TO_APB(adev)->start;
|
||||||
|
|
||||||
|
prescaler = gpt->scaler_reload + 1;
|
||||||
|
gpt->scaler_reload = new_prescaler - 1;
|
||||||
|
gpt->timer[0].reload = 0xffffffff;
|
||||||
|
gpt->timer[0].ctrl = LEON3_GPTIMER_EN | LEON3_GPTIMER_RL
|
||||||
|
| LEON3_GPTIMER_LD;
|
||||||
|
|
||||||
|
leon3_cpu_counter_gpt = gpt;
|
||||||
|
|
||||||
|
/* Assume that GRMON initialized the timer to 1MHz */
|
||||||
|
frequency = UINT32_C(1000000) * (prescaler / new_prescaler);
|
||||||
|
rtems_counter_initialize_converter(frequency);
|
||||||
|
}
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read(void)
|
||||||
|
{
|
||||||
|
volatile struct gptimer_regs *gpt = leon3_cpu_counter_gpt;
|
||||||
|
|
||||||
|
return 0U - gpt->timer[0].value;
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ include_rtemsdir = $(includedir)/rtems
|
|||||||
include_rtems_HEADERS = include/confdefs.h
|
include_rtems_HEADERS = include/confdefs.h
|
||||||
include_rtems_HEADERS += include/rtems/chain.h
|
include_rtems_HEADERS += include/rtems/chain.h
|
||||||
include_rtems_HEADERS += include/rtems/config.h
|
include_rtems_HEADERS += include/rtems/config.h
|
||||||
|
include_rtems_HEADERS += include/rtems/counter.h
|
||||||
include_rtems_HEADERS += include/rtems/extension.h
|
include_rtems_HEADERS += include/rtems/extension.h
|
||||||
include_rtems_HEADERS += include/rtems/extensionimpl.h
|
include_rtems_HEADERS += include/rtems/extensionimpl.h
|
||||||
include_rtems_HEADERS += include/rtems/fatal.h
|
include_rtems_HEADERS += include/rtems/fatal.h
|
||||||
@@ -32,6 +33,9 @@ libsapi_a_SOURCES = src/debug.c src/extension.c src/extensioncreate.c \
|
|||||||
src/chainprependnotify.c src/rbheap.c src/interrtext.c \
|
src/chainprependnotify.c src/rbheap.c src/interrtext.c \
|
||||||
src/fatal2.c src/fatalsrctext.c
|
src/fatal2.c src/fatalsrctext.c
|
||||||
libsapi_a_SOURCES += src/chainsmp.c
|
libsapi_a_SOURCES += src/chainsmp.c
|
||||||
|
libsapi_a_SOURCES += src/cpucounterconverter.c
|
||||||
|
libsapi_a_SOURCES += src/delayticks.c
|
||||||
|
libsapi_a_SOURCES += src/delaynano.c
|
||||||
libsapi_a_CPPFLAGS = $(AM_CPPFLAGS)
|
libsapi_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
|
|
||||||
include $(srcdir)/preinstall.am
|
include $(srcdir)/preinstall.am
|
||||||
|
|||||||
160
cpukit/sapi/include/rtems/counter.h
Normal file
160
cpukit/sapi/include/rtems/counter.h
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
*
|
||||||
|
* @ingroup ClassicCounter
|
||||||
|
*
|
||||||
|
* @brief Free-Running Counter and Busy Wait Delay API
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014 embedded brains GmbH. All rights reserved.
|
||||||
|
*
|
||||||
|
* embedded brains GmbH
|
||||||
|
* Dornierstr. 4
|
||||||
|
* 82178 Puchheim
|
||||||
|
* Germany
|
||||||
|
* <rtems@embedded-brains.de>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _RTEMS_SAPI_COUNTER_H
|
||||||
|
#define _RTEMS_SAPI_COUNTER_H
|
||||||
|
|
||||||
|
#include <rtems/score/cpu.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup ClassicCounter Free-Running Counter and Busy Wait Delay
|
||||||
|
*
|
||||||
|
* @ingroup ClassicRTEMS
|
||||||
|
*
|
||||||
|
* @brief Free-running counter and busy wait delay functions.
|
||||||
|
*
|
||||||
|
* The RTEMS counter is some free-running counter. It ticks usually with a
|
||||||
|
* frequency close to the CPU or system bus clock.
|
||||||
|
*
|
||||||
|
* The counter can be used in case the overhead of the
|
||||||
|
* rtems_clock_get_uptime_nanoseconds() is too high. The step from counter
|
||||||
|
* ticks to/from nanoseconds is explicit in this API unlike to
|
||||||
|
* rtems_clock_get_uptime_nanoseconds() which performs the conversion on each
|
||||||
|
* invocation.
|
||||||
|
*
|
||||||
|
* This counter works without a clock driver and during system initialization.
|
||||||
|
*
|
||||||
|
* The counter can be used to profile low-level operations like SMP locks or
|
||||||
|
* interrupt disabled critical sections. The counter can act also as an
|
||||||
|
* entropy source for a random number generator.
|
||||||
|
*
|
||||||
|
* The period of the counter depends on the actual hardware.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Unsigned integer type for counter values.
|
||||||
|
*/
|
||||||
|
typedef CPU_Counter_ticks rtems_counter_ticks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reads the current counter values.
|
||||||
|
*
|
||||||
|
* @return The current counter values.
|
||||||
|
*/
|
||||||
|
static inline rtems_counter_ticks rtems_counter_read( void )
|
||||||
|
{
|
||||||
|
return _CPU_Counter_read();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the difference between the second and first CPU counter
|
||||||
|
* value.
|
||||||
|
*
|
||||||
|
* This operation may be carried out as a modulo operation depending on the
|
||||||
|
* range of the CPU counter device.
|
||||||
|
*
|
||||||
|
* @param[in] second The second CPU counter value.
|
||||||
|
* @param[in] first The first CPU counter value.
|
||||||
|
*
|
||||||
|
* @return Returns second minus first modulo counter period.
|
||||||
|
*/
|
||||||
|
static inline rtems_counter_ticks rtems_counter_difference(
|
||||||
|
rtems_counter_ticks second,
|
||||||
|
rtems_counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return _CPU_Counter_difference( second, first );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* brief Converts counter ticks into nanoseconds.
|
||||||
|
*
|
||||||
|
* @param[in] ticks Some counter ticks.
|
||||||
|
*
|
||||||
|
* @return The nanoseconds corresponding to the counter ticks. The value is
|
||||||
|
* rounded up.
|
||||||
|
*/
|
||||||
|
uint64_t rtems_counter_ticks_to_nanoseconds(
|
||||||
|
rtems_counter_ticks ticks
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* brief Converts nanoseconds into counter ticks.
|
||||||
|
*
|
||||||
|
* @param[in] nanoseconds Some nanoseconds.
|
||||||
|
*
|
||||||
|
* @return The counter ticks corresponding to the nanoseconds. The value is
|
||||||
|
* rounded up.
|
||||||
|
*/
|
||||||
|
rtems_counter_ticks rtems_counter_nanoseconds_to_ticks(
|
||||||
|
uint32_t nanoseconds
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* brief Initializes the counter ticks to/from nanoseconds converter functions.
|
||||||
|
*
|
||||||
|
* This function must be used to initialize the
|
||||||
|
* rtems_counter_ticks_to_nanoseconds() and
|
||||||
|
* rtems_counter_nanoseconds_to_ticks() functions. It should be called during
|
||||||
|
* system initialization by the board support package.
|
||||||
|
*
|
||||||
|
* @param[in] uint32_t frequency The current counter frequency in Hz.
|
||||||
|
*/
|
||||||
|
void rtems_counter_initialize_converter( uint32_t frequency );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Busy wait for some counter ticks.
|
||||||
|
*
|
||||||
|
* This function does not disable interrupts. Thus task switches and
|
||||||
|
* interrupts can interfere with this busy wait may prolong the delay. This
|
||||||
|
* function busy waits at least the specified time. Due to some overhead the
|
||||||
|
* actual delay may be longer.
|
||||||
|
*
|
||||||
|
* @param[in] ticks The minimum busy wait time in counter ticks.
|
||||||
|
*/
|
||||||
|
void rtems_counter_delay_ticks( rtems_counter_ticks ticks );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Busy wait for some nanoseconds.
|
||||||
|
*
|
||||||
|
* This function does not disable interrupts. Thus task switches and
|
||||||
|
* interrupts can interfere with this busy wait may prolong the delay. This
|
||||||
|
* function busy waits at least the specified time. Due to some overhead the
|
||||||
|
* actual delay may be longer.
|
||||||
|
*
|
||||||
|
* @param[in] nanoseconds The minimum busy wait time in nanoseconds.
|
||||||
|
*/
|
||||||
|
void rtems_counter_delay_nanoseconds( uint32_t nanoseconds );
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* _RTEMS_SAPI_COUNTER_H */
|
||||||
@@ -40,6 +40,10 @@ $(PROJECT_INCLUDE)/rtems/config.h: include/rtems/config.h $(PROJECT_INCLUDE)/rte
|
|||||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/config.h
|
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/config.h
|
||||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/config.h
|
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/config.h
|
||||||
|
|
||||||
|
$(PROJECT_INCLUDE)/rtems/counter.h: include/rtems/counter.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
|
||||||
|
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/counter.h
|
||||||
|
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/counter.h
|
||||||
|
|
||||||
$(PROJECT_INCLUDE)/rtems/extension.h: include/rtems/extension.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
|
$(PROJECT_INCLUDE)/rtems/extension.h: include/rtems/extension.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
|
||||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/extension.h
|
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/extension.h
|
||||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/extension.h
|
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/extension.h
|
||||||
|
|||||||
39
cpukit/sapi/src/cpucounterconverter.c
Normal file
39
cpukit/sapi/src/cpucounterconverter.c
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 embedded brains GmbH. All rights reserved.
|
||||||
|
*
|
||||||
|
* embedded brains GmbH
|
||||||
|
* Dornierstr. 4
|
||||||
|
* 82178 Puchheim
|
||||||
|
* Germany
|
||||||
|
* <rtems@embedded-brains.de>
|
||||||
|
*
|
||||||
|
* 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 <rtems/counter.h>
|
||||||
|
|
||||||
|
RTEMS_STATIC_ASSERT(sizeof(rtems_counter_ticks) <= sizeof(uint32_t), type);
|
||||||
|
|
||||||
|
static uint64_t to_ns_scaler = UINT64_C(1) << 32;
|
||||||
|
|
||||||
|
static uint64_t from_ns_scaler = UINT64_C(1) << 32;
|
||||||
|
|
||||||
|
uint64_t rtems_counter_ticks_to_nanoseconds( rtems_counter_ticks counter )
|
||||||
|
{
|
||||||
|
return (uint32_t) ((counter * to_ns_scaler) >> 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
rtems_counter_ticks rtems_counter_nanoseconds_to_ticks( uint32_t nanoseconds )
|
||||||
|
{
|
||||||
|
return (rtems_counter_ticks) ((nanoseconds * from_ns_scaler) >> 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rtems_counter_initialize_converter( uint32_t frequency )
|
||||||
|
{
|
||||||
|
uint64_t ns_per_s = UINT64_C(1000000000);
|
||||||
|
|
||||||
|
to_ns_scaler = ((ns_per_s << 32) + frequency - 1) / frequency;
|
||||||
|
from_ns_scaler = ((UINT64_C(1) << 32) * frequency + ns_per_s - 1) / ns_per_s;
|
||||||
|
}
|
||||||
27
cpukit/sapi/src/delaynano.c
Normal file
27
cpukit/sapi/src/delaynano.c
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 embedded brains GmbH. All rights reserved.
|
||||||
|
*
|
||||||
|
* embedded brains GmbH
|
||||||
|
* Dornierstr. 4
|
||||||
|
* 82178 Puchheim
|
||||||
|
* Germany
|
||||||
|
* <rtems@embedded-brains.de>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
|
void rtems_counter_delay_nanoseconds( uint32_t nanoseconds )
|
||||||
|
{
|
||||||
|
rtems_counter_ticks ticks =
|
||||||
|
rtems_counter_nanoseconds_to_ticks( nanoseconds );
|
||||||
|
|
||||||
|
rtems_counter_delay_ticks( ticks );
|
||||||
|
}
|
||||||
35
cpukit/sapi/src/delayticks.c
Normal file
35
cpukit/sapi/src/delayticks.c
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 embedded brains GmbH. All rights reserved.
|
||||||
|
*
|
||||||
|
* embedded brains GmbH
|
||||||
|
* Dornierstr. 4
|
||||||
|
* 82178 Puchheim
|
||||||
|
* Germany
|
||||||
|
* <rtems@embedded-brains.de>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
|
void rtems_counter_delay_ticks( rtems_counter_ticks ticks )
|
||||||
|
{
|
||||||
|
rtems_counter_ticks a = rtems_counter_read();
|
||||||
|
rtems_counter_ticks delta = 0;
|
||||||
|
|
||||||
|
do {
|
||||||
|
rtems_counter_ticks b;
|
||||||
|
|
||||||
|
ticks -= delta;
|
||||||
|
|
||||||
|
b = rtems_counter_read();
|
||||||
|
delta = rtems_counter_difference( b, a );
|
||||||
|
a = b;
|
||||||
|
} while ( ticks > delta );
|
||||||
|
}
|
||||||
@@ -555,6 +555,15 @@ static inline uint16_t CPU_swap_u16( uint16_t value )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
);
|
||||||
|
|
||||||
#if CPU_PROVIDES_IDLE_THREAD_BODY == TRUE
|
#if CPU_PROVIDES_IDLE_THREAD_BODY == TRUE
|
||||||
void *_CPU_Thread_Idle_body( uintptr_t ignored );
|
void *_CPU_Thread_Idle_body( uintptr_t ignored );
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ include_rtems_avr_HEADERS += avr/wdt.h
|
|||||||
|
|
||||||
noinst_LIBRARIES = libscorecpu.a
|
noinst_LIBRARIES = libscorecpu.a
|
||||||
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
|
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
|
||||||
|
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
|
||||||
libscorecpu_a_SOURCES += avr-exception-frame-print.c
|
libscorecpu_a_SOURCES += avr-exception-frame-print.c
|
||||||
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
|
|
||||||
|
|||||||
@@ -1180,6 +1180,18 @@ static inline uint32_t CPU_swap_u32(
|
|||||||
#define CPU_swap_u16( value ) \
|
#define CPU_swap_u16( value ) \
|
||||||
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* ASM */
|
#endif /* ASM */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ include_rtems_score_HEADERS += rtems/score/cpuatomic.h
|
|||||||
|
|
||||||
noinst_LIBRARIES = libscorecpu.a
|
noinst_LIBRARIES = libscorecpu.a
|
||||||
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
|
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
|
||||||
|
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
|
||||||
libscorecpu_a_SOURCES += bfin-exception-frame-print.c
|
libscorecpu_a_SOURCES += bfin-exception-frame-print.c
|
||||||
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
|
|
||||||
|
|||||||
@@ -1280,6 +1280,18 @@ static inline uint32_t CPU_swap_u32(
|
|||||||
#define CPU_swap_u16( value ) \
|
#define CPU_swap_u16( value ) \
|
||||||
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* ASM */
|
#endif /* ASM */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ include_rtems_score_HEADERS += rtems/score/cpuatomic.h
|
|||||||
|
|
||||||
noinst_LIBRARIES = libscorecpu.a
|
noinst_LIBRARIES = libscorecpu.a
|
||||||
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
|
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
|
||||||
|
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
|
||||||
libscorecpu_a_SOURCES += h8300-exception-frame-print.c
|
libscorecpu_a_SOURCES += h8300-exception-frame-print.c
|
||||||
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
|
|
||||||
|
|||||||
@@ -1162,6 +1162,18 @@ static inline uint32_t CPU_swap_u32(
|
|||||||
#define CPU_swap_u16( value ) \
|
#define CPU_swap_u16( value ) \
|
||||||
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
/* to be provided by the BSP */
|
/* to be provided by the BSP */
|
||||||
extern void H8BD_Install_IRQ(
|
extern void H8BD_Install_IRQ(
|
||||||
uint32_t vector,
|
uint32_t vector,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ include_rtems_score_HEADERS += rtems/score/cpusmplock.h
|
|||||||
|
|
||||||
noinst_LIBRARIES = libscorecpu.a
|
noinst_LIBRARIES = libscorecpu.a
|
||||||
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
|
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
|
||||||
|
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
|
||||||
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
|
|
||||||
include $(srcdir)/preinstall.am
|
include $(srcdir)/preinstall.am
|
||||||
|
|||||||
@@ -694,6 +694,18 @@ static inline void _CPU_Context_validate( uintptr_t pattern )
|
|||||||
|
|
||||||
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
|
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* ASM */
|
#endif /* ASM */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ include_rtems_score_HEADERS += rtems/score/cpuatomic.h
|
|||||||
|
|
||||||
noinst_LIBRARIES = libscorecpu.a
|
noinst_LIBRARIES = libscorecpu.a
|
||||||
libscorecpu_a_SOURCES = cpu.c cpu_asm.S irq.c
|
libscorecpu_a_SOURCES = cpu.c cpu_asm.S irq.c
|
||||||
|
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
|
||||||
libscorecpu_a_SOURCES += lm32-exception-frame-print.c
|
libscorecpu_a_SOURCES += lm32-exception-frame-print.c
|
||||||
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
|
|
||||||
|
|||||||
@@ -1282,6 +1282,18 @@ static inline uint16_t CPU_swap_u16(uint16_t v)
|
|||||||
return v << 8 | v >> 8;
|
return v << 8 | v >> 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ include_rtems_score_HEADERS += rtems/score/cpuatomic.h
|
|||||||
noinst_LIBRARIES = libscorecpu.a
|
noinst_LIBRARIES = libscorecpu.a
|
||||||
libscorecpu_a_SOURCES = cpu.c cpu_asm.c context_switch.S context_init.c \
|
libscorecpu_a_SOURCES = cpu.c cpu_asm.c context_switch.S context_init.c \
|
||||||
varvects.S
|
varvects.S
|
||||||
|
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
|
||||||
libscorecpu_a_SOURCES += m32c-exception-frame-print.c
|
libscorecpu_a_SOURCES += m32c-exception-frame-print.c
|
||||||
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
|
|
||||||
|
|||||||
@@ -1233,6 +1233,18 @@ static inline uint32_t CPU_swap_u32(
|
|||||||
#define CPU_swap_u16( value ) \
|
#define CPU_swap_u16( value ) \
|
||||||
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ include_rtems_score_HEADERS += rtems/score/cpuatomic.h
|
|||||||
|
|
||||||
noinst_LIBRARIES = libscorecpu.a
|
noinst_LIBRARIES = libscorecpu.a
|
||||||
libscorecpu_a_SOURCES = cpu.c cpu_asm.c context_switch.S context_init.c
|
libscorecpu_a_SOURCES = cpu.c cpu_asm.c context_switch.S context_init.c
|
||||||
|
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
|
||||||
libscorecpu_a_SOURCES += m32r-exception-frame-print.c
|
libscorecpu_a_SOURCES += m32r-exception-frame-print.c
|
||||||
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
|
|
||||||
|
|||||||
@@ -1274,6 +1274,18 @@ static inline uint32_t CPU_swap_u32(
|
|||||||
#define CPU_swap_u16( value ) \
|
#define CPU_swap_u16( value ) \
|
||||||
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ include_rtems_score_HEADERS += rtems/score/types.h
|
|||||||
include_rtems_score_HEADERS += rtems/score/cpuatomic.h
|
include_rtems_score_HEADERS += rtems/score/cpuatomic.h
|
||||||
|
|
||||||
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
|
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
|
||||||
|
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
|
||||||
libscorecpu_a_SOURCES += m68k-exception-frame-print.c
|
libscorecpu_a_SOURCES += m68k-exception-frame-print.c
|
||||||
libscorecpu_a_SOURCES += __m68k_read_tp.c
|
libscorecpu_a_SOURCES += __m68k_read_tp.c
|
||||||
|
|
||||||
|
|||||||
@@ -723,6 +723,18 @@ void _CPU_Exception_frame_print(
|
|||||||
const CPU_Exception_frame *frame
|
const CPU_Exception_frame *frame
|
||||||
);
|
);
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
#if (M68K_HAS_FPSP_PACKAGE == 1)
|
#if (M68K_HAS_FPSP_PACKAGE == 1)
|
||||||
/*
|
/*
|
||||||
* Hooks for the Floating Point Support Package (FPSP) provided by Motorola
|
* Hooks for the Floating Point Support Package (FPSP) provided by Motorola
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ include_rtems_score_HEADERS += rtems/score/cpuatomic.h
|
|||||||
|
|
||||||
noinst_LIBRARIES = libscorecpu.a
|
noinst_LIBRARIES = libscorecpu.a
|
||||||
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
|
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
|
||||||
|
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
|
||||||
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
|
|
||||||
include $(srcdir)/preinstall.am
|
include $(srcdir)/preinstall.am
|
||||||
|
|||||||
@@ -1193,6 +1193,17 @@ static inline uint32_t CPU_swap_u32(
|
|||||||
#define CPU_swap_u16( value ) \
|
#define CPU_swap_u16( value ) \
|
||||||
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ include_rtems_score_HEADERS += rtems/score/cpuatomic.h
|
|||||||
|
|
||||||
noinst_LIBRARIES = libscorecpu.a
|
noinst_LIBRARIES = libscorecpu.a
|
||||||
libscorecpu_a_SOURCES = cpu.c moxie-exception-frame-print.c cpu_asm.S
|
libscorecpu_a_SOURCES = cpu.c moxie-exception-frame-print.c cpu_asm.S
|
||||||
|
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
|
||||||
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
|
|
||||||
include $(srcdir)/preinstall.am
|
include $(srcdir)/preinstall.am
|
||||||
|
|||||||
@@ -1049,6 +1049,18 @@ static inline uint32_t CPU_swap_u32(
|
|||||||
#define CPU_swap_u16( value ) \
|
#define CPU_swap_u16( value ) \
|
||||||
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ include_rtems_score_HEADERS += rtems/score/cpuatomic.h
|
|||||||
noinst_LIBRARIES = libscorecpu.a
|
noinst_LIBRARIES = libscorecpu.a
|
||||||
|
|
||||||
libscorecpu_a_SOURCES =
|
libscorecpu_a_SOURCES =
|
||||||
|
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
|
||||||
libscorecpu_a_SOURCES += nios2-context-initialize.c
|
libscorecpu_a_SOURCES += nios2-context-initialize.c
|
||||||
libscorecpu_a_SOURCES += nios2-context-switch.S
|
libscorecpu_a_SOURCES += nios2-context-switch.S
|
||||||
libscorecpu_a_SOURCES += nios2-context-validate.S
|
libscorecpu_a_SOURCES += nios2-context-validate.S
|
||||||
|
|||||||
@@ -364,6 +364,18 @@ static inline uint32_t CPU_swap_u32( uint32_t value )
|
|||||||
#define CPU_swap_u16( value ) \
|
#define CPU_swap_u16( value ) \
|
||||||
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* ASM */
|
#endif /* ASM */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ include_rtems_score_HEADERS += rtems/score/cpusmplock.h
|
|||||||
|
|
||||||
noinst_LIBRARIES = libscorecpu.a
|
noinst_LIBRARIES = libscorecpu.a
|
||||||
libscorecpu_a_SOURCES = cpu.c cpu_asm.c
|
libscorecpu_a_SOURCES = cpu.c cpu_asm.c
|
||||||
|
libscorecpu_a_SOURCES += cpucounterread.c
|
||||||
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
|
|
||||||
include $(srcdir)/preinstall.am
|
include $(srcdir)/preinstall.am
|
||||||
|
|||||||
27
cpukit/score/cpu/no_cpu/cpucounterread.c
Normal file
27
cpukit/score/cpu/no_cpu/cpucounterread.c
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 embedded brains GmbH. All rights reserved.
|
||||||
|
*
|
||||||
|
* embedded brains GmbH
|
||||||
|
* Dornierstr. 4
|
||||||
|
* 82178 Puchheim
|
||||||
|
* Germany
|
||||||
|
* <rtems@embedded-brains.de>
|
||||||
|
*
|
||||||
|
* 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 <rtems/score/cpu.h>
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void )
|
||||||
|
{
|
||||||
|
static CPU_Counter_ticks counter;
|
||||||
|
|
||||||
|
CPU_Counter_ticks snapshot;
|
||||||
|
|
||||||
|
snapshot = counter;
|
||||||
|
counter = snapshot + 1;
|
||||||
|
|
||||||
|
return snapshot;
|
||||||
|
}
|
||||||
@@ -1426,6 +1426,40 @@ static inline uint32_t CPU_swap_u32(
|
|||||||
#define CPU_swap_u16( value ) \
|
#define CPU_swap_u16( value ) \
|
||||||
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Unsigned integer type for CPU counter values.
|
||||||
|
*/
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the current CPU counter value.
|
||||||
|
*
|
||||||
|
* A CPU counter is some free-running counter. It ticks usually with a
|
||||||
|
* frequency close to the CPU or system bus clock. The board support package
|
||||||
|
* must ensure that this function works before the RTEMS initialization.
|
||||||
|
* Otherwise invalid profiling statistics will be gathered.
|
||||||
|
*
|
||||||
|
* @return The current CPU counter value.
|
||||||
|
*/
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the difference between the second and first CPU counter
|
||||||
|
* value.
|
||||||
|
*
|
||||||
|
* This operation may be carried out as a modulo operation depending on the
|
||||||
|
* range of the CPU counter device.
|
||||||
|
*
|
||||||
|
* @param[in] second The second CPU counter value.
|
||||||
|
* @param[in] first The first CPU counter value.
|
||||||
|
*
|
||||||
|
* @return Returns second minus first modulo counter period.
|
||||||
|
*/
|
||||||
|
CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
);
|
||||||
|
|
||||||
#ifdef RTEMS_SMP
|
#ifdef RTEMS_SMP
|
||||||
/**
|
/**
|
||||||
* @brief Returns the index of the current processor.
|
* @brief Returns the index of the current processor.
|
||||||
|
|||||||
@@ -769,6 +769,30 @@ static inline uint32_t CPU_swap_u32(
|
|||||||
#define CPU_swap_u16( value ) \
|
#define CPU_swap_u16( value ) \
|
||||||
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_read( void )
|
||||||
|
{
|
||||||
|
CPU_Counter_ticks value;
|
||||||
|
|
||||||
|
#ifdef ppc8540
|
||||||
|
/* Book E has no mftb */
|
||||||
|
__asm__ volatile( "mfspr %0, 268" : "=r" (value) );
|
||||||
|
#else
|
||||||
|
__asm__ volatile( "mftb %0" : "=r" (value) );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* ASM */
|
#endif /* ASM */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ include_rtems_score_HEADERS += rtems/score/cpuatomic.h
|
|||||||
|
|
||||||
noinst_LIBRARIES = libscorecpu.a
|
noinst_LIBRARIES = libscorecpu.a
|
||||||
libscorecpu_a_SOURCES = cpu.c context.c
|
libscorecpu_a_SOURCES = cpu.c context.c
|
||||||
|
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
|
||||||
libscorecpu_a_SOURCES += sh-exception-frame-print.c
|
libscorecpu_a_SOURCES += sh-exception-frame-print.c
|
||||||
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
|
|
||||||
|
|||||||
@@ -910,6 +910,18 @@ typedef CPU_Interrupt_frame CPU_Exception_frame;
|
|||||||
|
|
||||||
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
|
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1269,6 +1269,18 @@ static inline uint32_t CPU_swap_u32(
|
|||||||
#define CPU_swap_u16( value ) \
|
#define CPU_swap_u16( value ) \
|
||||||
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* ASM */
|
#endif /* ASM */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ include_rtems_score_HEADERS += rtems/score/cpuatomic.h
|
|||||||
|
|
||||||
noinst_LIBRARIES = libscorecpu.a
|
noinst_LIBRARIES = libscorecpu.a
|
||||||
libscorecpu_a_SOURCES = context.S cpu.c
|
libscorecpu_a_SOURCES = context.S cpu.c
|
||||||
|
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
|
||||||
libscorecpu_a_SOURCES += sparc64-exception-frame-print.c
|
libscorecpu_a_SOURCES += sparc64-exception-frame-print.c
|
||||||
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
|
|
||||||
|
|||||||
@@ -1089,6 +1089,18 @@ static inline uint32_t CPU_swap_u32(
|
|||||||
#define CPU_swap_u16( value ) \
|
#define CPU_swap_u16( value ) \
|
||||||
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
(((value&0xff) << 8) | ((value >> 8)&0xff))
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* ASM */
|
#endif /* ASM */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ include_rtems_score_HEADERS += rtems/score/cpuatomic.h
|
|||||||
noinst_LIBRARIES = libscorecpu.a
|
noinst_LIBRARIES = libscorecpu.a
|
||||||
libscorecpu_a_SOURCES = cpu.c
|
libscorecpu_a_SOURCES = cpu.c
|
||||||
libscorecpu_a_SOURCES += cpu_asm.S
|
libscorecpu_a_SOURCES += cpu_asm.S
|
||||||
|
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
|
||||||
libscorecpu_a_SOURCES += v850-exception-frame-print.c
|
libscorecpu_a_SOURCES += v850-exception-frame-print.c
|
||||||
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
|
|
||||||
|
|||||||
@@ -1233,6 +1233,18 @@ static inline uint16_t CPU_swap_u16( uint16_t value )
|
|||||||
return swapped;
|
return swapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef uint32_t CPU_Counter_ticks;
|
||||||
|
|
||||||
|
CPU_Counter_ticks _CPU_Counter_read( void );
|
||||||
|
|
||||||
|
static inline CPU_Counter_ticks _CPU_Counter_difference(
|
||||||
|
CPU_Counter_ticks second,
|
||||||
|
CPU_Counter_ticks first
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return second - first;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -341,6 +341,27 @@ _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
|
|||||||
_TLS_Alignment = ALIGNOF (.tdata);
|
_TLS_Alignment = ALIGNOF (.tdata);
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
@section CPU counter
|
||||||
|
|
||||||
|
The CPU support must implement the CPU counter interface. A CPU counter is
|
||||||
|
some free-running counter. It ticks usually with a frequency close to the CPU
|
||||||
|
or system bus clock. On some architectures the actual implementation is board
|
||||||
|
support package dependent. The CPU counter is used for profiling of low-level
|
||||||
|
functions. It is also used to implement two busy wait functions
|
||||||
|
@code{rtems_counter_delay_ticks()} and @code{rtems_counter_delay_nanoseconds()}
|
||||||
|
which may be used in device drivers. It may be also used as an entropy source
|
||||||
|
for random number generators.
|
||||||
|
|
||||||
|
The CPU counter interface uses a CPU port specific unsigned integer type
|
||||||
|
@code{CPU_Counter_ticks} to represent CPU counter values. The CPU port must
|
||||||
|
provide the following two functions
|
||||||
|
|
||||||
|
@itemize
|
||||||
|
@item @code{_CPU_Counter_read()} to read the current CPU counter value, and
|
||||||
|
@item @code{_CPU_Counter_difference()} to get the difference between two CPU
|
||||||
|
counter values.
|
||||||
|
@end itemize
|
||||||
|
|
||||||
@c
|
@c
|
||||||
@c
|
@c
|
||||||
@c
|
@c
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ SUBDIRS = \
|
|||||||
spsimplesched03 spnsext01 spedfsched01 spedfsched02 spedfsched03 \
|
spsimplesched03 spnsext01 spedfsched01 spedfsched02 spedfsched03 \
|
||||||
spcbssched01 spcbssched02 spcbssched03 spqreslib sptimespec01 \
|
spcbssched01 spcbssched02 spcbssched03 spqreslib sptimespec01 \
|
||||||
spregion_err01 sppartition_err01
|
spregion_err01 sppartition_err01
|
||||||
|
SUBDIRS += spcpucounter01
|
||||||
if HAS_CPLUSPLUS
|
if HAS_CPLUSPLUS
|
||||||
SUBDIRS += sptls02
|
SUBDIRS += sptls02
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ AM_CONDITIONAL(HAS_CPUSET,test x"${ac_cv_header_sys_cpuset_h}" = x"yes")
|
|||||||
|
|
||||||
# Explicitly list all Makefiles here
|
# Explicitly list all Makefiles here
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
|
spcpucounter01/Makefile
|
||||||
sptls02/Makefile
|
sptls02/Makefile
|
||||||
sptls01/Makefile
|
sptls01/Makefile
|
||||||
spintrcritical20/Makefile
|
spintrcritical20/Makefile
|
||||||
|
|||||||
19
testsuites/sptests/spcpucounter01/Makefile.am
Normal file
19
testsuites/sptests/spcpucounter01/Makefile.am
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
rtems_tests_PROGRAMS = spcpucounter01
|
||||||
|
spcpucounter01_SOURCES = init.c
|
||||||
|
|
||||||
|
dist_rtems_tests_DATA = spcpucounter01.scn spcpucounter01.doc
|
||||||
|
|
||||||
|
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||||
|
include $(top_srcdir)/../automake/compile.am
|
||||||
|
include $(top_srcdir)/../automake/leaf.am
|
||||||
|
|
||||||
|
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
|
||||||
|
|
||||||
|
LINK_OBJS = $(spcpucounter01_OBJECTS)
|
||||||
|
LINK_LIBS = $(spcpucounter01_LDLIBS)
|
||||||
|
|
||||||
|
spcpucounter01$(EXEEXT): $(spcpucounter01_OBJECTS) $(spcpucounter01_DEPENDENCIES)
|
||||||
|
@rm -f spcpucounter01$(EXEEXT)
|
||||||
|
$(make-exe)
|
||||||
|
|
||||||
|
include $(top_srcdir)/../automake/local.am
|
||||||
112
testsuites/sptests/spcpucounter01/init.c
Normal file
112
testsuites/sptests/spcpucounter01/init.c
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 embedded brains GmbH. All rights reserved.
|
||||||
|
*
|
||||||
|
* embedded brains GmbH
|
||||||
|
* Dornierstr. 4
|
||||||
|
* 82178 Puchheim
|
||||||
|
* Germany
|
||||||
|
* <rtems@embedded-brains.de>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#include <rtems.h>
|
||||||
|
#include <rtems/counter.h>
|
||||||
|
|
||||||
|
#define TESTS_USE_PRINTF
|
||||||
|
#include "tmacros.h"
|
||||||
|
|
||||||
|
#define NS_PER_TICK 1000000
|
||||||
|
|
||||||
|
static rtems_interval sync_with_clock_tick(void)
|
||||||
|
{
|
||||||
|
rtems_interval start = rtems_clock_get_ticks_since_boot();
|
||||||
|
rtems_interval current;
|
||||||
|
|
||||||
|
do {
|
||||||
|
current = rtems_clock_get_ticks_since_boot();
|
||||||
|
} while (current == start);
|
||||||
|
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_converter(void)
|
||||||
|
{
|
||||||
|
CPU_Counter_ticks frequency = rtems_counter_nanoseconds_to_ticks(1000000000);
|
||||||
|
uint64_t ns = rtems_counter_ticks_to_nanoseconds(frequency);
|
||||||
|
|
||||||
|
printf("CPU counter frequency: %" PRIu32 "Hz\n", frequency);
|
||||||
|
printf("nanoseconds for frequency count ticks: %" PRIu64 "\n", ns);
|
||||||
|
|
||||||
|
rtems_test_assert(ns == 1000000000);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_delay_nanoseconds(void)
|
||||||
|
{
|
||||||
|
rtems_counter_ticks start;
|
||||||
|
rtems_counter_ticks end;
|
||||||
|
rtems_counter_ticks delta;
|
||||||
|
double ns_per_tick = NS_PER_TICK;
|
||||||
|
double ns_delta;
|
||||||
|
rtems_interval tick;
|
||||||
|
int n = 10;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
printf("test delay nanoseconds (%i times)\n", n);
|
||||||
|
|
||||||
|
for (i = 0; i < n; ++i) {
|
||||||
|
tick = sync_with_clock_tick();
|
||||||
|
|
||||||
|
start = rtems_counter_read();
|
||||||
|
rtems_counter_delay_nanoseconds(NS_PER_TICK);
|
||||||
|
end = rtems_counter_read();
|
||||||
|
|
||||||
|
rtems_test_assert(tick < rtems_clock_get_ticks_since_boot());
|
||||||
|
|
||||||
|
delta = rtems_counter_difference(end, start);
|
||||||
|
ns_delta = rtems_counter_ticks_to_nanoseconds(delta);
|
||||||
|
|
||||||
|
rtems_test_assert(ns_delta >= ns_per_tick);
|
||||||
|
|
||||||
|
printf(
|
||||||
|
"busy wait relative to clock tick: %f\n",
|
||||||
|
(ns_delta - ns_per_tick) / ns_per_tick
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Init(rtems_task_argument arg)
|
||||||
|
{
|
||||||
|
puts("\n\n*** TEST SPCPUCOUNTER 1 ***");
|
||||||
|
|
||||||
|
test_converter();
|
||||||
|
test_delay_nanoseconds();
|
||||||
|
|
||||||
|
puts("*** END OF TEST SPCPUCOUNTER 1 ***");
|
||||||
|
|
||||||
|
rtems_test_exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
||||||
|
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
|
||||||
|
|
||||||
|
#define CONFIGURE_MICROSECONDS_PER_TICK (NS_PER_TICK / 1000)
|
||||||
|
|
||||||
|
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||||
|
|
||||||
|
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
|
||||||
|
|
||||||
|
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||||
|
|
||||||
|
#define CONFIGURE_INIT
|
||||||
|
|
||||||
|
#include <rtems/confdefs.h>
|
||||||
16
testsuites/sptests/spcpucounter01/spcpucounter01.doc
Normal file
16
testsuites/sptests/spcpucounter01/spcpucounter01.doc
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
This file describes the directives and concepts tested by this test set.
|
||||||
|
|
||||||
|
test set name: spcpucounter01
|
||||||
|
|
||||||
|
directives:
|
||||||
|
|
||||||
|
- rtems_counter_read()
|
||||||
|
- rtems_counter_difference()
|
||||||
|
- rtems_counter_ticks_to_nanoseconds()
|
||||||
|
- rtems_counter_nanoseconds_to_ticks()
|
||||||
|
|
||||||
|
concepts:
|
||||||
|
|
||||||
|
- Ensure that the CPU counter converter functions produce consistent values.
|
||||||
|
- Ensure that the busy wait functions are consistent with the clock tick
|
||||||
|
durations.
|
||||||
15
testsuites/sptests/spcpucounter01/spcpucounter01.scn
Normal file
15
testsuites/sptests/spcpucounter01/spcpucounter01.scn
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
*** TEST SPCPUCOUNTER 1 ***
|
||||||
|
CPU counter frequency: 25000000Hz
|
||||||
|
nanoseconds for frequency count ticks: 1000000000
|
||||||
|
test delay nanoseconds (10 times)
|
||||||
|
busy wait relative to clock tick: 0.001320
|
||||||
|
busy wait relative to clock tick: 0.001640
|
||||||
|
busy wait relative to clock tick: 0.001320
|
||||||
|
busy wait relative to clock tick: 0.001160
|
||||||
|
busy wait relative to clock tick: 0.001280
|
||||||
|
busy wait relative to clock tick: 0.001240
|
||||||
|
busy wait relative to clock tick: 0.001280
|
||||||
|
busy wait relative to clock tick: 0.001280
|
||||||
|
busy wait relative to clock tick: 0.001320
|
||||||
|
busy wait relative to clock tick: 0.001280
|
||||||
|
*** END OF TEST SPCPUCOUNTER 1 ***
|
||||||
Reference in New Issue
Block a user