📄 lh79520_timer_driver.h
字号:
/***********************************************************************
* $Workfile: lh79520_timer_driver.h $
* $Revision: 1.0 $
* $Author: LiJ $
* $Date: Jul 07 2003 16:41:02 $
*
* Project: LH79520 timer driver
*
* Description:
* This file contains driver support for the timer modules on the
* LH79520
*
* Revision History:
* $Log: //smaicnt2/pvcs/VM/sharpmcu/archives/sharpmcu/software/csps/lh79520/include/lh79520_timer_driver.h-arc $
*
* Rev 1.0 Jul 07 2003 16:41:02 LiJ
* 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 LH79520_TIMER_DRIVER_H
#define LH79520_TIMER_DRIVER_H
#ifdef __cplusplus
extern "C" {
#endif
#include "lh79520_timer.h"
/***********************************************************************
* Timer device configuration commands (IOCTL commands and arguments)
**********************************************************************/
/* Timer device commands (IOCTL commands) */
typedef enum {
TIMER_START, /* Start the timer running, no arg */
TIMER_STOP, /* Stop the timer running, no arg */
TIMER_MODE, /* Set the timer count mode, use an argument type
of TIMER_RUN_MODE_T to set the mode */
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_SET_PRESCALE, /* Set the prescaler for timer, arg is defined
in TIMER_PRESCALE_T */
TIMER_SET_CASCADE, /* Set the timer cascade mode, arg 1 to enable
the cascade mode, arg 0 to disable the cascade
mode */
TIMER_INT_CLEAR, /* Clears a pending timer interrupt, no
argument */
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 prescaler value */
typedef enum{
PRESCALE_1, /* arg for TIMER_SET_PRESCALE - timer prescaler as 1 */
PRESCALE_16, /* arg for TIMER_SET_PRESCALE - timer prescaler as 16 */
PRESCALE_256 /* arg for TIMER_SET_PRESCALE - timer prescaler as 256 */
} TIMER_PRESCALE_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_GET_STATUS command (IOCTL
arguments) */
typedef enum {
GET_TIMER_ENABLE, /* Returns timer enabled status (1 = timer
enabled, 0 = timer disabled */
GET_TIMER_MODE, /* Returns timer clock mode (TIMER_FREERUN or
TIMER_PERIODIC) */
GET_TIMER_CLOCK, /* Returns timer clock source (TIMER_CLOCK_2K or
TIMER_CLOCK_508K) */
GET_TIMER_COUNT, /* Returns timer count value (value initially
load with TIMER_SET_COUNT command) */
GET_TIMER_VALUE /* Returns current timer count value */
} TIMER_IOCTL_STS_T;
/***********************************************************************
* Timer device configuration structure
**********************************************************************/
/* Timer device configuration structure */
typedef struct
{
INT_32 init; /* Device initialized flag */
TIMER_REGS_T *regptr; /* Pointer to Timer registers */
} TIMER_CFG_T;
/***********************************************************************
* Timer driver 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);
/* Delay for usec microSeconds */
void timer_wait_us(TIMER_REGS_T *timer,
UNS_32 usec);
#ifdef __cplusplus
}
#endif
#endif /* LH79520_TIMER_DRIVER_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -