⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lh79520_pwm_driver.h

📁 Sharp Lh79520 PWM驱动源码.
💻 H
字号:
/***********************************************************************
 * $Workfile:   lh79520_pwm_driver.h  $
 * $Revision:   1.0  $
 * $Author:   LiJ  $
 * $Date:   Jul 07 2003 16:41:00  $
 *
 * Project: LH79520 PWM driver
 *
 * Description:
 *     This file contains driver support for the PWM module on the
 *     LH79520
 *
 * Revision History:
 * $Log:   //smaicnt2/pvcs/VM/sharpmcu/archives/sharpmcu/software/csps/lh79520/include/lh79520_pwm_driver.h-arc  $
 * 
 *    Rev 1.0   Jul 07 2003 16:41:00   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_PWM_DRIVER_H
#define LH79520_PWM_DRIVER_H

#ifdef __cplusplus
extern "C" {
#endif

#include "lh79520_pwm.h"

/***********************************************************************
 * PWM device configuration commands (IOCTL commands and arguments)
 **********************************************************************/

/* PWM device commands (IOCTL commands) */
typedef enum {
    PWM0_ENABLE,    /* Enable PWM0 operation, config IOCON pin. arg = 1,
                    enable PWM0, arg = 0, disable PWM0 */
    PWM1_ENABLE,    /* Enable PWM1 operation, config IOCON pin. arg = 1,
                    enable PWM1, arg = 0, disable PWM1 */               
    PWM0_SET_MODE,  /* Set PWM0 working mode, arg = 1, PWM0 working as 
                    synchronous mode, output start sync. with SYNC pin. 
                    arg = 0, PWM0 working in normal mode */
    PWM0_START,     /* Start PWM0 output, no arg */
    PWM0_STOP,      /* Stop PWM0 output, no arg */          
    PWM1_START,     /* Start PWM1 output, no arg */         
    PWM1_STOP,      /* Stop PWM1 output, no arg */
    PWM0_SET_FREQ,  /* Set PWM0 frequency, arg = is the frequency in Hz */
    PWM0_SET_DUTY_CYCLE,    /* Set PWM0 duty cycle, arg = 1 to 100 for 1% 
                    to 100 % */
    PWM1_SET_FREQ,  /* Set PWM1 frequency, arg = is the frequency in Hz */
    PWM1_SET_DUTY_CYCLE,    /* Set PWM1 duty cycle, arg = 1 to 100 for 1% 
                    to 100 % */
    PWM0_SET_OUTPUT_INVERT, /* Set the PWM0 output signal to be normal or 
                    invert output, arg = 1 for invert singla, arg = 0 for 
                    normal signal */
    PWM1_SET_OUTPUT_INVERT, /* Set the PWM1 output signal to be normal or 
                    invert output, arg = 1 for invert singla, arg = 0 for 
                    normal signal */
    PWM0_GET_STATUS,/* Get a pwm0 status, use an argument type of
                    PWM_IOCTL_STS_T as the argument to return the
                    correct status */   
    PWM1_GET_STATUS /* Get a pwm1 status, use an argument type of
                    PWM_IOCTL_STS_T as the argument to return the
                    correct status */   
} PWM_IOCTL_CMD_T;

/* PWM device arguments for PWM_GET_STATUS command (IOCTL arguments) */
typedef enum {
    PWM_GET_START,  /* Returns pwm start status (1 = start,
                    0 = stop ) */
    PWM_GET_MODE,   /* Returns PWM operation mode (1 = synchornous mode,
                    0 = normal mode */              
    PWM_GET_FREQ,   /* Returns PWM frequency */
    PWM_GET_DUTY_CYCLE, /* Returns PWM duty cycle */
    PWM_GET_OUTPUT_INVERT   /* Return PWM output status (1 = output invert,
                        0 = output normal */
                        
} PWM_IOCTL_STS_T;

/***********************************************************************
 * PWM device configuration structure
 **********************************************************************/

/* PWM device configuration structure */
typedef struct
{
    INT_32 init;       /* Device initialized flag */
    PWM_REGS_T *regptr; /* Pointer to PWM registers */
} PWM_CFG_T;

/***********************************************************************
 * PWM driver functions
 **********************************************************************/
/* Open the pwm */
INT_32 pwm_open(void *ipbase, INT_32 arg);

/* Close the pwm */
STATUS pwm_close(INT_32 devid);

/* pwm configuration block */
STATUS pwm_ioctl(INT_32 devid,
                 INT_32 cmd,
                 INT_32 arg);

/* PWM read function (stub only) */
INT_32 pwm_read(INT_32 devid,
                void *buffer,
                INT_32 max_bytes);

/* PWM write function (stub only) */
INT_32 pwm_write(INT_32 devid,
                 void *buffer,
                 INT_32 n_bytes);

#ifdef __cplusplus
}
#endif

#endif /* LH79520_PWM_DRIVER_H */

⌨️ 快捷键说明

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