Initial cut of the open ath9k htc firmware.
[open-ath9k-htc-firmware.git] / target_firmware / magpie_fw_dev / target / inc / asf_sm.h
1 /*
2  * Copyright (c) 2007-2008 Atheros Communications, Inc.
3  * All rights reserved.
4  */
5 #ifndef _ASF_SM_H_
6 #define _ASF_SM_H_
7
8 typedef void (*asf_sm_fn_t)(void *object, int event);
9
10 typedef struct asf_sm_s {
11     void *          object;
12     asf_sm_fn_t     fn;
13     void *          event_arg;
14 } asf_sm_t;
15
16 static inline void
17 asf_sm_init(asf_sm_t *sm, void *object)
18 {
19     sm->object = object;
20 }
21
22 static inline void
23 asf_sm_set_state(asf_sm_t *sm, asf_sm_fn_t fn)
24 {
25     sm->fn = fn;
26 }
27
28 static inline void
29 asf_sm_send_event(asf_sm_t *sm, int event)
30 {
31     sm->fn(sm->object, event);
32 }
33
34 static inline void
35 asf_sm_set_event_arg(asf_sm_t *sm, void *arg)
36 {
37     sm->event_arg = arg;
38 }
39
40 static inline void *
41 asf_sm_get_event_arg(asf_sm_t *sm)
42 {
43     return sm->event_arg;
44 }
45
46 #endif /* _ASF_SM_H_ */