csl_gptimeraux.h

来自「dsp在音频处理中的运用」· C头文件 代码 · 共 1,099 行 · 第 1/2 页

H
1,099
字号
/** ============================================================================
 *   @file  csl_gptimerAux.h
 *
 *   @path  $(CSLPATH)\arm\gptimer\src
 *
 *   @desc  API Auxilary header file for general purpose timer CSL.
 *
 */

/*  ============================================================================
 *   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-05-27)  */

/* =============================================================================
 *  Revision History
 *  ===============
 *  28-Jun-2004 Ar File Created.
 *
 * =============================================================================
 */

#ifndef _CSL_GPTIMERAUX_H_
#define _CSL_GPTIMERAUX_H_
 
#include<csl_gptimer.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 *  Status Query Functions of General purpose timer
 */

/** ============================================================================
 *   @n@b CSL_gptimerGetHwRevId
 *
 *   @b Description
 *   @n This function gets the hardware revision ID for the module
 *
 *   @b Arguments
 *   @verbatim

            hGptimer            Handle to the general purpose timer instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  Bool
 *
 *   @li                    TRUE  - Reset is complete
 *   
 *   @li                    FALSE - Reset is not complete
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        Uint8  hwRevId;
        
        hwRevId = CSL_gptimerGetHwRevId (hGptimer);
        
     @endverbatim
 * ===========================================================================
 */

static inline
Uint8 CSL_gptimerGetHwRevId (
    CSL_GptimerHandle    hGptimer    
)
{
	volatile Uint8 temp;
	
	temp = (Uint8)CSL_FEXT(hGptimer->regs->TIDR, GPTIMER_TIDR_TID_REV);
    return (temp);
}

/** ============================================================================
 *   @n@b CSL_gptimerGetResetState
 *
 *   @b Description
 *   @n This function gets the completion state of reset operation
 *
 *   @b Arguments
 *   @verbatim

            hGptimer            Handle to the general purpose timer instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  Uint8
 *
 *   @li                    Hardware revision ID of the module
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        Bool  resetDone;
        
        resetDone = CSL_gptimerGetResetState (hGptimer);
        
     @endverbatim
 * ===========================================================================
 */
static inline
Bool CSL_gptimerGetResetState(
    CSL_GptimerHandle    hGptimer
)
{
	volatile Bool temp;
	
	temp = (Bool) CSL_FEXT(hGptimer->regs->TISTAT, GPTIMER_TISTAT_RESETDONE);
    return (temp); 
}

/** ============================================================================
 *   @n@b CSL_gptimerGetCount
 *
 *   @b Description
 *   @n This function gets the current value of the counter
 *
 *   @b Arguments
 *   @verbatim

            hGptimer            Handle to the general purpose timer instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  Uint32
 *
 *   @li                    Current value of the counter
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        Uint32  count;
        
        count = CSL_gptimerGetCount (hGptimer);
        
     @endverbatim
 * ===========================================================================
 */
static inline
Uint32 CSL_gptimerGetCount (
    CSL_GptimerHandle    hGptimer
)
{
   return (hGptimer->regs->TCRR);   
}

/** ============================================================================
 *   @n@b CSL_gptimerGetCapturedValue
 *
 *   @b Description
 *   @n This function gets the counter value at the time of event capture from 
 *      TCAR register
 *
 *   @b Arguments
 *   @verbatim

            hGptimer            Handle to the general purpose timer instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  Uint8
 *
 *   @li                    Value of the Timer capture register(TCAR)
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        Uint32  captValue;
        
        captValue = CSL_gptimerGetCapturedValue (hGptimer);
        
     @endverbatim
 * ===========================================================================
 */

static inline
Uint32 CSL_gptimerGetCapturedValue (
    CSL_GptimerHandle    hGptimer
)
{
    return (hGptimer->regs->TCAR);
}

/** ============================================================================
 *   @n@b CSL_gptimerGetTimerStatus
 *
 *   @b Description
 *   @n This function gets the hardware revision ID for the module
 *
 *   @b Arguments
 *   @verbatim

            hGptimer            Handle to the general purpose timer instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  Uint8
 *
 *   @li                    Gets the event status from TISR register
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        Uint8  event;
        
        event = CSL_gptimerGetTimerStatus (hGptimer);
        
     @endverbatim
 * ===========================================================================
 */
static inline
Uint8 CSL_gptimerGetTimerStatus (
   CSL_GptimerHandle    hGptimer
)
{
    volatile Uint8 temp;
    temp = (Uint8)(hGptimer->regs->TISR);
    return (temp);
}

/** ============================================================================
 *   @n@b CSL_gptimerGetTmarWrPendStat
 *
 *   @b Description
 *   @n This function gets the write pend status for TMAR register
 *
 *   @b Arguments
 *   @verbatim

            hGptimer            Handle to the general purpose timer instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  Bool
 *
 *   @li                    Write pend status for TMAR register
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        Bool  pend;
        
        pend = CSL_gptimerGetTmarWrPendStat (hGptimer);
        
     @endverbatim
 * ===========================================================================
 */
