[PATCH] how to fix shmdr for POLLING? [was: Re: PSIM and MP tests -- anybody got working?]
Karel Gardas
kgardas at objectsecurity.com
Mon Jan 23 23:04:48 UTC 2006
On Mon, 23 Jan 2006, Joel Sherrill wrote:
> I was afraid of this. shmdr has not been used with new execption model
> and assumes it can "wrap" the clock tick driver ISR. It was written before
> the Timer Manager exists. Instead of its clock tick ISR trick, it should
> install
> an RTEMS timer to run once a tick when polled.
If I understand this well, then the code should looks like in diff below,
but the problem is that then Shm_Poll seems to be run too often (just my
idea), since I usually end with consumed amount of instructions/time...
Even if I go with 1000 clicks, it's still the same, but test at least runs
some functionality. I guess my task setup is wrong...
Do you have any idea how to fix this?
Thanks,
Karel
--
Karel Gardas kgardas at objectsecurity.com
ObjectSecurity Ltd. http://www.objectsecurity.com
Index: Makefile.am
===================================================================
RCS file: /usr1/CVS/rtems/c/src/libchip/Makefile.am,v
retrieving revision 1.36
diff -u -r1.36 Makefile.am
--- Makefile.am 12 Jan 2006 10:12:31 -0000 1.36
+++ Makefile.am 23 Jan 2006 22:59:35 -0000
@@ -96,7 +96,7 @@
shmdr_rel_SOURCES = shmdr/addlq.c shmdr/cnvpkt.c shmdr/getlq.c shmdr/dump.c \
shmdr/fatal.c shmdr/getpkt.c shmdr/init.c shmdr/initlq.c shmdr/intr.c \
shmdr/mpisr.c shmdr/poll.c shmdr/receive.c shmdr/retpkt.c shmdr/send.c \
- shmdr/setckvec.c
+ shmdr/poller.c
shmdr_rel_CPPFLAGS = $(AM_CPPFLAGS)
shmdr_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif
Index: shmdr/init.c
===================================================================
RCS file: /usr1/CVS/rtems/c/src/libchip/shmdr/init.c,v
retrieving revision 1.16
diff -u -r1.16 init.c
--- shmdr/init.c 20 Apr 2004 10:43:39 -0000 1.16
+++ shmdr/init.c 23 Jan 2006 22:59:36 -0000
@@ -20,6 +20,7 @@
#define _SHM_INIT
#include <rtems.h>
+#include <rtems/rtems/tasks.h>
#include <shm_driver.h>
#include <string.h> /* memset() */
@@ -126,8 +127,21 @@
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();
- else Shm_setvec();
+ if ( Shm_Configuration->poll_intr == POLLED_MODE ) {
+ rtems_name task_name;
+ rtems_id tid;
+ rtems_status_code status;
+
+ task_name = rtems_build_name( 'P', 'S', 'H', 'M' );
+ status = rtems_task_create( task_name,
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_TIMESLICE | RTEMS_NO_ASR | RTEMS_INTERRUPT_LEVEL(0),
+ RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL,
+ &tid );
+ status = rtems_task_start( tid, Shm_Poller_task, 0 );
+ }
+ else Shm_setvec();
if ( Shm_Is_master_node() ) {
Index: shmdr/poll.c
===================================================================
RCS file: /usr1/CVS/rtems/c/src/libchip/shmdr/poll.c,v
retrieving revision 1.15
diff -u -r1.15 poll.c
--- shmdr/poll.c 20 Apr 2004 10:43:39 -0000 1.15
+++ shmdr/poll.c 23 Jan 2006 22:59:36 -0000
@@ -27,12 +27,6 @@
void Shm_Poll()
{
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);
/*
* Check for msgs only if we are "up"
Index: shmdr/shm_driver.h
===================================================================
RCS file: /usr1/CVS/rtems/c/src/libchip/shmdr/shm_driver.h,v
retrieving revision 1.25
diff -u -r1.25 shm_driver.h
--- shmdr/shm_driver.h 29 Sep 2004 20:36:20 -0000 1.25
+++ shmdr/shm_driver.h 23 Jan 2006 22:59:38 -0000
@@ -479,8 +479,9 @@
void Shm_Print_statistics( void );
void MPCI_Fatal( Internal_errors_Source, boolean, uint32_t);
rtems_task Shm_Cause_interrupt( uint32_t);
+rtems_task Shm_Poller_task( rtems_task_argument unused );
void Shm_Poll();
-void Shm_setclockvec();
+/* void Shm_setclockvec(); */
void Shm_Convert_packet( rtems_packet_prefix * );
/* CPU specific routines are inlined in shmcpu.h */
--- /dev/null 2005-04-30 23:10:27.000000000 +0200
+++ shmdr/poller.c 2006-01-23 23:49:08.000000000 +0100
@@ -0,0 +1,33 @@
+/* Shm_Poller_task
+ *
+ * This routine serves as a Shm_Poller task. It just calls Shm_Poll
+ * every tick.
+ *
+ * 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 <rtems.h>
+#include <rtems/libio.h>
+
+#include "shm_driver.h"
+
+rtems_task Shm_Poller_task(
+ rtems_task_argument unused
+)
+{
+ for ( ; ; ) {
+ rtems_task_wake_after( 1 );
+ Shm_Poll();
+ }
+}
More information about the users
mailing list