📄 csl_idma.c
字号:
* "byteCnt" bytes of the "fill_value" to destination "dst".
*
* @b Arguments
* @verbatim
dst Pointer to the destination address
byteCnt Number of bytes to be transferred.
fill_value Data to be filled
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n The hardware registers of IDMA.
*
* @b Example
* @verbatim
Uint32 dst1[100];
...
IDMA1_fill(dst1, 0x800, 0xAAAABABA);
@endverbatim
* ============================================================================
*/
#pragma CODE_SECTION (IDMA1_fill, ".text:cslsys_section:idma");
Int IDMA1_fill (
Uint32 *dst,
Uint32 byteCnt,
Uint32 fill_value
)
{
Uint32 cs;
/* Make sure that there are no pending tyransfers before using
* this channel. This is done by reading bit "1" of the status
* register.
*/
cs = _disable_interrupts();
#ifdef PEND_SUPPORT
while (CSL_FEXT(((CSL_IdmaRegs*)CSL_IDMA_0_REGS)->IDMA1_STAT,
IDMA_IDMA1_STAT_PEND));
#endif
/*
* Poke in "fill_value" into source and destination in the
* "dst". Poke in the count into the "COUNT" field.
*/
((CSL_IdmaRegs*)CSL_IDMA_0_REGS)->IDMA1_SRC = fill_value;
((CSL_IdmaRegs*)CSL_IDMA_0_REGS)->IDMA1_DST = (Uint32) dst;
((CSL_IdmaRegs*)CSL_IDMA_0_REGS)->IDMA1_CNT = ( (byteCnt& 0xFFFC) |
idma1_handle_priv.cnt | CSL_IDMA_IDMA1_CNT_FILL_MASK );
_restore_interrupts(cs);
return(0);
}
/** ===========================================================================
* @n@b IDMA1_getStatus
*
* @b Description
* @n IDMA1_getStatus() gets the active and pending status of IMDA
* Channel 1 and returns ACTV in the least significant bit and PEND
* in the 2nd least significant bit
*
* Gets the active and pending status of IDMA channel 1
*
* @b Arguments
* @n None
*
* <b> Return Value </b> IDMA channel 1 status.
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
Uint32 stat;
...
stat = IDMA1_getStatus();
@endverbatim
* ============================================================================
*/
#pragma CODE_SECTION (IDMA1_getStatus, ".text:cslsys_section:idma");
Uint32 IDMA1_getStatus(void)
{
return (((CSL_IdmaRegs*)CSL_IDMA_0_REGS)->IDMA1_STAT &
(CSL_IDMA_IDMA1_STAT_PEND_MASK | CSL_IDMA_IDMA1_STAT_ACTV_MASK));
}
/** ===========================================================================
* @n@b IDMA1_wait
*
* @b Description
* @n IDMA1_wait() waits until all previous transfers for IDMA Channel
* 1 have been completed by making sure that both active and pend
* bits are zero. These are the two least significant bits of the
* status register for the channel.
*
* Waits until previous transfers have completed for IDMA channel 1
* before returning.
*
* @b Arguments
* @n None
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
Uint32 stat;
...
stat = IDMA1_getStatus();
IDMA1_wait();
@endverbatim
* ============================================================================
*/
#pragma CODE_SECTION (IDMA1_wait, ".text:cslsys_section:idma");
void IDMA1_wait (void)
{
Uint32 cs;
cs = _disable_interrupts();
while (((CSL_IdmaRegs*)CSL_IDMA_0_REGS)->IDMA1_STAT &
(CSL_IDMA_IDMA1_STAT_PEND_MASK | CSL_IDMA_IDMA1_STAT_ACTV_MASK));
_restore_interrupts(cs);
}
/** ===========================================================================
* @n@b IDMA1_setPriority
*
* @b Description
* @n IDMA1_setPriority() set a "3-bit" priority field which has
* a valid range of 0-7 for priorities 0-7. It returns the a
* "32-bit" count register field back to the user. This 32-bit
* register field will be used in IDMA1_copy() and IDMA1_fill()
* to program the Priority and Interrupt options for IDMA Chan 1
*
* Set the priority level for IDMA channel 1 transfers
*
* @b Arguments
* @verbatim
priority Priority 0-7 of handle
@endverbatim
*
* <b> Return Value </b> idma1_handle_priv.cnt
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
Uint32 tempCnt;
...
// Set and test Priority level for IDMA1
tempCnt = IDMA1_setPriority(IDMA_PRI_2);
@endverbatim
* ============================================================================
*/
#pragma CODE_SECTION (IDMA1_setPriority, ".text:cslsys_section:idma");
Int IDMA1_setPriority (
IDMA_priSet priority
)
{
Uint32 Priority;
Uint32 cs;
cs = _disable_interrupts();
Priority = ((Uint32)priority << CSL_IDMA_IDMA1_CNT_PRI_SHIFT)
& CSL_IDMA_IDMA1_CNT_PRI_MASK;
idma1_handle_priv.cnt =
(idma1_handle_priv.cnt & CSL_IDMA_IDMA1_CNT_INT_MASK) | Priority;
_restore_interrupts(cs);
return (idma1_handle_priv.cnt);
}
/** ===========================================================================
* @n@b IDMA1_setInt
*
* @b Description
* @n IDMA1_setInt() set a the interrupt enable field which
* is used to enable/disable interrupts for IDMA Channel 1.
* It returns the a "32-bit" count register field back to the
* user. This 32-bit register field will be used in IDMA1_copy()
* and IDMA1_fill() to program the Priority and Interrupt options
* for IDMA Channel 1
*
* Enables/Disables interrupt event generation for IDMA channel 1
* transfers
*
* @b Arguments
* @verbatim
interr interrupt event generated on/off
@endverbatim
*
* <b> Return Value </b> idma1_handle_priv.cnt
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
Uint32 tempCnt;
...
// Set and test Interrupt event gen for IDMA1
tempCnt = IDMA1_setInt(IDMA_INT_DIS);
@endverbatim
* ============================================================================
*/
#pragma CODE_SECTION (IDMA1_setInt, ".text:cslsys_section:idma");
Int IDMA1_setInt (
IDMA_intEn interr
)
{
Uint32 Interrupt;
Uint32 cs;
cs = _disable_interrupts();
Interrupt = ((Uint32)interr << CSL_IDMA_IDMA1_CNT_INT_SHIFT)
& CSL_IDMA_IDMA1_CNT_INT_MASK;
idma1_handle_priv.cnt =
(idma1_handle_priv.cnt & CSL_IDMA_IDMA1_CNT_PRI_MASK) | Interrupt;
_restore_interrupts(cs);
return (idma1_handle_priv.cnt);
}
/** ===========================================================================
* @n@b IDMA0_init
*
* @b Description
* @n This function obtains a interrupt enable setting and
* remembers them so that all future transfers on Channel 0
* generate interrupts or not.
* Initializes the Interrupt Event Generation for IDMA Channel 0
*
* @b Arguments
* @verbatim
interr interrupt event generated on/off
@endverbatim
*
* <b> Return Value </b> idma0_configHandle_priv.cnt
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
Uint32 cnt0;
...
// Initialize IDMA Channel 0
// Set Chan 0 to have Interrupt Event Gen On
cnt0 = IDMA0_init(IDMA_INT_EN);
@endverbatim
* ============================================================================
*/
#pragma CODE_SECTION (IDMA0_init, ".text:cslsys_section:idma");
Int IDMA0_init (
IDMA_intEn interr
)
{
Uint32 Interrupt;
Uint32 cs;
/* Move the interrupt enable bit "interr" into the right
* locations in the count register, namely bit 28. Remember
* this 32-bit field in the local handle
* "idma0_configHandle_priv.cnt
*/
cs = _disable_interrupts();
Interrupt = ((Uint32)interr << CSL_IDMA_IDMA0_CNT_INT_SHIFT)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -