Fusion 0.8 / VxWorks skin : problems using rt_intr_wait()

Eddy, Paul paul.eddy at office.xerox.com
Wed Jun 22 00:20:57 CEST 2005


Hello,

I've been trying to get a simple 2-task program running in userspace using
Fusion 0.8 and the VxWorks skin.  At this point, the program does nothing
useful, but is being used for my own purposes of learning how things work.

With the code shown below, I would expect to see the intrHandler task
blocked, waiting for an interrupt (which will never occur, using this code).
While intrHandler is blocked at rt_intr_wait(), the second task,
intGenerator, should be doing xnprintf's every 500 ms.  The code is here:
============

#include <rtai/intr.h>
#include <vxworks/vxworks.h>

static int intrHandler_tid;
static int intrGenerator_tid;
static RT_INTR intr_desc;

void cleanup (int dummy);
void intrHandler (int a0, int a1, int a2, int a3, int a4,
                  int a5, int a6, int a7, int a8, int a9);
void intrGenerator (int a0, int a1, int a2, int a3, int a4,
                    int a5, int a6, int a7, int a8, int a9);

int root_thread_init (void)
{
   int err;

   signal (SIGTERM, cleanup);
   signal (SIGINT, cleanup);
  
   err = rt_intr_create (&intr_desc, 7, I_AUTOENA);

   intrHandler_tid = taskSpawn ("IntrHandler", 99, 0, 8192,
                                (FUNCPTR)&intrHandler,
                                0,0,0,0,0,0,0,0,0,0);

   intrGenerator_tid = taskSpawn ("IntrGenerator", 50, 0, 8192,
                                  (FUNCPTR)&intrGenerator,
                                  0,0,0,0,0,0,0,0,0,0);

   rt_intr_enable(&intr_desc);
   return 0;
}

void root_thread_exit (void)
{
   xnprintf ("root_thread_exit\n");
   rt_intr_disable(&intr_desc);
   rt_intr_delete(&intr_desc);
   taskDelete(intrHandler_tid);
   taskDelete(intrGenerator_tid);
   exit(0);
}

void cleanup (int dummy)
{
   root_thread_exit();
}

void intrHandler (int a0, int a1, int a2, int a3, int a4,
                  int a5, int a6, int a7, int a8, int a9)
{
   xnprintf ("Start intrHandler task\n");
   
   while (1)
   {
      int err;
      
      err = rt_intr_wait(&intr_desc, TM_INFINITE);
      if (err > 0)
         xnprintf ("RX Intr\n");
   }
}

void intrGenerator (int a0, int a1, int a2, int a3, int a4,
                    int a5, int a6, int a7, int a8, int a9)
{
   xnprintf ("Start intrGenerator task\n");
   
   while (1)
   {
      taskDelay(500);
      xnprintf ("Generate\n");
   }
}

=============

When I try running the code, I get the following console output:

=============
RTAI/uvm: fusion core v0.8 (Time Machine) started.
starting VxWorks services.
Start intrHandler task
Start intrGenerator task
Generate
<then it just sits here, until I press CTRL-C>
<Press CTRL-C>
root_thread_exit
CPU  NAME           PRI  STATUS
  0  ROOT           256  0x00280080 -- fpu
  0  IntrGenerator   50  0x10008084 -- dly rrb
Periodic timer is running [tickval=1000 us, elapsed=500]
UVM fatal: zombie thread IntrHandler (0x80593bc) would not die...
root_thread_exit
root_thread_exit
===============

Am I doing something incorrect in regards to using/configuring the timers?
I ran "satch" with no problems.  Things stopped working when I added the
rt_intr_wait() call.

Paul
 




More information about the Rtai mailing list