Question

In Vxworks we have various clocks like system clock and auxiliary clock and has various API's according like below

  • sysClkConnect( ) - connect a routine to the system clock interrupt
  • sysClkDisable( ) - turn off system clock interrupts
  • sysClkEnable( ) - turn on system clock interrupts
  • sysClkRateGet( ) - get the system clock rate
  • sysClkRateSet( ) - set the system clock rate
  • sysAuxClkConnect( ) - connect a routine to the auxiliary clock interrupt
  • sysAuxClkDisable( ) - turn off auxiliary clock interrupts
  • sysAuxClkEnable( ) - turn on auxiliary clock interrupts
  • sysAuxClkRateGet( ) - get the auxiliary clock rate
  • sysAuxClkRateSet( ) - set the auxiliary clock rate

My question is what is difference between system clock and auxillary clock. When programmer should use what and under what scenarios?

Was it helpful?

Solution

The system clock forms the basis of how VxWorks tracks time and timeouts.

Most of the OS objects supporting timeouts (semaphores, message queues, events) as well as the taskDelay call are in units of clock ticks, which is based on the system clock.

Generally speaking, the system clock rate is chosen by the board designer for a reason.

Cranking up the clock speed increases system overhead slightly since during every system clock ticks, the OS needs to service various timeout elements, time slice counters and other internal stuff.

If you need to perform a task at a high rate of speed (2000 - 8000 Hz), you can use the auxiliary clock. The auxClock API is a simplified interface to an Interrupt Service Routine. Whenever the clock expires, the routine specified by sysAuxClockConnect will be invoked from the aux clock ISR.

There is no system overhead associated with the aux Clock beyound the ISR servicing time.

Of course, you do need a 2nd hardware clock in order to use the auxClock. Also, some vxWorks components like spy make use of the auxClock. If you have such a component, you might not be able to use it as there is a conflict.

Note that if you have more than 2 timers on your hardware platform, you could write your own routines to essentially do the same thing that the aux Clock API does.

OTHER TIPS

The auxillary clock (when supported by the hardware) can for example be used for high speed polling. It's clock rate can be set by sysAuxClkRateSet() to deviate from the system clock interrupt period.

Example: Programming Interrupts: Example for MVME 162 Using VxWorks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top