mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 21:36:28 +08:00
arch/sim/src: Variable fixes to get a Bluetooth simulation build.
This commit is contained in:
@@ -52,6 +52,7 @@
|
|||||||
#include <nuttx/video/fb.h>
|
#include <nuttx/video/fb.h>
|
||||||
#include <nuttx/timers/oneshot.h>
|
#include <nuttx/timers/oneshot.h>
|
||||||
#include <nuttx/wireless/pktradio.h>
|
#include <nuttx/wireless/pktradio.h>
|
||||||
|
#include <nuttx/wireless/bt_driver.h>
|
||||||
#include <nuttx/wireless/bt_null.h>
|
#include <nuttx/wireless/bt_null.h>
|
||||||
#include <nuttx/wireless/ieee802154/ieee802154_loopback.h>
|
#include <nuttx/wireless/ieee802154/ieee802154_loopback.h>
|
||||||
|
|
||||||
@@ -257,6 +258,15 @@ int sim_bringup(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
#ifdef CONFIG_BLUETOOTH_NULL
|
||||||
/* Register the NULL Bluetooth network device */
|
/* Register the NULL Bluetooth network device */
|
||||||
|
|
||||||
@@ -265,6 +275,7 @@ int sim_bringup(void)
|
|||||||
{
|
{
|
||||||
syslog(LOG_ERR, "ERROR: btnull_register() failed: %d\n", ret);
|
syslog(LOG_ERR, "ERROR: btnull_register() failed: %d\n", ret);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UNUSED(ret);
|
UNUSED(ret);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ static const struct bt_driver_s g_bt_null =
|
|||||||
0, /* head_reserve */
|
0, /* head_reserve */
|
||||||
btnull_open, /* open */
|
btnull_open, /* open */
|
||||||
btnull_send /* send */
|
btnull_send /* send */
|
||||||
}
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
|
|||||||
@@ -72,6 +72,27 @@ struct bt_driver_s
|
|||||||
* Public Function Prototypes
|
* 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
|
* Name: bt_driver_register
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ static int bluetooth_bind(FAR struct socket *psock,
|
|||||||
addrlen < sizeof(struct sockaddr_bt_s))
|
addrlen < sizeof(struct sockaddr_bt_s))
|
||||||
{
|
{
|
||||||
nerr("ERROR: Invalid family: %u or address length: %d < %d\n",
|
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;
|
return -EBADF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -601,41 +601,20 @@ static int btnet_ifup(FAR struct net_driver_s *dev)
|
|||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NET_IPv6
|
#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[0], dev->d_ipv6addr[1], dev->d_ipv6addr[2],
|
||||||
dev->d_ipv6addr[3], dev->d_ipv6addr[4], dev->d_ipv6addr[5],
|
dev->d_ipv6addr[3], dev->d_ipv6addr[4], dev->d_ipv6addr[5],
|
||||||
dev->d_ipv6addr[6], dev->d_ipv6addr[7]);
|
dev->d_ipv6addr[6], dev->d_ipv6addr[7]);
|
||||||
|
wlinfo(" ADDR %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
|
||||||
wlinfo(" Node: %02x:%02x:%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[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[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[4], dev->d_mac.radio.nv_addr[5]);
|
||||||
dev->d_mac.radio.nv_addr[6], dev->d_mac.radio.nv_addr[7]);
|
|
||||||
#else
|
#else
|
||||||
wlinfo(" Node: %02x:%02x\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[0], dev->d_mac.radio.nv_addr[1],
|
||||||
#endif
|
dev->d_mac.radio.nv_addr[2], dev->d_mac.radio.nv_addr[3],
|
||||||
#else
|
dev->d_mac.radio.nv_addr[4], dev->d_mac.radio.nv_addr[5]);
|
||||||
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");
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set and activate a timer process */
|
/* Set and activate a timer process */
|
||||||
@@ -997,8 +976,11 @@ static int btnet_properties(FAR struct radio_driver_s *netdev,
|
|||||||
* Name: bt_netdev_register
|
* Name: bt_netdev_register
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Register a network driver to access the Bluetooth MAC layer using a
|
* Register a network driver to access the Bluetooth layer using a 6LoWPAN
|
||||||
* 6LoWPAN IPv6 or AF_BLUETOOTH socket.
|
* 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:
|
* Input Parameters:
|
||||||
* None
|
* None
|
||||||
|
|||||||
@@ -146,7 +146,6 @@ int bt_queue_receive(mqd_t mqd, FAR struct bt_buf_s **buf)
|
|||||||
|
|
||||||
ssize_t msgsize;
|
ssize_t msgsize;
|
||||||
int priority;
|
int priority;
|
||||||
int ret;
|
|
||||||
|
|
||||||
DEBUGASSERT(mqd != NULL && buf != NULL);
|
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);
|
msgsize = nxmq_receive(mqd, u.msgbuf, BT_MSGSIZE, &priority);
|
||||||
if (msgsize < 0)
|
if (msgsize < 0)
|
||||||
{
|
{
|
||||||
wlerr("ERROR: nxmq_receive() failed: %d\n", ret);
|
wlerr("ERROR: nxmq_receive() failed: %ld\n", (long)msgsize);
|
||||||
return ret;
|
return (int)msgsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only buffers are expected as messages and all messages should have an
|
/* Only buffers are expected as messages and all messages should have an
|
||||||
|
|||||||
Reference in New Issue
Block a user