📄 lh7a404_timer_driver.h
字号:
/***********************************************************************
* $Workfile: lh7a404_timer_driver.h $
* $Revision: 1.4 $
* $Author: WellsK $
* $Date: Mar 29 2004 15:01:28 $
*
* Project: LH7A404 timer driver
*
* Description:
* This file contains driver support for the timer modules on the
* LH7A404
*
* Revision History:
* $Log: //smaicnt2/pvcs/VM/sharpmcu/archives/sharpmcu/software/csps/lh7a404/include/lh7a404_timer_driver.h-arc $
*
* Rev 1.4 Mar 29 2004 15:01:28 WellsK
* Changed return type of timer_wait_ms() to void.
*
* Rev 1.3 Mar 29 2004 14:34:32 WellsK
* Added comment for timer_wait_ms function.
*
* Rev 1.2 Mar 15 2004 12:14:04 SuryanG
* Added timer_wait_ms() function.
*
* Rev 1.1 Sep 02 2003 15:16:38 WellsK
* Added predefined macros for TIMER_USEC and
* TIMER_MSEC
*
* Rev 1.0 Jun 30 2003 17:16:48 WellsK
* Initial revision.
*
*
***********************************************************************
* SHARP MICROELECTRONICS OF THE AMERICAS MAKES NO REPRESENTATION
* OR WARRANTIES WITH RESPECT TO THE PERFORMANCE OF THIS SOFTWARE,
* AND SPECIFICALLY DISCLAIMS ANY RESPONSIBILITY FOR ANY DAMAGES,
* SPECIAL OR CONSEQUENTIAL, CONNECTED WITH THE USE OF THIS SOFTWARE.
*
* SHARP MICROELECTRONICS OF THE AMERICAS PROVIDES THIS SOFTWARE SOLELY
* FOR THE PURPOSE OF SOFTWARE DEVELOPMENT INCORPORATING THE USE OF A
* SHARP MICROCONTROLLER OR SYSTEM-ON-CHIP PRODUCT. USE OF THIS SOURCE
* FILE IMPLIES ACCEPTANCE OF THESE CONDITIONS.
*
* COPYRIGHT (C) 2001 SHARP MICROELECTRONICS OF THE AMERICAS, INC.
* CAMAS, WA
**********************************************************************/
#ifndef LH7A404_TIMER_DRIVER_H
#define LH7A404_TIMER_DRIVER_H
#ifdef __cplusplus
extern "C" {
#endif
#include "lh7a404_timer.h"
/***********************************************************************
* Timer device configuration commands (IOCTL commands and arguments)
**********************************************************************/
/* Timer device commands (IOCTL commands) */
typedef enum {
TIMER_ENABLE, /* Enable or disable the timer, use arg = 0 to
disable, use arg = 1 to enable */
TIMER_MODE, /* Set the timer count mode, use an argument type
of TIMER_RUN_MODE_T to set the mode */
TIMER_CLOCK, /* Set timer clock source (timers 1 and 2), use
an argument type of TIMER_CLOCK_T to set the
clock source */
TIMER_SET_COUNT, /* Sets an initial timer count value, arg should
be a value between 0 to 65535 */
TIMER_SET_USECS, /* Sets up a timer to underflow based on the
passed microsecond value in arg - this will
overridethe TIMER_CLOCK and TIMER_SET_COUNT
commands */
TIMER_INT_CLEAR, /* Clears a pending timer interrupt, no
argument */
TIMER_SET_BZCONT, /* Set timer 1 buzzer output state, use an
argument type of TIMER_BZCONT_T to set the
state */
TIMER_GET_STATUS /* Get a timer status, use an argument type of
TIMER_IOCTL_STS_T as the argument to return
the correct status */
} TIMER_IOCTL_CMD_T;
/* Timer device arguments for TIMER_MODE command (IOCTL arguments) */
typedef enum {
TIMER_FREERUN, /* Set timer in freerun mode */
TIMER_PERIODIC /* Set timer in periodic mode */
} TIMER_RUN_MODE_T;
/* Timer device arguments for TIMER_CLOCK command (IOCTL arguments) */
typedef enum {
TIMER_CLOCK_2K, /* Set timer 1/2 clock source to 2KHz */
TIMER_CLOCK_508K /* Set timer 1/2 clock source to 508KHz */
} TIMER_CLOCK_T;
/* Timer device arguments for TIMER_SET_BZCONT command (IOCTL
arguments) */
typedef enum
{
TIMER_BZTOG_LOW, /* BZTOG out is driven low */
TIMER_BZTOG_HIGH, /* BZTOG out is driven high */
TIMER_BZTOG_TOGGLE /* BZTOG out is toggled high or low by the
timer 1 underflow state */
} TIMER_BZCONT_T;
/* Timer device arguments for TIMER_GET_STATUS command (IOCTL
arguments) */
typedef enum {
TIMER_ENABLE_ST, /* Returns timer enabled status (1 = timer
enabled, 0 = timer disabled */
TIMER_MODE_ST, /* Returns timer clock mode (TIMER_FREERUN or
TIMER_PERIODIC) */
TIMER_CLOCK_ST, /* Returns timer clock source (TIMER_CLOCK_2K or
TIMER_CLOCK_508K) */
TIMER_COUNT_ST, /* Returns timer count value (value initially
load with TIMER_SET_COUNT command) */
TIMER_VALUE_ST, /* Returns current timer count value */
TIMER_BZCONT_ST /* Returns BZTOG output state (TIMER_BZTOG_LOW,
TIMER_BZTOG_HIGH, or TIMER_BZTOG_TOGGLE) */
} TIMER_IOCTL_STS_T;
/* Predefined timer driver macro value for 1 microSecond delay */
#define TIMER_USEC 1
/* Predefined timer driver macro value for 1 milliSecond delay */
#define TIMER_MSEC (1000 * TIMER_USEC)
/***********************************************************************
* Timer driver API functions
**********************************************************************/
/* Open the timer */
INT_32 timer_open(void *ipbase, INT_32 arg);
/* Close the timer */
STATUS timer_close(INT_32 devid);
/* Timer configuration block */
STATUS timer_ioctl(INT_32 devid,
INT_32 cmd,
INT_32 arg);
/* Timer read function (stub only) */
INT_32 timer_read(INT_32 devid,
void *buffer,
INT_32 max_bytes);
/* Timer write function (stub only) */
INT_32 timer_write(INT_32 devid,
void *buffer,
INT_32 n_bytes);
/***********************************************************************
* Other Timer driver functions
**********************************************************************/
/* Delay for usec microSeconds */
void timer_wait_us(TIMER_REGS_T *timer,
UNS_32 usec);
/* Delay for msec microSeconds */
void timer_wait_ms(TIMER_REGS_T *timer,
UNS_32 msec);
#ifdef __cplusplus
}
#endif
#endif /* LH7A404_TIMER_DRIVER_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -