对于具有 DMA 功能的设备,要使用的寄存器比前面示例中所用寄存器多。
设备寄存器结构中使用以下字段来支持具有 DMA 功能但不支持分散/集中的设备:
uint32_t dma_addr; /* starting address for DMA */ uint32_t dma_size; /* amount of data to transfer */
设备寄存器结构中使用以下字段来支持具有 DMA 功能并支持分散/集中的设备:
struct sglentry {
uint32_t dma_addr;
uint32_t dma_size;
} sglist[SGLLEN];
caddr_t iopb_addr; /* When written, informs the device of the next */
/* command's parameter block address. */
/* When read after an interrupt, contains */
/* the address of the completed command. */