📄 csl_timer.h
字号:
/** @mainpage TIMER 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 TIMER 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 TIMER module. While other cases * this list of APIs may not be sufficient to cover all the features of a * particular TIMER 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_timer.h * * @brief Header file for functional layer of CSL * * Description * - The different enumerations, structure definitions * and function declarations * * Modification 1 * - modified on: 15/04/2004 * - reason: Created the sources * * @date 15th Apr, 2004 * @author Amruth Tadas. * */#ifndef _CSL_TIMER_H_#define _CSL_TIMER_H_#ifdef __cplusplusextern "C" {#endif#include <csl.h>#include <cslr_timer.h> /** * @brief Enumeration for Reload mode */typedef enum { CSL_TIMER_LOADMODE_ONESHOT = CSL_TIMER_CNTL_AR_ONESHOT, /**< One shot mode */ CSL_TIMER_LOADMODE_RELOAD = CSL_TIMER_CNTL_AR_RELOAD /**< Auto Reload mode */} CSL_TimerLoadMode;/** * @brief Emulation setting */typedef enum { CSL_TIMER_EMUMODE_STOP = CSL_TIMER_CNTL_FREE_SUSPEND, /**< Stop on emulation suspend */ CSL_TIMER_EMUMODE_RUNFREE = CSL_TIMER_CNTL_FREE_FREEMODE /**< Unchanged on emulation suspend */} CSL_TimerEmuMode;/** * @brief External clock enable/disable settings */typedef enum { CSL_TIMER_EXTCLOCK_DISABLE = CSL_TIMER_CNTL_CLKEN_DISABLE, /**< External clock disabled */ CSL_TIMER_EXTCLOCK_ENABLE = CSL_TIMER_CNTL_CLKEN_ENABLE /**< External clock enabled */} CSL_TimerExtClock;/** * @brief Prescale value */typedef enum { CSL_TIMER_PRESCALE_CLKBY2 = CSL_TIMER_CNTL_PTV_CLKBY2, /**< Prescale by 2 */ CSL_TIMER_PRESCALE_CLKBY4 = CSL_TIMER_CNTL_PTV_CLKBY4, /**< Prescale by 4 */ CSL_TIMER_PRESCALE_CLKBY8 = CSL_TIMER_CNTL_PTV_CLKBY8, /**< Prescale by 8 */ CSL_TIMER_PRESCALE_CLKBY16 = CSL_TIMER_CNTL_PTV_CLKBY16, /**< Prescale by 16 */ CSL_TIMER_PRESCALE_CLKBY32 = CSL_TIMER_CNTL_PTV_CLKBY32, /**< Prescale by 32 */ CSL_TIMER_PRESCALE_CLKBY64 = CSL_TIMER_CNTL_PTV_CLKBY64, /**< Prescale by 64 */ CSL_TIMER_PRESCALE_CLKBY128 = CSL_TIMER_CNTL_PTV_CLKBY128, /**< Prescale by 128 */ CSL_TIMER_PRESCALE_CLKBY256 = CSL_TIMER_CNTL_PTV_CLKBY256 /**< Prescale by 256 */} CSL_TimerPrescale;/** * @brief Enumeration of the control commands * * These are the control commands that could be used with * CSL_timerHwControl(..). Some of the commands expect an * argument as documented along-side the description of * the command. * */typedef enum { CSL_TIMER_CMD_START, /**< * @brief Start the timer * @param None */ CSL_TIMER_CMD_STOP, /**< * @brief Stop the timer * @param None */ CSL_TIMER_CMD_SETCOUNT, /**< * @brief Sets the load-value * @param CSL_TimerCount */ CSL_TIMER_CMD_REGRESET, /**< * @brief Resets registers to power-on defaults * @param None */ CSL_TIMER_CMD_SETPRESCALE, /**< * @brief Modify the prescale * @param CSL_TimerPrescale */ CSL_TIMER_CMD_MODEONESHOT, /**< * @brief Change mode to One Shot * @param None */ CSL_TIMER_CMD_MODERELOAD, /**< * @brief Change mode to Auto Reload * @param None */ CSL_TIMER_CMD_EMUSTOP, /**< * @brief Configure to stop on encountering a emulator breakpoint * @param None */ CSL_TIMER_CMD_EMURUNFREE, /**< * @brief Configure to run-free, even on encountering a emulator breakpoint * @param None */ CSL_TIMER_CMD_EXTCLKDISABLE, /**< * @brief Disable use of external clock * @param None */ CSL_TIMER_CMD_EXTCLKENABLE /**< * @brief Enable use of external clock * @param None */} CSL_TimerHwControlCmd;/** * @brief Enumeration of the queries * * These are the queries that could be used with CSL_timerGetHwStatus(..). * The queries return a value through the object pointed to by the pointer * that it takes as an argument. The argument supported by the query is * documented along-side the description of the query. */typedef enum { CSL_TIMER_QUERY_COUNT, /**< * @brief Retrieve the current count value * @param (CSL_TimerCount *) */ CSL_TIMER_QUERY_PRESCALE, /**< * @brief Retrieve prescale value * @param (CSL_TimerPrescale *) */ CSL_TIMER_QUERY_LOADMODE, /**< * @brief Retrieve current timer load mode * @param (CSL_TimerLoadMode *) */ CSL_TIMER_QUERY_EMUMODE, /**< * @brief Retrieve the current emulation mode * @param (CSL_TimerEmuMode *) */ CSL_TIMER_QUERY_EXTCLOCK, /**< * @brief Retrieve whether external clock is enabled or disabled * @param (CSL_TimerExtClock *) */ CSL_TIMER_QUERY_ISRUNNING /**< * @brief Check whether timer is running * @param (Bool *) */} CSL_TimerHwStatusQuery;/**< * @brief Type abstraction for timer count */typedef Uint32 CSL_TimerCount;/** * @brief The setup-structure * * Used to configure the timer using CSL_timerHwSetup(..) */typedef struct CSL_TimerHwSetup { CSL_TimerCount loadVal; /**< Load Value (reload count) */ CSL_TimerPrescale prescale; /**< Prescale */ CSL_TimerLoadMode loadMode; /**< Load Mode */ CSL_TimerEmuMode emuMode; /**< Emulation Control */ CSL_TimerExtClock extClock; /**< External Clock Enable/Disable */} CSL_TimerHwSetup;/** * @brief Default values for the setup-parameters */#define CSL_TIMER_HWSETUP_DEFAULTS { \ 0xFFFFFFFF, \ CSL_TIMER_PRESCALE_CLKBY2, \ CSL_TIMER_LOADMODE_ONESHOT, \ CSL_TIMER_EMUMODE_STOP, \ CSL_TIMER_EXTCLOCK_DISABLE \}/** * @brief The config-structure * * Used to configure the timer using CSL_timerHwSetupRaw(..) */typedef struct { Uint32 CNTL; /**< CNTL register */ Uint32 LOAD; /**< LOAD register */} CSL_TimerConfig;/** * @brief Default values for the config-structure */#define CSL_TIMER_CONFIG_DEFAULTS { \ CSL_TIMER_CNTL_RESETVAL,\ CSL_TIMER_LOAD_RESETVAL\}/** @brief This object contains the reference to the instance of TIMER opened * using the @a CSL_timerOpen(). * * The pointer to this, is passed to all TIMER CSL APIs. */typedef struct CSL_TimerObj { /** This is a pointer to the registers of the instance of TIMER * referred to by this object */ CSL_TimerRegsOvly regs; /** This is the instance of TIMER being referred to by this object */ CSL_InstNum perNum;} CSL_TimerObj;typedef struct CSL_TimerObj *CSL_TimerHandle;/** @brief This will have the base-address information for the peripheral * instance */typedef struct { /** Base-address of the Configuration registers of the peripheral */ CSL_TimerRegsOvly regs;} CSL_TimerBaseAddress;/** @brief Module specific parameters. Present implementation doesn't have * any module specific parameters. */typedef struct{ /** Bit mask to be used for module specific parameters. * The below declaration is just a place-holder for future * implementation. */ CSL_BitMask16 flags;} CSL_TimerParam;/** @brief Module specific context information. Present implementation doesn't have * any Context information. */typedef struct { /** Context information of TIMER. * The below declaration is just a place-holder for future * implementation. */ Uint16 contextInfo;} CSL_TimerContext;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -