📄 csl_dmaxaux.h
字号:
/* ============================================================================
* Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005, 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_dmaxAux.h
*
* @brief Header file for functional layer of CSL
*
* Description
* - The defines inline function definitions
*
* Modification 1
* - Modified on: 11/Mar/2005
* - Reason: created the sources
*
* @author asr.
*/
#ifndef _CSL_DMAXAUX_H_
#define _CSL_DMAXAUX_H_
#include <csl_dmax.h>
#ifdef __cplusplus
extern "C" {
#endif
extern far cregister volatile unsigned int IFR;
extern far cregister volatile unsigned int OUT;
#define CSL_DMAX_CPUINT_REG IFR
/**
* Control Functions of dmax.
*/
/** ============================================================================
* @n@b CSL_dmaxSetPriority
*
* @b Description
* @n Sets the appropriate bit in the EHPR or ELPR registers to set priority
* for the event.
* @b Arguments
* @verbatim
hDmax Handle to DMAX instance
@endverbatim
*
* <b> Return Value </b> None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_dmaxEnable (hDmax);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_dmaxSetPriority (
CSL_DmaxHandle hDmax,
void *arg
)
{
Uint16 flag;
Uint32 mask;
flag = hDmax->eventUid & 0xFFFF;
mask = 1u << flag;
if ((*(Int *)arg) == CSL_DMAX_EVENT_HI_PRIORITY) {
hDmax->regs->DEHPR = mask;
} else {
hDmax->regs->DELPR = mask;
}
}
/** ============================================================================
* @n@b CSL_dmaxSetPolarity
*
* @b Description
* @n Sets the appropriate bit in the EHPR or ELPR registers to set priority
* for the event.
* @b Arguments
* @verbatim
hDmax Handle to DMAX instance
@endverbatim
*
* <b> Return Value </b> None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_dmaxSetPolarity (hDmax);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_dmaxSetPolarity (
CSL_DmaxHandle hDmax,
void *arg
)
{
Uint16 flag;
Uint32 mask;
flag = hDmax->eventUid & 0xFFFF;
mask = ((*(Uint32 *)arg) == CSL_DMAX_POLARITY_RISING_EDGE) << flag;
hDmax->regs->DEPR = mask;
}
/** ============================================================================
* @n@b CSL_dmaxEventEnable
*
* @b Description
* @n Enables the event..
*
* @b Arguments
* @verbatim
hDmax Handle to DMAX instance
@endverbatim
*
* <b> Return Value </b> None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_dmaxEventEnable (hDmax);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_dmaxEventEnable (
CSL_DmaxHandle hDmax
)
{
Uint16 flag;
Uint32 mask;
flag = hDmax->eventUid & 0xFFFF;
mask = 1u << flag;
hDmax->regs->DEER = mask;
}
/** ============================================================================
* @n@b CSL_dmaxClearTcc
*
* @b Description
* @n Clears TCC bit for this event.
*
* @b Arguments
* @verbatim
hDmax Handle to DMAX instance
@endverbatim
*
* <b> Return Value </b> None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_dmaxClearTcc (hDmax);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_dmaxClearTcc (
CSL_DmaxHandle hDmax
)
{
Uint16 flag;
Uint32 tmpReg;
if (*(hDmax->hiTableEventEntryPtr) != 0) {
tmpReg = *(hDmax->hiTableEventEntryPtr);
flag = CSL_FEXT(tmpReg, DMAX_EVENT0_TCC);
flag = 1u << flag;
if (flag <= CSL_DMAX_TCC_SPLIT) {
hDmax->regs->DTCR0=flag;
} else {
flag = flag >> 8;
hDmax->regs->DTCR1=flag;
}
} else if (*(hDmax->loTableEventEntryPtr) != 0){
tmpReg = *(hDmax->loTableEventEntryPtr);
flag = CSL_FEXT(tmpReg, DMAX_EVENT0_TCC);
flag = 1u << flag;
if (flag <= CSL_DMAX_TCC_SPLIT) {
hDmax->regs->DTCR0=flag;
} else {
flag = flag >> 8;
hDmax->regs->DTCR1=flag;
}
}
}
/** ============================================================================
* @n@b CSL_dmaxEventDisable
*
* @b Description
* @n Disables the event.
*
* @b Arguments
* @verbatim
hDmax Handle to DMAX instance
@endverbatim
*
* <b> Return Value </b> None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_dmaxEventDisable (hDmax);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_dmaxEventDisable (
CSL_DmaxHandle hDmax
)
{
Uint16 flag;
Uint32 mask;
flag = hDmax->eventUid & 0xFFFF;
mask = 1u << flag;
hDmax->regs->DEDR = mask;
}
/** ============================================================================
* @n@b CSL_dmaxClearEventEntry
*
* @b Description
* @n Clears event entry for this event.
*
* @b Arguments
* @verbatim
*
* hDmax Handle to DMAX instance
*
* @endverbatim
*
* <b> Return Value </b> None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_dmaxClearEventEntry (hDmax);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_dmaxClearEventEntry (
CSL_DmaxHandle hDmax
)
{
hDmax->hiTableEventEntryPtr = 0;
hDmax->loTableEventEntryPtr = 0;
}
/** ============================================================================
* @n@b CSL_dmaxClearParameterEntry
*
* @b Description
* @n Clears parameter table entry for this event.
*
* @b Arguments
* @verbatim
hDmax Handle to DMAX instance
@endverbatim
*
* <b> Return Value </b> None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_dmaxClearParameterEntry (hDmax);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_dmaxClearParameterEntry (
CSL_DmaxHandle hDmax
)
{
CSL_DmaxParameterEntry *tmpPtr;
if (*(hDmax->hiTableEventEntryPtr) != 0) {
tmpPtr = (CSL_DmaxParameterEntry*)
(&(hDmax->regs->HiMaxParam));
} else {
tmpPtr = (CSL_DmaxParameterEntry*)
(&(hDmax->regs->LoMaxParam));
}
/*
* :KLUDGE: KSB Nov 13,2004
* For dmax Event Entries the parameter table offset is expressed
* as the number of dmax word offsets from the top of the Parameter
* Table RAM. So address caluclation is done in bytes first and
* then cast to entry type.
*/
tmpPtr = (CSL_DmaxParameterEntry *)(((Uint8 *)tmpPtr)
+ ((hDmax->paramPtr) * CSL_DMAX_WORD_SIZE));
tmpPtr->word0 = 0;
tmpPtr->word1 = 0;
tmpPtr->word2 = 0;
tmpPtr->word3 = 0;
tmpPtr->word4 = 0;
tmpPtr->word5 = 0;
tmpPtr->word6 = 0;
tmpPtr->word7 = 0;
tmpPtr->word8 = 0;
tmpPtr->word9 = 0;
tmpPtr->word10 = 0;
}
/** ============================================================================
* @n@b CSL_dmaxStartAsyncTransfer
*
* @b Description
* @n This function initiates a dmax data transfer by toggling the
* appropriate bit in the ESR (Event Set Register) register.
*
* @b Arguments
* @verbatim
hDmax Handle to Dmax instance
@endverbatim
*
* <b> Return Value </b> None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_dmaxStartAsyncTransfer (hDmax);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_dmaxStartAsyncTransfer (
CSL_DmaxHandle hDmax
)
{
Uint16 flag;
Uint32 mask;
Uint32 polarity;
flag = ((hDmax->eventUid) >> 16) & 0x00FF;
if (flag != CSL_DMAX_BAD_ESR_FLAG) {
mask = 1u << flag;
polarity = (hDmax->regs->DEPR) & (1u << (hDmax->eventUid & 0xFF));
if (polarity != 0) {
CSL_dmaxSetDetr(0);
CSL_dmaxSetDetr(mask);
} else {
CSL_dmaxSetDetr(mask);
CSL_dmaxSetDetr(0);
}
}
}
/** ============================================================================
* @n@b CSL_dmaxClearFifoStatus
*
* @b Description
* @n Clears FIFO Error code (EFIELD) in FIFO descriptor.
*
* @b Arguments
* @verbatim
hDmax Handle to DMAX instance
@endverbatim
*
* <b> Return Value </b> None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_dmaxClearFifoStatus (hDmax);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_dmaxClearFifoStatus (
CSL_DmaxHandle hDmax
)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -