这是最新(主)开发分支的文档。如果您正在查找以前版本的文档,使用左侧的下拉菜单选择所需的版本。

DMA API 参考

DMA

wm_device_t *wm_drv_dma_init(const char *dma_name)

dma drv init

参数:

dma_name[in]

返回:

dma device reference

wm_drv_dma_status_t wm_drv_dma_deinit(wm_device_t *dev)

dma drv deinit

参数:

dev[in] device reference

返回:

deinit operation status

wm_drv_dma_status_t wm_drv_dma_request_ch(wm_device_t *dev, uint8_t *ch, uint32_t wait_time)

request dma channel

参数:
  • dev[in] device reference

  • ch[out] channel that alloced by dma drv

  • wait_time[in] channel request timeout

返回:

dma channel request operation status

wm_drv_dma_status_t wm_drv_dma_release_ch(wm_device_t *dev, uint8_t ch, uint32_t wait_time)

release dma channel

参数:
  • dev[in] device reference

  • ch[in] channel that need release, please make sure to use wm_drv_dma_request_ch to apply. If not applied, there may be exceptions

  • wait_time[in] channel release timeout

返回:

dma channel release operation status

wm_drv_dma_status_t wm_drv_dma_register_callback(wm_device_t *dma_dev, wm_dma_ch_t ch, wm_drv_dma_ch_callback_t dma_callback, void *user_data)

register dma done callback for user

参数:
  • dma_dev[in] device reference

  • ch[in] channel, please make sure to use wm_drv_dma_request_ch to apply. If not applied, there may be exceptions

  • dma_callback[in] done user callback

  • user_data[in] data

返回:

callback register operation status

wm_drv_dma_status_t wm_drv_dma_unregister_callback(wm_device_t *dma_dev, wm_dma_ch_t ch)

unregister dma done callback for user

参数:
  • dma_dev[in] device reference

  • ch[in] channel, please make sure to use wm_drv_dma_request_ch to apply. If not applied, there may be exceptions

返回:

callback unregister operation status

wm_drv_dma_status_t wm_drv_dma_config(wm_device_t *dma_dev, wm_drv_dma_desc_t *dma_desc)

config transfer param to dma, support mormal mode/list mode/warp mode/poolling mode/interrupt mode

参数:
  • dma_dev[in] device reference

  • dma_desc[in] config

返回:

dma config operation status

wm_drv_dma_status_t wm_drv_dma_start(wm_device_t *dma_dev, wm_dma_ch_t ch)

start dma transfer

参数:
  • dma_dev[in] device reference

  • ch[in] channel to start, please make sure to use wm_drv_dma_request_ch to apply. If not applied, there may be exceptions

返回:

dma start operation status

wm_drv_dma_status_t wm_drv_dma_stop(wm_device_t *dma_dev, wm_dma_ch_t ch)

stop dma transfer

参数:
  • dma_dev[in] device reference

  • ch[in] channel to stop, please make sure to use wm_drv_dma_request_ch to apply. If not applied, there may be exceptions

返回:

dma stop operation status

wm_drv_dma_status_t wm_drv_dma_get_status(wm_device_t *dma_dev, wm_dma_ch_t ch, wm_dma_sts_info_t *dma_sts)

get dma status

参数:
  • dma_dev[in] device reference

  • ch[in] channel to get status, please make sure to use wm_drv_dma_request_ch to apply. If not applied, there may be exceptions

  • dma_sts[out] status

返回:

get dma status operation status

wm_drv_dma_status_t wm_drv_dma_transfer(wm_device_t *dma_dev, wm_dma_ch_t ch, wm_drv_dma_xfer_cfg_t *dma_xfer)

config and start dma

参数:
  • dma_dev[in] device reference

  • ch[in] channel that need release, please make sure to use wm_drv_dma_request_ch to apply. If not applied, there may be exceptions

  • dma_xfer[in] xfer config

返回:

dma transfer operation status