csl_ostimeraux.h

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

H
286
字号
/** =========================================================
 *   @file  csl_ostimerAux.h
 *
 *   @path  $(CSLPATH)\arm\ostimer\src
 *
 *   @desc  API Auxilary header file for ostimer 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
 *  ===============
 *  11-Jun-2004 PR File Created.
 *
 * =============================================================================
 */

#ifndef _CSL_OSTIMERAUX_H_
#define _CSL_OSTIMERAUX_H_

#include <cslr.h>
#include <csl_ostimer.h>
#include <cslr_ostimer.h>

/** Inline Functions */

/** ============================================================================
 *   @n@b CSL_ostimerStart
 *
 *   @b Description
 *   @n This function starts the OS timer
 *
 *   @b Arguments
 *   @verbatim
          hOstimer Handle timer object.

      @endverbatim
 *
 *   <b> Return Value </b>  void
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *  @n   None
 *
 *   @b Example
 *   @verbatim
            CSL_ostimerStart (hOstimer);

     @endverbatim
 * ===========================================================================
 */
static inline
void
    CSL_ostimerStart(
        CSL_OstimerHandle hOstimer
)
{
	/* Starts the OS timer */
   CSL_FINST (hOstimer->regs->TIMER_CTRL_REG, \
	          OSTIMER_TIMER_CTRL_REG_TSS, START);
}

/** ============================================================================
 *   @n@b CSL_ostimerStop
 *
 *   @b Description
 *   @n This function stops the OS timer
 *
 *   @b Arguments
 *   @verbatim
        hOstimer   Handle timer object.

      @endverbatim
 *
 *   <b> Return Value </b>  void
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *  @n   None
 *
 *   @b Example
 *   @verbatim
            CSL_ostimerStop (hOstimer);

     @endverbatim
 * ===========================================================================
 */
static inline
void
    CSL_ostimerStop (
        CSL_OstimerHandle hOstimer
)
{
   /* Stops the OS timer */
   CSL_FINST (hOstimer->regs->TIMER_CTRL_REG, \
		        OSTIMER_TIMER_CTRL_REG_TSS, STOP);
}

/** ============================================================================
 *   @n@b CSL_ostimerLoad
 *
 *   @b Description
 *   @n This function gets the load value into the specified register
 *
 *   @b Arguments
 *   @verbatim
        hOstimer   Handle timer object.

        cmd        Control Command which needs to performed.

      @endverbatim
 *
 *   <b> Return Value </b>  void
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *  @n   None
 *
 *   @b Example
 *   @verbatim
            CSL_ostimerLoad(hOstimer, *(Uint32 *)cmdArg);

     @endverbatim
 * ===========================================================================
 */
static inline
void
    CSL_ostimerLoad(
       CSL_OstimerHandle   hOstimer,
	   Uint32              cmd
)
{
   /* Write the value into  TICK_VALUE_REG */
   CSL_FINS(hOstimer->regs->TICK_VALUE_REG, \
            OSTIMER_TICK_VALUE_REG_TICK_VALUE_REG, cmd);
}

/** ============================================================================
 *   @n@b CSL_ostimerReload
 *
 *   @b Description
 *   @n This function gets the reload mode value
 *
 *   @b Arguments
 *   @verbatim
        hOstimer   Handle ostimer object.
       
      @endverbatim
 *
 *   <b> Return Value </b>  void
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *  @n   None
 *
 *   @b Example
 *   @verbatim
             CSL_ostimerReload(hOstimer);

     @endverbatim
 * ===========================================================================
 */  
static inline   
void
    CSL_ostimerReload(
       CSL_OstimerHandle hOstimer
)
{
	 /* Relaod the timer  */
     CSL_FINST(hOstimer->regs->TIMER_CTRL_REG, OSTIMER_TIMER_CTRL_REG_TRB,\
               SET);
}

/** ============================================================================
 *   @n@b CSL_ostimerGetCount
 *
 *   @b Description
 *   @n This function gets the timer value. 
 *
 *   @b Arguments
 *   @verbatim
       hOstimer    Handle ostimer object.
       
      @endverbatim
 *
 *   <b> Return Value </b>  Uint32
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *  @n   None
 *
 *   @b Example
 *   @verbatim
            CSL_ostimerGetCount(hOstimer);

     @endverbatim
 * ===========================================================================
 */   
static inline
Uint32
    CSL_ostimerGetCount (
        CSL_OstimerHandle hOstimer
)
{    
	 /* Get the ostimer Count  */
    return hOstimer->regs->TICK_COUNTER_REG;
}

/** ============================================================================
 *   @n@b CSL_ostimerTrbStatus
 *
 *   @b Description
 *   @n This function gets TRB bit status of timer. 
 *
 *   @b Arguments
 *   @verbatim
         hOstimer   Handle ostimer object.
       
      @endverbatim
 *
 *   <b> Return Value </b> Bool
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *  @n   None
 *
 *   @b Example
 *   @verbatim
           CSL_ostimerTrbStatus(hOstimer);

     @endverbatim
 * ===========================================================================
 */   
static inline
Bool
    CSL_ostimerTrbStatus (
        CSL_OstimerHandle  hOstimer
)
{
	/* Get the TRB bit status */
    return (Bool)CSL_FEXT(hOstimer->regs->TIMER_CTRL_REG, \
	                    OSTIMER_TIMER_CTRL_REG_TRB);
}

#endif  /* _CSL_OSTIMERAUX_H_ */

⌨️ 快捷键说明

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