?? timer.h
字號:
/******************************************************************************/
/* TIMER.H - TMS320C6711 Peripheral Support Library Timer Support */
/* */
/* This file provides the header for the DSP's Timer support. */
/******************************************************************************/
#ifndef _TIMER_H_
#define _TIMER_H_
/*----------------------------------------------------------------------------*/
/* INCLUDES */
/*----------------------------------------------------------------------------*/
#ifndef MASTER_FILE
#define C6711_GLOBALS
#include "C6711_CPU.H"
#endif
/*----------------------------------------------------------------------------*/
/* DEFINES */
/*----------------------------------------------------------------------------*/
/* Define Timer0 Registers */
#define TIMER0_CTRL 0x1940000 /* Address of timer0 control reg. */
#define TIMER0_PRD 0x1940004 /* Address of timer0 period reg. */
#define TIMER0_COUNT 0x1940008 /* Address of timer0 counter reg. */
/* Define Timer1 Registers */
#define TIMER1_CTRL 0x1980000 /* Address of timer1 control reg. */
#define TIMER1_PRD 0x1980004 /* Address of timer1 period reg. */
#define TIMER1_COUNT 0x1980008 /* Address of timer1 counter reg. */
/*Timer Mode Control Register (TIMER_CTL) Bitfield*/
#define FUNC 0 /*Function of TOUT pin */
#define INVOUT 1 /*TOUT inverter control. Used only if FUNC = 1. */
#define DATOUT 2 /*Data output */
#define DATIN 3 /*Data in: Value on TINP pin */
#define PWID 4 /*Pulse width. */
#define GO 6 /*GO bit. Resets and starts the timer counter. */
#define HLD 7 /*Hold. Counter may be read or written regardless of HLD value.*/
#define CP 8 /*Clock/pulse mode */
#define CLKSRC 9 /*Timer input clock source */
#define INVINP 10 /*TINP inverter control. */
#define TSTAT 11 /*Timer status. Value of timer output. */
#define CTRL_SEL 0
#define PRD_SEL 1
#define COUNT_SEL 2
/* TIMER STATUS */
#define TIMER_HOLD 0
#define TIMER_RESUME 1
#define TIMER_START 3
/*----------------------------------------------------------------------------*/
/* TIMER0 MACRO FUNCTIONS */
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/* TOUT0_IS_TSTAT0() - TOUT0 follow the value of TSTAT0 by setting the FUNC */
/* bit (bit 0) in the TIMER0_CTRL */
/*----------------------------------------------------------------------------*/
#define TOUT0_IS_TSTAT0() SET_REG_BIT(TIMER0_CTRL, FUNC)
/*----------------------------------------------------------------------------*/
/* TOUT0_IS_DATOUT0() - TOUT0 follow the value of DATOUT0 by clearing the */
/* CLKSRC bit (bit 0) in the TIMER0_CTRL. */
/*----------------------------------------------------------------------------*/
#define TOUT0_IS_DATOUT0() RESET_REG_BIT(TIMER0_CTRL, CLKSRC)
/*----------------------------------------------------------------------------*/
/* INVER_TSTAT0() - Inverse value of TSTAT0 by setting the INVOUT */
/* bit (bit 1) in the TIMER0_CTRL */
/*----------------------------------------------------------------------------*/
#define INVER_TSTAT0() SET_REG_BIT(TIMER0_CTRL, INVOUT)
/*----------------------------------------------------------------------------*/
/* NOT_INVER_TSTA0T() - Not Inverse value of TSTAT0 by clearing the INVOUT */
/* bit (bit 1) in the TIMER0_CTRL */
/*----------------------------------------------------------------------------*/
#define NOT_INVER_TSTAT0() RESET_REG_BIT(TIMER0_CTRL, INVOUT)
/*----------------------------------------------------------------------------*/
/* WRITE_DATOUT0() - Write value of DATOUT0 bit (bit 2) in the TIMER0_CTRL */
/*----------------------------------------------------------------------------*/
#define WRITE_DATOUT0(val) ASSIGN_BIT_VAL(TIMER0_CTRL,DATOUT,val)
/*----------------------------------------------------------------------------*/
/* READ_DATIN0() - Read value of DATIN0 bit (bit 3) in the TIMER0_CTRL */
/*----------------------------------------------------------------------------*/
#define READ_DATIN0() GET_BIT(TIMER0_CTRL,DATIN)
/*----------------------------------------------------------------------------*/
/* PULSE_WIDTH_ONE0() - Pulse Width is one clock by setting the PWID */
/* bit (bit 4) in the TIMER0_CTRL */
/*----------------------------------------------------------------------------*/
#define PULSE_WIDTH_ONE0() SET_REG_BIT(TIMER0_CTRL, PWID)
/*----------------------------------------------------------------------------*/
/* PULSE_WIDTH_TWO0() - Pulse Width is one clock by clearing the PWID */
/* bit (bit 4) in the TIMER0_CTRL */
/*----------------------------------------------------------------------------*/
#define PULSE_WIDTH_TWO0() RESET_REG_BIT(TIMER0_CTRL, PWID)
/*----------------------------------------------------------------------------*/
/* TSTAT0_IS_CLOCK0() - Out of TSTAT0 is clock,by setting the C/P */
/* bit bit(8) in the TIMER0_CTRL */
/*----------------------------------------------------------------------------*/
#define TSTAT0_IS_CLOCK0() SET_REG_BIT(TIMER0_CTRL, CP)
/*----------------------------------------------------------------------------*/
/* TSTAT0_IS_PULSE0() - Out of TSTAT0 is pluse,by clearring the C/P */
/* bit bit(8) in the TIMER0_CTRL */
/*----------------------------------------------------------------------------*/
#define TSTAT0_IS_PULSE0() RESET_REG_BIT(TIMER0_CTRL, CP)
/*----------------------------------------------------------------------------*/
/* TIMER_INT_CLOCK0() - TIMER use internal clock source by setting the CLKSRC */
/* bit (bit 9) in the TIMER0_CTRL */
/*----------------------------------------------------------------------------*/
#define TIMER_INT_CLOCK0() SET_REG_BIT(TIMER0_CTRL, CLKSRC)
/*----------------------------------------------------------------------------*/
/* TIMER_EXT_CLOCK0() - TIMER use external clock source by clearing the */
/* CLKSRC bit (bit 9) in the TIMER0_CTRL. */
/*----------------------------------------------------------------------------*/
#define TIMER_EXT_CLOCK0() RESET_REG_BIT(TIMER0_CTRL, CLKSRC)
/*----------------------------------------------------------------------------*/
/* RIS_EDGE_TRIG0() - Rising edge of DATIN trigger counting,by setting */
/* INVINP bit bit(10) in the TIMER0_CTRL */
/*----------------------------------------------------------------------------*/
#define RIS_EDGE_TRIG0() SET_REG_BIT(TIMER0_CTRL, INVINP)
/*----------------------------------------------------------------------------*/
/* FAL_EDGE_TRIG0() - Falling edge of DATIN trigger counting,by clearing */
/* INVINP bit bit(10) in the TIMER0_CTRL */
/*----------------------------------------------------------------------------*/
#define FAL_EDGE_TRIG0() RESET_REG_BIT(TIMER0_CTRL, INVINP)
/*----------------------------------------------------------------------------*/
/* READ_TSTAT0() - Read value of TSTAT bit (bit 11) in the TIMER0_CTRL */
/*----------------------------------------------------------------------------*/
#define READ_TSTAT0() GET_BIT(TIMER0_CTRL,TSTAT)
/*----------------------------------------------------------------------------*/
/* TIMER1 MACRO FUNCTIONS */
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/* TOUT1_IS_TSTAT1() - TOUT1 follow the value of TSTAT1 by setting the FUNC */
/* bit (bit 0) in the TIMER1_CTRL */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -