To initiate a DMA transfer, you need to:

  1. open GPDMA device node, for example "/dev/edma0.51" (first number is the device number, and second is the channel number)
  2. query channel for it's capabilities issuing a GPDMA_IOCTL_GETCAPS ioctl passing gpdma_cdev_caps structure
  3. write() gpdma_cdev_request structure to device
  4. wait for read() gpdma_cdev_response when transfer is completed or an error occured.
  5. repeat step 3 as needed.

   1 enum gpdma_cdev_buftype {
   2         GPDMA_CDEVBUF_BLOCK     = 0x1,
   3         GPDMA_CDEVBUF_FRAME     = 0x2,
   4 };
   5 
   6 enum gpdma_cdev_op {
   7         GPDMA_FILL      = 0x1,
   8         GPDMA_COPY      = 0x2,
   9         GPDMA_XOR       = 0x4,
  10 };
  11 
  12 struct gpdma_cdev_buffer {
  13         int                     dcb_type;
  14         struct iovec            dcb_iov;
  15         size_t                  dcb_stride_width;
  16         size_t                  dcb_stride_spacing;
  17 };
  18 
  19 struct gpdma_cdev_request {
  20         int                     dcr_op;
  21         struct gpdma_cdev_buffer        dcr_buffers[8];
  22 #define dcr_dst                 dcr_buffers[0]
  23 #define dcr_src                 dcr_buffers[1]
  24 };
  25 
  26 struct gpdma_cdev_response {
  27         int                     drp_status; # errno number
  28 };
  29 
  30 struct gpdma_cdev_caps {
  31         uint32_t                dcc_ops;
  32         uint32_t                dcc_buffers;
  33 };

SOC2010JakubKlama/CharDevice (last edited 2010-08-16 12:04:46 by JakubKlama)