timerctrl.c

来自「音频数据采集与IIR处理例程」· C语言 代码 · 共 91 行

C
91
字号
/*H*****************************************************************************
*
* $Archive::                                                                   $
* $Revision::                                                                  $
* $Date::                                                                      $
* $Author::                                                                    $
*
* DESCRIPTION:  Timer delay code
*
* GLOBALS 
*
* PUBLIC FUNCTIONS:
*                              
* PRIVATE FUNCTIONS:
*
* USAGE/LIMITATIONS:
*
* NOTES: Assumptions:
*
* COMPILE SWITCHES:
*
*H***************************************************************************/
#define timer_c
#define CHIP_6713

/*---- compilation control switches ----------------------------------------*/

/*****************************************************************************
* INCLUDE FILES
*****************************************************************************/
/*---- system and platform files -------------------------------------------*/
#include <stdlib.h>
#include <stdio.h>
#include <c6x.h>
/*---- program files -------------------------------------------------------*/

#include "csl.h"
#include "csl_timer.h"

/*****************************************************************************
* EXTERNAL REFERENCE    
*****************************************************************************/
/*---- data declarations ---------------------------------------------------*/

/*---- function prototypes -------------------------------------------------*/

/*****************************************************************************
* PUBLIC DECLARATIONS 
*****************************************************************************/

/*---- data declarations ---------------------------------------------------*/
TIMER_Handle hTimer = NULL;


/*****************************************************************************
* PRIVATE DECLARATIONS  
*****************************************************************************/
/*---- context -------------------------------------------------------------*/
/*---- data declarations ---------------------------------------------------*/
/*---- function prototypes -------------------------------------------------*/
/*---- macros --------------------------------------------------------------*/

/*****************************************************************************
* PUBLIC FUNCTION DEFINITIONS
*****************************************************************************/

/*F***************************************************************************
* NAME:   TIMER_Init()
*
* DESCRIPTION: Setup our timer that is used for all TEB examples.       
*       
* NOTES:
*   
*F***************************************************************************/
void TIMER_Init(void)
{
  
  TIMER_Config myTimerConfig;  
                
  hTimer = TIMER_open(TIMER_DEV0, TIMER_OPEN_RESET);
  TIMER_getConfig( hTimer, &myTimerConfig);
  myTimerConfig.ctl &= 0xff3f;
  myTimerConfig.ctl |= 0x3c0;
  myTimerConfig.prd  = 0x200;
  myTimerConfig.cnt = 0x00000000;
  TIMER_config(hTimer, &myTimerConfig);
  IRQ_enable(TIMER_getEventId(hTimer));
}


⌨️ 快捷键说明

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