123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- #ifndef __ALT_ALARM_H__
- #define __ALT_ALARM_H__
- #include "alt_llist.h"
- #include "alt_types.h"
- #include "priv/alt_alarm.h"
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- typedef struct alt_alarm_s alt_alarm;
- extern int alt_alarm_start (alt_alarm* the_alarm,
- alt_u32 nticks,
- alt_u32 (*callback) (void* context),
- void* context);
- extern void alt_alarm_stop (alt_alarm* the_alarm);
- static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_ticks_per_second (void)
- {
- return _alt_tick_rate;
- }
- static ALT_INLINE int ALT_ALWAYS_INLINE alt_sysclk_init (alt_u32 nticks)
- {
- if (! _alt_tick_rate)
- {
- _alt_tick_rate = nticks;
- return 0;
- }
- else
- {
- return -1;
- }
- }
- static ALT_INLINE alt_u32 ALT_ALWAYS_INLINE alt_nticks (void)
- {
- return _alt_nticks;
- }
- extern void alt_tick (void);
- #ifdef __cplusplus
- }
- #endif
- #endif
|