⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csl_dmaxaux.h

📁 基于ti tms320c672x下音频开发例子程式
💻 H
📖 第 1 页 / 共 3 页
字号:
        if (*(hDmax->hiTableEventEntryPtr) != 0) {
	        eventCtl = *(hDmax->hiTableEventEntryPtr);
	        tmpPtr = (Uint32 *)(hDmax->regs->HiMaxParam);
        } else {
            eventCtl = *(hDmax->loTableEventEntryPtr);
	        tmpPtr = (Uint32 *)(hDmax->regs->LoMaxParam);            
        }
        etype = CSL_FEXT(eventCtl, DMAX_EVENT0_ETYPE);
        /* Make sure we have a valid FIFO event */          
        if ((etype == CSL_DMAX_EVENT0_ETYPE_FIFOREAD) 
           || (etype == CSL_DMAX_EVENT0_ETYPE_FIFOWRITE)){
	       tmpPtr += (hDmax->paramPtr) * CSL_DMAX_WORD_SIZE;
	       fifoObj = (CSL_DmaxFifoDesc *)(((CSL_DmaxFifoParam *)tmpPtr)->pfd);
	       fifoObj->efield = 0x00000000u;
       }
}

/** ============================================================================
 *   @n@b CSL_dmaxWatermarkEnable
 *
 *   @b Description
 *   @n Sets the the Watermark enable bit in the event entry associated
 *      with 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_dmaxWatermarkEnable (hDmax);

     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_dmaxWatermarkEnable (
    /** Pointer to the object that holds reference to the
     *  instance of DMAX requested after the call
     */
    CSL_DmaxHandle        hDmax

)
{
		Uint32 	tmpEv;
	
        if (*(hDmax->hiTableEventEntryPtr) != 0) {
	        tmpEv = *(hDmax->hiTableEventEntryPtr);
	        tmpEv |= CSL_DMAX_EVENT0_WMENAB_MASK;
	        *(hDmax->hiTableEventEntryPtr) = tmpEv;
        } else {
	        tmpEv = *(hDmax->loTableEventEntryPtr);
	        tmpEv |= CSL_DMAX_EVENT0_WMENAB_MASK;
	        *(hDmax->loTableEventEntryPtr) = tmpEv;
        }
}

/** ============================================================================
 *   @n@b CSL_dmaxWatermarkDisable
 *
 *   @b Description
 *   @n Clears the the Watermark enable bit in the event entry associated
 *      with 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_dmaxWatermarkDisable (hDmax);

     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_dmaxWatermarkDisable (
    /** Pointer to the object that holds reference to the
     *  instance of DMAX requested after the call
     */
    CSL_DmaxHandle        hDmax

)
{
		Uint32 	tmpEv;
	
        if (*(hDmax->hiTableEventEntryPtr) != 0) {
	        tmpEv = *(hDmax->hiTableEventEntryPtr);
	        tmpEv &= (~CSL_DMAX_EVENT0_WMENAB_MASK);
	        *(hDmax->hiTableEventEntryPtr) = tmpEv;
        } else {
	        tmpEv = *(hDmax->loTableEventEntryPtr);
	        tmpEv &= (~CSL_DMAX_EVENT0_WMENAB_MASK);
	        *(hDmax->loTableEventEntryPtr) = tmpEv;
        }
}

/** ============================================================================
 *   @n@b CSL_dmaxGetEventFlag
 *
 *   @b Description
 *   @n Returns status of event flag in EFR register.
 *
 *   @b Arguments
 *   @verbatim

            hDmax           Handle to DMAX instance

            response        Placeholder to return status.

     @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_dmaxGetEventFlag (hDMAX, &response);

     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_dmaxGetEventFlag (
    /** Pointer to the object that holds reference to the
     *  instance of DMAX requested after the call
     */
    CSL_DmaxHandle        hDmax,

    /** Placeholder to return the status. @a void* casted */
    void                 *arg
)
{
	Uint8 flag;
	Uint32 mask;
	
	flag = (hDmax->eventUid) & 0xFFFFu;
	mask = 1u << flag;
	*((Uint32 *)arg) = (((hDmax->regs->DEFR) & mask) >> flag) & 0x1u;
}

/** ============================================================================
 *   @n@b CSL_dmaxGetTcc
 *
 *   @b Description
 *   @n Returns the right-shifted value of the TCC bit associated with this
 *      event.
 *
 *   @b Arguments
 *   @verbatim

            hDmax           Handle to DMAX instance

            response        Placeholder to return status.

     @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_dmaxGetTcc (hDmax, &response);

     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_dmaxGetTcc (
    /** Pointer to the object that holds reference to the
     *  instance of DMAX requested after the call
     */
    CSL_DmaxHandle        hDmax,

    /** Placeholder to return the status. @a void* casted */
    void                 *response
)
{
	Uint16 		flag;
	Uint32 		tmpReg;
	
	if (*(hDmax->hiTableEventEntryPtr) != 0) {
		tmpReg = *(hDmax->hiTableEventEntryPtr);
	} else if(*(hDmax->loTableEventEntryPtr) != 0){
		tmpReg = *(hDmax->loTableEventEntryPtr);
	}
	flag = CSL_FEXT(tmpReg, DMAX_EVENT0_TCC);
	flag = 1u << flag;
	if (flag <= CSL_DMAX_TCC_SPLIT) {
		tmpReg = hDmax->regs->DTCR0;
	} else {
		flag = flag >> 8;
		tmpReg = hDmax->regs->DTCR1;
	}
	tmpReg &= flag;
	*((Uint32 *)response) =(Uint32) tmpReg;
}

/** ============================================================================
 *   @n@b CSL_dmaxGetTc
 *
 *   @b Description
 *   @n Returns right-shifted value of transfer complete flag.
 *
 *   @b Arguments
 *   @verbatim

            hDmax           Handle to DMAX instance

            response        Placeholder to return status.

     @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_dmaxGetTc (hDmax, &response);

     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_dmaxGetTc (
    /** Pointer to the object that holds reference to the
     *  instance of DMAX requested after the call
     */
    CSL_DmaxHandle        hDmax,

    /** Placeholder to return the status. @a void* casted */
    void                 *response
)
{
	*((Uint32 *)response) = CSL_FEXT(hDmax->regs->DTCR1 , DMAX_CPUINT8);
}

/** ============================================================================
 *   @n@b CSL_dmaxGetFmsc
 *
 *   @b Description
 *   @n Returns the value of FIFO Full mark condition flag.
 *
 *   @b Arguments
 *   @verbatim

            hDmax           Handle to DMAX instance

            response        Placeholder to return status.

     @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_dmaxGetFmsc (hDmax, &response);

     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_dmaxGetFmsc (
    /** Pointer to the object that holds reference to the
     *  instance of DMAX requested after the call
     */
    CSL_DmaxHandle        hDmax,

    /** Placeholder to return the status. @a void* casted */
    void                 *response
)
{
	Uint16 				flag;
	Uint16 				etype;
	Uint32 				eventCtl;
	Uint32 				mask;
	Uint32 				tmpReg;
	Uint32 				*tmpPtr;
	CSL_DmaxFifoDesc 	*fifoObj;
	
    
        if (*(hDmax->hiTableEventEntryPtr) != 0) {
	        eventCtl = *(hDmax->hiTableEventEntryPtr);
	        tmpPtr = (Uint32 *)(hDmax->regs->HiMaxParam);
        } else {
            eventCtl = *(hDmax->loTableEventEntryPtr);
	        tmpPtr = (Uint32 *)(hDmax->regs->LoMaxParam);            
        }
        etype = CSL_FEXT(eventCtl, DMAX_EVENT0_ETYPE);
        /* Make sure we have a valid FIFO event */          
        if ((etype == CSL_DMAX_EVENT0_ETYPE_FIFOREAD) 
           || (etype == CSL_DMAX_EVENT0_ETYPE_FIFOWRITE)){
	       tmpPtr += (hDmax->paramPtr) * CSL_DMAX_WORD_SIZE;
	       fifoObj = (CSL_DmaxFifoDesc *)(((CSL_DmaxFifoParam *)tmpPtr)->pfd);
	       flag = CSL_FEXT(fifoObj->fmark, DMAX_FIFODESC_FMSC);
	       mask = 1u << flag;
	       if (mask <= CSL_DMAX_TCC_SPLIT) {
		       tmpReg = hDmax->regs->DFSR0;
	       } else {
		       mask = mask >> 8;
		       flag = flag - 8;
		       tmpReg = hDmax->regs->DFSR1;
           }
           *((Uint32 *)response) = ((tmpReg & mask) >> flag) & 0x1u;  
       }
}


/** ============================================================================
 *   @n@b CSL_dmaxGetEmsc
 *
 *   @b Description
 *   @n Returns the value of FIFO Empty mark condition flag.
 *
 *   @b Arguments
 *   @verbatim

            hDmax           Handle to DMAX instance

            response        Placeholder to return status.

     @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_dmaxGetEmsc (hDmax, &response);

     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_dmaxGetEmsc (
    /** Pointer to the object that holds reference to the
     *  instance of DMAX requested after the call
     */
    CSL_DmaxHandle        hDmax,

    /** Placeholder to return the status. @a void* casted */
    void                 *response
)
{
	Uint16 flag;
	Uint16 etype;
	Uint32 mask;
	Uint32 eventCtl;
	Uint32 tmpReg;
	Uint32 *tmpPtr;
	CSL_DmaxFifoDesc *fifoObj;
	
        if (*(hDmax->hiTableEventEntryPtr) != 0) {
	        eventCtl = *(hDmax->hiTableEventEntryPtr);
	        tmpPtr = (Uint32 *)(hDmax->regs->HiMaxParam);
        } else {
            eventCtl = *(hDmax->loTableEventEntryPtr);
	        tmpPtr = (Uint32 *)(hDmax->regs->LoMaxParam);            
        }
        etype = CSL_FEXT(eventCtl, DMAX_EVENT0_ETYPE);
        /* Make sure we have a valid FIFO event */          
        if ((etype == CSL_DMAX_EVENT0_ETYPE_FIFOREAD) 
           || (etype == CSL_DMAX_EVENT0_ETYPE_FIFOWRITE)){
	       tmpPtr += (hDmax->paramPtr) * CSL_DMAX_WORD_SIZE;
	       fifoObj = (CSL_DmaxFifoDesc *)(((CSL_DmaxFifoParam *)tmpPtr)->pfd);
	       flag = CSL_FEXT(fifoObj->emark, DMAX_FIFODESC_EMSC);
	       mask = 1u << flag;
	       if (mask <= CSL_DMAX_TCC_SPLIT) {
		       tmpReg = hDmax->regs->DFSR0;
	       } else {
		       mask = mask >> 8;
		       flag = flag - 8;
		       tmpReg = hDmax->regs->DFSR1;
           }
           *((Uint32 *)response) = ((tmpReg & mask) >> flag) & 0x1u;  
       }
}


/** ============================================================================
 *   @n@b CSL_dmaxGetFifoError
 *
 *   @b Description
 *   @n Checks INT7 for FIFO Error.
 *
 *   @b Arguments
 *   @verbatim

            hDmax           Handle to DMAX instance

            response        Placeholder to return status.

     @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_dmaxGetFifoError (hDmax, &response);

     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_dmaxGetFifoError (
    /** Pointer to the object that holds reference to the
     *  instance of DMAX requested after the call
     */
    CSL_DmaxHandle        hDmax,

    /** Placeholder to return the status. @a void* casted */
    void                 *response
)
{
	Uint32 tmpReg;
    
	tmpReg = CSL_DMAX_CPUINT_REG;
	*((Uint32 *)response) = CSL_FEXT(tmpReg, DMAX_ESR_FIFOERR);
}

/** ============================================================================
 *   @n@b CSL_dmaxGetFifoErrorCode
 *
 *   @b Description
 *   @n Returns the value of the FIFO Error code (EFIELD) in FIFO descriptor.
 *
 *   @b Arguments
 *   @verbatim

            hDmax           Handle to DMAX instance

            response        Placeholder to return status.

     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -