Instruction manual
AMPDIO DRIVERS
Page 52
6.4.15.5) has been available, which allows the caller to tell whether or not
TCdriveNCBufferUserInterrupt would block. The TCwaitNCBufferReady function has a timeout
parameter that allows it to wait until either a specified maximum number of milliseconds have
elapsed (rounded up to a number of system clock ticks), or it is known that
TCdriveNCBufferUserInterrupt may be called without blocking. The return value indicates which of
these conditions is the case. Specifying a timeout of 0 milliseconds results in a simple poll. The
timeout can be set to INFINITE to stop it expiring, but you might as well not bother calling the
TCwaitNCBufferReady function in that case.
If multiple non-callback user interrupts are to be handled, The TCwaitNCBufferReady function may
be used with a timeout of zero with each user interrupt in turn to see which ones require attention.
In AMPDIO v4.20, the TCwaitMultiNCBufferReady function was introduced (see section 6.4.15.6).
This function allows you to wait on or poll multiple non-callback user interrupts simultaneously. It is
quite tricky to set up, requiring two input arrays which between them hold a board handle and user
interrupt handle pairing at each index of the array. Another parameter indicates the number of user
interrupts being handled. There is also a timeout parameter to indicate the maximum number of
milliseconds to wait, which may be 0, some number or INFINITE. The function returns indicating
whether the timeout expired or TCdriveNCBufferUserInterrupt can be called without blocking for
one of the specified user interrupts. Two other parameters are used by reference to return the
board handle and user interrupt handle of such a user interrupt.
When using the non-callback user interrupt handling to read data values from the driver
(ISR_READ_... data requests), the following should be noted. Once the user interrupt has been set
up and enabled, then if the fContinuous parameter was set to FALSE when the user interrupt was
set up, no buffer is sent to the driver to be filled in until the first call to
TCdriveNCBufferUserInterrupt, TCwaitNCBufferReady or TCwaitMultiNCBufferReady for this user
interrupt. If the fContinuous parameter was set to TRUE for continuous double-buffered operation,
then only one buffer is sent to the driver to be filled in when the user interrupt is enabled and the
other buffer is sent on the first call to TCdriveNCBufferUserInterrupt, TCwaitNCBufferReady or
TCwaitMultiNCBufferReady.
The driver will not enable the interrupt until it receives the first buffer to be filled in. For some
applications, it is necessary to ensure that the driver has enabled the interrupt and has a buffer to
fill in before some other initialization is performed that allows interrupts to be generated. This can
be done with a call to TCwaitNCBufferReady or TCwaitMultiNCBufferReady with a timeout of 0
before this other initialization is performed (but after the call to enableInterrupts).