summaryrefslogtreecommitdiff
path: root/cesar/hal/leon/timer.h
blob: 8c4578402fe7ecf0c1739df37d3d63d7a02928fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef hal_leon_timer_h
#define hal_leon_timer_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    hal/leon/timer.h
 * \brief   Public function header to use the Leon Timer.
 * \ingroup hal_leon 
 *
 */

typedef void (*leon_timer_cb_t) (void *user_data);

/** forward declaration. */
typedef struct leon_timer_t leon_timer_t;

/**
 * Initialise Leon timer.
 * \param  user_data  user data passed to the callback
 * \param  cb  timer callback, called in ISR context
 * \return  the newly created context
 */
leon_timer_t *
leon_timer_init (void *user_data, leon_timer_cb_t cb);

/**
 * Uninitialise the Leon timer.
 * \param  ctx  Leon timer context
 */
void
leon_timer_uninit (leon_timer_t *ctx);

/**
 * Program the timer to the given date.
 * \param  ctx  Leon timer context
 * \param  date  timer expiration date
 */
void
leon_timer_program (leon_timer_t *ctx, u32 date);

/**
 * Cancel timer programmation.
 * \param  ctx  Leon timer context
 */
void
leon_timer_cancel (leon_timer_t *ctx);

#endif /* hal_leon_timer_h */