mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
This comment adds (1) basic support for AF_BLUETOOTH sockets. The logic compiles but is still incomplete. Support for Bluetooth is general is still dependent on CONFIG_EXPERMIMENTAL because it is not yet ready for used.
Squashed commit of the following:
wireless/bluetooth: Some small changes that gets to a clean compile by just eliminating some incorrect implementations (still with a lot of warnings. The logic is still incomplete but now not so lethal.
wireless/bluetooth: Restructuring: Connection interfaces should internal to wireless/bluetooth. include/nuttx/wireless/bt_conn.h removed and merged with wireless/bluetooth/bt_conn.h. Several fix to get closer to bt_netdev.c compiling. Need to design some not interfaces and use some existing interfaces to send and receiv packets.
wireless/bluetooth: Some organization with some network device compile errors fixed. Still not even close to compiling.
net/bluetooth: Fix numerous compile issues; Still open design issues with regard to the interface with the Bluetooth stack.
wireless/bluetooth: Create bt_netdev.c with a crude copy of mac802154_netdev.c. Does not not even compile yet.
include/nuttx/net: Add bluetooth.h. Content is not yet correct.
net/netpackets: Add bluetooth.h. Update net/bluetooth to use new socket address definition.
net/bluetooth: Some fixes for initial build.
net/bluetooth: Add initial support for Bluetooth sockets. The initial cut is just the a clone of the IEEE 802.15.4 socket support with name changes.
net/ieee802154: Fix some typos noted when cloning to create net/bluetooth.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* net/netdev/netdev_ioctl.c
|
||||
*
|
||||
* Copyright (C) 2007-2012, 2015-2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2012, 2015-2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -73,6 +73,10 @@
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NET_6LOWPAN)
|
||||
# ifdef CONFIG_WIRELESS_BLUETOOTH
|
||||
# include <nuttx/wireless/bt_ioctl.h>
|
||||
# endif
|
||||
|
||||
# ifdef CONFIG_WIRELESS_IEEE802154
|
||||
# include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
# endif
|
||||
@@ -370,6 +374,68 @@ static void ioctl_set_ipv6addr(FAR net_ipv6addr_t outaddr,
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netdev_iee802154_ioctl
|
||||
*
|
||||
* Description:
|
||||
* Perform Bluetooth network device specific operations.
|
||||
*
|
||||
* Input Parameters:
|
||||
* psock - Socket structure
|
||||
* dev - Ethernet driver device structure
|
||||
* cmd - The ioctl command
|
||||
* req - The argument of the ioctl cmd
|
||||
*
|
||||
* Returned Value:
|
||||
* >=0 on success (positive non-zero values are cmd-specific)
|
||||
* Negated errno returned on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NET_6LOWPAN) && \
|
||||
defined(CONFIG_WIRELESS_BLUETOOTH)
|
||||
static int netdev_iee802154_ioctl(FAR struct socket *psock, int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
FAR struct net_driver_s *dev;
|
||||
FAR char *ifname;
|
||||
int ret = -ENOTTY;
|
||||
|
||||
if (arg != 0ul)
|
||||
{
|
||||
if (WL_IBLUETOOTHCMD(cmd))
|
||||
{
|
||||
/* Get the name of the Bluetooth device to receive the IOCTL
|
||||
* command
|
||||
*/
|
||||
|
||||
FAR struct bluetooth_ifreq_s *cmddata =
|
||||
(FAR struct bluetooth_ifreq_s *)((uintptr_t)arg);
|
||||
|
||||
ifname = cmddata->ifr_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Not a Bluetooth IOCTL command */
|
||||
|
||||
return -ENOTTY;
|
||||
}
|
||||
|
||||
/* Find the device with this name */
|
||||
|
||||
dev = netdev_findbyname(ifname);
|
||||
if (dev != NULL && dev->d_lltype == NET_LL_BLUETOOTH)
|
||||
{
|
||||
/* Perform the device IOCTL */
|
||||
|
||||
ret = dev->d_ioctl(dev, cmd, arg);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netdev_iee802154_ioctl
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* net/netdev/netdev_lladdrsize.c
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2017-2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -48,6 +48,7 @@
|
||||
#include <nuttx/net/net.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/radiodev.h>
|
||||
#include <nuttx/net/bluetooth.h>
|
||||
#include <nuttx/net/sixlowpan.h>
|
||||
|
||||
#include "netdev/netdev.h"
|
||||
@@ -62,7 +63,7 @@
|
||||
* Description:
|
||||
* Returns the size of the node address associated with a packet radio.
|
||||
* This is probably CONFIG_PKTRADIO_ADDRLEN but we cannot be sure in the
|
||||
* case that there ar mutiple packet radios. In that case, we have to
|
||||
* case that there are multiple packet radios. In that case, we have to
|
||||
* query the radio for its address length.
|
||||
*
|
||||
* Input Parameters:
|
||||
@@ -127,6 +128,17 @@ int netdev_dev_lladdrsize(FAR struct net_driver_s *dev)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
#ifdef CONFIG_WIRELESS_BLUETOOTH
|
||||
case NET_LL_BLUETOOTH:
|
||||
{
|
||||
/* 6LoWPAN can be configured to use either extended or short
|
||||
* addressing.
|
||||
*/
|
||||
|
||||
return BLUETOOTH_HDRLEN;
|
||||
}
|
||||
#endif /* CONFIG_WIRELESS_BLUETOOTH */
|
||||
|
||||
#ifdef CONFIG_WIRELESS_IEEE802154
|
||||
case NET_LL_IEEE802154:
|
||||
{
|
||||
@@ -140,7 +152,6 @@ int netdev_dev_lladdrsize(FAR struct net_driver_s *dev)
|
||||
return NET_6LOWPAN_SADDRSIZE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* CONFIG_WIRELESS_IEEE802154 */
|
||||
|
||||
#ifdef CONFIG_WIRELESS_PKTRADIO
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <nuttx/net/netconfig.h>
|
||||
#include <nuttx/net/netdev.h>
|
||||
#include <nuttx/net/arp.h>
|
||||
#include <nuttx/net/bluetooth.h>
|
||||
|
||||
#include "utils/utils.h"
|
||||
#include "igmp/igmp.h"
|
||||
@@ -66,6 +67,8 @@
|
||||
#define NETDEV_LO_FORMAT "lo"
|
||||
#define NETDEV_SLIP_FORMAT "sl%d"
|
||||
#define NETDEV_TUN_FORMAT "tun%d"
|
||||
#define NETDEV_BNEP_FORMAT "bnep%d"
|
||||
#define NETDEV_PAN_FORMAT "pan%d"
|
||||
#define NETDEV_WLAN_FORMAT "wlan%d"
|
||||
#define NETDEV_WPAN_FORMAT "wpan%d"
|
||||
|
||||
@@ -215,6 +218,21 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_BLUETOOTH
|
||||
case NET_LL_BLUETOOTH: /* Bluetooth */
|
||||
dev->d_llhdrlen = BLUETOOTH_HDRLEN;
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
# warning Missing logic
|
||||
dev->d_mtu = ???;
|
||||
#ifdef CONFIG_NET_TCP
|
||||
# warning Missing logic
|
||||
dev->d_recvwndo = ???;
|
||||
#endif
|
||||
#endif
|
||||
devfmt = NETDEV_BNEP_FORMAT;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)
|
||||
case NET_LL_IEEE802154: /* IEEE 802.15.4 MAC */
|
||||
case NET_LL_PKTRADIO: /* Non-IEEE 802.15.4 packet radio */
|
||||
|
||||
Reference in New Issue
Block a user