Merge branch 'ieee802154'

This commit is contained in:
Gregory Nutt 2017-06-19 08:04:27 -06:00
commit 1774ae812c
26 changed files with 205 additions and 90 deletions

View File

@ -1906,7 +1906,7 @@
Kivilinna (2017-04-03).
* NSH: Fix some warnings about integer/pointer casts of different sizes
(probably only effects 64-bit simulation) (2017-04-03).
* examples/nettest: Trying to adapt to use for testing 6loWPAN
* examples/nettest: Trying to adapt to use for testing 6LoWPAN
(2017-04-03).
* examples/nettest: If doing loopback, but not using the official
loopback device, then use the server should use the configured client
@ -1925,10 +1925,10 @@
default is +x. No printing of a trace of script commands as they are
executed. From David Sidrane (2017-04-05).
* Print expanded variables if -x. From David Sidrane (2017-04-05).
* examples/udpblaster: Several fixes to work with 6loWPAN (2017-04-06).
* examples/udpblaster: Several fixes to work with 6LoWPAN (2017-04-06).
* examples/udpblaster: Add logic to bind the local UDP socket to a
well-known address (2017-04-06).
* 6loWPAN: Add network IOCTL support to set the node address
* 6LoWPAN: Add network IOCTL support to set the node address
(2017-04-06).
* examples/ostest: Add tests for pthread_rwlock. Adding tests to be
used to verify the pthread_rwlock lock works. From Mark Schulte
@ -1937,9 +1937,9 @@
unconditionally (2017-04-07).
* examples/ostest: pthread rwlock additional tests and bugfixes. From
Mark Schulte (2017-04-07).
* netutils: Add a helper function to convert a string to a 6loWPAN node
* netutils: Add a helper function to convert a string to a 6LoWPAN node
address (2017-04-08).
* NSH library: Extend ifconfig to support 6loWPAN. Adapt to some
* NSH library: Extend ifconfig to support 6LoWPAN. Adapt to some
changes in configuration variable usage (2017-04-08).
* NSH set command: Eliminate useless argc check of SCRIPTS are enabled
but ENVIRONMENT is disabled (2017-04-09).
@ -1995,7 +1995,7 @@
eth0 for network device name (2017-05-02).
* wireless/wext: Add drivers_wext from the WPA supplicant; Integrate
into NSH. From Simon Piriou (2017-05-02).
* 6loWPAN: Replace some Rime address naming with more consistent
* 6LoWPAN: Replace some Rime address naming with more consistent
short/exended address terminology (2017-05-04).
* wireless/ieee802154: Removes libradio to coincide with removal of
ioctl with radio. Moves all functionality from libradio to libmac.

View File

@ -118,7 +118,7 @@ int netlib_getmacaddr(FAR const char *ifname, FAR uint8_t *macaddr);
/* Set IEEE 802.15.4 extended address. */
int netlib_seteaddr(FAR const char *ifname, FAR const uint8_t *eaddr);
int netlib_getpanid(FAR const char *ifname, FAR uint16_t *panid);
int netlib_getpanid(FAR const char *ifname, FAR uint8_t *panid);
bool netlib_eaddrconv(FAR const char *hwstr, FAR uint8_t *hw);
#endif

View File

