// hdaudio.h
PTRANSFER_CODEC_VERBS PtransferCodecVerbs;
NTSTATUS PtransferCodecVerbs(
[in] PVOID _context,
[in] ULONG Count,
[in, out] PHDAUDIO_CODEC_TRANSFER CodecTransfer,
[in] PHDAUDIO_TRANSFER_COMPLETE_CALLBACK Callback,
[in] PVOID Context
)
{...}
View the official Windows Driver Kit DDI referenceNo description available.
The TransferCodecVerbs routine transfers one or more commands to a codec or codecs and retrieves the responses to those commands.
The function pointer type for a TransferCodecVerbs routine is defined as follows.
_context [in]Specifies the context value from the Context member of the HDAUDIO_BUS_INTERFACE, HDAUDIO_BUS_INTERFACE_V2, or HDAUDIO_BUS_INTERFACE_BDL structure.
Count [in]Specifies the number of elements in the codecTransfer array.
CodecTransfer [in, out]Pointer to an array of HDAUDIO_CODEC_TRANSFER structures. Each array element is a structure that contains storage for both an output command from the caller and the corresponding input response from the codec.
Callback [in]Function pointer to a callback routine. This parameter is a function pointer of type HDAUDIO_TRANSFER_COMPLETE_CALLBACK. The parameter can be specified as NULL. For more information, see the following Remarks section.
Context [in]A context value for the callback routine. The caller casts the context value to type PVOID. After completing the commands asynchronously, the HD Audio bus driver passes the context value to the callback routine as a call parameter.
TransferCodecVerbs returns STATUS_SUCCESS if the call succeeds. Otherwise, the routine returns an appropriate error code. The following table shows a possible return status code.
| Return code | Description |
|---|---|
| STATUS_NO_MEMORY | Indicates that the request could not be added to the command queue due to a shortage of nonpaged memory. |
This routine submits one or more codec commands to the HD Audio bus driver. The bus driver issues the commands to the codecs, retrieves the codecs' responses to the commands, and outputs the responses to the caller.
The caller specifies the commands in an array of HDAUDIO_CODEC_TRANSFER structures. Each structure contains storage for both a command and the codec's response to that command. Before calling TransferCodecVerbs, the caller fills in the commands in each of the structures in the array. As each command completes, the HD Audio bus driver retrieves the codec's response and writes it into the structure. After the last command completes, the caller can read the responses from the array.
The routine can operate either synchronously or asynchronously:
The function pointer type for the callback parameter is defined as:
typedef VOID
(*PHDAUDIO_TRANSFER_COMPLETE_CALLBACK)
(HDAUDIO_CODEC_TRANSFER *, PVOID);
The first call parameter is a pointer to the codecTransfer array element that contains the codec command and the response that triggered the callback. The second call parameter is the same context value that was specified previously in the TransferCodecVerbs routine's callbackContext parameter.
If successful, TransferCodecVerbs returns STATUS_SUCCESS. The meaning of this status code depends on whether the routine operates synchronously or asynchronously:
If a response is invalid due to a FIFO overrun, the likely cause is that the codec responded to the command but the response was lost due to an insufficiently sized response input ring buffer (RIRB). If a FIFO overrun is not the cause of the invalid response, the failure probably occurred because the codec did not respond in time (timed out). In this case, the caller can assume that the command did not reach the codec.
If the callback parameter is NULL, the caller must be running at IRQL PASSIVE_LEVEL. If callback is non-NULL, the caller can call TransferCodecVerbs at IRQL <= DISPATCH_LEVEL, in which case the call returns immediately without waiting for the codecs to process all the commands; after the commands complete, the HD Audio bus driver calls the callback routine at IRQL DISPATCH_LEVEL.
The caller must allocate the codecTransfer array from the nonpaged pool.