static inline
Bool CSL_gptimerGetTmarWrPendStat(
    CSL_GptimerHandle    hGptimer
)
{
	volatile Bool temp;
	temp = (Bool) CSL_FEXT(hGptimer->regs->TWPS, GPTIMER_TWPS_W_PEND_TMAR);
    return (temp);
}

/** ============================================================================
 *   @n@b CSL_gptimerGetTtgrWrPendStat
 *
 *   @b Description
 *   @n This function gets the write pend status for TTGR register
 *
 *   @b Arguments
 *   @verbatim

            hGptimer            Handle to the general purpose timer instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  Bool
 *
 *   @li                    Write pend status for TTGR register
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        Bool  pend;
        
        pend = CSL_gptimerGetTtgrWrPendStat (hGptimer);
        
     @endverbatim
 * ===========================================================================
 */
static inline
Bool CSL_gptimerGetTtgrWrPendStat(
    CSL_GptimerHandle    hGptimer
)
{
    volatile Bool temp;
    
    temp = (Bool) CSL_FEXT(hGptimer->regs->TWPS, GPTIMER_TWPS_W_PEND_TTGR);
    return (temp);
}

/** ============================================================================
 *   @n@b CSL_gptimerGetTldrWrPendStat
 *
 *   @b Description
 *   @n This function gets the write pend status for TLDR register
 *
 *   @b Arguments
 *   @verbatim

            hGptimer            Handle to the general purpose timer instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  Bool
 *
 *   @li                    Write pend status for TLDR
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        Bool  pend;
        
        pend = CSL_gptimerGetTldrWrPendStat (hGptimer);
        
     @endverbatim
 * ===========================================================================
 */
static inline
Bool CSL_gptimerGetTldrWrPendStat(
    CSL_GptimerHandle    hGptimer
)
{
    volatile Bool temp;
    
    temp = (Bool) CSL_FEXT(hGptimer->regs->TWPS, GPTIMER_TWPS_W_PEND_TLDR); 
    return (temp);
}

/** ============================================================================
 *   @n@b CSL_gptimerGetTcrrWrPendStat
 *
 *   @b Description
 *   @n This function gets the write pend status for TCRR register
 *
 *   @b Arguments
 *   @verbatim

            hGptimer            Handle to the general purpose timer instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  Bool
 *
 *   @li                    Write pend status for TCRR register
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        Bool  pend;
        
        pend = CSL_gptimerGetTcrrWrPendStat (hGptimer);
        
     @endverbatim
 * ===========================================================================
 */
static inline
Bool CSL_gptimerGetTcrrWrPendStat(
    CSL_GptimerHandle    hGptimer
)
{
    volatile Bool temp;
    
    temp = (Bool) CSL_FEXT(hGptimer->regs->TWPS, GPTIMER_TWPS_W_PEND_TCRR);
    return (temp);
}

/** ============================================================================
 *   @n@b CSL_gptimerGetTclrWrPendStat
 *
 *   @b Description
 *   @n This function gets the write pend status for TMAR register
 *
 *   @b Arguments
 *   @verbatim

            hGptimer            Handle to the general purpose timer instance
 
     @endverbatim
 *
 *   <b> Return Value </b>  Bool
 *
 *   @li                    Write pend status for TCLR register
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n None
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        Bool  pend;
        
        pend = CSL_gptimerGetTclrWrPendStat (hGptimer);
        
     @endverbatim
 * ===========================================================================
 */
static inline
Bool CSL_gptimerGetTclrWrPendStat(
    CSL_GptimerHandle    hGptimer
)
{
    volatile Bool temp;
    
    temp = (Bool) CSL_FEXT(hGptimer->regs->TWPS, GPTIMER_TWPS_W_PEND_TCLR);
    return (temp);
}
 
/**
 *  Hardware Control Functions of general purpose timer
 */

/** ============================================================================
 *   @n@b CSL_gptimerLoadTcrr
 *
 *   @b Description
 *   @n This function writes the specified value into the TCRR register
 *
 *   @b Arguments
 *   @verbatim

            hGptimer            Handle to the general purpose timer instance

            count               Value to be loaded into TCRR register
 
     @endverbatim
 *
 *   <b> Return Value </b>  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n TCRR register will be loaded with the specified value
 *
 *   @b  Modifies
 *   @n  TCRR register
 *
 *   @b Example
 *   @verbatim
        Uint32  count;
        
        count = 0xFF000000;
        CSL_gptimerLoadTcrr (hGptimer, count);
        
     @endverbatim
 * ===========================================================================
 */
static inline
void CSL_gptimerLoadTcrr (
    CSL_GptimerHandle    hGptimer,
    Uint32               count
)

{
    hGptimer->regs->TCRR = count;
}

/** ============================================================================
 *   @n@b CSL_gptimerLoadTldr
 *

⌨️ 快捷键说明

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