@ -2,7 +2,10 @@
* apps/include/wireless/ieee802154.h
*
* Copyright(C) 2015 Sebastien Lorquet. All rights reserved.
* Copyright(C) 2017 Verge Inc. All rights reserved.
*
* Author: Sebastien Lorquet <sebastien@lorquet.fr>
* Author: Anthony Merlino <anthony@vergeaero.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -86,11 +89,11 @@ int ieee802154_calibrate_req(int fd,
int ieee802154_setchan(int fd, uint8_t chan);
int ieee802154_getchan(int fd, FAR uint8_t *chan);
int ieee802154_setpanid(int fd, uint16_t panid);
int ieee802154_getpanid(int fd, FAR uint16_t *panid);
int ieee802154_setpanid(int fd, FAR const uint8_t *panid);
int ieee802154_getpanid(int fd, FAR uint8_t *panid);
int ieee802154_setsaddr(int fd, uint16_t saddr);
int ieee802154_getsaddr(int fd, FAR uint16_t *saddr);
int ieee802154_setsaddr(int fd, FAR const uint8_t *saddr);
int ieee802154_getsaddr(int fd, FAR uint8_t *saddr);
int ieee802154_seteaddr(int fd, FAR const uint8_t *eaddr);
int ieee802154_geteaddr(int fd, FAR uint8_t *eaddr);
@ -154,13 +157,15 @@ int sixlowpan_calibrate_req(int sock, FAR const char *ifname,
int sixlowpan_setchan(int sock, FAR const char *ifname, uint8_t chan);
int sixlowpan_getchan(int sock, FAR const char *ifname, FAR uint8_t *chan);
int sixlowpan_setpanid(int sock, FAR const char *ifname, uint16_t panid);
int sixlowpan_setpanid(int sock, FAR const char *ifname,
FAR const uint8_t *panid);
int sixlowpan_getpanid(int sock, FAR const char *ifname,
FAR uint16_t *panid);
FAR uint8_t *panid);
int sixlowpan_setsaddr(int sock, FAR const char *ifname, uint16_t saddr);
int sixlowpan_setsaddr(int sock, FAR const char *ifname,
FAR const uint8_t *saddr);
int sixlowpan_getsaddr(int sock, FAR const char *ifname,
FAR uint16_t *saddr);
FAR uint8_t *saddr);
int sixlowpan_seteaddr(int sock, FAR const char *ifname,
FAR const uint8_t *eaddr);

View File

@ -80,7 +80,7 @@ ifeq ($(CONFIG_NETDEV_WIRELESS_IOCTL),y)
CSRCS += netlib_getessid.c netlib_setessid.c
endif
# MAC address support(Ethernet and 6loWPAN only)
# MAC address support(Ethernet and 6LoWPAN only)
ifeq ($(CONFIG_NET_ETHERNET),y)
CSRCS += netlib_setmacaddr.c netlib_getmacaddr.c

View File

@ -70,7 +70,7 @@
*
****************************************************************************/
int netlib_getpanid(FAR const char *ifname, FAR uint16_t *panid)
int netlib_getpanid(FAR const char *ifname, FAR uint8_t *panid)
{
int ret = ERROR;

View File

@ -123,7 +123,7 @@
# undef CONFIG_NET_LOOPBACK
#endif
/* Only Ethernet and 6loWPAN have MAC layer addresses */
/* Only Ethernet and 6LoWPAN have MAC layer addresses */
#undef HAVE_MAC
#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_NET_6LOWPAN)
@ -310,7 +310,7 @@ static void nsh_set_macaddr(void)
eaddr[6] = (CONFIG_NSH_MACADDR >> (8 * 1)) & 0xff;
eaddr[7] = (CONFIG_NSH_MACADDR >> (8 * 0)) & 0xff;
/* Set the 6loWPAN extended address */
/* Set the 6LoWPAN extended address */
(void)netlib_seteaddr(NET_DEVNAME, eaddr);
@ -326,7 +326,7 @@ static void nsh_set_macaddr(void)
* Description:
* Setup IP addresses.
*
* For 6loWPAN, the IP address derives from the MAC address. Setting it
* For 6LoWPAN, the IP address derives from the MAC address. Setting it
* to any user provided value is asking for trouble.
*
****************************************************************************/

View File

@ -99,6 +99,8 @@
/* /dev/ is 5 characters */
#define I8SAK_DAEMONNAME_FMTLEN (6 + (I8SAK_MAX_DEVNAME-5) + 1)
/****************************************************************************
* Public Types
****************************************************************************/
@ -148,7 +150,7 @@ struct i8sak_s
uint8_t chpage;
struct ieee802154_addr_s addr;
struct ieee802154_addr_s ep;
uint16_t next_saddr;
uint8_t next_saddr[IEEE802154_SADDRSIZE];
uint8_t payload[IEEE802154_MAX_MAC_PAYLOAD_SIZE];
uint16_t payload_len;
int blasterperiod;
@ -166,6 +168,8 @@ uint8_t i8sak_char2nibble(char ch);
int i8sak_str2payload(FAR const char *str, FAR uint8_t *buf);
void i8sak_str2eaddr(FAR const char *str, FAR uint8_t *eaddr);
void i8sak_str2saddr(FAR const char *str, FAR uint8_t *saddr);
void i8sak_str2panid(FAR const char *str, FAR uint8_t *panid);
bool i8sak_str2bool(FAR const char *str);
void i8sak_startpan_cmd (FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]);

