2017-01-21 00:52:34 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 comsuisse AG
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @file
|
|
|
|
* @brief Atmel SAM MCU family Direct Memory Access (XDMAC) driver.
|
|
|
|
*/
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_DRIVERS_DMA_DMA_SAM_XDMAC_H_
|
|
|
|
#define ZEPHYR_DRIVERS_DMA_DMA_SAM_XDMAC_H_
|
2017-01-21 00:52:34 +08:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* XDMA_MBR_UBC */
|
|
|
|
#define XDMA_UBC_NDE (0x1u << 24)
|
|
|
|
#define XDMA_UBC_NDE_FETCH_DIS (0x0u << 24)
|
|
|
|
#define XDMA_UBC_NDE_FETCH_EN (0x1u << 24)
|
|
|
|
#define XDMA_UBC_NSEN (0x1u << 25)
|
|
|
|
#define XDMA_UBC_NSEN_UNCHANGED (0x0u << 25)
|
|
|
|
#define XDMA_UBC_NSEN_UPDATED (0x1u << 25)
|
|
|
|
#define XDMA_UBC_NDEN (0x1u << 26)
|
|
|
|
#define XDMA_UBC_NDEN_UNCHANGED (0x0u << 26)
|
|
|
|
#define XDMA_UBC_NDEN_UPDATED (0x1u << 26)
|
|
|
|
#define XDMA_UBC_NVIEW_SHIFT 27
|
|
|
|
#define XDMA_UBC_NVIEW_MASK (0x3u << XDMA_UBC_NVIEW_SHIFT)
|
|
|
|
#define XDMA_UBC_NVIEW_NDV0 (0x0u << XDMA_UBC_NVIEW_SHIFT)
|
|
|
|
#define XDMA_UBC_NVIEW_NDV1 (0x1u << XDMA_UBC_NVIEW_SHIFT)
|
|
|
|
#define XDMA_UBC_NVIEW_NDV2 (0x2u << XDMA_UBC_NVIEW_SHIFT)
|
|
|
|
#define XDMA_UBC_NVIEW_NDV3 (0x3u << XDMA_UBC_NVIEW_SHIFT)
|
|
|
|
|
|
|
|
/** DMA channel configuration parameters */
|
|
|
|
struct sam_xdmac_channel_config {
|
|
|
|
/** Configuration Register */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t cfg;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Data Stride / Memory Set Pattern Register */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t ds_msp;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Source Microblock Stride */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t sus;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Destination Microblock Stride */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t dus;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Channel Interrupt Enable */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t cie;
|
2017-01-21 00:52:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** DMA transfer configuration parameters */
|
|
|
|
struct sam_xdmac_transfer_config {
|
|
|
|
/** Microblock length */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t ublen;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Source Address */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t sa;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Destination Address */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t da;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Block length (The length of the block is (blen+1) microblocks) */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t blen;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Next descriptor address */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t nda;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Next descriptor configuration */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t ndc;
|
2017-01-21 00:52:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** DMA Master transfer linked list view 0 structure */
|
|
|
|
struct sam_xdmac_linked_list_desc_view0 {
|
|
|
|
/** Next Descriptor Address */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_nda;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Microblock Control */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_ubc;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Transfer Address */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_ta;
|
2017-01-21 00:52:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** DMA Master transfer linked list view 1 structure */
|
|
|
|
struct sam_xdmac_linked_list_desc_view1 {
|
|
|
|
/** Next Descriptor Address */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_nda;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Microblock Control */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_ubc;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Source Address */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_sa;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Destination Address */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_da;
|
2017-01-21 00:52:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** DMA Master transfer linked list view 2 structure */
|
|
|
|
struct sam_xdmac_linked_list_desc_view2 {
|
|
|
|
/** Next Descriptor Address */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_nda;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Microblock Control */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_ubc;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Source Address */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_sa;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Destination Address */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_da;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Configuration Register */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_cfg;
|
2017-01-21 00:52:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** DMA Master transfer linked list view 3 structure */
|
|
|
|
struct sam_xdmac_linked_list_desc_view3 {
|
|
|
|
/** Next Descriptor Address */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_nda;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Microblock Control */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_ubc;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Source Address */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_sa;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Destination Address */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_da;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Configuration Register */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_cfg;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Block Control */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_bc;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Data Stride */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_ds;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Source Microblock Stride */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_sus;
|
2017-01-21 00:52:34 +08:00
|
|
|
/** Destination Microblock Stride */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t mbr_dus;
|
2017-01-21 00:52:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_DRIVERS_DMA_DMA_SAM_XDMAC_H_ */
|