diff options
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmfmac/commonring.h')
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/commonring.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/commonring.h b/drivers/net/wireless/brcm80211/brcmfmac/commonring.h new file mode 100644 index 000000000000..002336e35764 --- /dev/null +++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* Copyright (c) 2014 Broadcom Corporation | ||
2 | * | ||
3 | * Permission to use, copy, modify, and/or distribute this software for any | ||
4 | * purpose with or without fee is hereby granted, provided that the above | ||
5 | * copyright notice and this permission notice appear in all copies. | ||
6 | * | ||
7 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
8 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
9 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | ||
10 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
11 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | ||
12 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | ||
13 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
14 | */ | ||
15 | #ifndef BRCMFMAC_COMMONRING_H | ||
16 | #define BRCMFMAC_COMMONRING_H | ||
17 | |||
18 | |||
19 | struct brcmf_commonring { | ||
20 | u16 r_ptr; | ||
21 | u16 w_ptr; | ||
22 | u16 f_ptr; | ||
23 | u16 depth; | ||
24 | u16 item_len; | ||
25 | |||
26 | void *buf_addr; | ||
27 | |||
28 | int (*cr_ring_bell)(void *ctx); | ||
29 | int (*cr_update_rptr)(void *ctx); | ||
30 | int (*cr_update_wptr)(void *ctx); | ||
31 | int (*cr_write_rptr)(void *ctx); | ||
32 | int (*cr_write_wptr)(void *ctx); | ||
33 | |||
34 | void *cr_ctx; | ||
35 | |||
36 | spinlock_t lock; | ||
37 | unsigned long flags; | ||
38 | bool inited; | ||
39 | bool was_full; | ||
40 | }; | ||
41 | |||
42 | |||
43 | void brcmf_commonring_register_cb(struct brcmf_commonring *commonring, | ||
44 | int (*cr_ring_bell)(void *ctx), | ||
45 | int (*cr_update_rptr)(void *ctx), | ||
46 | int (*cr_update_wptr)(void *ctx), | ||
47 | int (*cr_write_rptr)(void *ctx), | ||
48 | int (*cr_write_wptr)(void *ctx), void *ctx); | ||
49 | void brcmf_commonring_config(struct brcmf_commonring *commonring, u16 depth, | ||
50 | u16 item_len, void *buf_addr); | ||
51 | void brcmf_commonring_lock(struct brcmf_commonring *commonring); | ||
52 | void brcmf_commonring_unlock(struct brcmf_commonring *commonring); | ||
53 | bool brcmf_commonring_write_available(struct brcmf_commonring *commonring); | ||
54 | void *brcmf_commonring_reserve_for_write(struct brcmf_commonring *commonring); | ||
55 | void * | ||
56 | brcmf_commonring_reserve_for_write_multiple(struct brcmf_commonring *commonring, | ||
57 | u16 n_items, u16 *alloced); | ||
58 | int brcmf_commonring_write_complete(struct brcmf_commonring *commonring); | ||
59 | void brcmf_commonring_write_cancel(struct brcmf_commonring *commonring, | ||
60 | u16 n_items); | ||
61 | void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring, | ||
62 | u16 *n_items); | ||
63 | int brcmf_commonring_read_complete(struct brcmf_commonring *commonring); | ||
64 | |||
65 | #define brcmf_commonring_n_items(commonring) (commonring->depth) | ||
66 | #define brcmf_commonring_len_item(commonring) (commonring->item_len) | ||
67 | |||
68 | |||
69 | #endif /* BRCMFMAC_COMMONRING_H */ | ||