MgslWaitGpio


Prototype  
ULONG MgslWaitGpio( HANDLE hDevice, GPIO_DESC *gpio, LPOVERLAPPED pOverlapped  );
Parameters  
hDevice
handle to open port
gpio
pointer to GPIO_DESC structure
pOverlapped
pointer to overlapped structure initialized with a WIN32 manual reset event object which will be signaled when the receive operation completes
Return Value  
ERROR_SUCCESS (0)
one or more signals already in specified state
ERROR_INVALID_PARAMETER
invalid option ID or value pointer
ERROR_INVALID_HANDLE
hDevice is invalid
ERROR_BUSY
a request of this type is already pending
ERROR_IO_PENDING
waiting for operation to complete when specified event occurs

Wait for one or more input signals to reach the specified states. Only input signals can be monitored with this call. Setup the GPIO_DESC structure as shown below before the call.

GPIO_DESC Setup
smask set bit for each watched signal
state target state for each watched signal
dmask ignored
dir ignored

If one or more watched signals (as indicated by smask field) are already in the state specified in the state field, the function returns immediately with STATUS_SUCCESS. Otherwise, STATUS_PENDING is returned and the application must monitor the event in the overlapped structure for completion. In either case the state field is set to the state of all signals at the time the wait was satisfied. At least one of the watched signals will be in the target state.

GPIO_DESC on Completion
smask set bit for each watched signal
state state of signals on completion
dmask ignored
dir ignored

Only one call to MgslWaitGpio may be pending for a single port. If a MgslWaitGpio call is made for a port that already has a pending MgslWaitGpio call, STATUS_BUSY is returned.

A pending MgslWaitGpio call can be cancelled before completion by calling MgslCancelWaitGpio. After cancelling a pending MgslWaitGpio call, the application must wait for the event in the overlapped structure to be set before calling MgslWaitGpio again. The contents of the GPIO_DESC structure is undefined for a cancelled MgslWaitGpio call.

See also: MgslCancelWaitGpio, GPIO_DESC, General Purpose I/O Asynchronous API Notification


Previous Contents Next