UDMACC26XX driver implementation.
============================================================================
The UDMACC26XX header file should be included in an application as follows:
The UDMACC26XX driver currently only supports being used by the SPICC26XXDMA.h. module. In other words, the application should never call any of the functions in this file.
This driver is used implicitly by the SPICC26XXDMA.h driver so user should not have to interface to this driver from the application. The uDMA HW makes use of a control table in RAM which must be 1024 bytes aligned. The default base address of this control table is 0x20000400, however this can be changed by simply changing UDMACC26XX_CONFIG_BASE. The SPICC26XXDMA.h supports SPI0 and SPI1, and uses both TX and RX DMA channels. Each control table entry is 16 bytes, so if an application uses both SSI0 and SSI1 the total RAM usage will be 4*16=64 bytes. If only one SSI module is used only 2*16=32 bytes of RAM is used. Please see Use cases for example.
Error handling is handled by the overlying driver which uses the DMA, currently this is only SPICC26XXDMA.h
Power management is handled by the overlying driver which uses the DMA, currently this is only SPICC26XXDMA.h
Note that these functions should never be called from the application, they are only called from other drivers. They are however included here for completeness:
API function | Description |
---|---|
UDMACC26XX_open() | Initialize and enable the uDMA HW and set system dependencies. |
UDMACC26XX_close() | Disable uUDMA HW and release system dependencies |
No known limitations
The DMA is only used together with the SPICC26XXDMA.h driver, so the application should never call any of the functions in this driver directly. The only thing that the application is allowed to modify is the base address of the DMA control table in RAM. (Default value is 0x2000_0400) Remember it must be 1024 bytes aligned.
The SPI driver interface produces log statements if instrumentation is enabled.
Diagnostics Mask | Log details |
---|---|
Diags_USER1 | basic SPI operations performed |
Diags_USER2 | detailed SPI operations performed |
#include <stdint.h>
#include <stdbool.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>
#include <ti/devices/DeviceFamily.h>
#include <DeviceFamily_constructPath(inc/hw_types.h)>
#include <DeviceFamily_constructPath(driverlib/udma.h)>
Go to the source code of this file.
Data Structures | |
struct | UDMACC26XX_Object |
UDMACC26XX object. More... | |
struct | UDMACC26XX_HWAttrs |
UDMACC26XX hardware attributes. More... | |
struct | UDMACC26XX_Config |
UDMACC26XX Global configuration. More... | |
Macros | |
#define | UDMACC26XX_CONFIG_BASE 0x20001800 |
#define | UDMACC26XX_SET_TRANSFER_SIZE(SIZE) (((SIZE - 1) << UDMA_XFER_SIZE_S) & UDMA_XFER_SIZE_M) |
#define | UDMACC26XX_GET_TRANSFER_SIZE(CONTROL) (((CONTROL & UDMA_XFER_SIZE_M) >> UDMA_XFER_SIZE_S) + 1) |
Typedefs | |
typedef struct UDMACC26XX_Object | UDMACC26XX_Object |
UDMACC26XX object. More... | |
typedef struct UDMACC26XX_HWAttrs | UDMACC26XX_HWAttrs |
UDMACC26XX hardware attributes. More... | |
typedef struct UDMACC26XX_Config | UDMACC26XX_Config |
UDMACC26XX Global configuration. More... | |
typedef struct UDMACC26XX_Config * | UDMACC26XX_Handle |
A handle that is returned from a UDMACC26XX_open() call. More... | |
Functions | |
void | UDMACC26XX_hwiIntFxn (uintptr_t callbacks) |
__STATIC_INLINE void | UDMACC26XX_init (UDMACC26XX_Handle handle) |
Function to initialize the CC26XX DMA driver. More... | |
UDMACC26XX_Handle | UDMACC26XX_open () |
Function to initialize the CC26XX DMA peripheral. More... | |
__STATIC_INLINE void | UDMACC26XX_channelEnable (UDMACC26XX_Handle handle, uint32_t channelBitMask) |
__STATIC_INLINE bool | UDMACC26XX_channelDone (UDMACC26XX_Handle handle, uint32_t channelBitMask) |
__STATIC_INLINE void | UDMACC26XX_clearInterrupt (UDMACC26XX_Handle handle, uint32_t channelBitMask) |
__STATIC_INLINE void | UDMACC26XX_channelDisable (UDMACC26XX_Handle handle, uint32_t channelBitMask) |
__STATIC_INLINE void | UDMACC26XX_disableAttribute (UDMACC26XX_Handle handle, uint32_t channelNum, uint32_t attr) |
void | UDMACC26XX_close (UDMACC26XX_Handle handle) |
Function to close the DMA driver. More... | |
#define UDMACC26XX_CONFIG_BASE 0x20001800 |
Base address for the DMA control table, must be 1024 bytes aligned
#define UDMACC26XX_SET_TRANSFER_SIZE | ( | SIZE | ) | (((SIZE - 1) << UDMA_XFER_SIZE_S) & UDMA_XFER_SIZE_M) |
Make sure DMA control table base address is 1024 bytes aligned
Compiler specific macros to allocate DMA control table entries
Sets the DMA transfer size in number of items
#define UDMACC26XX_GET_TRANSFER_SIZE | ( | CONTROL | ) | (((CONTROL & UDMA_XFER_SIZE_M) >> UDMA_XFER_SIZE_S) + 1) |
Gets the DMA transfer size in number of items
typedef struct UDMACC26XX_Object UDMACC26XX_Object |
UDMACC26XX object.
typedef struct UDMACC26XX_HWAttrs UDMACC26XX_HWAttrs |
UDMACC26XX hardware attributes.
typedef struct UDMACC26XX_Config UDMACC26XX_Config |
UDMACC26XX Global configuration.
typedef struct UDMACC26XX_Config* UDMACC26XX_Handle |
A handle that is returned from a UDMACC26XX_open() call.
void UDMACC26XX_hwiIntFxn | ( | uintptr_t | callbacks | ) |
__STATIC_INLINE void UDMACC26XX_init | ( | UDMACC26XX_Handle | handle | ) |
Function to initialize the CC26XX DMA driver.
The function will set the isOpen flag to false, and should be called prior to opening the DMA driver.
References UDMACC26XX_Config::object, and UDMACC26XX_open().
UDMACC26XX_Handle UDMACC26XX_open | ( | ) |
Function to initialize the CC26XX DMA peripheral.
The function will set a dependency on the peripheral power domain, i.e. power up the module and enable the clock. Note this function always uses the first DMA entry in the global UDMACC26XX_config list.
Referenced by UDMACC26XX_init().
__STATIC_INLINE void UDMACC26XX_channelEnable | ( | UDMACC26XX_Handle | handle, |
uint32_t | channelBitMask | ||
) |
References UDMACC26XX_HWAttrs::baseAddr, and UDMACC26XX_Config::hwAttrs.
__STATIC_INLINE bool UDMACC26XX_channelDone | ( | UDMACC26XX_Handle | handle, |
uint32_t | channelBitMask | ||
) |
References UDMACC26XX_HWAttrs::baseAddr, and UDMACC26XX_Config::hwAttrs.
__STATIC_INLINE void UDMACC26XX_clearInterrupt | ( | UDMACC26XX_Handle | handle, |
uint32_t | channelBitMask | ||
) |
References UDMACC26XX_HWAttrs::baseAddr, and UDMACC26XX_Config::hwAttrs.
__STATIC_INLINE void UDMACC26XX_channelDisable | ( | UDMACC26XX_Handle | handle, |
uint32_t | channelBitMask | ||
) |
References UDMACC26XX_HWAttrs::baseAddr, and UDMACC26XX_Config::hwAttrs.
__STATIC_INLINE void UDMACC26XX_disableAttribute | ( | UDMACC26XX_Handle | handle, |
uint32_t | channelNum, | ||
uint32_t | attr | ||
) |
References UDMACC26XX_HWAttrs::baseAddr, UDMACC26XX_Config::hwAttrs, and UDMACC26XX_close().
void UDMACC26XX_close | ( | UDMACC26XX_Handle | handle | ) |
Function to close the DMA driver.
Will disable the DMA hardware, release the power dependency and destruct the HWI interrupt.
handle | A SPI_Handle returned from SPI_open() |
Referenced by UDMACC26XX_disableAttribute().