ADuCM4x50 Device Drivers API Reference Manual  Release 4.0.0.0
adi_tmr.h
1 
13 #ifndef ADI_TMR_H
14 #define ADI_TMR_H
15 
16 
17 #include <stdint.h>
18 #include <stdbool.h>
19 #include <adi_processor.h>
20 #include <adi_callback.h>
21 
22 
27 /* C++ linkage */
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31 
39 typedef enum {
59 
65 typedef enum {
72 #if defined(__ADUCM302x__)
73 
74  ADI_TMR_DEVICE_NUM = 3u,
75 #elif defined(__ADUCM4x50__)
76 
80 #else
81 #error TMR is not ported for this processor
82 #endif
84 
90 typedef enum {
96 
102 typedef enum {
112 
118 typedef enum {
128 
136 typedef enum {
146 
153 typedef struct {
157  bool bPeriodic;
163  uint16_t nLoad;
165  uint16_t nAsyncLoad;
171 
178 typedef struct {
180  bool bEnable;
184  uint8_t nEventID;
186 
193 typedef struct {
197  bool bMatch;
199  bool bIdleHigh;
201  uint16_t nMatchValue;
203 
204 /******************************************************************************
205  * PUBLIC API
206  * 1.) Eliminate functions that may be optimized out by the linker
207  * 2.) Ordered by designed function call sequence
208  *****************************************************************************/
209 
210 /* Initialize timer driver */
211 ADI_TMR_RESULT adi_tmr_Init (ADI_TMR_DEVICE const eDevice, ADI_CALLBACK const pfCallback, void * const pCBParam, bool bEnableInt);
212 
213 /* Configuration interface functions */
217 
218 /* Timer start and stop */
219 ADI_TMR_RESULT adi_tmr_Enable (ADI_TMR_DEVICE const eDevice, bool bEnable);
220 
221 /* Read functions */
222 ADI_TMR_RESULT adi_tmr_GetCurrentCount (ADI_TMR_DEVICE const eDevice, uint16_t *pCount);
223 ADI_TMR_RESULT adi_tmr_GetCaptureCount (ADI_TMR_DEVICE const eDevice, uint16_t *pCount);
224 
225 /* Reload function */
227 
228 
229 #ifdef __cplusplus
230 }
231 #endif
232 
233 
237 #endif /* ADI_TMR_H */
238 
ADI_TMR_PRESCALER ePrescaler
Definition: adi_tmr.h:159
ADI_TMR_PWM_OUTPUT eOutput
Definition: adi_tmr.h:195
ADI_TMR_CLOCK_SOURCE
Definition: adi_tmr.h:118
ADI_TMR_RESULT adi_tmr_Enable(ADI_TMR_DEVICE const eDevice, bool bEnable)
Enable or Disable the GP or RGB Timer.
Definition: adi_tmr.c:425
ADI_TMR_RESULT adi_tmr_GetCaptureCount(ADI_TMR_DEVICE const eDevice, uint16_t *pCount)
Get GP or RGB Timer Captured Count.
Definition: adi_tmr.c:496
bool bCountingUp
Definition: adi_tmr.h:155
ADI_TMR_RESULT
Definition: adi_tmr.h:39
bool bPeriodic
Definition: adi_tmr.h:157
uint16_t nMatchValue
Definition: adi_tmr.h:201
ADI_TMR_RESULT adi_tmr_Init(ADI_TMR_DEVICE const eDevice, ADI_CALLBACK const pfCallback, void *const pCBParam, bool bEnableInt)
Initialize GP or RGB Timer.
Definition: adi_tmr.c:143
uint16_t nAsyncLoad
Definition: adi_tmr.h:165
ADI_TMR_DEVICE
Definition: adi_tmr.h:65
uint16_t nLoad
Definition: adi_tmr.h:163
ADI_TMR_CLOCK_SOURCE eClockSource
Definition: adi_tmr.h:161
ADI_TMR_RESULT adi_tmr_ConfigPwm(ADI_TMR_DEVICE const eDevice, ADI_TMR_PWM_CONFIG *pwmConfig)
Setup GP or RGB Timer Pulse Width Modulation.
Definition: adi_tmr.c:362
bool bReloading
Definition: adi_tmr.h:167
bool bSyncBypass
Definition: adi_tmr.h:169
ADI_TMR_RESULT adi_tmr_ConfigTimer(ADI_TMR_DEVICE const eDevice, ADI_TMR_CONFIG *timerConfig)
Configure GP or RGB Timer.
Definition: adi_tmr.c:209
ADI_TMR_EVENT
Definition: adi_tmr.h:90
ADI_TMR_RESULT adi_tmr_Reload(ADI_TMR_DEVICE const eDevice)
Reload GP or RGB Timer.
Definition: adi_tmr.c:528
ADI_TMR_PRESCALER
Definition: adi_tmr.h:102
ADI_TMR_PWM_OUTPUT
Definition: adi_tmr.h:136
ADI_TMR_RESULT adi_tmr_ConfigEvent(ADI_TMR_DEVICE const eDevice, ADI_TMR_EVENT_CONFIG *eventConfig)
Setup GP or RGB Timer Event Capture.
Definition: adi_tmr.c:291
ADI_TMR_RESULT adi_tmr_GetCurrentCount(ADI_TMR_DEVICE const eDevice, uint16_t *pCount)
Get GP or RGB Timer Current Count.
Definition: adi_tmr.c:464