FD32M0P Microcontroller SDK
Loading...
Searching...
No Matches

Data Structures

struct  dma_channel_cfg_t
 Channel based transfer configuration. More...
struct  dma_mem_ctrl_cfg_t
 Channel Control Configuration Struct. More...
struct  dma_mem_channel_cfg_t
 Channel Configuration struct. More...

Macros

#define DMA_STRIDE_MODE_LOOKUP_SRC_ADDR   0x20010004
 Define for Stride Source and Destination Address.
#define DMA_STRIDE_MODE_LOOKUP_DST_ADDR   0x20010008
#define CHANNEL_TRANSFER_CFG_DEFAULT
 Default initializer for channel_transfer_cfg struct.

Enumerations

enum  DMA_SRC_INC_E { DMA_SRC_INC_BYTE = 0 , DMA_SRC_INC_HALF_WORD = 1 , DMA_SRC_INC_WORD = 2 , DMA_SRC_INC_NO_INCR = 3 }
 Enum for src inc. More...
enum  DMA_SRC_SIZE_E { DMA_SRC_SIZE_BYTE = 0 , DMA_SRC_SIZE_HALF_WORD = 1 , DMA_SRC_SIZE_WORD = 2 , DMA_SRC_SIZE_RESERVED = 3 }
 Enum for src size. More...
enum  DMA_CHANNEL_E {
  DMA_CHANNEL_0 = 0 , DMA_CHANNEL_1 = 1 , DMA_CHANNEL_2 = 2 , DMA_CHANNEL_3 = 3 ,
  DMA_CHANNEL_4 = 4 , DMA_CHANNEL_5 = 5 , DMA_CHANNEL_6 = 6 , DMA_CHANNEL_7 = 7 ,
  DMA_CHANNEL_8 = 8 , DMA_CHANNEL_9 = 9 , DMA_CHANNEL_10 = 10 , DMA_CHANNEL_11 = 11 ,
  DMA_CHANNEL_12 = 12 , DMA_CHANNEL_13 = 13 , DMA_CHANNEL_14 = 14 , DMA_CHANNEL_15 = 15
}
 Channel Number Enum. More...
enum  DMA_TRANSACTION_TYPE_E {
  DMA_TRANS_TYPE_INVALID = 0 , DMA_TRANS_TYPE_BASIC = 1 , DMA_TRANS_TYPE_AUTO_REQ = 2 , DMA_TRANS_TYPE_PING_PONG = 3 ,
  DMA_TRANS_TYPE_PRIMARY_MEM_SCATTER_GATHER = 4 , DMA_TRANS_TYPE_ALTERNATE_MEM_SCATTER_GATHER = 5 , DMA_TRANS_TYPE_PRIMARY_PER_SCATTER_GATHER = 6 , DMA_TRANS_TYPE_ALTERNATE_PER_SCATTER_GATHER = 7
}
 Transaction Type Enum. More...

Functions

void dma_init (PL230_REGS_s *PL230_REGS, uint32_t base_ptr_address)
 This function initalizes the dma, waits if there is any current transaction, set dma structure addressm disable all the channels and enables the controller.
void dma_channel_cfg (DMA_REGS_s *DMA_REGS, PL230_REGS_s *PL230_REGS, dma_channel_cfg_t *dma_channel_cfg, uint8_t channel)
 This function configures the DMA channel with required configuration.
void dma_channel_en_set (PL230_REGS_s *PL230_REGS, uint8_t channel)
 This function enables a particular dma channel.
uint8_t dma_channel_en_get (PL230_REGS_s *PL230_REGS, uint8_t channel)
 This function returns status of channel enable of a given channel.
void dma_channel_en_clr (PL230_REGS_s *PL230_REGS, uint8_t channel)
 This function clear a particular dma channel.
void dma_channel_sw_trig (PL230_REGS_s *PL230_REGS, uint8_t channel)
 This function generate a SW trigger for a given channel.
void dma_channel_priority_cfg (DMA_REGS_s *DMA_REGS, DMA_ARBITRATION_DMA_RR_EN_E mode, uint16_t round_robin_mask)
 This function set the dma arbitration.
bool dma_is_idle (PL230_REGS_s *PL230_REGS)
 This function check if dma fsm is in idle/stalled/done state.

Detailed Description


Data Structure Documentation

◆ dma_channel_cfg_t

struct dma_channel_cfg_t

Channel based transfer configuration.

Note
This struct contain parameters for initializing a DMA transfer using a given DMA channel number
Data Fields
uint32_t src_addr

DMA source address

uint32_t dst_addr

DMA destination address

uint16_t total_transaction

DMA total number of transaction

uint16_t repeated_transfer_en

DMA Repeated Transfer Enable

DMA_SRC_SIZE_E src_size

DMA source size 0:byte 1:halfword 2:word

DMA_SRC_INC_E src_incr

DMA source address increement

DMA_SRC_SIZE_E dst_size

DMA destination size 0:byte 1:halfword 2:word

