From 84aee2e9828e2c4d26d4b3ea5326143a3b153494 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 10 Dec 2019 08:09:13 +0100 Subject: mpci: Simplify MPCI configuration Use watchdog for shared memory driver instead of a Classic API Timer. --- bsps/include/shm_driver.h | 1 + bsps/shared/shmdr/shmdr-poll.c | 43 ++++++++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 18 deletions(-) (limited to 'bsps') diff --git a/bsps/include/shm_driver.h b/bsps/include/shm_driver.h index cb94cec0cb..e357b46e5e 100644 --- a/bsps/include/shm_driver.h +++ b/bsps/include/shm_driver.h @@ -17,6 +17,7 @@ #ifndef __SHM_h #define __SHM_h +#include #include #ifdef __cplusplus diff --git a/bsps/shared/shmdr/shmdr-poll.c b/bsps/shared/shmdr/shmdr-poll.c index 39eab7d352..e61e4ae4d6 100644 --- a/bsps/shared/shmdr/shmdr-poll.c +++ b/bsps/shared/shmdr/shmdr-poll.c @@ -13,18 +13,29 @@ * http://www.rtems.org/license/LICENSE. */ -#include #include -#include - -#include +#include #include "shm_driver.h" -static rtems_timer_service_routine Shm_Poll_TSR( - rtems_id id, - void *ignored_address -) +static void Shm_Poll_Set_timer( Watchdog_Control *the_watchdog ) +{ + Per_CPU_Control *cpu; + ISR_lock_Context lock_context; + + cpu = _Watchdog_Get_CPU( the_watchdog ); + _ISR_lock_ISR_disable( &lock_context ); + _Watchdog_Per_CPU_acquire_critical( cpu, &lock_context ); + _Watchdog_Insert( + &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_TICKS ], + the_watchdog, + cpu->Watchdog.ticks + 1 + ); + _Watchdog_Per_CPU_release_critical( cpu, &lock_context ); + _ISR_lock_ISR_enable( &lock_context ); +} + +static void Shm_Poll_TSR( Watchdog_Control *the_watchdog ) { uint32_t tmpfront; @@ -40,18 +51,14 @@ static rtems_timer_service_routine Shm_Poll_TSR( Shm_Interrupt_count++; } - (void) rtems_timer_reset( id ); + Shm_Poll_Set_timer( the_watchdog ); } +static Watchdog_Control Shm_Poll_Watchdog = WATCHDOG_INITIALIZER( + Shm_Poll_TSR +); + void Shm_install_timer(void) { - rtems_id id; - rtems_status_code status; - - status = rtems_timer_create( rtems_build_name( 'S', 'H', 'P', 'L' ), &id ); - assert( !status ); - - status = rtems_timer_fire_after( id, 1, Shm_Poll_TSR, NULL ); - assert( !status ); + Shm_Poll_Set_timer( &Shm_Poll_Watchdog ); } - -- cgit v1.2.3