arch/sim/src: Variable fixes to get a Bluetooth simulation build.

This commit is contained in:
Gregory Nutt 2018-04-03 10:00:56 -06:00
parent 15d033e32b
commit 0142a5ad13
6 changed files with 49 additions and 36 deletions

View file

@ -52,6 +52,7 @@
#include <nuttx/video/fb.h>
#include <nuttx/timers/oneshot.h>
#include <nuttx/wireless/pktradio.h>
#include <nuttx/wireless/bt_driver.h>
#include <nuttx/wireless/bt_null.h>
#include <nuttx/wireless/ieee802154/ieee802154_loopback.h>
@ -257,6 +258,15 @@ int sim_bringup(void)
}
#endif
#ifdef CONFIG_WIRELESS_BLUETOOTH
/* Initialize the Bluetooth stack */
ret = bt_netdev_register();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: bt_netdev_register() failed: %d\n", ret);
}
#ifdef CONFIG_BLUETOOTH_NULL
/* Register the NULL Bluetooth network device */
@ -265,6 +275,7 @@ int sim_bringup(void)
{
syslog(LOG_ERR, "ERROR: btnull_register() failed: %d\n", ret);
}
#endif
#endif
UNUSED(ret);

View file

@ -56,7 +56,7 @@ static const struct bt_driver_s g_bt_null =
0, /* head_reserve */
btnull_open, /* open */
btnull_send /* send */
}
};
/****************************************************************************
* Private Functions

View file

@ -72,6 +72,27 @@ struct bt_driver_s
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: bt_netdev_register
*
* Description:
* Register a network driver to access the Bluetooth layer using a 6LoWPAN
* IPv6 or AF_BLUETOOTH socket.
*
* This function should be called only once from board bring-up logic
* before any Bluetooth devices are registered.
*
* Input Parameters:
* None
*
* Returned Value:
* Zero (OK) is returned on success. Otherwise a negated errno value is
* returned to indicate the nature of the failure.
*
****************************************************************************/
int bt_netdev_register(void);
/****************************************************************************
* Name: bt_driver_register
*

View file

@ -392,7 +392,7 @@ static int bluetooth_bind(FAR struct socket *psock,
addrlen < sizeof(struct sockaddr_bt_s))
{
nerr("ERROR: Invalid family: %u or address length: %d < %d\n",
addr->sa_family, addrlen, sizeof(struct sockaddr_ll));
addr->sa_family, addrlen, sizeof(struct sockaddr_bt_s));
return -EBADF;
}

View file

@ -601,41 +601,20 @@ static int btnet_ifup(FAR struct net_driver_s *dev)
if (ret >= 0)
{
#ifdef CONFIG_NET_IPv6
wlinfo("Bringing up: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
wlinfo("Bringing up: IP %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
dev->d_ipv6addr[0], dev->d_ipv6addr[1], dev->d_ipv6addr[2],
dev->d_ipv6addr[3], dev->d_ipv6addr[4], dev->d_ipv6addr[5],
dev->d_ipv6addr[6], dev->d_ipv6addr[7]);
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
wlinfo(" Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
wlinfo(" ADDR %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1],
dev->d_mac.radio.nv_addr[2], dev->d_mac.radio.nv_addr[3],
dev->d_mac.radio.nv_addr[4], dev->d_mac.radio.nv_addr[5],
dev->d_mac.radio.nv_addr[6], dev->d_mac.radio.nv_addr[7]);
dev->d_mac.radio.nv_addr[4], dev->d_mac.radio.nv_addr[5]);
#else
wlinfo(" Node: %02x:%02x\n",
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1]);
#endif
#else
if (dev->d_mac.radio.nv_addrlen == 8)
{
ninfo("Bringing up: Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x PANID=%02x:%02x\n",
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1],
dev->d_mac.radio.nv_addr[2], dev->d_mac.radio.nv_addr[3],
dev->d_mac.radio.nv_addr[4], dev->d_mac.radio.nv_addr[5],
dev->d_mac.radio.nv_addr[6], dev->d_mac.radio.nv_addr[7],
priv->lo_panid[0], priv->lo_panid[1]);
}
else if (dev->d_mac.radio.nv_addrlen == 2)
{
ninfo("Bringing up: Node: %02x:%02x PANID=%02x:%02x\n",
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1],
priv->lo_panid[0], priv->lo_panid[1]);
}
else
{
nerr("ERROR: No address assigned\n");
}
wlinfo("Bringing up: %02x:%02x:%02x:%02x:%02x:%02x\n",
dev->d_mac.radio.nv_addr[0], dev->d_mac.radio.nv_addr[1],
dev->d_mac.radio.nv_addr[2], dev->d_mac.radio.nv_addr[3],
dev->d_mac.radio.nv_addr[4], dev->d_mac.radio.nv_addr[5]);
#endif
/* Set and activate a timer process */
@ -997,8 +976,11 @@ static int btnet_properties(FAR struct radio_driver_s *netdev,
* Name: bt_netdev_register
*
* Description:
* Register a network driver to access the Bluetooth MAC layer using a
* 6LoWPAN IPv6 or AF_BLUETOOTH socket.
* Register a network driver to access the Bluetooth layer using a 6LoWPAN
* IPv6 or AF_BLUETOOTH socket.
*
* This function should be called only once from board bring-up logic
* before any Bluetooth devices are registered.
*
* Input Parameters:
* None

View file

@ -146,7 +146,6 @@ int bt_queue_receive(mqd_t mqd, FAR struct bt_buf_s **buf)
ssize_t msgsize;
int priority;
int ret;
DEBUGASSERT(mqd != NULL && buf != NULL);
@ -155,8 +154,8 @@ int bt_queue_receive(mqd_t mqd, FAR struct bt_buf_s **buf)
msgsize = nxmq_receive(mqd, u.msgbuf, BT_MSGSIZE, &priority);
if (msgsize < 0)
{
wlerr("ERROR: nxmq_receive() failed: %d\n", ret);
return ret;
wlerr("ERROR: nxmq_receive() failed: %ld\n", (long)msgsize);
return (int)msgsize;
}
/* Only buffers are expected as messages and all messages should have an