blob: acc9de0aa3771544e35886025ed5acf04a4218d1 (
plain) (
blame)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#ifndef _SYS_CALLOUT_H
#define _SYS_CALLOUT_H /* include this to override rtems stack's */
/* RTEMS systm.h still declares old timout stuff which is not
* fully compatible with more recent 'callout' functionality.
*
* Also: our struct callout it incompatible with the one
* declared in rtems' sys/callout.h.
* Make sure to include the proper header (first).
*/
typedef unsigned callout_time_t;
struct callout {
struct callout *c_next;
struct callout **c_pprev;
void (*c_func)(void*);
void *c_arg;
struct mtx *c_mtx;
callout_time_t c_time;
unsigned c_flags;
};
#define CALLOUT_PENDING (1<<0)
#define CALLOUT_ACTIVE (1<<1)
/*
* Strictly, we don't need any protection
* because the global network semaphore
* takes care; however we want to
*/
static inline int
callout_active(struct callout *p_c)
{
int rval;
rtems_interrupt_level l;
rtems_interrupt_disable(l);
rval = p_c->c_flags & CALLOUT_ACTIVE;
rtems_interrupt_enable(l);
return rval;
}
static inline int
callout_pending(struct callout *p_c)
{
int rval;
rtems_interrupt_level l;
rtems_interrupt_disable(l);
rval = p_c->c_flags & CALLOUT_PENDING;
rtems_interrupt_enable(l);
return rval;
}
static inline void
callout_decativate(struct callout *p_c)
{
rtems_interrupt_level l;
rtems_interrupt_disable(l);
p_c->c_flags &= ~CALLOUT_ACTIVE;
rtems_interrupt_enable(l);
}
/* We cannot stop a callout that's in progress */
int
callout_stop(struct callout *c);
#define callout_drain callout_stop
int
callout_reset(struct callout *c, int ticks, void (*fn)(void*), void *arg);
void
callout_init(struct callout *c, int mpsafe);
void
callout_init_mtx(struct callout *c, struct mtx *m, unsigned flags);
/* Initialize callout facility [networking must have been initialized already] */
rtems_id
rtems_callout_initialize();
#endif
|