View File

@ -137,37 +137,25 @@ static void acceptassoc_eventcb(FAR struct ieee802154_notif_s *notif, FAR void *
printf("i8sak: a device is trying to associate\n");
/* Send a ASSOC.resp primtive to the MAC. Copy the association
* indication address into the association response primitive
*/
IEEE802154_EADDRCOPY(assocresp.devaddr, notif->u.assocind.devaddr);
/* If the address matches our device, accept the association.
* Otherwise, reject the assocation.
*/
if (memcmp(&notif->u.assocind.devaddr[0], &i8sak->ep.eaddr[0],
IEEE802154_EADDR_LEN) == 0)
if (IEEE802154_EADDRCMP(notif->u.assocind.devaddr, i8sak->ep.eaddr))
{
/* Send a ASSOC.resp primtive to the MAC. Copy the association
* indication address into the association response primitive
*/
memcpy(&assocresp.devaddr[0], &notif->u.assocind.devaddr[0],
IEEE802154_EADDR_LEN);
assocresp.assocsaddr = i8sak->next_saddr;
IEEE802154_SADDRCOPY(assocresp.assocsaddr, i8sak->next_saddr);
assocresp.status = IEEE802154_STATUS_SUCCESS;
printf("i8sak: accepting association request\n");
}
else
{
/* Send a ASSOC.resp primtive to the MAC. Copy the association
* indication address into the association response primitive
*/
memcpy(&assocresp.devaddr[0], &notif->u.assocind.devaddr[0],
IEEE802154_EADDR_LEN);
assocresp.status = IEEE802154_STATUS_DENIED;
printf("i8sak: rejecting association request\n");
}

View File

@ -115,14 +115,14 @@ void i8sak_assoc_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
case 's':
/* Parse extended address and put it into the i8sak instance */
i8sak->ep.saddr = i8sak_str2luint16(optarg);
i8sak_str2saddr(optarg, i8sak->ep.saddr);
i8sak->ep.mode= IEEE802154_ADDRMODE_SHORT;
break;
case 'e':
/* Parse extended address and put it into the i8sak instance */
i8sak_str2eaddr(optarg, &i8sak->ep.eaddr[0]);
i8sak_str2eaddr(optarg, i8sak->ep.eaddr);
i8sak->ep.mode = IEEE802154_ADDRMODE_EXTENDED;
break;
@ -148,7 +148,7 @@ void i8sak_assoc_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
if (optcnt && argc == 2)
{
i8sak->ep.panid = i8sak_str2luint16(argv[1]);
i8sak_str2panid(argv[1], i8sak->ep.panid);
}
fd = open(i8sak->devname, O_RDWR);

View File

@ -353,7 +353,7 @@ uint8_t i8sak_char2nibble(char ch)
* Name: i8sak_str2eaddr
*
* Description:
* Convert a string 8-byte EADAR array.
* Convert a string 8-byte EADDR array.
*
****************************************************************************/
@ -387,6 +387,82 @@ void i8sak_str2eaddr(FAR const char *str, FAR uint8_t *eaddr)
}
}
/****************************************************************************
* Name: i8sak_str2saddr
*
* Description:
* Convert a string 2-byte SADDR array.
*
****************************************************************************/
void i8sak_str2saddr(FAR const char *str, FAR uint8_t *saddr)
{
FAR const char *src = str;
uint8_t bvalue;
char ch;
int i;
for (i = 0; i < 2; i++)
{
ch = (char)*src++;
bvalue = i8sak_char2nibble(ch) << 4;
ch = (char)*src++;
bvalue |= i8sak_char2nibble(ch);
*saddr++ = bvalue;
if (i < 1)
{
ch = (char)*src++;
if (ch != ':')
{
fprintf(stderr, "ERROR: Missing colon separator: %s\n", str);
fprintf(stderr, " Expected xx:xx\n");
exit(EXIT_FAILURE);
}
}
}
}
/****************************************************************************
* Name: i8sak_str2panid
*
* Description:
* Convert a string 2-byte PAN ID array.
*
****************************************************************************/
void i8sak_str2panid(FAR const char *str, FAR uint8_t *panid)
{
FAR const char *src = str;
uint8_t bvalue;
char ch;
int i;
for (i = 0; i < 2; i++)
{
ch = (char)*src++;
bvalue = i8sak_char2nibble(ch) << 4;
ch = (char)*src++;
bvalue |= i8sak_char2nibble(ch);
*panid++ = bvalue;
if (i < 1)
{
ch = (char)*src++;
if (ch != ':')
{
fprintf(stderr, "ERROR: Missing colon separator: %s\n", str);
fprintf(stderr, " Expected xx:xx\n");
exit(EXIT_FAILURE);
}
}
}
}
/****************************************************************************
* Name: i8sak_str2bool
*
@ -496,23 +572,38 @@ static int i8sak_setup(FAR struct i8sak_s *i8sak, FAR const char *devname)
/* Initialze default extended address */
for (i = 0; i < IEEE802154_EADDR_LEN; i++)
for (i = 0; i < IEEE802154_EADDRSIZE; i++)
{
i8sak->addr.eaddr[i] = (uint8_t)((CONFIG_IEEE802154_I8SAK_DEV_EADDR >> (i*8)) & 0xFF);
}
/* Initialize the default remote endpoint address */
for (i = 0; i < IEEE802154_EADDR_LEN; i++)
i8sak->ep.mode = IEEE802154_ADDRMODE_SHORT;
for (i = 0; i < IEEE802154_EADDRSIZE; i++)
{
i8sak->ep.eaddr[i] = (uint8_t)((CONFIG_IEEE802154_I8SAK_PANCOORD_EADDR >> (i*8)) & 0xFF);
}
i8sak->ep.mode = IEEE802154_ADDRMODE_SHORT;
i8sak->ep.saddr = CONFIG_IEEE802154_I8SAK_PANCOORD_SADDR;
i8sak->ep.panid = CONFIG_IEEE802154_I8SAK_PANID;
for (i = 0; i < IEEE802154_SADDRSIZE; i++)
{
i8sak->ep.saddr[i] = (uint8_t)((CONFIG_IEEE802154_I8SAK_PANCOORD_SADDR >> (i*8)) & 0xFF);
}
i8sak->next_saddr = CONFIG_IEEE802154_I8SAK_DEV_SADDR;
for (i = 0; i < IEEE802154_PANIDSIZE; i++)
{
i8sak->ep.panid[i] = (uint8_t)((CONFIG_IEEE802154_I8SAK_PANID >> (i*8)) & 0xFF);
}
/* Set the next association device to the default device address, so that
* the first device to request association gets that address.
*/
for (i = 0; i < IEEE802154_SADDRSIZE; i++)
{
i8sak->next_saddr[i] = (uint8_t)((CONFIG_IEEE802154_I8SAK_DEV_SADDR >> (i*8)) & 0xFF);
}
fd = open(i8sak->devname, O_RDWR);
if (fd < 0)
@ -521,7 +612,7 @@ static int i8sak_setup(FAR struct i8sak_s *i8sak, FAR const char *devname)
i8sak_cmd_error(i8sak);
}
ieee802154_seteaddr(fd, &i8sak->addr.eaddr[0]);
ieee802154_seteaddr(fd, i8sak->addr.eaddr);
close(fd);

View File

@ -63,7 +63,6 @@
****************************************************************************/
static void poll_eventcb(FAR struct ieee802154_notif_s *notif, FAR void *arg);
static void poll_receiver(FAR struct mac802154dev_rxframe_s *frame, FAR void *arg);
/****************************************************************************
* Public Functions
@ -133,13 +132,13 @@ void i8sak_poll_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
wpanlistener_add_eventreceiver(&i8sak->wpanlistener, poll_eventcb,
&eventfilter, (FAR void *)i8sak, true);
printf("i8sak: Polling coordinator. PAN ID: 0x%04X SADDR: 0x%04X\n",
i8sak->ep.panid,
i8sak->ep.saddr);
printf("i8sak: Polling coordinator. PAN ID: %02X:%02X SADDR: %02X:%02X\n",
i8sak->ep.panid[0], i8sak->ep.panid[1],
i8sak->ep.saddr[0], i8sak->ep.saddr[1]);
pollreq.coordaddr.mode = IEEE802154_ADDRMODE_SHORT;
pollreq.coordaddr.saddr = i8sak->ep.saddr;
pollreq.coordaddr.panid = i8sak->ep.panid;
IEEE802154_SADDRCOPY(pollreq.coordaddr.saddr, i8sak->ep.saddr);
IEEE802154_PANIDCOPY(pollreq.coordaddr.panid, i8sak->ep.panid);
ieee802154_poll_req(fd, &pollreq);

View File

@ -129,37 +129,61 @@ void i8sak_startpan_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
if (!i8sak->addrset)
{
for (i = 0; i < IEEE802154_EADDR_LEN; i++)
/* Set our address to the default PAN Coordinator configuration */
i8sak->addr.mode = IEEE802154_ADDRMODE_SHORT;
for (i = 0; i < IEEE802154_EADDRSIZE; i++)
{
i8sak->addr.eaddr[i] =
(uint8_t)((CONFIG_IEEE802154_I8SAK_PANCOORD_EADDR >> (i*8)) & 0xFF);
}
i8sak->addr.mode = IEEE802154_ADDRMODE_SHORT;
i8sak->addr.saddr = CONFIG_IEEE802154_I8SAK_PANCOORD_SADDR;
i8sak->addr.panid = CONFIG_IEEE802154_I8SAK_PANID;
for (i = 0; i < IEEE802154_SADDRSIZE; i++)
{
i8sak->addr.saddr[i] =
(uint8_t)((CONFIG_IEEE802154_I8SAK_PANCOORD_SADDR >> (i*8)) & 0xFF);
}
for (i = 0; i < IEEE802154_EADDR_LEN; i++)
for (i = 0; i < IEEE802154_PANIDSIZE; i++)
{
i8sak->addr.panid[i] =
(uint8_t)((CONFIG_IEEE802154_I8SAK_PANID >> (i*8)) & 0xFF);
}
/* Set the endpoint address to the default endpoint device */
i8sak->ep.mode = IEEE802154_ADDRMODE_SHORT;
for (i = 0; i < IEEE802154_EADDRSIZE; i++)
{
i8sak->ep.eaddr[i] =
(uint8_t)((CONFIG_IEEE802154_I8SAK_DEV_EADDR >> (i*8)) & 0xFF);
}
i8sak->ep.mode = IEEE802154_ADDRMODE_SHORT;
i8sak->ep.saddr = CONFIG_IEEE802154_I8SAK_DEV_SADDR;
i8sak->ep.panid = CONFIG_IEEE802154_I8SAK_PANID;
for (i = 0; i < IEEE802154_SADDRSIZE; i++)
{
i8sak->ep.saddr[i] =
(uint8_t)((CONFIG_IEEE802154_I8SAK_DEV_SADDR >> (i*8)) & 0xFF);
}
for (i = 0; i < IEEE802154_PANIDSIZE; i++)
{
i8sak->ep.panid[i] =
(uint8_t)((CONFIG_IEEE802154_I8SAK_PANID >> (i*8)) & 0xFF);
}
}
/* Set EADDR and SADDR */
ieee802154_seteaddr(fd, &i8sak->addr.eaddr[0]);
ieee802154_seteaddr(fd, i8sak->addr.eaddr);
ieee802154_setsaddr(fd, i8sak->addr.saddr);
/* Tell the MAC to start acting as a coordinator */
printf("i8sak: starting PAN\n");
startreq.panid = i8sak->addr.panid;
IEEE802154_PANIDCOPY(startreq.panid, i8sak->addr.panid);
startreq.chnum = i8sak->chnum;
startreq.chpage = i8sak->chpage;
startreq.beaconorder = 15;

View File

@ -61,7 +61,7 @@ int ieee802154_geteaddr(int fd, FAR uint8_t *eaddr)
req.attr = IEEE802154_ATTR_MAC_EXTENDED_ADDR;
ret = ieee802154_get_req(fd, &req);
memcpy(eaddr, &req.attrval.mac.eaddr[0], 8);
IEEE802154_EADDRCOPY(eaddr, req.attrval.mac.eaddr);
return ret;
}

View File

@ -52,7 +52,7 @@
* Public Functions
****************************************************************************/
int ieee802154_getpanid(int fd, FAR uint16_t *panid)
int ieee802154_getpanid(int fd, FAR uint8_t *panid)
{
struct ieee802154_get_req_s req;
int ret;
@ -60,7 +60,7 @@ int ieee802154_getpanid(int fd, FAR uint16_t *panid)
req.attr = IEEE802154_ATTR_MAC_PANID;
ret = ieee802154_get_req(fd, &req);
*panid = req.attrval.mac.panid;
IEEE802154_PANIDCOPY(panid, req.attrval.mac.panid);
return ret;
}

View File

@ -52,7 +52,7 @@
* Public Functions
****************************************************************************/
int ieee802154_getsaddr(int fd, FAR uint16_t *saddr)
int ieee802154_getsaddr(int fd, FAR uint8_t *saddr)
{
struct ieee802154_get_req_s req;
int ret;
@ -60,7 +60,7 @@ int ieee802154_getsaddr(int fd, FAR uint16_t *saddr)
req.attr = IEEE802154_ATTR_MAC_SHORT_ADDRESS;
ret = ieee802154_get_req(fd, &req);
*saddr = req.attrval.mac.saddr;
IEEE802154_SADDRCOPY(saddr, req.attrval.mac.saddr);
return ret;
}

View File

@ -59,7 +59,7 @@ int ieee802154_seteaddr(int fd, FAR const uint8_t *eaddr)
struct ieee802154_set_req_s req;
req.attr = IEEE802154_ATTR_MAC_EXTENDED_ADDR;
memcpy(&req.attrval.mac.eaddr[0], eaddr, 8);
IEEE802154_EADDRCOPY(req.attrval.mac.eaddr, eaddr);
return ieee802154_set_req(fd, &req);
}

View File

@ -53,12 +53,12 @@
* Public Functions
****************************************************************************/
int ieee802154_setpanid(int fd, uint16_t panid)
int ieee802154_setpanid(int fd, FAR const uint8_t *panid)
{
struct ieee802154_set_req_s req;
req.attr = IEEE802154_ATTR_MAC_PANID;
req.attrval.mac.panid = panid;
IEEE802154_PANIDCOPY(req.attrval.mac.panid, panid);
return ieee802154_set_req(fd, &req);
}

View File

@ -53,12 +53,12 @@
* Public Functions
****************************************************************************/
int ieee802154_setsaddr(int fd, uint16_t saddr)
int ieee802154_setsaddr(int fd, FAR const uint8_t *saddr)
{
struct ieee802154_set_req_s req;
req.attr = IEEE802154_ATTR_MAC_SHORT_ADDRESS;
req.attrval.mac.saddr = saddr;
IEEE802154_SADDRCOPY(req.attrval.mac.saddr, saddr);
return ieee802154_set_req(fd, &req);
}

View File

@ -61,7 +61,7 @@ int sixlowpan_geteaddr(int sock, FAR const char *ifname, FAR uint8_t *eaddr)
req.attr = IEEE802154_ATTR_MAC_EXTENDED_ADDR;
ret = sixlowpan_get_req(sock, ifname, &req);
memcpy(eaddr, &req.attrval.mac.eaddr[0], 8);
IEEE802154_EADDRCOPY(eaddr, req.attrval.mac.eaddr);
return ret;
}

View File

@ -53,7 +53,7 @@
* Public Functions
****************************************************************************/
int sixlowpan_getpanid(int sock, FAR const char *ifname, FAR uint16_t *panid)
int sixlowpan_getpanid(int sock, FAR const char *ifname, FAR uint8_t *panid)
{
struct ieee802154_get_req_s req;
int ret;
@ -61,7 +61,7 @@ int sixlowpan_getpanid(int sock, FAR const char *ifname, FAR uint16_t *panid)
req.attr = IEEE802154_ATTR_MAC_PANID;
ret = sixlowpan_get_req(sock, ifname, &req);
*panid = req.attrval.mac.panid;
IEEE802154_PANIDCOPY(panid, req.attrval.mac.panid);
return ret;
}

