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

📄 csl_pwm.h

📁 ccs下对dm6446的测试程序
💻 H
📖 第 1 页 / 共 3 页
字号:
/*  ============================================================================
 *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005                 
 *                                                                              
 *   Use of this software is controlled by the terms and conditions found in the
 *   license agreement under which this software has been supplied.             
 *   ===========================================================================
 */ 

/** @mainpage PWM CSL 3.x
 *
 * @section Introduction
 *
 * @subsection xxx Purpose and Scope
 * The purpose of this document is to identify a set of common CSL APIs for
 * the PWM module across various devices. The CSL developer is expected to
 * refer to this document while designing APIs for these modules. Some of the
 * listed APIs may not be applicable to a given PWM module. While other cases
 * this list of APIs may not be sufficient to cover all the features of a
 * particular PWM Module. The CSL developer should use his discretion designing
 * new APIs or extending the existing ones to cover these.
 *
 * @subsection aaa Terms and Abbreviations
 *   -# CSL:  Chip Support Library
 *   -# API:  Application Programmer Interface
 *
 * @subsection References
 *    -# CSL-001-DES, CSL 3.x Design Specification DocumentVersion 1.02
 *
 */

/**
 *  @file  csl_pwm.h
 *
 *  @brief PWM functional layer API header file
 *
 *  Path: \\(CSLPATH)\\ipmodules\\pwm\\src
 *
 *  @internal
 *  @date 27th April, 2004
 *  @author Pratheesh Gangadhar (pratheesh@ti.com)
 */
/* =============================================================================
 *  Revision History
 *  ===============
 *  03-Oct-2004 brn Updated for the new CSL architecture.
 *  11-Oct_2004 brn Updated whit the code review comments. Added header for
 *      CSL_pwmInit() function.
 * =============================================================================
 */

#ifndef _CSL_PWM_H_
#define _CSL_PWM_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <soc.h>
#include <cslr.h>
#include <csl_error.h>
#include <csl_types.h>
#include <cslr_pwm.h>

/* Definitions for default Hardware setup */
/** Definition for default phase1 duration*/
#define CSL_PWM_PH1_DURATION                (8)

/** Definition for default out put period */
#define CSL_PWM_OUT_PERIOD                  (8)

/** Definition for default repeat count */
#define CSL_PWM_RPT_CNT                     (1)

/**
 * @defgroup CSL_PWM_API PWM
 * @internal Based on <b>Imaging and Audio Group PWM Detailed Design
 *  Specification Rev 1.00.w.03 </b>
 */

/**
 *  @defgroup CSL_PWM_DATASTRUCT Data Structures
 *  @ingroup CSL_PWM_API
 */

/**
 *  @defgroup CSL_PWM_DEFINE  Defines
 *  @ingroup CSL_PWM_API
 */

/**
 *  @defgroup CSL_PWM_ENUM  Enumerated Data Types
 *  @ingroup CSL_PWM_API
 */

/**
 *  @defgroup CSL_PWM_FUNCTION  Functions
 *  @ingroup CSL_PWM_API
 */

/*****************************************************************************\
          LCDC global macro declarations
\*****************************************************************************/

/**
 *  @defgroup CSL_PWM_ERROR_DEFINE Error Code
 *  @ingroup CSL_PWM_DEFINE
 * @{
 */
/** Invalid mode */
#define CSL_EPWM_INVMODE CSL_EPWM_FIRST

/**
@} */

/**
 *  @defgroup CSL_PWM_OUTPUT_DEFINE Output Level
 *  @ingroup CSL_PWM_DEFINE
 *
 * @{
 */

/** Low */
#define CSL_PWM_OUTPUT_LOW CSL_PWM_CFG_CURLEV_LOW

/** High */
#define CSL_PWM_OUTPUT_HIGH CSL_PWM_CFG_CURLEV_HIGH

/**
@} */

/**
 *  @defgroup CSL_PWM_OPERSTAT_DEFINE Operation Staus
 *  @ingroup CSL_PWM_DEFINE
 * @{
 */

/** Idle */
#define CSL_PWM_OPERSTAT_IDLE CSL_PWM_CFG_OPST_IDLE

/** Run */
#define CSL_PWM_OPERSTAT_RUN CSL_PWM_CFG_OPST_RUN

/**
@} */


/**************************************************************************\
* PWM global typedef declarations
\**************************************************************************/

/**
 *  @defgroup CSL_PWM_OPMODE_ENUM PWM Operating Modes
 *  @ingroup CSL_PWM_ENUM
 *  @{
 */

/**
 *  @brief  Enums for PWM operating modes
 */
typedef enum {
    /**  Disable PWM module */
    CSL_PWM_DISABLE,

    /**  One shot mode */
    CSL_PWM_ONESHOT,

    /**  Continuous mode */
    CSL_PWM_CONTINUOUS
} CSL_PwmMode;
/**
@} */

/**
 *  @defgroup CSL_PWM_EMUMODE_ENUM Emulation Control
 *  @ingroup CSL_PWM_ENUM
 * @{
 */

/**
 *  @brief  Enums for Emulation modes
 *   This is used by control commands to configure emulation mode
 */
typedef enum {
    /**  PWM stops immediately*/
    CSL_PWM_EMU_STOP = CSL_PWM_PCR_FREE_STOP,

    /**  PWM runs free */
    CSL_PWM_EMU_RUN  = CSL_PWM_PCR_FREE_RUN

} CSL_PwmEmuCtrl;
/**
@} */


