📄 csl_edmaaux.h
字号:
{
if (hEdma->region == -1) {
if (hEdma->chaNum >= CSL_EDMA_NUM_DMACH)
return CSL_ESYS_INVPARAMS;
else if (hEdma->chaNum < 32)
hEdma->ccregs->ECR = (1 << hEdma->chaNum);
else
hEdma->ccregs->ECRH = (1 << (hEdma->chaNum - 32));
} else {
if (hEdma->chaNum >= CSL_EDMA_NUM_DMACH)
return CSL_ESYS_INVPARAMS;
else if (hEdma->chaNum < 32)
hEdma->ccregs->SHADOW[hEdma->region].ECR = (1 << hEdma->chaNum);
else
hEdma->ccregs->SHADOW[hEdma->region].ECRH =
(1 << (hEdma->chaNum - 32));
}
return CSL_SOK;
}
/** =============================================================================
* @n@b CSL_edmaChannelMapParamEntry
*
* @b Description
* @n Maps the channel to a given parameter entry
*
* @b Arguments
* @verbatim
hCh Channel Handle
@endverbatim
*
* <b> Return Value CSL_Status
* @li CSL_SOK - Always returns
*
* <b> Pre Condition </b>
* @n @a CSL_edmaInit() must be called successfully.
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
*
* <b> Usage Constraints: </b>
* All @a CSL_edmaInit(), @a CSL_edmaOpen(), @a CSL_edmaChannelOpen() must be
* invoked successfully in that order before @a CSL_edmaChannelMapParamEntry()
* can be invoked. If the channel is opened in context of a Region,
* @a CSL_edmaRegionOpen() may also need to be invoked before this API.
*
* @b Example:
* @verbatim
CSL_EdmaChanObj ChObj;
CSL_EdmaChanHandle chHndl;
CSL_EdmaHwChannelSetup chParam;
CSL_EdmaHandle hModHndl;
CSL_Status modStatus;
Uint32 paramMap;
// Initialization
modStatus = CSL_edmaInit(NULL);
...
// Open Module
hModHndl = CSL_edmaOpen(NULL,CSL_EDMA_0,NULL,&modStatus);
// Open Channel 0
chParam.regionNum = CSL_EDMA_REGION_GLOBAL;
chParam.chaNum = CSL_EDMA_CHA0;
chHndl = CSL_edmaChannelOpen(&ChObj,
CSL_EDMA_0,
&chParam,
&edmaStatus);
status = CSL_edmaChannelMapParamEntry(chHndl, 6);
@endverbatim
*
* ===========================================================================
*/
//#pragma CODE_SECTION (CSL_edmaChannelMapParamEntry, ".text:csl_section:edma");
CSL_IDEF_INLINE CSL_Status CSL_edmaChannelMapParamEntry(
/** a handle to the requested channel instance of the specified EDMA
* obtained through the @a CSL_edmaChannelOpen() call */
CSL_EdmaChanHandle hEdma,
/** Param entry number */
Uint32 paramEntry
)
{
if (hEdma->chaNum < CSL_EDMA_NUM_DMACH) {
#if CSL_EDMA_CHMAPEXIST
CSL_FINS(hEdma->ccregs->DCHMAP[hEdma->chaNum], EDMACC_DCHMAP_PAENTRY,\
paramEntry);
#endif
} else
hEdma->ccregs->QCHMAP[hEdma->chaNum-CSL_EDMA_NUM_DMACH] = \
CSL_FMK(EDMACC_QCHMAP_PAENTRY,paramEntry) | \
CSL_FMK(EDMACC_QCHMAP_TRWORD,7);
return CSL_SOK;
}
/** =============================================================================
* @n@b CSL_edmaChannelSetTrigWord
*
* @b Description
* @n This API maps the channel to paRam entry
*
* @b Arguments
* @verbatim
hCh Channel Handle
@endverbatim
*
* <b> Return Value CSL_Status
* @li CSL_SOK - Always returns
*
* <b> Pre Condition </b>
* @n @a CSL_edmaInit() must be called successfully.
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
*
* <b> Usage Constraints: </b>
* All @a CSL_edmaInit(), @a CSL_edmaOpen(), @a CSL_edmaChannelOpen() must be
* invoked successfully in that order before @a CSL_edmaChannelSetTrigWord() can
* be invoked. If the channel is opened in context of a Region, @a
* CSL_edmaRegionOpen() may also need to be invoked before this API.
*
*
* @b Example:
* @verbatim
CSL_EdmaChanObj ChObj;
CSL_EdmaChanHandle chHndl;
CSL_EdmaHwChannelSetup chParam;
CSL_EdmaHandle hModHndl;
CSL_Status modStatus;
Uint32 paramMap;
// Initialization
modStatus = CSL_edmaInit(NULL);
...
// Open Module
hModHndl = CSL_edmaOpen(NULL,CSL_EDMA_0,NULL,&modStatus);
// Open Channel 0
chParam.regionNum = CSL_EDMA_REGION_GLOBAL;
chParam.chaNum = CSL_EDMA_CHA0;
chHndl = CSL_edmaChannelOpen(&ChObj,
CSL_EDMA_0,
&chParam,
&edmaStatus);
// Setting the Trigger word to be te last one
status = CSL_edmaChannelSetTrigWord(chHndl, 7);
@endverbatim
*
* ===========================================================================
*/
//#pragma CODE_SECTION (CSL_edmaChannelSetTrigWord, ".text:csl_section:edma");
CSL_IDEF_INLINE CSL_Status CSL_edmaChannelSetTrigWord(
/** a handle to the requested channel instance of the specified EDMA
* obtained through the @a CSL_edmaChannelOpen() call */
CSL_EdmaChanHandle hEdma,
/** trigger word */
Uint32 trigWord
)
{
if (hEdma->chaNum < CSL_EDMA_NUM_DMACH)
return CSL_ESYS_INVPARAMS;
else
CSL_FINS(hEdma->ccregs->QCHMAP[hEdma->chaNum - CSL_EDMA_NUM_DMACH],
EDMACC_QCHMAP_TRWORD, trigWord);
return CSL_SOK;
}
/** =============================================================================
* @n@b CSL_edmaChannelSetEvtQue
*
* @b Description
* @n Sets the Channel to the Event Queue specified
*
* @b Arguments
* @verbatim
hCh Channel Handle
@endverbatim
*
* <b> Return Value CSL_Status
* @li CSL_SOK - Always returns
*
* <b> Pre Condition </b>
* @n @a CSL_edmaInit() must be called successfully.
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
*
* <b> Usage Constraints: </b>
* All @a CSL_edmaInit(), @a CSL_edmaOpen(), @a CSL_edmaChannelOpen() must be
* invoked successfully in that order before @a CSL_edmaChannelSetEvtQue() can
* be invoked. If the channel is opened in context of a Region,
* @a CSL_edmaRegionOpen() may also need to be invoked before this API.
*
*
* @b Example:
* @verbatim
CSL_EdmaChanObj ChObj;
CSL_EdmaChanHandle chHndl;
CSL_EdmaHwChannelSetup chParam;
CSL_EdmaHandle hModHndl;
CSL_Status modStatus;
Uint32 paramMap;
// Initialization
modStatus = CSL_edmaInit(NULL);
...
// Open Module
hModHndl = CSL_edmaOpen(NULL,CSL_EDMA_0,NULL,&modStatus);
// Open Channel 0
chParam.regionNum = CSL_EDMA_REGION_GLOBAL;
chParam.chaNum = CSL_EDMA_CHA0;
chHndl = CSL_edmaChannelOpen(&ChObj,
CSL_EDMA_0,
&chParam,
&edmaStatus);
// EDMA Chanbnel 0 is submitted to Event queue 3
status = CSL_edmaChannelSetEvtQue(chHndl, CSL_EDMA_EVT_QUE3);
@endverbatim
*
* ===========================================================================
*/
//#pragma CODE_SECTION (CSL_edmaChannelSetEvtQue, ".text:csl_section:edma");
CSL_IDEF_INLINE CSL_Status CSL_edmaChannelSetEvtQue(
/** a handle to the requested channel instance of the specified EDMA
* obtained through the @a CSL_edmaChannelOpen() call */
CSL_EdmaChanHandle hEdma,
/** event queue number
*/
CSL_EdmaEventQueue evtQue
)
{
Uint32 _cha, _qNumIndex, _qchMap;
if (hEdma->chaNum >= CSL_EDMA_NUM_DMACH) {
/* Extracting the Channel Number in case of QDMA */
_cha = hEdma->chaNum - CSL_EDMA_NUM_DMACH;
/* Channel to Event Queue mapping */
CSL_FINSR(hEdma->ccregs->QDMAQNUM,_cha*4 + 2,_cha*4,evtQue);
} else {
/* Finding out the relevant DMAQNUM register and the correct bit positions to
write into */
_qNumIndex = hEdma->chaNum >> 3;
_qchMap = hEdma->chaNum - (_qNumIndex * 8);
CSL_FINSR(hEdma->ccregs->DMAQNUM[_qNumIndex],_qchMap*4+2,_qchMap*4,evtQue);
}
return CSL_SOK;
}
/**
@}
*/
/**
@addtogroup CSL_EDMA_FUNCTION_MODULE_INTERNAL
@{
*/
/** =============================================================================
* @n@b CSL_edmaGetRevision
*
* @b Description
* @n Gets the status of the different operations or the current setup of EDMA
* module
*
* @b Arguments
* @verbatim
hCh Channel Handle
@endverbatim
*
* <b> Return Value <b/>
* revision Revision of Module
*
* <b> Pre Condition </b>
* @n @a CSL_edmaInit() must be called successfully.
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
*
* <b> Usage Constraints: </b>
* All @a CSL_edmaInit(), @a CSL_edmaOpen(), must be
* called successfully in that order before @a CSL_edmaGetRevision() can
* be called.
*
*
* @b Example:
* @verbatim
CSL_EdmaHandle edmaHndl;
CSL_Status modStatus;
// Initialize
modStatus = CSL_edmaInit(NULL);
...
edmaHndl = CSL_edmaOpen(NULL,CSL_EDMA_0,NULL,&modStatus);
revision = CSL_edmaGetRevision(edmaHndl);
@endverbatim
*
* ===========================================================================
*/
//pragma CODE_SECTION (CSL_edmaGetRevision, ".text:csl_section:edma");
CSL_IDEF_INLINE Uint32 CSL_edmaGetRevision(
/** module handle to EDMA module */
CSL_EdmaHandle hMod
)
{
return (hMod->REV);
}
/** =============================================================================
* @n@b CSL_edmaGetEventsMissed
*
* @b Description
* @n Queries all the events missed.
*
* @b Arguments
* @verbatim
hMod Module Handle
Uint32 Since there may be upto 64 EDMA channels + upto 8 QDMA channels,
* this points to an array of 3, 32 bit elements to hold
* all 64 + 8 event missed status bits.
* missed [0] - holds status from EMR
* missed [1] - holds status from EMRH
* missed [2] - holds status from QEMR
@endverbatim
*
* <b> Return Value <b/>
* edmaStatus CSL_SOK - Alwaya returns
*
* <b> Pre Condition </b>
* @n @a CSL_edmaInit() must be called successfully.
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* <b> Usage Constraints: </b>
* All @a CSL_edmaInit(), @a CSL_edmaOpen(), must be
* called successfully in that order before @a CSL_edmaGetEventsMissed() can
* be called.
*
*
* @b Example:
* @verbatim
CSL_EdmaHandle edmaHndl;
CSL_Status modStatus;
Uint32 missedEdma,missedEdmaHi,missedQdma;
// Initialize
modStatus = CSL_edmaInit(NULL);
...
edmaHndl = CSL_edmaOpen(NULL,CSL_EDMA_0,NULL,&modStatus);
// Get missed events
edmaStatus = CSL_edmaGetEventsMissed(edmaHndl,
&missedEdma,
&missedEdmaHi,
&missedQdma
);
@endverbatim
*
* ===========================================================================
*/
//#pragma CODE_SECTION (CSL_edmaGetEventsMissed, ".text:csl_section:edma");
CSL_IDEF_INLINE CSL_Status CSL_edmaGetEventsMissed(
/** module handle to EDMA */
CSL_EdmaHandle hMod,
/** a place holder for 0-31 events */
CSL_BitMask32 *missedLo,
/** a place holder for 32-63 events */
CSL_BitMask32 *missedHi,
/** a place holder for QDMA events */
CSL_BitMask32 *missedQdma
)
{
/* Reading the missed Status registers */
*missedLo = hMod->EMR;
*missedHi = hMod->EMRH ;
*missedQdma = hMod->QEMR ;
/* Clearing the status registers */
hMod->EMCR = *missedLo;
hMod->EMCRH = *missedHi;
hMod->QEMCR = *missedQdma;
return CSL_SOK;
}
/** =============================================================================
* @n@b CSL_edmaGetControllerError
*
* @b Description
* @n Queries the Channel controller Error Status.
*
* @b Arguments
* @verbatim
hMod Module Handle
ccStat this points to a structure allocated by the user program
that can hold the queried status values.
@endverbatim
*
* <b> Return Value <b/>
* Status CSL_SOK - Alwaya returns
*
* <b> Pre Condition </b>
* @n @a CSL_edmaInit() must be called successfully.
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
*
* <b> Usage Constraints: </b>
* All @a CSL_edmaInit(), @a CSL_edmaOpen(), must be
* called successfully in that order before @a CSL_edmaGetControllerError() can
* be called.
*
*
* @b Example:
* @verbatim
CSL_EdmaHandle edmaHndl;
CSL_Status modStatus;
CSL_EdmaccStatus ccError;
// Initialize
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -