net: cc2520: Let's provide ll addr in LE already
As it used directly as the ieee addr. Propre endianess will have to be solved once this stack will be ported to other arch than x86. Change-Id: Ie556fabbd99cc5559025c8392d2f699facb007fa Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
330da1f4c3
commit
4b7309c751
|
@ -268,15 +268,15 @@ static inline uint8_t *get_mac(struct device *dev)
|
|||
{
|
||||
struct cc2520_context *cc2520 = dev->driver_data;
|
||||
|
||||
cc2520->mac_addr[0] = 0x00;
|
||||
cc2520->mac_addr[1] = 0x12;
|
||||
cc2520->mac_addr[2] = 0x4b;
|
||||
cc2520->mac_addr[7] = 0x00;
|
||||
cc2520->mac_addr[6] = 0x12;
|
||||
cc2520->mac_addr[5] = 0x4b;
|
||||
|
||||
cc2520->mac_addr[3] = 0x00;
|
||||
UNALIGNED_PUT(sys_cpu_to_be32(sys_rand32_get()),
|
||||
(uint32_t *) ((void *)cc2520->mac_addr+4));
|
||||
cc2520->mac_addr[4] = 0x00;
|
||||
UNALIGNED_PUT(sys_rand32_get(),
|
||||
(uint32_t *) ((void *)cc2520->mac_addr));
|
||||
|
||||
cc2520->mac_addr[7] = (cc2520->mac_addr[7] & ~0x01) | 0x02;
|
||||
cc2520->mac_addr[0] = (cc2520->mac_addr[0] & ~0x01) | 0x02;
|
||||
|
||||
return cc2520->mac_addr;
|
||||
}
|
||||
|
|
|
@ -225,18 +225,12 @@ void ieee802154_init(struct net_if *iface)
|
|||
#ifdef CONFIG_NET_L2_IEEE802154_ORFD
|
||||
struct ieee802154_context *ctx = net_if_l2_data(iface);
|
||||
const uint8_t *mac = iface->link_addr.addr;
|
||||
uint8_t long_addr[8];
|
||||
uint16_t short_addr;
|
||||
int idx;
|
||||
|
||||
short_addr = (mac[0] << 8) + mac[1];
|
||||
|
||||
for (idx = 0; idx < 8; idx++) {
|
||||
long_addr[7 - idx] = mac[idx];
|
||||
}
|
||||
|
||||
radio->set_ieee_addr(iface->dev, long_addr);
|
||||
radio->set_short_addr(iface->dev, short_addr);
|
||||
radio->set_ieee_addr(iface->dev, mac);
|
||||
|
||||
ctx->pan_id = CONFIG_NET_L2_IEEE802154_ORFD_PAN_ID;
|
||||
ctx->channel = CONFIG_NET_L2_IEEE802154_ORFD_CHANNEL;
|
||||
|
|
Loading…
Reference in a new issue