DMA_SRC_INC_E dst_incr

DMA destination address increement

uint8_t r_power

DMA Arbitration rate

uint8_t next_useburst

DMA Set this to disable Single reqs

uint8_t src_prot_ctrl

DMA source protection control

uint8_t dst_prot_ctrl

DMA destination protection control

uint8_t alternate_cfg_sel

DMA alternate configuration select

uint8_t fill_en

DMA fill mode enable

uint8_t fill_incr_value

DMA fill increement value

uint8_t fill_init_value

DMA fill initial value

uint8_t stride_en

DMA stride mode enable

DMA_STRIDE_MODE_CFG_0_SRC_INC_E stride_src_incr

DMA stride source address increement value

DMA_STRIDE_MODE_CFG_0_DST_INC_E stride_dst_incr

DMA stride destination address increement value

DMA_TRANSACTION_TYPE_E transfer_type

DMA transaction type

◆ dma_mem_ctrl_cfg_t

struct dma_mem_ctrl_cfg_t

Channel Control Configuration Struct.

Data Fields
uint32_t cycle_ctrl:3
uint32_t next_useburst:1
uint32_t n_minus_1:10
uint32_t r_power:4
uint32_t src_prot_ctrl:3
uint32_t dst_prot_ctrl:3
uint32_t src_size:2
uint32_t src_inc:2
uint32_t dst_size:2
uint32_t dst_inc:2

◆ dma_mem_channel_cfg_t

struct dma_mem_channel_cfg_t

Channel Configuration struct.

Data Fields
uint32_t rsp
uint32_t rdp
dma_mem_ctrl_cfg_t ctrl
uint32_t rsvd

Macro Definition Documentation

◆ DMA_STRIDE_MODE_LOOKUP_SRC_ADDR

#define DMA_STRIDE_MODE_LOOKUP_SRC_ADDR   0x20010004

Define for Stride Source and Destination Address.

Referenced by dma_channel_cfg().

◆ DMA_STRIDE_MODE_LOOKUP_DST_ADDR

#define DMA_STRIDE_MODE_LOOKUP_DST_ADDR   0x20010008

Referenced by dma_channel_cfg().

◆ CHANNEL_TRANSFER_CFG_DEFAULT

#define CHANNEL_TRANSFER_CFG_DEFAULT
Value:
{ \
.src_addr = 0 ,\
.dst_addr = 0 ,\
.src_size = DMA_SRC_SIZE_WORD ,\
.src_incr = DMA_SRC_INC_WORD ,\
.dst_size = DMA_SRC_SIZE_WORD ,\
.dst_incr = DMA_SRC_INC_WORD ,\
.transfer_type = DMA_TRANS_TYPE_AUTO_REQ ,\
.total_transaction = 1 ,\
.r_power = 0 ,\
.next_useburst = 0 ,\
.alternate_cfg_sel = 0 ,\
.fill_en = 0 ,\
.fill_incr_value = 0 ,\
.fill_init_value = 0 ,\
.stride_en = 0 ,\
.stride_src_incr = DMA_STRIDE_MODE_CFG_0_SRC_INC_BYTE ,\
.stride_dst_incr = DMA_STRIDE_MODE_CFG_0_DST_INC_BYTE ,\
.repeated_transfer_en = 0 \
}
@ PL230_DMA_CFG_CHNL_PROT_CTRL_PRIVILEGE_ACCESS
Definition PL230_REGS.h:239
@ DMA_SRC_INC_WORD
Definition dma.h:30
@ DMA_TRANS_TYPE_AUTO_REQ
Definition dma.h:73
@ DMA_SRC_SIZE_WORD
Definition dma.h:40
@ DMA_STRIDE_MODE_CFG_0_SRC_INC_BYTE
0x0
Definition DMA_REGS.h:1365
@ DMA_STRIDE_MODE_CFG_0_DST_INC_BYTE
0x0
Definition DMA_REGS.h:1374

Default initializer for channel_transfer_cfg struct.

Note
Make sure to updgrade this macro if 'channel_transfer_cfg_struct' is modified

Enumeration Type Documentation

◆ DMA_SRC_INC_E

Enum for src inc.

Enumerator
DMA_SRC_INC_BYTE 
DMA_SRC_INC_HALF_WORD 
DMA_SRC_INC_WORD 
DMA_SRC_INC_NO_INCR 

◆ DMA_SRC_SIZE_E

Enum for src size.

Enumerator
DMA_SRC_SIZE_BYTE 
DMA_SRC_SIZE_HALF_WORD 
DMA_SRC_SIZE_WORD 
DMA_SRC_SIZE_RESERVED 

◆ DMA_CHANNEL_E

Channel Number Enum.

Enumerator
DMA_CHANNEL_0 

DMA Channel 0

DMA_CHANNEL_1 

DMA Channel 1

DMA_CHANNEL_2 

DMA Channel 2

DMA_CHANNEL_3 

DMA Channel 3

DMA_CHANNEL_4 