View File

@ -53,7 +53,7 @@
* Public Functions
****************************************************************************/
int sixlowpan_getsaddr(int sock, FAR const char *ifname, FAR uint16_t *saddr)
int sixlowpan_getsaddr(int sock, FAR const char *ifname, FAR uint8_t *saddr)
{
struct ieee802154_get_req_s req;
int ret;
@ -61,7 +61,7 @@ int sixlowpan_getsaddr(int sock, FAR const char *ifname, FAR uint16_t *saddr)
req.attr = IEEE802154_ATTR_MAC_SHORT_ADDRESS;
ret = sixlowpan_get_req(sock, ifname, &req);
*saddr = req.attrval.mac.saddr;
IEEE802154_SADDRCOPY(saddr, req.attrval.mac.saddr);
return ret;
}

View File

@ -58,7 +58,7 @@ int sixlowpan_seteaddr(int sock, FAR const char *ifname, FAR const uint8_t *eadd
struct ieee802154_set_req_s req;
req.attr = IEEE802154_ATTR_MAC_EXTENDED_ADDR;
memcpy(&req.attrval.mac.eaddr[0], eaddr, 8);
IEEE802154_EADDRCOPY(req.attrval.mac.eaddr, eaddr);
return sixlowpan_set_req(sock, ifname, &req);
}

View File

@ -53,12 +53,12 @@
* Public Functions
****************************************************************************/
int sixlowpan_setpanid(int sock, FAR const char *ifname, uint16_t panid)
int sixlowpan_setpanid(int sock, FAR const char *ifname, FAR const uint8_t *panid)
{
struct ieee802154_set_req_s req;
req.attr = IEEE802154_ATTR_MAC_PANID;
req.attrval.mac.panid = panid;
IEEE802154_PANIDCOPY(req.attrval.mac.panid, panid);
return sixlowpan_set_req(sock, ifname, &req);
}

View File

@ -53,12 +53,12 @@
* Public Functions
****************************************************************************/
int sixlowpan_setsaddr(int sock, FAR const char *ifname, uint16_t saddr)
int sixlowpan_setsaddr(int sock, FAR const char *ifname, FAR const uint8_t *saddr)
{
struct ieee802154_set_req_s req;
req.attr = IEEE802154_ATTR_MAC_SHORT_ADDRESS;
req.attrval.mac.saddr = saddr;
IEEE802154_SADDRCOPY(req.attrval.mac.saddr, saddr);
return sixlowpan_set_req(sock, ifname, &req);
}

View File

@ -48,9 +48,11 @@
* Public Functions
****************************************************************************/
int ieee802154_addrtostr(FAR char *buf, int len,
FAR struct ieee802154_addr_s *addr)
{
#if 0
#ifndef CONFIG_BIG_ENDIAN
uint16_t panid = ((addr->panid & 0xff) << 8) | ((addr->panid >> 8) & 0xff);
#else
@ -87,5 +89,7 @@ int ieee802154_addrtostr(FAR char *buf, int len,
return snprintf(buf,len,"<INVAL>");
}
return -1;
#endif
return -1;
}

View File

@ -315,7 +315,7 @@ static bool iwpan_str2bool(FAR const char *str)
static void iwpan_show_cmd(int sock, FAR const char *ifname)
{
uint8_t eaddr[IEEE802154_EADDR_LEN] =
uint8_t eaddr[IEEE802154_EADDRSIZE] =
{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
@ -506,7 +506,7 @@ static void iwpan_devmode_cmd(int sock, FAR const char *ifname,
static void iwpan_eaddr_cmd(int sock, FAR const char *ifname,
FAR const char *addrstr)
{
uint8_t eaddr[IEEE802154_EADDR_LEN];
uint8_t eaddr[IEEE802154_EADDRSIZE];
int ret;
/* Convert input strings to values */