Warning: this is dirty working draft version and is subject to change in future.
Allocating channels (in bus layers, etc)
1 struct resource *gpdma_alloc_channel(const char *name, int chno)
Allocated a channel chno on engine named name (eg. edma0)
1 int gpdma_release_channel(struct resource *rv)
Frees previously allocated channel.
Allocating transfers and starting DMA operations
1 gpdma_transfer_t gpdma_alloc_transfer(struct resource *rv);
Allocates a new transfer structure, which will be used on engine and channel represented by rv. Transfer can be reused once completed.
1 void gpdma_free_transfer(gpdma_transfer_t xfer);
Frees transfer xfer.
1 void *gpdma_program_transfer(gpdma_transfer_t xfer);
Programs transfer xfer on channel described by res. This function returns a cookie of type void * which will be used to reference this DMA operation in future.
1 int gpdma_start_transfer(void *cookie);
Starts previously programmed transfer. Returns 0 on success, nonzero on error.
1 int gpdma_stop_transfer(void *cookie);
Stops previously started transfer. Returns 0 on success, nonzero on error. In particular, it can return ENOTSUP if stopping transfers is not supported.
Setting up transfers, buffers, etc
1 int gpdma_setup_buffer_raw(gpdma_transfer_t xfer, int buffer, bus_addr_t addr, bus_size_t length)
Sets buffer of xfer pointing to physical memory address addr with length size.
1 int gpdma_setup_buffer_virt(gpdma_transfer_t xfer, int buffer, void *p, size_t length);
Sets buffer of xfer pointing to virtual memory address (in KVA) p with length size.
1 int gpdma_setup_buffer_uio(gpdma_transfer_t xfer, int buffer, struct uio *uio);
TODO describe
1 void gpdma_set_transfer_func(gpdma_transfer_t xfer, int func)
2 void gpdma_set_transfer_link(gpdma_transfer_t xfer, dmae_transfer_t next);
3 void gpdma_set_transfer_callback(gpdma_transfer_t xfer, dmae_callback_t cb, void *arg);
4 void gpdma_set_transfer_flags(gpdma_transfer_t xfer, int flags);
5
6 int gpdma_get_buffer_layout(gpdma_transfer_t xfer, int buffer);
7 void gpdma_set_buffer_layout(gpdma_transfer_t xfer, int buffer, int layout);
8 void gpdma_set_buffer_stride(gpdma_transfer_t xfer, int buffer, int width, int spacing);
9 void gpdma_set_buffer_fifo_width(gpdma_transfer_t xfer, int buffer, int width);
TODO describe