<div dir="ltr"><div><div>Thanks.<br><br></div>It looks like the BSP has clockOn() and clockOff() functions to control the BSP's default clock.<br><br></div><div>I think this is what we need.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 4, 2016 at 5:56 PM, Gedare Bloom <span dir="ltr"><<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Fri, Mar 4, 2016 at 9:46 AM, Michael Westfall <<a href="mailto:mwestfal@gemini.edu">mwestfal@gemini.edu</a>> wrote:<br>
> Hello,<br>
><br>
> We have a vxWorks driver for a VME IRIG-B time provider card (Bancomm<br>
> bc635/bc637) which we want to port to RTEMS.<br>
><br>
> The ISR of the current vxWorks driver disables the system clock via<br>
> sysClkDisable() in order to take over providing ticks to the kernel via<br>
> tickAnnounce().<br>
><br>
> rtems_clock_tick() seems to be a direct replacement for the tickAnnounce()<br>
> function, but what is the strategy for disabling/reenabling the system<br>
> clock?<br>
><br>
> Surely someone else has implemented something similar.<br>
><br>
</span>You should be able to provide a custom clock source for the clock<br>
driver at the BSP level. Most (all?) BSPs use the framework in<br>
c/src/lib/libbsp/shared/clockdrv_shell.h to drive the system clock<br>
ticks by implementing the necessary "hook" functions. You can<br>
replace/modify the BSP's ckinit.c to use the bc635 card instead. See<br>
for example c/src/lib/libbsp/i386/pc386/clock/ckinit.c for how the x86<br>
currently has two options for the clock timer.<br>
<br>
This would relieve you from having to track quite so much "state".<br>
However, I suppose if you wanted to just port your code below, you<br>
would replace the Clock_isr with this code, and undo the<br>
Clock_driver_support_initialize_hardware() that your BSP has done.<br>
<div><div class="h5"><br>
><br>
> Here is our vxWorks ISR:<br>
><br>
> void isr_bc635<br>
> (<br>
> void *parg<br>
> )<br>
> {<br>
> register short intnum;<br>
> register unsigned short tmask, bcistatus, bcimask;<br>
><br>
> bcistatus = pbc635->intstat; /* Save copy of status register */<br>
> bcimask = pbc635->mask; /* Save copy of interrupt mask */<br>
> /* First check for periodic interrupt */<br>
> if ( ((bcistatus & 0x02) & bcimask) != 0)<br>
> {<br>
> if (bcUseper) /* Using BC periodics for system clock? */<br>
> {<br>
> if (!HadPerint) /* First Periodic Interrupt? */<br>
> {<br>
> HadPerint = TRUE;<br>
> sysClkDisable(); /* Turn off system clock interrupts */<br>
> sysClkRateSet(tickFrequency); /* set clock rate */<br>
> }<br>
> bcIntCounter++; /* Increment interrupt count */<br>
> if (bcUsrClock != NULL) (*bcUsrClock)(bcIntCounter); /* Call user<br>
> routine */<br>
> if (bcIntCounter%bcIntPerTick == 0) /* If right number of ticks */<br>
> tickAnnounce(); /* Announce system clock tick */<br>
> }<br>
> pbc635->intstat = pbc635->intstat | 0x02; /* Clear interrupt status<br>
> bit */<br>
> }<br>
> /* Other interrupts - not periodic pulse */<br>
> for (intnum = 1; intnum < 5; intnum++)<br>
> {<br>
> if (intnum != 2)<br>
> {<br>
> tmask = 0x01 << (intnum - 1); /* Test value for interrupt */<br>
> /* Check for interrupt bit set - request I/O scan, but only if<br>
> ioscanpvt is valid */<br>
> if ( ((bcistatus & tmask) & bcimask) != 0)<br>
> {<br>
> if (ioscanpvt[intnum-1] != NULL)<br>
> scanIoRequest(ioscanpvt[intnum-1]);<br>
> pbc635->intstat = pbc635->intstat | tmask; /* Clear interrupt<br>
> status bit */<br>
> }<br>
> }<br>
> }<br>
> }<br>
><br>
><br>
> --<br>
> Mike Westfall<br>
> Gemini Observatory<br>
><br>
</div></div>> _______________________________________________<br>
> users mailing list<br>
> <a href="mailto:users@rtems.org">users@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div>Mike Westfall<br></div>Gemini Observatory<br></div></div>
</div>