diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2009-09-22 07:26:48 -0400 |
---|---|---|
committer | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2009-11-06 06:23:41 -0500 |
commit | a0b4a738e0e03f5e0d6ca366560f9a48e5adf83a (patch) | |
tree | 8063be3ae88a2bef6377cdf913b2432d9805c48b | |
parent | 375bb0e04b618d0c425b0ea492d16cf71eb94905 (diff) |
wpan-phy: allow specifying a per-page channel mask
IEEE 802.15.4-2006 defines channel pages that hold channels (max 32 pages,
27 channels per page). Allow the driver to specify supported channels
on pages, other than the first one.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
-rw-r--r-- | drivers/ieee802154/fakehard.c | 2 | ||||
-rw-r--r-- | include/net/wpan-phy.h | 2 | ||||
-rw-r--r-- | net/ieee802154/wpan-class.c | 20 |
3 files changed, 21 insertions, 3 deletions
diff --git a/drivers/ieee802154/fakehard.c b/drivers/ieee802154/fakehard.c index 96a2959ce877..f6f2afefaa17 100644 --- a/drivers/ieee802154/fakehard.c +++ b/drivers/ieee802154/fakehard.c | |||
@@ -356,7 +356,7 @@ static int __devinit ieee802154fake_probe(struct platform_device *pdev) | |||
356 | dev->addr_len); | 356 | dev->addr_len); |
357 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | 357 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); |
358 | 358 | ||
359 | phy->channels_supported = (1 << 27) - 1; | 359 | phy->channels_supported[0] = (1 << 27) - 1; |
360 | phy->transmit_power = 0xbf; | 360 | phy->transmit_power = 0xbf; |
361 | 361 | ||
362 | dev->netdev_ops = &fake_ops; | 362 | dev->netdev_ops = &fake_ops; |
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h index 3367dd95cf85..7b7fc581e673 100644 --- a/include/net/wpan-phy.h +++ b/include/net/wpan-phy.h | |||
@@ -34,7 +34,7 @@ struct wpan_phy { | |||
34 | */ | 34 | */ |
35 | u8 current_channel; | 35 | u8 current_channel; |
36 | u8 current_page; | 36 | u8 current_page; |
37 | u32 channels_supported; | 37 | u32 channels_supported[32]; |
38 | u8 transmit_power; | 38 | u8 transmit_power; |
39 | u8 cca_mode; | 39 | u8 cca_mode; |
40 | 40 | ||
diff --git a/net/ieee802154/wpan-class.c b/net/ieee802154/wpan-class.c index 68ccde63155b..0c51f85aa591 100644 --- a/net/ieee802154/wpan-class.c +++ b/net/ieee802154/wpan-class.c | |||
@@ -40,12 +40,30 @@ static ssize_t name ## _show(struct device *dev, \ | |||
40 | 40 | ||
41 | MASTER_SHOW(current_channel, "%d"); | 41 | MASTER_SHOW(current_channel, "%d"); |
42 | MASTER_SHOW(current_page, "%d"); | 42 | MASTER_SHOW(current_page, "%d"); |
43 | MASTER_SHOW(channels_supported, "%#x"); | ||
44 | MASTER_SHOW_COMPLEX(transmit_power, "%d +- %d dB", | 43 | MASTER_SHOW_COMPLEX(transmit_power, "%d +- %d dB", |
45 | ((signed char) (phy->transmit_power << 2)) >> 2, | 44 | ((signed char) (phy->transmit_power << 2)) >> 2, |
46 | (phy->transmit_power >> 6) ? (phy->transmit_power >> 6) * 3 : 1 ); | 45 | (phy->transmit_power >> 6) ? (phy->transmit_power >> 6) * 3 : 1 ); |
47 | MASTER_SHOW(cca_mode, "%d"); | 46 | MASTER_SHOW(cca_mode, "%d"); |
48 | 47 | ||
48 | static ssize_t channels_supported_show(struct device *dev, | ||
49 | struct device_attribute *attr, char *buf) | ||
50 | { | ||
51 | struct wpan_phy *phy = container_of(dev, struct wpan_phy, dev); | ||
52 | int ret; | ||
53 | int i, len = 0; | ||
54 | |||
55 | mutex_lock(&phy->pib_lock); | ||
56 | for (i = 0; i < 32; i++) { | ||
57 | ret = snprintf(buf + len, PAGE_SIZE - len, | ||
58 | "%#09x\n", phy->channels_supported[i]); | ||
59 | if (ret < 0) | ||
60 | break; | ||
61 | len += ret; | ||
62 | } | ||
63 | mutex_unlock(&phy->pib_lock); | ||
64 | return len; | ||
65 | } | ||
66 | |||
49 | static struct device_attribute pmib_attrs[] = { | 67 | static struct device_attribute pmib_attrs[] = { |
50 | __ATTR_RO(current_channel), | 68 | __ATTR_RO(current_channel), |
51 | __ATTR_RO(current_page), | 69 | __ATTR_RO(current_page), |