pdiag_dd_dma_enable
Purpose
The pdiag_dd_dma_enable() function enables and disables a DMA operation. The actual function performed depends on the bus type and operation requested.
Syntax
#include <sys/pdiagex_dds.h>
int32 pdiag_dd_dma_enable( handle, daddr, operation )
pdiag_info_handle_t> handle;
pdiag_addr_t daddr;
uint32 operation;
Description
Where bus type = BUS_MICRO_CHANNEL and operation is PDIAG_DMA_FLUSH
- The PDIAG_DMA_FLUSH operation uses the specified daddr to
retrieve the baddr and count specified in the corresponding pdiag_dd_dma_setup()
call. Then the d_cflush and d_bflush kernel routines
are called to do the processor cache and IOCC buffer flushes, respectively.
If users need to change data in the DMA address space, they first change the data in their user space and then call pdiag_dd_dma_enable() with a PDIAG_DMA_FLUSH operation. If they need to read data in the DMA address space, they first call pdiag_dd_dma_enable () with a PDIAG_DMA_FLUSH operation, and then reads the data in the user space.
- The PDIAG_DMA_FLUSH operation flushes the processor cache and
the IOCC buffer. This may be used if a user is required to look at
or change the DMA area after a pdiag_dd_dma_setup()
routine. This routine works only if pdiag_dd_dma_setup() is
called with dma_flags = DMA_NOHIDE.
This routine is required only if the user wants to read the data before doing pdiag_dd_dma_complete().
Where bus type = BUS_MICRO_CHANNEL or BUS_BID and operation is PDIAG_DMA_DISABLE
- The DMA channel for that handle is disabled.
Where bus type = BUS_MICRO_CHANNEL or BUS_BID and operation is PDIAG_DMA_ENABLE
- The DMA channel for that handle is enabled.
Execution Environment
The pdiag_dd_dma_enable() function can be called from the process or the interrupt environment on a BUS_MICRO_CHANNEL system. The function can only be called from the process environment on a BUS_BID system.
Parameters
Parameter | Description |
---|---|
handle | Points to pdiag_info_handle_t structure which is returned from pdiag_open (). |
daddr | Pointer to the user's physical DMA address. This is returned by pdiag_dd_dma_setup() routine. |
operation | Type of operation to perform: PDIAG_DMA_ENABLE PDIAG_DMA_DISABLE PDIAG_DMA_FLUSH |
Return Value
The pdiag_dd_dma_enable function returns one of the following values:
Return Value | Description |
---|---|
DGX_OK | The operation was successful. The errno is not set. |
DGX_INVALID_HANDLE | Specified handle has been closed or was not generated by the pdiag_open() call. The errno is not set. |
DGX_BADVAL_FAIL | Specified daddr is not valid. The errno is not set. |
DGX_FAIL | Application could not transfer data between the processor and the I/O controller (IOCC) data caches. The errno is set to the d_cflush or d_bflush return code. |