From 5c980d0f993bcb2b59ba4faf25cf9d887faf83f3 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 5 Sep 2008 14:48:37 +0000 Subject: 2008-09-05 Joel Sherrill * libchip/Makefile.am, libchip/shmdr/init.c, libchip/shmdr/mpisr.c, libchip/shmdr/poll.c, libchip/shmdr/shm_driver.h: Update shared memory driver to not use the clock ioctl to install a method to poll for input. It now uses a Class API Timer which means we can eliminate this special IOCTL from all clock drivers. * libchip/shmdr/setckvec.c: Removed. --- c/src/libchip/shmdr/init.c | 2 +- c/src/libchip/shmdr/mpisr.c | 4 +-- c/src/libchip/shmdr/poll.c | 60 +++++++++++++++++++++------------------- c/src/libchip/shmdr/setckvec.c | 33 ---------------------- c/src/libchip/shmdr/shm_driver.h | 7 ++--- 5 files changed, 37 insertions(+), 69 deletions(-) delete mode 100644 c/src/libchip/shmdr/setckvec.c (limited to 'c/src/libchip/shmdr') diff --git a/c/src/libchip/shmdr/init.c b/c/src/libchip/shmdr/init.c index 270409263d..131ff24257 100644 --- a/c/src/libchip/shmdr/init.c +++ b/c/src/libchip/shmdr/init.c @@ -126,7 +126,7 @@ rtems_mpci_entry Shm_Initialization( void ) interrupt_value = Shm_Convert( Shm_Configuration->Intr.value ); interrupt_cause = Shm_Convert( Shm_Configuration->Intr.length ); - if ( Shm_Configuration->poll_intr == POLLED_MODE ) Shm_setclockvec(); + if ( Shm_Configuration->poll_intr == POLLED_MODE ) Shm_install_timer(); else Shm_setvec(); if ( Shm_Is_master_node() ) { diff --git a/c/src/libchip/shmdr/mpisr.c b/c/src/libchip/shmdr/mpisr.c index 547a518e56..cdeb6626de 100644 --- a/c/src/libchip/shmdr/mpisr.c +++ b/c/src/libchip/shmdr/mpisr.c @@ -13,9 +13,7 @@ #include #include "shm_driver.h" -rtems_isr Shm_isr( - rtems_vector_number vector -) +void Shm_isr(void) { Shm_Interrupt_count += 1; rtems_multiprocessing_announce(); diff --git a/c/src/libchip/shmdr/poll.c b/c/src/libchip/shmdr/poll.c index 411f740fb0..1190a53854 100644 --- a/c/src/libchip/shmdr/poll.c +++ b/c/src/libchip/shmdr/poll.c @@ -1,14 +1,8 @@ -/* void Shm_Poll() - * +/* * This routine polls to see if a packet has arrived. If one - * has it informs the executive. It is typically called from - * the clock tick interrupt service routine. - * - * Input parameters: NONE - * - * Output parameters: NONE + * has it informs the executive. It uses a Classic API Timer * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -22,31 +16,41 @@ #include #include +#include + #include "shm_driver.h" -void Shm_Poll() +rtems_timer_service_routine Shm_Poll_TSR( + rtems_id id, + void *ignored_address +) { - uint32_t tmpfront; - rtems_libio_ioctl_args_t args; - - /* invoke clock isr */ - args.iop = 0; - args.command = rtems_build_name('I', 'S', 'R', ' '); - (void) rtems_io_control(rtems_clock_major, rtems_clock_minor, &args); + uint32_t tmpfront; /* - * Check for msgs only if we are "up" - * This avoids a race condition where we may get a clock - * interrupt before MPCI has completed its init + * This should NEVER happen but just in case. */ + if (!_System_state_Is_up(_System_state_Get())) + return; - if (_System_state_Is_up(_System_state_Get())) - { - tmpfront = Shm_Local_receive_queue->front; - if ( Shm_Convert(tmpfront) != Shm_Locked_queue_End_of_list ) - { - rtems_multiprocessing_announce(); - Shm_Interrupt_count++; - } + tmpfront = Shm_Local_receive_queue->front; + if ( Shm_Convert(tmpfront) != Shm_Locked_queue_End_of_list ) { + rtems_multiprocessing_announce(); + Shm_Interrupt_count++; } + + (void) rtems_timer_reset( id ); } + +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 ); +} + diff --git a/c/src/libchip/shmdr/setckvec.c b/c/src/libchip/shmdr/setckvec.c deleted file mode 100644 index 27343547df..0000000000 --- a/c/src/libchip/shmdr/setckvec.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Shm_setclockvec - * - * This routines installs the shared memory clock interrupt handler - * used when the driver is used in polling mode. - * - * INPUT PARAMETERS: NONE - * - * OUTPUT PARAMETERS: NONE - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - * - * $Id$ - */ - -#include -#include - -#include "shm_driver.h" - -rtems_isr Shm_setclockvec() -{ - rtems_libio_ioctl_args_t args; - args.iop = 0; - args.command = rtems_build_name('N', 'E', 'W', ' '); - args.buffer = (void *) Shm_Poll; - - (void) rtems_io_control(rtems_clock_major, rtems_clock_minor, &args); -} diff --git a/c/src/libchip/shmdr/shm_driver.h b/c/src/libchip/shmdr/shm_driver.h index 5905d7d0d9..695172a0ba 100644 --- a/c/src/libchip/shmdr/shm_driver.h +++ b/c/src/libchip/shmdr/shm_driver.h @@ -404,8 +404,8 @@ typedef struct { * poll_intr - The operational mode of the driver. Some * target boards may not provide hardware for * an interprocessor interrupt. If POLLED_MODE - * is selected, the SHM driver will install a - * wrapper around the Clock_isr() to poll for + * is selected, the SHM driver will use a + * Classiv API Timer instance to poll for * incoming packets. Throughput is dependent * on the time between clock interrupts. * Valid values are POLLED_MODE and INTR_MODE. @@ -482,8 +482,7 @@ void Init_env_pool( void ); void Shm_Print_statistics( void ); void MPCI_Fatal( Internal_errors_Source, boolean, uint32_t); rtems_task Shm_Cause_interrupt( uint32_t ); -void Shm_Poll( void ); -void Shm_setclockvec( void ); +void Shm_install_timer( void ); void Shm_Convert_packet( rtems_packet_prefix * ); /* CPU specific routines are inlined in shmcpu.h */ -- cgit v1.2.3