Kamcho Library 02.00.03  lib.kamcho.02.00.03.287
timer_device.h
Go to the documentation of this file.
1 
12 #ifndef __TIMER_DEVICE_H__
13 #define __TIMER_DEVICE_H__
14 
15 #include <stdint.h>
16 #include "hdf.h"
17 #include "errno.h"
18 
19 typedef const struct Timer_Device_t Timer_Device_Type;
20 typedef void (*timer_cb_func_t)(Timer_Device_Type *dev);
21 
25 typedef struct {
27  uint32_t tick;
29 
33 typedef const struct Timer_Device_t {
34  void (*Start)(void);
35  void (*Stop)(void);
36  void (*LoadCounter)(uint32_t cnt);
38  uint8_t Num;
40  char *Name;
41  void *SFRS;
43 
50 int32_t Timer_devStart(Timer_Device_t *dev);
51 
58 int32_t Timer_devStop(Timer_Device_t *dev);
59 
67 int32_t Timer_devSetMs(Timer_Device_t *dev, uint32_t ms);
68 
76 int32_t Timer_devRegisterIRQ(Timer_Device_t *dev, void *cb);
77 
85 int32_t Timer_devUnregisterIRQ(Timer_Device_t *dev, void *cb);
86 
94 
101 int32_t Timer_devDisableIRQ(Timer_Device_t *dev);
102 
109 int32_t Timer_devClearTick(Timer_Device_t *dev);
110 
117 int32_t Timer_devGetTick(Timer_Device_t *dev);
118 
125 Timer_Device_t *Timer_devRequest(const char *name);
126 
127 #endif /* __TIMER_DEVICE_H__ */
char * Name
Definition: timer_device.h:40
void(* LoadCounter)(uint32_t cnt)
Definition: timer_device.h:36
void * SFRS
Definition: timer_device.h:41
int32_t Timer_devRegisterIRQ(Timer_Device_t *dev, void *cb)
Register interrupt handling function to a timer device.
Definition: timer_device.c:121
uint8_t Num
Definition: timer_device.h:38
const struct Timer_Device_t Timer_Device_t
A structure to represent timer device.
void(* timer_cb_func_t)(Timer_Device_Type *dev)
Definition: timer_device.h:20
A structure to represent timer device state.
Definition: timer_device.h:25
Timer_Device_t * Timer_devRequest(const char *name)
Request a Timer Device.
Definition: timer_device.c:189
int32_t Timer_devStart(Timer_Device_t *dev)
Start a timer.
Definition: timer_device.c:97
timer_cb_func_t cb_func
Definition: timer_device.h:26
int32_t Timer_devGetTick(Timer_Device_t *dev)
Get the tick counter of a timer device.
Definition: timer_device.c:161
uint32_t tick
Definition: timer_device.h:27
int32_t Timer_devUnregisterIRQ(Timer_Device_t *dev, void *cb)
Unregister interrupt handling function to a timer device.
Definition: timer_device.c:129
int32_t Timer_devClearTick(Timer_Device_t *dev)
Clear the tick counter of a timer interrupt.
Definition: timer_device.c:153
A structure to represent timer device.
Definition: timer_device.h:33
int32_t Timer_devSetMs(Timer_Device_t *dev, uint32_t ms)
Set timing interval of a timer.
Definition: timer_device.c:113
IRQn_Type IRQ
Definition: timer_device.h:37
enum IRQn IRQn_Type
The enumeration of Interrupt Number Assignments.
int32_t Timer_devDisableIRQ(Timer_Device_t *dev)
Disable the interrupt of a timer device.
Definition: timer_device.c:145
void(* Start)(void)
Definition: timer_device.h:34
int32_t Timer_devStop(Timer_Device_t *dev)
Stop a timer.
Definition: timer_device.c:105
int32_t Timer_devEnableIRQ(Timer_Device_t *dev)
Enable the interrupt of a timer device.
Definition: timer_device.c:137
void(* Stop)(void)
Definition: timer_device.h:35
Timer_State_t * State
Definition: timer_device.h:39