DMA Channel 4

DMA_CHANNEL_5 

DMA Channel 5

DMA_CHANNEL_6 

DMA Channel 6

DMA_CHANNEL_7 

DMA Channel 7

DMA_CHANNEL_8 

DMA Channel 8

DMA_CHANNEL_9 

DMA Channel 9

DMA_CHANNEL_10 

DMA Channel 10

DMA_CHANNEL_11 

DMA Channel 11

DMA_CHANNEL_12 

DMA Channel 12

DMA_CHANNEL_13 

DMA Channel 13

DMA_CHANNEL_14 

DMA Channel 14

DMA_CHANNEL_15 

DMA Channel 15

◆ DMA_TRANSACTION_TYPE_E

Transaction Type Enum.

Enumerator
DMA_TRANS_TYPE_INVALID 
DMA_TRANS_TYPE_BASIC 
DMA_TRANS_TYPE_AUTO_REQ 
DMA_TRANS_TYPE_PING_PONG 
DMA_TRANS_TYPE_PRIMARY_MEM_SCATTER_GATHER 
DMA_TRANS_TYPE_ALTERNATE_MEM_SCATTER_GATHER 
DMA_TRANS_TYPE_PRIMARY_PER_SCATTER_GATHER 
DMA_TRANS_TYPE_ALTERNATE_PER_SCATTER_GATHER 

Function Documentation

◆ dma_init()

void dma_init ( PL230_REGS_s * PL230_REGS,
uint32_t base_ptr_address )

This function initalizes the dma, waits if there is any current transaction, set dma structure addressm disable all the channels and enables the controller.

Parameters
base_ptr: pointer to base address of the dma channel configration memory
pl230_regs: pointer to the pl230 register space
Return values
void

References PL230_REGS_s::CHNL_ENABLE_CLR, PL230_REGS_s::CTRL_BASE_PTR, PL230_REGS_s::DMA_CFG, dma_is_idle(), PL230_CHNL_ENABLE_CLR_u::packed_w, PL230_CTRL_BASE_PTR_u::packed_w, and PL230_CHNL_ENABLE_CLR_CHNL_ENABLE_CLR_MASK.

Here is the call graph for this function:

◆ dma_channel_cfg()

void dma_channel_cfg ( DMA_REGS_s * DMA_REGS,
PL230_REGS_s * PL230_REGS,
dma_channel_cfg_t * dma_channel_cfg,
uint8_t channel )

This function configures the DMA channel with required configuration.

Parameters
channel_transfer_cfgstruct containing all the required configuration
channel: the channel id for which the configuration is being done
pl230_regs: pointer to the pl230 register space
dma_regs: pointer to the dma register space
Return values
void

References dma_channel_cfg().

Here is the call graph for this function:

◆ dma_channel_en_set()

void dma_channel_en_set ( PL230_REGS_s * PL230_REGS,
uint8_t channel )

This function enables a particular dma channel.

Parameters
enable: set this value to enable the channel
channel: channel id
pl230_regs: pointer to the pl230 register space
Return values
void

◆ dma_channel_en_get()

uint8_t dma_channel_en_get ( PL230_REGS_s * PL230_REGS,
uint8_t channel )

This function returns status of channel enable of a given channel.

Parameters
channel: channel id
pl230_regs: pointer to the pl230 register space
Return values
channelenable status

◆ dma_channel_en_clr()

void dma_channel_en_clr ( PL230_REGS_s * PL230_REGS,
uint8_t channel )

This function clear a particular dma channel.

Parameters
channel: channel id
pl230_regs: pointer to the pl230 register space
Return values
<br>

◆ dma_channel_sw_trig()

void dma_channel_sw_trig ( PL230_REGS_s * PL230_REGS,
uint8_t channel )

This function generate a SW trigger for a given channel.

Parameters
channel: channel id
pl230_regs: pointer to the pl230 register space
Return values
<br>

◆ dma_channel_priority_cfg()

void dma_channel_priority_cfg ( DMA_REGS_s * DMA_REGS,
DMA_ARBITRATION_DMA_RR_EN_E mode,
uint16_t round_robin_mask )

This function set the dma arbitration.

Parameters
dma_regs: pointer to the dma register space
mode: 1 for round robin, 0 for pl230 based arbitration
Return values
<br>

References DMA_REGS_s::ARBITRATION, DMA_REGS_s::ARBITRATION_MASK, and DMA_ARBITRATION_DMA_RR_EN_SET.

◆ dma_is_idle()

bool dma_is_idle ( PL230_REGS_s * PL230_REGS)

This function check if dma fsm is in idle/stalled/done state.

Parameters
pl230_regs: pointer to the pl230 register space
Return values
statusof pl230 fsm

References PL230_REGS_s::DMA_STATUS, PL230_DMA_STATUS_STATE_DONE, PL230_DMA_STATUS_STATE_IDLE, and PL230_DMA_STATUS_STATE_STALLED.

Referenced by dma_init().

Here is the caller graph for this function: