📄 edma3_rm.h
字号:
* User can either request a specific resource by passing the resource id
* in 'resObj->resId' OR request ANY available resource of the type
* 'resObj->type'.
*
* ANY types of resources are those resources when user doesn't care about the
* actual resource allocated; user just wants a resource of the type specified.
* One use-case is to perform memory-to-memory data transfer operation. This
* operation can be performed using any available DMA or QDMA channel.
* User doesn't need any specific channel for the same.
*
* To allocate a specific resource, first this API checks whether that resource
* is OWNED by the Resource Manager instance. Then it checks the current
* availability of that resource.
*
* To allocate ANY available resource, this API tries to allocate a resource
* from the pool of (owned && non_reserved && available_right_now) resources.
*
* After allocating a DMA/QDMA channel or TCC, the same resource is enabled in
* the shadow region specific register (DRAE/DRAEH/QRAE).
*
* Allocated PaRAM Set is initialized to NULL before this API returns if user
* has requested for one.
*
* \param hEdmaResMgr [IN] Handle to the previously opened Resource
* Manager Instance.
* \param resObj [IN/OUT] Handle to the resource descriptor
* object, which needs to be allocated.
* In case user passes a specific resource
* Id, resObj value is left unchanged.
* In case user requests ANY available
* resource, the allocated resource id is
* returned in resObj.
*
* \return EDMA3_RM_SOK or EDMA3_RM Error Code
*
* \note This function acquires a RM Instance specific semaphore
* to prevent simultaneous access to the global pool of resources.
* It is re-entrant, but should not be called from the user callback
* function (ISR context).
*/
EDMA3_RM_Result EDMA3_RM_allocResource (EDMA3_RM_Handle hEdmaResMgr,
EDMA3_RM_ResDesc *resObj);
/**\fn EDMA3_RM_Result EDMA3_RM_freeResource(EDMA3_RM_Handle hEdmaResMgr,
* const EDMA3_RM_ResDesc *resObj)
* \brief This API is used to free previously allocated EDMA3 Resources like
* DMA/QDMA channel, PaRAM Set or TCC.
*
* To free a specific resource, first this API checks whether that resource is
* OWNED by the Resource Manager Instance. Then it checks whether that resource
* has been allocated by the Resource Manager instance or not.
*
* After freeing a DMA/QDMA channel or TCC, the same resource is disabled in
* the shadow region specific register (DRAE/DRAEH/QRAE).
*
* \param hEdmaResMgr [IN] Handle to the previously opened Resource
* Manager Instance.
* \param resObj [IN] Handle to the resource descriptor
* object, which needs to be freed.
*
* \return EDMA3_RM_SOK or EDMA3_RM Error Code
*
* \note This function disables the global interrupts to prevent
* simultaneous access to the global pool of resources.
* It is re-entrant.
*/
EDMA3_RM_Result EDMA3_RM_freeResource(EDMA3_RM_Handle hEdmaResMgr,
const EDMA3_RM_ResDesc *resObj);
/**\fn EDMA3_RM_Result EDMA3_RM_allocContiguousResource(EDMA3_RM_Handle
* hEdmaResMgr, EDMA3_RM_ResDesc *firstResIdObj,
* unsigned int numResources)
* \brief Allocate a contiguous region of specified EDMA3 Resource
* like DMA channel, QDMA channel, PaRAM Set or TCC.
*
* This API is used to allocate a contiguous region of specified EDMA3
* Resources like DMA channel, QDMA channel, PaRAM Set or TCC.
*
* User can specify a particular resource Id to start with and go up to the
* number of resources requested. The specific resource id to start from could
* be passed in 'firstResIdObject->resId' and the number of resources requested
* in 'numResources'.
*
* User can also request ANY available resource(s) of the type
* 'firstResIdObject->type' by specifying 'firstResIdObject->resId' as
* EDMA3_RM_RES_ANY.
*
* ANY types of resources are those resources when user doesn't care about the
* actual resource allocated; user just wants a resource of the type specified.
* One use-case is to perform memory-to-memory data transfer operation. This
* operation can be performed using any available DMA or QDMA channel. User
* doesn't need any specific channel for the same.
*
* To allocate specific contiguous resources, first this API checks whether
* those requested resources are OWNED by the Resource Manager instance. Then
* it checks the current availability of those resources.
*
* To allocate ANY available contiguous resources, this API tries to allocate
* resources from the pool of (owned && non_reserved && available_right_now)
* resources.
*
* After allocating DMA/QDMA channels or TCCs, the same resources are enabled in
* the shadow region specific register (DRAE/DRAEH/QRAE). Allocated PaRAM Sets
* are initialized to NULL before this API returns.
*
* \param hEdmaResMgr [IN] Handle to the previously opened Resource
* Manager Instance.
* \param firstResIdObj [IN] Handle to the first resource descriptor
* object, which needs to be allocated.
* firstResIdObject->resId could be a valid
* resource id in case user wants to
* allocate specific resources OR it could
* be EDMA3_RM_RES_ANY in case user wants
* only the required number of resources
* and doesn't care about which resources
* were allocated.
* \param numResources [IN] Number of contiguous resources user
* wants to allocate.
*
* \return EDMA3_RM_SOK or EDMA3_RM Error Code
*
* \note This function acquires a RM Instance specific semaphore
* to prevent simultaneous access to the global pool of resources.
* It is re-entrant, but should not be called from the user callback
* function (ISR context).
*/
EDMA3_RM_Result EDMA3_RM_allocContiguousResource(EDMA3_RM_Handle hEdmaResMgr,
EDMA3_RM_ResDesc *firstResIdObj,
unsigned int numResources);
/**
* \fn EDMA3_RM_Result EDMA3_RM_freeContiguousResource(EDMA3_RM_Handle
* hEdmaResMgr, EDMA3_RM_ResDesc *firstResIdObj,
* unsigned int numResources)
* \brief Free a contiguous region of specified EDMA3 Resource
* like DMA channel, QDMA channel, PaRAM Set or TCC, previously allocated.
*
* This API frees a contiguous region of specified EDMA3 Resources
* like DMA channel, QDMA channel, PaRAM Set or TCC, which have been previously
* allocated. In case of an error during the freeing of any specific resource,
* user can check the 'firstResIdObj' object to know the last resource id
* whose freeing has failed. In case of success, there is no need to check this
* object.
*
* \param hEdmaResMgr [IN] Handle to the previously opened
* Resource Manager Instance.
* \param firstResIdObj [IN/OUT] Handle to the first resource
* descriptor object, which needs to be
* freed. In case of an error while
* freeing any particular resource,
* the last resource id whose freeing has
* failed is returned in this resource
* descriptor object.
* \param numResources [IN] Number of contiguous resources allocated
* previously which user wants to release
*
* \note This is a re-entrant function which internally calls
* EDMA3_RM_freeResource() for resource de-allocation.
*/
EDMA3_RM_Result EDMA3_RM_freeContiguousResource(EDMA3_RM_Handle hEdmaResMgr,
EDMA3_RM_ResDesc *firstResIdObj,
unsigned int numResources);
/* Defines for Logical Channel Values */
/*---------------------------------------------------------------------------*/
/**
* Used to specify any available DMA Channel while requesting
* one. Used in the API EDMA3_RM_allocLogicalChannel ().
* DMA channel from the pool of (owned && non_reserved && available_right_now)
* DMA channels will be chosen and returned.
*/
#define EDMA3_RM_DMA_CHANNEL_ANY (1011u)
/**
* Used to specify any available QDMA Channel while requesting
* one. Used in the API EDMA3_RM_allocLogicalChannel().
* QDMA channel from the pool of (owned && non_reserved && available_right_now)
* QDMA channels will be chosen and returned.
*/
#define EDMA3_RM_QDMA_CHANNEL_ANY (1012u)
/**
* Used to specify any available TCC while requesting
* one. Used in the API EDMA3_RM_allocLogicalChannel(), for
* both DMA and QDMA channels.
* TCC from the pool of (owned && non_reserved && available_right_now)
* TCCs will be chosen and returned.
*/
#define EDMA3_RM_TCC_ANY (1013u)
/**
* Used to specify any available PaRAM Set while requesting
* one. Used in the API EDMA3_RM_allocLogicalChannel(), for
* both DMA/QDMA and Link channels.
* PaRAM Set from the pool of (owned && non_reserved && available_right_now)
* PaRAM Sets will be chosen and returned.
*/
#define EDMA3_RM_PARAM_ANY (1014u)
/**
* This define is used to specify that a DMA channel is NOT tied to any PaRAM
* Set and hence any available PaRAM Set could be used for that DMA channel.
* It could be used in dmaChannelPaRAMMap [EDMA3_MAX_DMA_CH], in global
* configuration structure EDMA3_RM_GblConfigParams.
*
* This value should mandatorily be used to mark DMA channels with no initial
* mapping to specific PaRAM Sets.
*/
#define EDMA3_RM_CH_NO_PARAM_MAP (1015u)
/**
* This define is used to specify that the DMA/QDMA channel is not tied to any
* TCC and hence any available TCC could be used for that DMA/QDMA channel.
* It could be used in dmaChannelTccMap [EDMA3_MAX_DMA_CH], in global
* configuration structure EDMA3_RM_GblConfigParams.
*
* This value should mandatorily be used to mark DMA channels with no initial
* mapping to specific TCCs.
*/
#define EDMA3_RM_CH_NO_TCC_MAP (1016u)
/*---------------------------------------------------------------------------*/
/**
* \brief DMA Channels assigned to different Hardware Events.
* They should be used while requesting a specific DMA channel.
* One possible usage is to maintain a SoC specific file, which will
* contain the mapping of these hardware events to the respective
* peripherals for better understanding and lesser probability of
* errors. Also, if any event associated with a particular peripheral
* gets changed, only that SoC specific file needs to be changed.
*
* for eg, the sample SoC specific file "soc.h" can have these defines:
*
* #define EDMA3_RM_HW_CHANNEL_MCBSP_TX EDMA3_RM_HW_CHANNEL_EVENT_2
* #define EDMA3_RM_HW_CHANNEL_MCBSP_RX EDMA3_RM_HW_CHANNEL_EVENT_3
*
* These defines will be used by the MCBSP driver. The same event
* EDMA3_RM_HW_CHANNEL_EVENT_2/3 could be mapped to some other
* peripheral also.
*/
typedef enum
{
/** Channel assigned to EDMA3 Event 0 */
EDMA3_RM_HW_CHANNEL_EVENT_0 = 0,
/** Channel assigned to EDMA3 Event 1 */
EDMA3_RM_HW_CHANNEL_EVENT_1,
/** Channel assigned to EDMA3 Event 2 */
EDMA3_RM_HW_CHANNEL_EVENT_2,
/** Channel assigned to EDMA3 Event 3 */
EDMA3_RM_HW_CHANNEL_EVENT_3,
/** Channel assigned to EDMA3 Event 4 */
EDMA3_RM_HW_CHANNEL_EVENT_4,
/** Channel assigned to EDMA3 Event 5 */
EDMA3_RM_HW_CHANNEL_EVENT_5,
/** Channel assigned to EDMA3 Event 6 */
EDMA3_RM_HW_CHANNEL_EVENT_6,
/** Channel assigned to EDMA3 Event 7 */
EDMA3_RM_HW_CHANNEL_EVENT_7,
/** Channel assigned to EDMA3 Event 8 */
EDMA3_RM_HW_CHANNEL_EVENT_8,
/** Channel assigned to EDMA3 Event 9 */
EDMA3_RM_HW_CHANNEL_EVENT_9,
/** Channel assigned to EDMA3 Event 10 */
EDMA3_RM_HW_CHANNEL_EVENT_10,
/** Channel assigned to EDMA3 Event 11 */
EDMA3_RM_HW_CHANNEL_EVENT_11,
/** Channel assigned to EDMA3 Event 12 */
EDMA3_RM_HW_CHANNEL_EVENT_12,
/** Channel assigned to EDMA3 Event 13 */
EDMA3_RM_HW_CHANNEL_EVENT_13,
/** Channel assigned to EDMA3 Event 14 */
EDMA3_RM_HW_CHANNEL_EVENT_14,
/** Channel assigned to EDMA3 Event 15 */
EDMA3_RM_HW_CHANNEL_EVENT_15,
/** Channel assigned to EDMA3 Event 16 */
EDMA3_RM_HW_CHANNEL_EVENT_16,
/** Channel assigned to EDMA3 Event 17 */
EDMA3_RM_HW_CHANNEL_EVENT_17,
/** Channel assigned to EDMA3 Event 18 */
EDMA3_RM_HW_CHANNEL_EVENT_18,
/** Channel assigned to EDMA3 Event 19 */
EDMA3_RM_HW_CHANNEL_EVENT_19,
/** Channel assigned to EDMA3 Event 20 */
EDMA3_RM_HW_CHANNEL_EVENT_20,
/** Channel assigned to EDMA3 Event 21 */
EDMA3_RM_HW_CHANNEL_EVENT_21,
/** Channel assigned to EDMA3 Event 22 */
EDMA3_RM_HW_CHANNEL_EVENT_22,
/** Channel assigned to EDMA3 Event 23 */
EDMA3_RM_HW_CHANNEL_EVENT_23,
/** Channel assigned to EDMA3 Event 24 */
EDMA3_RM_HW_CHANNEL_EVENT_24,
/** Channel assigned to EDMA3 Event 25 */
EDMA3_RM_HW_CHANNEL_EVENT_25,
/** Channel assigned to EDMA3 Event 26 */
EDMA3_RM_HW_CHANNEL_EVENT_26,
/** Channel assigne
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -