Skip to content
GitLab
Explore
Sign in
f4grx
NuttX RTOS
Compare revisions
49644be9a55a003a23a4555e846d42670c4e98df to 7d7b8a243b0ceecda239c4d86bf91783fc4c6638
Hide whitespace changes
Inline
Side-by-side
wireless/bluetooth/bt_netdev.c
View file @
7d7b8a24
...
...
@@ -217,10 +217,15 @@ static int btnet_advertise(FAR struct net_driver_s *dev)
DEBUGASSERT
(
dev
!=
NULL
&&
dev
->
d_private
!=
NULL
);
/* Get the 6-byte local address from the device */
#warning Missing logic
/* Get the 6-byte local address from the device.
*
* REVISIT: The use of the g_btdev global restricts the implementation to
* a single Bluetooth device.
*/
/* Set the MAC address using that address */
addr
=
g_btdev
.
bdaddr
.
val
;
/* Set the MAC address using 6-byte local address from the device. */
BLUETOOTH_ADDRCOPY
(
dev
->
d_mac
.
radio
.
nv_addr
,
addr
);
dev
->
d_mac
.
radio
.
nv_addrlen
=
BLUETOOTH_ADDRSIZE
;
...
...
@@ -228,15 +233,16 @@ static int btnet_advertise(FAR struct net_driver_s *dev)
#ifdef CONFIG_NET_IPv6
/* Set the IP address based on the 6-byte address */
dev
->
d_ipv6addr
[
0
]
=
HTONS
(
0xfe80
);
dev
->
d_ipv6addr
[
1
]
=
0
;
dev
->
d_ipv6addr
[
2
]
=
0
;
dev
->
d_ipv6addr
[
3
]
=
0
;
dev
->
d_ipv6addr
[
4
]
=
HTONS
(
0x0200
);
dev
->
d_ipv6addr
[
5
]
=
(
uint16_t
)
addr
[
0
]
<<
8
|
(
uint16_t
)
addr
[
1
];
dev
->
d_ipv6addr
[
6
]
=
(
uint16_t
)
addr
[
2
]
<<
8
|
(
uint16_t
)
addr
[
3
];
dev
->
d_ipv6addr
[
7
]
=
(
uint16_t
)
addr
[
4
]
<<
8
|
(
uint16_t
)
addr
[
5
];
dev
->
d_ipv6addr
[
0
]
=
HTONS
(
0xfe80
);
dev
->
d_ipv6addr
[
1
]
=
0
;
dev
->
d_ipv6addr
[
2
]
=
0
;
dev
->
d_ipv6addr
[
3
]
=
0
;
dev
->
d_ipv6addr
[
4
]
=
HTONS
(
0x0200
);
dev
->
d_ipv6addr
[
5
]
=
(
uint16_t
)
addr
[
0
]
<<
8
|
(
uint16_t
)
addr
[
1
];
dev
->
d_ipv6addr
[
6
]
=
(
uint16_t
)
addr
[
2
]
<<
8
|
(
uint16_t
)
addr
[
3
];
dev
->
d_ipv6addr
[
7
]
=
(
uint16_t
)
addr
[
4
]
<<
8
|
(
uint16_t
)
addr
[
5
];
#endif
return
OK
;
}
...
...
@@ -601,41 +607,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
]);
#else
wlinfo
(
" Node: %02x:%02x
\n
"
,
dev
->
d_mac
.
radio
.
nv_addr
[
0
],
dev
->
d_mac
.
radio
.
nv_addr
[
1
]);
#endif
dev
->
d_mac
.
radio
.
nv_addr
[
4
],
dev
->
d_mac
.
radio
.
nv_addr
[
5
]);
#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 */
...
...
@@ -860,7 +845,9 @@ static int btnet_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
static
int
btnet_get_mhrlen
(
FAR
struct
radio_driver_s
*
netdev
,
FAR
const
void
*
meta
)
{
return
BLUETOOTH_FRAME_HDRLEN
;
/* Always report the maximum frame length. */
return
BLUETOOTH_MAX_HDRLEN
;
}
/****************************************************************************
...
...
@@ -933,12 +920,12 @@ static int btnet_req_data(FAR struct radio_driver_s *netdev,
framelist
=
iob
->
io_flink
;
iob
->
io_flink
=
NULL
;
DEBUGASSERT
(
iob
->
io_offset
==
BLUETOOTH_
FRAME
_HDRLEN
&&
iob
->
io_len
>=
BLUETOOTH_
FRAME
_HDRLEN
);
DEBUGASSERT
(
iob
->
io_offset
==
BLUETOOTH_
MAX
_HDRLEN
&&
iob
->
io_len
>=
BLUETOOTH_
MAX
_HDRLEN
);
/* Allocate a buffer to contain the IOB */
buf
=
bt_buf_alloc
(
BT_ACL_OUT
,
iob
,
BLUETOOTH_
FRAME
_HDRLEN
);
buf
=
bt_buf_alloc
(
BT_ACL_OUT
,
iob
,
BLUETOOTH_
MAX
_HDRLEN
);
if
(
buf
==
NULL
)
{
wlerr
(
"ERROR: Failed to allocate buffer container
\n
"
);
...
...
@@ -997,8 +984,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
* *AFTER* any Bluetooth devices have been registered.
*
* Input Parameters:
* None
...
...
wireless/bluetooth/bt_queue.c
View file @
7d7b8a24
...
...
@@ -146,17 +146,17 @@ 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
);
/* Wait for the next message */
u
.
msg
.
buf
=
NULL
;
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: %
l
d
\n
"
,
(
long
)
msgsize
);
return
(
int
)
msgsize
;
}
/* Only buffers are expected as messages and all messages should have an
...
...
@@ -164,7 +164,7 @@ int bt_queue_receive(mqd_t mqd, FAR struct bt_buf_s **buf)
*/
DEBUGASSERT
(
msgsize
==
sizeof
(
struct
bt_bufmsg_s
));
DEBUGASSERT
(
u
.
msg
.
buf
->
frame
!=
NULL
);
DEBUGASSERT
(
u
.
msg
.
buf
!=
NULL
&&
u
.
msg
.
buf
->
frame
!=
NULL
);
/* Return the buffer */
...
...
wireless/bluetooth/bt_queue.h
View file @
7d7b8a24
...
...
@@ -55,7 +55,7 @@
#define BT_CONN_TX "btconntx"
#define BT_HCI_TX "bthcitx"
#define BT_HCI_RX "bthci
t
x"
#define BT_HCI_RX "bthci
r
x"
/* All messages are sent FIFO at the mid-message priorities except for high-
* priority messages received from the Bluetooth driver.
...
...
wireless/bluetooth/bt_smp.c
View file @
7d7b8a24
...
...
@@ -1536,11 +1536,6 @@ static int smp_self_test(void)
return
0
;
}
#else
static
inline
int
smp_self_test
(
void
)
{
return
0
;
}
#endif
/****************************************************************************
...
...
Prev
1
…
11
12
13
14
15
Next