/**
 *  @defgroup CSL_PWM_INTR_ENUM Interrupt Control
 *  @ingroup CSL_PWM_ENUM
 *  @{
 */

/**
 *  @brief  Enums for PWM interrupt control
 */
typedef enum {
    /**  Disable PWM interrupt */
    CSL_PWM_INTR_DISABLE = CSL_PWM_CFG_INTEN_DISABLE,

    /**  Enable PWM interrupt */
    CSL_PWM_INTR_ENABLE = CSL_PWM_CFG_INTEN_ENABLE

} CSL_PwmInterrupt;
/**
@} */


/**
 *  @defgroup CSL_PWM_EVENTTRIG_ENUM Event Trigger
 *  @ingroup CSL_PWM_ENUM
 *  @{
 */

/**
 *  @brief  Enums for PWM event trigger configuration
 */
typedef enum {
    /**  Disable PWM event trigger */
    CSL_PWM_EVTTRIG_DISABLE = CSL_PWM_CFG_EVTRIG_DISABLE,

    /**  Enable positive edge trigger */
    CSL_PWM_EVTTRIG_POSITIVE_EDGE = CSL_PWM_CFG_EVTRIG_PEDGE,

    /**  Enable negative edge trigger */
    CSL_PWM_EVTTRIG_NEGATIVE_EDGE = CSL_PWM_CFG_EVTRIG_NEDGE

} CSL_PwmEventTrigger;
/**
@} */

/**
 *  @defgroup CSL_PWM_INACTLEVEL_ENUM Inactive Output Level
 *  @ingroup CSL_PWM_ENUM
 *  @{
 */

/**
 *  @brief  Enums for PWM inactive phase output level
 */
typedef enum {
    /**  Inactive level low  */
    CSL_PWM_INACTOUT_LOW = CSL_PWM_CFG_INACTOUT_LOW,

    /**  Inactive levelhigh */
    CSL_PWM_INACTOUT_HIGH = CSL_PWM_CFG_INACTOUT_HIGH

} CSL_PwmInactOutLevel;
/**
@} */

/**
 *  @defgroup CSL_PWM_P1OUT_ENUM First Phase Output Level
 *  @ingroup CSL_PWM_ENUM
 *  @{
 */

/**
 *  @brief  Enums for PWM first phase output level
 */
typedef enum {
    /**  First phase output level low  */
    CSL_PWM_P1OUT_LOW = CSL_PWM_CFG_P1OUT_LOW,

    /**  First phase output level high  */
    CSL_PWM_P1OUT_HIGH = CSL_PWM_CFG_P1OUT_HIGH

} CSL_PwmP1OutLevel;

/**
@} */

/**
 *  @defgroup CSL_PWM_CONTROLCMD_ENUM  Control Commands
 *  @ingroup CSL_PWM_CONTROL_API
 *  @{
 */
/**
 *  @brief Enumeration for control commands passed to \a CSL_pwmHwControl()
 *  This is the set of commands that are passed to the \a CSL_pwmHwControl()
 *  with an optional argument type-casted to \a void* .
 *  The arguments to be passed with each enumeration (if any) are specified
 *  next to the enumeration
 */
typedef enum {
    /**
     *  @brief Start PWM operation
     *  @param NONE
     *  @return CSL_SOK
     */
    CSL_PWM_CMD_START               = 1,

    /**
     *  @brief Set  (PWM output period - 1)
     *  @param Uint32
     *  @return CSL_SOK
     */
    CSL_PWM_CMD_SET_PERIOD          = 2,

    /**
     *  @brief  Set Phase1 Duration
     *  @param Uint32
     *  @return CSL_SOK
     */
    CSL_PWM_CMD_SET_PHASE1_DURATION = 3,

    /**
     *  @brief  Set mode of operation for PWM
     *  @param  CSL_PwmMode
     *  @return CSL_SOK
     *  @sa     CSL_PwmMode
     */
    CSL_PWM_CMD_SET_MODE            = 4,

    /**
     *  @brief  Configure PWM for one-shot mode
     *  @param CSL_PwmConfigOneShot
     *  @return CSL_SOK
     *  @sa CSL_PwmConfigOneShot
     */
    CSL_PWM_CMD_CONFIG_ONE_SHOT     = 5,

    /**
     *  @brief  Configure PWM for continuous mode
     *  @param CSL_PwmConfigContinuous
     *  @return CSL_SOK
     *  @sa CSL_PwmConfigContinuous
     */
    CSL_PWM_CMD_CONFIG_CONTINUOUS   = 6,

    /**
     *  @brief PWM stop immediately
     *  @param  NONE
     *  @return CSL_SOK
     */
    CSL_PWM_CMD_STOP                = 7,

    /**
     *  @brief  PWM runs free
     *  @param  NONE
     *  @return CSL_SOK */
    CSL_PWM_CMD_RUN_FREE            = 8

} CSL_PwmHwControlCmd;
/**
@} */


/**
 * @defgroup CSL_PWM_QUERYCMD_ENUM Query Commands
 *  @ingroup CSL_PWM_QUERY_API
 * @{
 */

/**
 *  @brief Enumeration for queries passed to \a CSL_PwmGetHwStatus()
 *
 * This is used to get the status of different operations.The arguments
 * to be passed with each enumeration if any are specified next to
 * the enumeration
 */
typedef enum {
    /**
     *  @brief Queries PWM output status
     *  @param (Uint32*)
     *  @return CSL_SOK
     *  @sa CSL_PWM_OUTPUT_DEFINE
     */

⌨️ 快捷键说明

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