📄 csl_edmaaux.h
字号:
/* ============================================================================
* Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005
*
* Use of this software is controlled by the terms and conditions found in the
* license agreement under which this software has been supplied.
* ===========================================================================
*/
/** @file csl_edmaAux.h
*
* @brief Header file for functional layer CSL of EDMA
*
* Description
* - This file contains inline functions definitions.
*/
/* ==========================================================
* @file csl_edmaAux.h
*
* @brief Header file for functional layer CSL of EDMA
*
* Description
* - This file contains inline functions definitions.
*
* @path $(CSLPATH)\\src\\armedma
*
* @desc EDMA module
* Modification : 15th July 2004
* Modified function
* CSL_edmaChannelMapParamEntry to default the trigger word to 7
*
*/
#ifndef _CSL_EDMAAUX_H_
#define _CSL_EDMAAUX_H_
#include <csl_edma.h>
#include <socEdma.h>
#include <soc.h>
/**
@addtogroup CSL_EDMA_FUNCTION_CHANNEL_INTERNAL
@{
*/
//pragma CODE_SECTION (CSL_edmaChannelQueryParamMap, ".text:csl_section:edma");
/** =============================================================================
* @n@b CSL_edmaChannelQueryParamMap
*
* @b Description
* @n Queries the parameter Entry associated with the channe.
*
* @b Arguments
* @verbatim
hCh Channel Handle
@endverbatim
*
* <b> Return Value
* @li paramEntry
*
* <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_edmaChannelQueryParamMap()
* 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);
paramMap = CSL_edmaChannelQueryParamMap(chHndl);
@endverbatim
*
* ===========================================================================
*/
CSL_IDEF_INLINE Uint32 CSL_edmaChannelQueryParamMap(
/** a handle to the requested channel instance of the specified EDMA
* obtained through @a CSL_edmaChannelOpen() call */
CSL_EdmaChanHandle hEdma
)
{
Uint32 paramEntry;
if (hEdma->chaNum < CSL_EDMA_NUM_DMACH){
#if CSL_EDMA_CHMAPEXIST
paramEntry = CSL_FEXT(hEdma->ccregs->DCHMAP[hEdma->chaNum],
EDMACC_DCHMAP_PAENTRY);
#endif
} else
paramEntry =
CSL_FEXT(hEdma->ccregs->QCHMAP[hEdma->chaNum - CSL_EDMA_NUM_DMACH],
EDMACC_QCHMAP_PAENTRY);
return paramEntry;
}
/* top level control internal API */
/** =============================================================================
* @n@b CSL_edmaHwChannelEnable
*
* @b Description
* @n This API enables the event associated with the Channel
*
* @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_edmaChannelEnable() 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. If a
* Shadow region is used then care of the DRAE settings must be taken.
*
* @b Example:
* @verbatim
// Initialization
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_edmaHwChannelEnable(chHndl);
@endverbatim
*
* ===========================================================================
*/
//#pragma CODE_SECTION (CSL_edmaChannelEnable, ".text:csl_section:edma");
CSL_IDEF_INLINE CSL_Status CSL_edmaChannelEnable(
/** a handle to the EDMA channel instance obtained through
the @a CSL_edmaChannelOpen() call */
CSL_EdmaChanHandle hEdma
)
{
/* Ensure this is a normal channel and not a QDMA channel */
if (hEdma->region == -1) {
if (hEdma->chaNum >= CSL_EDMA_NUM_DMACH)
hEdma->ccregs->QEESR = (1 << (hEdma->chaNum - CSL_EDMA_NUM_DMACH));
else if (hEdma->chaNum < 32)
hEdma->ccregs->EESR = (1 << hEdma->chaNum);
else
hEdma->ccregs->EESRH = (1 << (hEdma->chaNum - 32));
} else {
if (hEdma->chaNum >= CSL_EDMA_NUM_DMACH)
hEdma->ccregs->SHADOW[hEdma->region].QEESR =
(1 << (hEdma->chaNum - CSL_EDMA_NUM_DMACH));
else if (hEdma->chaNum < 32)
hEdma->ccregs->SHADOW[hEdma->region].EESR = (1 << hEdma->chaNum);
else
hEdma->ccregs->SHADOW[hEdma->region].EESRH =
(1 << (hEdma->chaNum - 32));
}
return CSL_SOK;
}
/** =============================================================================
* @n@b CSL_edmaHwChannelDisable
*
* @b Description
* @n This API disables the event associated with the Channel
*
* @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_edmaHwChannelDisable() 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. If a
* Shadow region is used then care of the DRAE settings must be taken.
*
* @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_edmaHwChannelDisable(chHndl);
@endverbatim
*
* ===========================================================================
*/
//#pragma CODE_SECTION (CSL_edmaChannelDisable, ".text:csl_section:edma");
CSL_IDEF_INLINE CSL_Status CSL_edmaChannelDisable(
/** a handle to the requested channel instance of the specified EDMA
* obtained through the @a CSL_edmaChannelOpen() call */
CSL_EdmaChanHandle hEdma
)
{
/* Ensure this is a normal channel and not a QDMA channel */
if (hEdma->region == -1) {
if (hEdma->chaNum >= CSL_EDMA_NUM_DMACH)
hEdma->ccregs->QEECR = (1 << (hEdma->chaNum - CSL_EDMA_NUM_DMACH));
else if (hEdma->chaNum < 32)
hEdma->ccregs->EECR = (1 << hEdma->chaNum);
else
hEdma->ccregs->EECRH = (1 << (hEdma->chaNum - 32));
} else {
if (hEdma->chaNum >= CSL_EDMA_NUM_DMACH)
hEdma->ccregs->SHADOW[hEdma->region].QEECR =
(1 << (hEdma->chaNum - CSL_EDMA_NUM_DMACH));
else if (hEdma->chaNum < 32)
hEdma->ccregs->SHADOW[hEdma->region].EECR = (1 << hEdma->chaNum);
else
hEdma->ccregs->SHADOW[hEdma->region].EECRH =
(1 << (hEdma->chaNum - 32));
}
return CSL_SOK;
}
/** =============================================================================
* @n@b CSL_edmaChannelEventSet
*
* @b Description
* @n Manually triggers an EDMA event by setting the ER register
*
* @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. If a
* Shadow region is used then care of the DRAE settings must be taken.
*
* @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_edmaHwEventSet(chHndl);
@endverbatim
*
* ===========================================================================
*/
//#pragma CODE_SECTION (CSL_edmaChannelEventSet, ".text:csl_section:edma");
CSL_IDEF_INLINE CSL_Status CSL_edmaChannelEventSet(
/** a handle to the requested channel instance of the specified EDMA
* obtained through the @a CSL_edmaChannelOpen() call */
CSL_EdmaChanHandle hEdma
)
{
if (hEdma->region == -1)
{
if (hEdma->chaNum < 32)
hEdma->ccregs->ESR = (1 << hEdma->chaNum);
else if (hEdma->chaNum < CSL_EDMA_NUM_DMACH)
hEdma->ccregs->ESRH = (1 << (hEdma->chaNum - 32));
else
return CSL_ESYS_INVPARAMS;
} else {
if (hEdma->chaNum < 32)
hEdma->ccregs->SHADOW[hEdma->region].ESR = (1 << hEdma->chaNum);
else if (hEdma->chaNum < CSL_EDMA_NUM_DMACH)
hEdma->ccregs->SHADOW[hEdma->region].ESRH =
(1 << (hEdma->chaNum - 32));
else
return CSL_ESYS_INVPARAMS;
}
return CSL_SOK;
}
/** =============================================================================
* @n@b CSL_edmaChannelEventClear
*
* @b Description
* @n Clears the EDMA event by writing the ECR register for normal channels
* for QDMA channels
*
* @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_edmaChannelEventClear()
* 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. If a
* Shadow region is used then care of the DRAE settings must be taken.
*
* @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_edmaChannelEventClear(chHndl);
@endverbatim
*
* ===========================================================================
*/
//#pragma CODE_SECTION (CSL_edmaChannelEventSet, ".text:csl_section:edma");
CSL_IDEF_INLINE CSL_Status CSL_edmaChannelEventClear(
/** a handle to the requested channel instance of the specified EDMA
* obtained through the @a CSL_edmaChannelOpen() call */
CSL_EdmaChanHandle hEdma
)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -