csl_pwtaux.h

来自「dsp在音频处理中的运用」· C头文件 代码 · 共 388 行

H
388
字号
/** ============================================================================
 *   @file  csl_pwtAux.h
 *
 *   @path  $(CSLPATH)\arm\pwt\inc
 *
 *   @desc  PWT CSL implementation for ARM side
 */
 
/*  ============================================================================
 *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004
 *
 *   Use of this software is controlled by the terms and conditions found in the
 *   license agreement under which this software has been supplied.
 *   ===========================================================================
 */

/*  @(#) PSP/CSL 3.00.01.00[5912] (2004-06-01) */

/* =============================================================================
 *  Revision History
 *  ===============
 *  09-Jul-2004 sp    File Created  
 *
 * =============================================================================
 */

#ifndef _CSL_PWTAUX_H_
#define _CSL_PWTAUX_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <csl_pwt.h>

/** ============================================================================
 *   @n@b CSL_pwtGetFreqNum
 *
 *   @b Description
 *   @n This function fetches the set frequency number from the 
 *      frequency control register.  
 *
 *   @b Arguments
 *   @verbatim
 
            hPwt     	    Handle to the PWT instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  value
 *   @li    value           - Frequency selection number                   
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
            CSL_PwtFrq  num;
            ...
            num = CSL_pwtGetFreqNum (hPwt);   
 	    
     @endverbatim
 * ===========================================================================
 */
static inline
CSL_PwtFrq CSL_pwtGetFreqNum (
    CSL_PwtHandle   hPwt
)
{
    CSL_PwtFrq  value;

    value = (CSL_PwtFrq)CSL_FEXT(hPwt->regs->FRC, PWT_FRC_FRQ);
    
    return value;
}

/** ============================================================================
 *   @n@b CSL_pwtGetOctaveNum
 *
 *   @b Description
 *   @n This function fetches the set octave number from the frequency
 *      control register.
 *
 *   @b Arguments
 *   @verbatim

            hPwt     	    Handle to the PWT instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  value
 *   @li    value           - Octave selection number 
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
            CSL_PwtOct  num;
            ...
            num = CSL_pwtGetOctaveNum (hPwt);    
 	    
     @endverbatim
 * ===========================================================================
 */
static inline
CSL_PwtOct CSL_pwtGetOctaveNum (
    CSL_PwtHandle   hPwt
)
{
    CSL_PwtOct  value;

    value = (CSL_PwtOct)CSL_FEXT(hPwt->regs->FRC, PWT_FRC_OCTV);

    return value;
}

/** ============================================================================
 *   @n@b CSL_pwtGetVolumeLvl
 *
 *   @b Description
 *   @n This function fetches the volume level.
 *
 *   @b Arguments
 *   @verbatim

            hPwt     	    Handle to the PWT instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  value
 *   @li    value           - Volume level
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
            Uint8   volLevel;
            ...
            volLevel = CSL_pwtGetVolumeLvl (hPwt);
 	    
     @endverbatim
 * ===========================================================================
 */
static inline
Uint8 CSL_pwtGetVolumeLvl (
    CSL_PwtHandle   hPwt
) 
{
    Uint8   value;

    value = CSL_FEXT(hPwt->regs->VRC, PWT_VRC_VOL);

    return value;
}

/** ============================================================================
 *   @n@b CSL_pwtGetTestinStatus
 *
 *   @b Description
 *   @n This function gets the status of the 1/154 divider
 *
 *   @b Arguments
 *   @verbatim

            hPwt     	    Handle to the PWT instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  value
 *   @li    value           - Status of the 1/154 divider 
 *                            (0 if switched on or 1 if switched off)
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
            CSL_PwtTestin value;
            ...
            value = CSL_pwtGetTestinStatus (hPwt);
 	    
     @endverbatim
 * ===========================================================================
 */
static inline
CSL_PwtTestin CSL_pwtGetTestinStatus (
    CSL_PwtHandle   hPwt
)
{
    CSL_PwtTestin   value;

    value = (CSL_PwtTestin)CSL_FEXT(hPwt->regs->GCR, PWT_GCR_TESTIN);

    return value;
}

/** ============================================================================
 *   @n@b CSL_pwtSetToneOff
 *
 *   @b Description
 *   @n This function switches off the volume tone.
 *
 *   @b Arguments
 *   @verbatim

            hPwt     	    Handle to the PWT instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  
 *   @n  None                    
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n Tone is switched off
 *
 *   @b Modifies
 *   @n PWT hardware registers
 *
 *   @b Example
 *   @verbatim
            void CSL_pwtSetToneOff (hPwt);
 	    
     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_pwtSetToneOff (
    CSL_PwtHandle   hPwt
)
{
    CSL_FINST (hPwt->regs->VRC, PWT_VRC_ONOFF, OFF);
}

/** ============================================================================
 *   @n@b CSL_pwtSetToneOn
 *
 *   @b Description
 *   @n This function switches on the volume tone.
 *
 *   @b Arguments
 *   @verbatim

            hPwt     	    Handle to the PWT instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  
 *   @n  None                    
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n Tone is switched on
 *
 *   @b Modifies
 *   @n PWT hardware registers
 *
 *   @b Example
 *   @verbatim
            void CSL_pwtSetToneOn (hPwt);
 	    
     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_pwtSetToneOn (
    CSL_PwtHandle   hPwt
)
{
    CSL_FINST (hPwt->regs->VRC, PWT_VRC_ONOFF, ON);
}

/** ============================================================================
 *   @n@b CSL_pwtDisableClk
 *
 *   @b Description
 *   @n This function disables the PWT clock.
 *
 *   @b Arguments
 *   @verbatim

            hPwt     	    Handle to the PWT instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  
 *   @n  None                    
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n The clock is disabled
 *
 *   @b Modifies
 *   @n PWT hardware registers
 *
 *   @b Example
 *   @verbatim
            void CSL_pwtDisableClk (hPwt);
 	    
     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_pwtDisableClk (
    CSL_PwtHandle   hPwt
)
{
    CSL_FINST (hPwt->regs->GCR, PWT_GCR_CLK_EN, DIS);
}

/** ============================================================================
 *   @n@b CSL_pwtEnableClk
 *
 *   @b Description
 *   @n This function enables the PWT clock
 *
 *   @b Arguments
 *   @verbatim

            hPwt     	    Handle to the PWT instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  
 *   @n  None                    
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n The clock is enabled
 *
 *   @b Modifies
 *   @n PWT hardware registers
 *
 *   @b Example
 *   @verbatim
            void CSL_pwtEnableClk (hPwt);
 	    
     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_pwtEnableClk (
    CSL_PwtHandle   hPwt
)
{
    CSL_FINST (hPwt->regs->GCR, PWT_GCR_CLK_EN, EN);
}

#ifdef __cplusplus
}
#endif

#endif /* _CSL_PWTAUX_H_ */

⌨️ 快捷键说明

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