Transferring Waveform Output Data

For waveform output operations, clients call the user-mode driver’s wodMessage function. User-mode drivers should expect the client to first send a WODM_OPEN message to open a driver instance. Next, the client allocates memory for one or more data buffers and sends WODM_PREPARE messages to prepare the buffers for use.

The client then begins filling the buffers and sending WODM_WRITE messages, which include a buffer address. The user-mode driver keeps a queue of buffer addresses. When the user-mode driver starts receiving WODM_WRITE messages, it uses a separate thread to begin sending the received data to the kernel-mode driver, typically by calling WriteFile or WriteFileEx. Each time the user-mode driver reads a buffer and sends the data to the kernel-mode driver, it dequeues the buffer and sends the client a WOM_DONE callback message to notify it that the buffer has been read. The client can then re-use the buffer by specifying its address with another WODM_WRITE message.

When the client has finished the output operation, it stops sending WODM_WRITE messages. It can also send WODM_RESET, which indicates to the user-mode driver that it should not dequeue any remaining data buffers. The client can then send a WODM_UNPREPARE message for each buffer and deallocate the buffers. Finally, the driver should expect the client to close the instance by sending WODM_CLOSE.