GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / drivers / uwb / i1480 / i1480-wlp.h
blob7866809dba3cd1c3f0c630f7bdaceed4426a9c31
3 #ifndef __i1480_wlp_h__
4 #define __i1480_wlp_h__
6 #include <linux/spinlock.h>
7 #include <linux/list.h>
8 #include <linux/uwb.h>
9 #include <linux/if_ether.h>
10 #include <asm/byteorder.h>
12 /* New simplified header format? */
13 #undef WLP_HDR_FMT_2
15 /**
16 * Values of the Delivery ID & Type field when PCA or DRP
18 * The Delivery ID & Type field in the WLP TX header indicates whether
19 * the frame is PCA or DRP. This is done based on the high level bit of
20 * this field.
21 * We use this constant to test if the traffic is PCA or DRP as follows:
22 * if (wlp_tx_hdr_delivery_id_type(wlp_tx_hdr) & WLP_DRP)
23 * this is DRP traffic
24 * else
25 * this is PCA traffic
27 enum deliver_id_type_bit {
28 WLP_DRP = 8,
31 /**
32 * WLP TX header
34 * Indicates UWB/WLP-specific transmission parameters for a network
35 * packet.
37 struct wlp_tx_hdr {
38 /* dword 0 */
39 struct uwb_dev_addr dstaddr;
40 u8 key_index;
41 u8 mac_params;
42 /* dword 1 */
43 u8 phy_params;
44 #ifndef WLP_HDR_FMT_2
45 u8 reserved;
46 __le16 oui01;
47 /* dword 2 */
48 u8 oui2; /* if all LE, it could be merged */
49 __le16 prid;
50 #endif
51 } __attribute__((packed));
53 static inline int wlp_tx_hdr_delivery_id_type(const struct wlp_tx_hdr *hdr)
55 return hdr->mac_params & 0x0f;
58 static inline int wlp_tx_hdr_ack_policy(const struct wlp_tx_hdr *hdr)
60 return (hdr->mac_params >> 4) & 0x07;
63 static inline int wlp_tx_hdr_rts_cts(const struct wlp_tx_hdr *hdr)
65 return (hdr->mac_params >> 7) & 0x01;
68 static inline void wlp_tx_hdr_set_delivery_id_type(struct wlp_tx_hdr *hdr, int id)
70 hdr->mac_params = (hdr->mac_params & ~0x0f) | id;
73 static inline void wlp_tx_hdr_set_ack_policy(struct wlp_tx_hdr *hdr,
74 enum uwb_ack_pol policy)
76 hdr->mac_params = (hdr->mac_params & ~0x70) | (policy << 4);
79 static inline void wlp_tx_hdr_set_rts_cts(struct wlp_tx_hdr *hdr, int rts_cts)
81 hdr->mac_params = (hdr->mac_params & ~0x80) | (rts_cts << 7);
84 static inline enum uwb_phy_rate wlp_tx_hdr_phy_rate(const struct wlp_tx_hdr *hdr)
86 return hdr->phy_params & 0x0f;
89 static inline int wlp_tx_hdr_tx_power(const struct wlp_tx_hdr *hdr)
91 return (hdr->phy_params >> 4) & 0x0f;
94 static inline void wlp_tx_hdr_set_phy_rate(struct wlp_tx_hdr *hdr, enum uwb_phy_rate rate)
96 hdr->phy_params = (hdr->phy_params & ~0x0f) | rate;
99 static inline void wlp_tx_hdr_set_tx_power(struct wlp_tx_hdr *hdr, int pwr)
101 hdr->phy_params = (hdr->phy_params & ~0xf0) | (pwr << 4);
106 * WLP RX header
108 * Provides UWB/WLP-specific transmission data for a received
109 * network packet.
111 struct wlp_rx_hdr {
112 /* dword 0 */
113 struct uwb_dev_addr dstaddr;
114 struct uwb_dev_addr srcaddr;
115 /* dword 1 */
116 u8 LQI;
117 s8 RSSI;
118 u8 reserved3;
119 #ifndef WLP_HDR_FMT_2
120 u8 oui0;
121 /* dword 2 */
122 __le16 oui12;
123 __le16 prid;
124 #endif
125 } __attribute__((packed));
128 /** User configurable options for WLP */
129 struct wlp_options {
130 struct mutex mutex; /* access to user configurable options*/
131 struct wlp_tx_hdr def_tx_hdr; /* default tx hdr */
132 u8 pca_base_priority;
133 u8 bw_alloc; /*index into bw_allocs[] for PCA/DRP reservations*/
137 static inline
138 void wlp_options_init(struct wlp_options *options)
140 mutex_init(&options->mutex);
141 wlp_tx_hdr_set_ack_policy(&options->def_tx_hdr, UWB_ACK_INM);
142 wlp_tx_hdr_set_rts_cts(&options->def_tx_hdr, 1);
143 wlp_tx_hdr_set_phy_rate(&options->def_tx_hdr, UWB_PHY_RATE_480);
144 #ifndef WLP_HDR_FMT_2
145 options->def_tx_hdr.prid = cpu_to_le16(0x0000);
146 #endif
150 /* sysfs helpers */
152 extern ssize_t uwb_pca_base_priority_store(struct wlp_options *,
153 const char *, size_t);
154 extern ssize_t uwb_pca_base_priority_show(const struct wlp_options *, char *);
155 extern ssize_t uwb_bw_alloc_store(struct wlp_options *, const char *, size_t);
156 extern ssize_t uwb_bw_alloc_show(const struct wlp_options *, char *);
157 extern ssize_t uwb_ack_policy_store(struct wlp_options *,
158 const char *, size_t);
159 extern ssize_t uwb_ack_policy_show(const struct wlp_options *, char *);
160 extern ssize_t uwb_rts_cts_store(struct wlp_options *, const char *, size_t);
161 extern ssize_t uwb_rts_cts_show(const struct wlp_options *, char *);
162 extern ssize_t uwb_phy_rate_store(struct wlp_options *, const char *, size_t);
163 extern ssize_t uwb_phy_rate_show(const struct wlp_options *, char *);
166 /** Simple bandwidth allocation (temporary and too simple) */
167 struct wlp_bw_allocs {
168 const char *name;
169 struct {
170 u8 mask, stream;
171 } tx, rx;
175 #endif /* #ifndef __i1480_wlp_h__ */