Contiki-NG
|
Files | |
file | udma.c |
Implementation of the cc2538 micro-DMA driver. | |
file | udma.h |
Header file with register, macro and function declarations for the cc2538 micro-DMA controller module. | |
Macros | |
#define | udma_xfer_size(len) ((len - 1) << 4) |
Calculate the value of the xfersize field in the control structure. | |
Functions | |
bool | udma_is_valid_source_address (uintptr_t address) |
Checks if data can be DMAed from the given address. | |
void | udma_init (void) |
Initialise the uDMA driver. | |
void | udma_set_channel_src (uint8_t channel, uint32_t src_end) |
Sets the channels source address. | |
void | udma_set_channel_dst (uint8_t channel, uint32_t dst_end) |
Sets the channel's destination address. | |
void | udma_set_channel_control_word (uint8_t channel, uint32_t ctrl) |
Configure the channel's control word. | |
void | udma_set_channel_assignment (uint8_t channel, uint8_t enc) |
Choose an encoding for a uDMA channel. | |
void | udma_channel_enable (uint8_t channel) |
Enables a uDMA channel. | |
void | udma_channel_disable (uint8_t channel) |
Disables a uDMA channel. | |
void | udma_channel_use_alternate (uint8_t channel) |
Use the alternate control data structure for a channel. | |
void | udma_channel_use_primary (uint8_t channel) |
Use the primary control data structure for a channel. | |
void | udma_channel_prio_set_high (uint8_t channel) |
Set a uDMA channel to high priority. | |
void | udma_channel_prio_set_default (uint8_t channel) |
Set a uDMA channel to default priority. | |
void | udma_channel_use_burst (uint8_t channel) |
Configure a channel to only use burst transfers. | |
void | udma_channel_use_single (uint8_t channel) |
Configure a channel to use single as well as burst requests. | |
void | udma_channel_mask_set (uint8_t channel) |
Disable peripheral triggers for a uDMA channel. | |
void | udma_channel_mask_clr (uint8_t channel) |
Enable peripheral triggers for a uDMA channel. | |
void | udma_channel_sw_request (uint8_t channel) |
Generate a software trigger to start a transfer. | |
uint8_t | udma_channel_get_mode (uint8_t channel) |
Retrieve the current mode for a channel. | |
UDMA_CFG register bit masks | |
#define | UDMA_CFG_MASTEN 0x00000001 |
Controller master enable. | |
UDMA_CTLBASE register bit masks | |
#define | UDMA_CTLBASE_ADDR 0xFFFFFC00 |
Channel control base address. | |
UDMA_ALTBASE register bit masks | |
#define | UDMA_ALTBASE_ADDR 0xFFFFFFFF |
Alternate channel address pointer. | |
UDMA_WAITSTAT register bit masks | |
#define | UDMA_WAITSTAT_WAITREQ 0xFFFFFFFF |
Channel [n] wait status. | |
UDMA_SWREQ register bit masks | |
#define | UDMA_SWREQ_SWREQ 0xFFFFFFFF |
Channel [n] software request. | |
UDMA_USEBURSTSET register bit masks | |
#define | UDMA_USEBURSTSET_SET 0xFFFFFFFF |
Channel [n] useburst set. | |
UDMA_USEBURSTCLR register bit masks | |
#define | UDMA_USEBURSTCLR_CLR 0xFFFFFFFF |
Channel [n] useburst clear. | |
UDMA_REQMASKSET register bit masks | |
#define | UDMA_REQMASKSET_SET 0xFFFFFFFF |
Channel [n] request mask set. | |
UDMA_REQMASKCLR register bit masks | |
#define | UDMA_REQMASKCLR_CLR 0xFFFFFFFF |
Channel [n] request mask clear. | |
UDMA_ENASET register bit masks | |
#define | UDMA_ENASET_SET 0xFFFFFFFF |
Channel [n] enable set. | |
UDMA_ENACLR register bit masks | |
#define | UDMA_ENACLR_CLR 0xFFFFFFFF |
Channel [n] enable clear. | |
UDMA_ALTSET register bit masks | |
#define | UDMA_ALTSET_SET 0xFFFFFFFF |
Channel [n] alternate set. | |
UDMA_ALTCLR register bit masks | |
#define | UDMA_ALTCLR_CLR 0xFFFFFFFF |
Channel [n] alternate clear. | |
UDMA_PRIOSET register bit masks | |
#define | UDMA_PRIOSET_SET 0xFFFFFFFF |
Channel [n] priority set. | |
UDMA_PRIOCLR register bit masks | |
#define | UDMA_PRIOCLR_CLR 0xFFFFFFFF |
Channel [n] priority clear. | |
UDMA_ERRCLR register bit masks | |
#define | UDMA_ERRCLR_ERRCLR 0x00000001 |
uDMA bus error status | |
UDMA_CHASGN register bit masks | |
#define | UDMA_CHASGN_CHASGN 0xFFFFFFFF |
Channel [n] assignment select. | |
UDMA_CHIS register bit masks | |
#define | UDMA_CHIS_CHIS 0xFFFFFFFF |
Channel [n] interrupt status. | |
Driver for the cc2538 uDMA controller
#define udma_xfer_size | ( | len | ) | ((len - 1) << 4) |
Calculate the value of the xfersize field in the control structure.
len | The number of items to be transferred |
If we want to transfer len items, we will normally do something like udma_set_channel_control_word(OTHER_FLAGS | udma_xfer_size(len))
void udma_channel_disable | ( | uint8_t | channel | ) |
Disables a uDMA channel.
channel | The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] |
Definition at line 138 of file udma.c.
References UDMA_ENACLR.
void udma_channel_enable | ( | uint8_t | channel | ) |
Enables a uDMA channel.
channel | The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] |
Definition at line 128 of file udma.c.
References UDMA_ENASET.
uint8_t udma_channel_get_mode | ( | uint8_t | channel | ) |
Retrieve the current mode for a channel.
channel | The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] |
The return value will be one of the UDMA_CHCTL_XFERMODE_xyz defines. This function is useful to determine whether a uDMA transfer has completed, in which case the return value will be UDMA_CHCTL_XFERMODE_STOP
void udma_channel_mask_clr | ( | uint8_t | channel | ) |
Enable peripheral triggers for a uDMA channel.
channel | The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] |
Definition at line 222 of file udma.c.
References UDMA_REQMASKCLR.
void udma_channel_mask_set | ( | uint8_t | channel | ) |
Disable peripheral triggers for a uDMA channel.
channel | The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] |
Calling this function will result in the uDMA controller not acknowledging peripheral-generated transfer triggers. Afterwards, the channel may be used with software triggers
Definition at line 212 of file udma.c.
References UDMA_REQMASKSET.
Referenced by init().
void udma_channel_prio_set_default | ( | uint8_t | channel | ) |
Set a uDMA channel to default priority.
channel | The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] |
Definition at line 180 of file udma.c.
References UDMA_PRIOCLR.
void udma_channel_prio_set_high | ( | uint8_t | channel | ) |
Set a uDMA channel to high priority.
channel | The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] |
Definition at line 170 of file udma.c.
References UDMA_PRIOSET.
void udma_channel_sw_request | ( | uint8_t | channel | ) |
Generate a software trigger to start a transfer.
channel | The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] |
Definition at line 233 of file udma.c.
References UDMA_SWREQ.
void udma_channel_use_alternate | ( | uint8_t | channel | ) |
Use the alternate control data structure for a channel.
channel | The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] |
Definition at line 149 of file udma.c.
References UDMA_ALTSET.
void udma_channel_use_burst | ( | uint8_t | channel | ) |
Configure a channel to only use burst transfers.
channel | The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] |
Definition at line 191 of file udma.c.
References UDMA_USEBURSTSET.
void udma_channel_use_primary | ( | uint8_t | channel | ) |
Use the primary control data structure for a channel.
channel | The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] |
Definition at line 159 of file udma.c.
References UDMA_ALTCLR.
void udma_channel_use_single | ( | uint8_t | channel | ) |
Configure a channel to use single as well as burst requests.
channel | The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] |
Definition at line 201 of file udma.c.
References UDMA_USEBURSTCLR.
void udma_init | ( | void | ) |
Initialise the uDMA driver.
Prepares the channel control structure and enables the controller
Definition at line 65 of file udma.c.
References UDMA_CFG, UDMA_CFG_MASTEN, UDMA_CTLBASE, UDMA_ERR_IRQn, and UDMA_SW_IRQn.
Referenced by platform_init_stage_two().
void udma_set_channel_assignment | ( | uint8_t | channel, |
uint8_t | enc ) |
Choose an encoding for a uDMA channel.
channel | The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] |
enc | A value in [0 , 4] |
Possible values for the encoding param are defined as UDMA_CHnn_xyz
Definition at line 108 of file udma.c.
References UDMA_CHMAP0.
void udma_set_channel_control_word | ( | uint8_t | channel, |
uint32_t | ctrl ) |
Configure the channel's control word.
channel | The channel as a value in [0 , UDMA_CONF_MAX_CHANNEL] |
ctrl | The value of the control word |
The value of the control word is generated by ORing the values defined as UDMA_CHCTL_xyz
For example, to configure a channel with 8 bit source and destination size, 0 source increment and 8 bit destination increment, one would need to pass UDMA_CHCTL_DSTINC_8 | UDMA_CHCTL_SRCINC_NONE | UDMA_CHCTL_SRCSIZE_8 | UDMA_CHCTL_DSTSIZE_8
Macros defined as 0 can be omitted.
void udma_set_channel_dst | ( | uint8_t | channel, |
uint32_t | dst_end ) |