abcdma.c 481 B

12345678910111213141516
  1. #include "fw.h"
  2. #include "io.h"
  3. void setup_abc_dma(void *buf, unsigned int len, uint8_t devsel,
  4. bool dir_in, unsigned long status)
  5. {
  6. devsel &= 63;
  7. volatile uint32_t *portctl = &ABCMEM_WRPORT(devsel) + dir_in;
  8. volatile uint32_t *portcount = &ABCMEM_WRCOUNT(devsel) + dir_in;
  9. volatile uint32_t *portstatus = &ABCMEMMAP_STATUS(devsel);
  10. *portctl = ((size_t)buf & 0x01ffffff) | (ABCMEMMAP_WR << dir_in);
  11. *portcount = len;
  12. *portstatus = status;
  13. }