Disabling system clock to use external clock driver card

Michael Westfall mwestfal at gemini.edu
Fri Mar 4 14:46:34 UTC 2016


Hello,

We have a vxWorks driver for a VME IRIG-B time provider card (Bancomm
bc635/bc637) which we want to port to  RTEMS.

The ISR of the current vxWorks driver disables the system clock via
sysClkDisable() in order to take over providing ticks to the kernel via
tickAnnounce().

rtems_clock_tick() seems to be a direct replacement for the tickAnnounce()
function, but what is the strategy for disabling/reenabling the system
clock?

Surely someone else has implemented something similar.


Here is our vxWorks ISR:

void isr_bc635
(
 void *parg
 )
{
   register short intnum;
   register unsigned short tmask, bcistatus, bcimask;

   bcistatus = pbc635->intstat; /* Save copy of status register */
   bcimask   = pbc635->mask; /* Save copy of interrupt mask */
   /* First check for periodic interrupt */
   if ( ((bcistatus & 0x02) & bcimask) != 0)
   {
      if (bcUseper) /* Using BC periodics for system clock? */
      {
         if (!HadPerint) /* First Periodic Interrupt? */
         {
            HadPerint = TRUE;
            sysClkDisable(); /* Turn off system clock interrupts */
            sysClkRateSet(tickFrequency); /* set clock rate */
         }
         bcIntCounter++; /* Increment interrupt count */
         if (bcUsrClock != NULL) (*bcUsrClock)(bcIntCounter); /* Call user
routine */
         if (bcIntCounter%bcIntPerTick == 0) /* If right number of ticks */
            tickAnnounce(); /* Announce system clock tick */
      }
      pbc635->intstat = pbc635->intstat | 0x02; /* Clear interrupt status
bit */
   }
   /* Other interrupts - not periodic pulse */
   for (intnum = 1; intnum < 5; intnum++)
   {
      if (intnum != 2)
      {
         tmask = 0x01 << (intnum - 1); /* Test value for interrupt */
         /* Check for interrupt bit set - request I/O scan, but only if
ioscanpvt is valid */
         if ( ((bcistatus & tmask) & bcimask) != 0)
         {
            if (ioscanpvt[intnum-1] != NULL)
               scanIoRequest(ioscanpvt[intnum-1]);
            pbc635->intstat = pbc635->intstat | tmask;   /* Clear interrupt
status bit */
         }
      }
   }
}


-- 
Mike Westfall
Gemini Observatory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20160304/592d681f/attachment.html>


More information about the users mailing list