2 * Intel 1480 Wireless UWB Link
3 * WLP specific definitions
6 * Copyright (C) 2005-2006 Intel Corporation
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27 #ifndef __i1480_wlp_h__
28 #define __i1480_wlp_h__
30 #include <linux/spinlock.h>
31 #include <linux/list.h>
32 #include <linux/uwb.h>
33 #include <linux/if_ether.h>
34 #include <asm/byteorder.h>
36 /* New simplified header format? */
37 #undef WLP_HDR_FMT_2 /* FIXME: rename */
40 * Values of the Delivery ID & Type field when PCA or DRP
42 * The Delivery ID & Type field in the WLP TX header indicates whether
43 * the frame is PCA or DRP. This is done based on the high level bit of
45 * We use this constant to test if the traffic is PCA or DRP as follows:
46 * if (wlp_tx_hdr_delivery_id_type(wlp_tx_hdr) & WLP_DRP)
51 enum deliver_id_type_bit
{
58 * Indicates UWB/WLP-specific transmission parameters for a network
63 struct uwb_dev_addr dstaddr
;
70 __le16 oui01
; /* FIXME: not so sure if __le16 or u8[2] */
72 u8 oui2
; /* if all LE, it could be merged */
75 } __attribute__((packed
));
77 static inline int wlp_tx_hdr_delivery_id_type(const struct wlp_tx_hdr
*hdr
)
79 return hdr
->mac_params
& 0x0f;
82 static inline int wlp_tx_hdr_ack_policy(const struct wlp_tx_hdr
*hdr
)
84 return (hdr
->mac_params
>> 4) & 0x07;
87 static inline int wlp_tx_hdr_rts_cts(const struct wlp_tx_hdr
*hdr
)
89 return (hdr
->mac_params
>> 7) & 0x01;
92 static inline void wlp_tx_hdr_set_delivery_id_type(struct wlp_tx_hdr
*hdr
, int id
)
94 hdr
->mac_params
= (hdr
->mac_params
& ~0x0f) | id
;
97 static inline void wlp_tx_hdr_set_ack_policy(struct wlp_tx_hdr
*hdr
,
98 enum uwb_ack_pol policy
)
100 hdr
->mac_params
= (hdr
->mac_params
& ~0x70) | (policy
<< 4);
103 static inline void wlp_tx_hdr_set_rts_cts(struct wlp_tx_hdr
*hdr
, int rts_cts
)
105 hdr
->mac_params
= (hdr
->mac_params
& ~0x80) | (rts_cts
<< 7);
108 static inline enum uwb_phy_rate
wlp_tx_hdr_phy_rate(const struct wlp_tx_hdr
*hdr
)
110 return hdr
->phy_params
& 0x0f;
113 static inline int wlp_tx_hdr_tx_power(const struct wlp_tx_hdr
*hdr
)
115 return (hdr
->phy_params
>> 4) & 0x0f;
118 static inline void wlp_tx_hdr_set_phy_rate(struct wlp_tx_hdr
*hdr
, enum uwb_phy_rate rate
)
120 hdr
->phy_params
= (hdr
->phy_params
& ~0x0f) | rate
;
123 static inline void wlp_tx_hdr_set_tx_power(struct wlp_tx_hdr
*hdr
, int pwr
)
125 hdr
->phy_params
= (hdr
->phy_params
& ~0xf0) | (pwr
<< 4);
132 * Provides UWB/WLP-specific transmission data for a received
137 struct uwb_dev_addr dstaddr
;
138 struct uwb_dev_addr srcaddr
;
143 #ifndef WLP_HDR_FMT_2
149 } __attribute__((packed
));
152 /** User configurable options for WLP */
154 struct mutex mutex
; /* access to user configurable options*/
155 struct wlp_tx_hdr def_tx_hdr
; /* default tx hdr */
156 u8 pca_base_priority
;
157 u8 bw_alloc
; /*index into bw_allocs[] for PCA/DRP reservations*/
162 void wlp_options_init(struct wlp_options
*options
)
164 mutex_init(&options
->mutex
);
165 wlp_tx_hdr_set_ack_policy(&options
->def_tx_hdr
, UWB_ACK_INM
);
166 wlp_tx_hdr_set_rts_cts(&options
->def_tx_hdr
, 1);
167 /* FIXME: default to phy caps */
168 wlp_tx_hdr_set_phy_rate(&options
->def_tx_hdr
, UWB_PHY_RATE_480
);
169 #ifndef WLP_HDR_FMT_2
170 options
->def_tx_hdr
.prid
= cpu_to_le16(0x0000);
177 extern ssize_t
uwb_pca_base_priority_store(struct wlp_options
*,
178 const char *, size_t);
179 extern ssize_t
uwb_pca_base_priority_show(const struct wlp_options
*, char *);
180 extern ssize_t
uwb_bw_alloc_store(struct wlp_options
*, const char *, size_t);
181 extern ssize_t
uwb_bw_alloc_show(const struct wlp_options
*, char *);
182 extern ssize_t
uwb_ack_policy_store(struct wlp_options
*,
183 const char *, size_t);
184 extern ssize_t
uwb_ack_policy_show(const struct wlp_options
*, char *);
185 extern ssize_t
uwb_rts_cts_store(struct wlp_options
*, const char *, size_t);
186 extern ssize_t
uwb_rts_cts_show(const struct wlp_options
*, char *);
187 extern ssize_t
uwb_phy_rate_store(struct wlp_options
*, const char *, size_t);
188 extern ssize_t
uwb_phy_rate_show(const struct wlp_options
*, char *);
191 /** Simple bandwidth allocation (temporary and too simple) */
192 struct wlp_bw_allocs
{
200 #endif /* #ifndef __i1480_wlp_h__ */