csl_gpt.h
Go to the documentation of this file.
00001 /*  ===========================================================================
00002  *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005, 2008
00003  *
00004  *   Use of this software is controlled by the terms and conditions found in
00005  *   the license agreement under which this software has been supplied.
00006  *  ===========================================================================
00007  */
00008 
00016 /* ============================================================================
00017  * Revision History
00018  * ================
00019  * 28-Sept-2008 Added GPT for CSL.
00020  * ============================================================================
00021  */
00022 
00033 #ifndef _CSL_GPT_H_
00034 #define _CSL_GPT_H_
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 #include "soc.h"
00041 #include "csl_error.h"
00042 #include "csl_types.h"
00043 #include "csl_general.h"
00044 
00065 /*****************************************************************************\
00066           GPT global macro declarations
00067 \*****************************************************************************/
00072 #define CSL_IAFR_TIMER_FLAG_0_RESETVAL (0x0001u)
00073 
00074 #define CSL_IAFR_TIMER_FLAG_1_RESETVAL (0x0002u)
00075 
00076 #define CSL_IAFR_TIMER_FLAG_2_RESETVAL (0x0004u)
00077 
00078 #define CSL_IAFR_TIMER_FLAG_0_1_2_RESETVAL (0x0007u)
00079 
00084 /**************************************************************************\
00085 * GPT global typedef declarations                                         *
00086 \**************************************************************************/
00087 
00096 typedef enum{
00097     GPT_0 = 0,      
00098     GPT_1,          
00099     GPT_2,          
00100     GPT_INVALID     
00101 }CSL_Instance;
00102 
00108 typedef enum{
00109     GPT_AUTO_DISABLE = 0,   
00110     GPT_AUTO_ENABLE         
00111 }CSL_AutoReLoad;
00112 
00113 
00119 typedef enum{
00120     GPT_TIMER_DISABLE = 0,  
00121     GPT_TIMER_ENABLE        
00122 }CSL_CtrlTimer;
00123 
00129 typedef enum{
00130     GPT_PRE_SC_DIV_0 = 0,   
00131     GPT_PRE_SC_DIV_1,       
00132     GPT_PRE_SC_DIV_2,       
00133     GPT_PRE_SC_DIV_3,       
00134     GPT_PRE_SC_DIV_4,       
00135     GPT_PRE_SC_DIV_5,       
00136     GPT_PRE_SC_DIV_6,       
00137     GPT_PRE_SC_DIV_7,       
00138     GPT_PRE_SC_DIV_8,       
00139     GPT_PRE_SC_DIV_9,       
00140     GPT_PRE_SC_DIV_10,      
00141     GPT_PRE_SC_DIV_11,      
00142     GPT_PRE_SC_DIV_12,      
00143     GPT_PRE_SC_DIV_RESERVE  
00144 }CSL_PreScale;
00145 
00159 typedef struct{
00160     CSL_AutoReLoad  autoLoad;      
00161     CSL_PreScale    preScaleDiv;   
00162     CSL_CtrlTimer   ctrlTim;       
00163     Uint16          prdLow;        
00164     Uint16          prdHigh;       
00165 }CSL_Config;
00166 
00172 typedef struct {
00173     CSL_Instance    Instance;   
00174     Uint16          EventId;    
00175     CSL_TimRegsOvly regs;       
00176 } CSL_GptObj;
00177 
00181 typedef CSL_GptObj *CSL_Handle;
00182 
00183 
00188 /******************************************************************************
00189  * GPT function declarations
00190  *****************************************************************************/
00191 
00239 CSL_Handle GPT_open(CSL_Instance    instance,
00240                     CSL_GptObj      *gptObj,
00241                     CSL_Status      *status);
00242 
00279 CSL_Status GPT_reset(CSL_Handle hGpt);
00280 
00316 CSL_Status GPT_close(CSL_Handle hGpt);
00317 
00318 
00356 CSL_Status GPT_start(CSL_Handle hGpt);
00357 
00395 CSL_Status GPT_stop(CSL_Handle hGpt);
00396 
00435 CSL_Status GPT_getCnt(CSL_Handle hGpt, Uint32 *timeCnt);
00436 
00480 CSL_Status GPT_config(CSL_Handle hGpt, CSL_Config *hwConfig);
00484 #ifdef __cplusplus
00485 }
00486 #endif
00487 
00488 #endif /* _CSL_GPT_H_ */
00489 
00490 
00491