Skip to content

Commit

Permalink
nimble/transport/socket: Add ISO Tx transport support
Browse files Browse the repository at this point in the history
Add support for sending ISO data on native.
  • Loading branch information
MariuszSkamra committed May 17, 2024
1 parent 7ec17b6 commit 1925040
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions nimble/transport/socket/src/ble_hci_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,50 @@ ble_hci_sock_acl_tx(struct os_mbuf *om)

#if MYNEWT_VAL(BLE_SOCK_USE_LINUX_BLUE) || MYNEWT_VAL(BLE_SOCK_USE_TCP)
static int
ble_hci_sock_iso_tx(struct os_mbuf *om)
{
struct msghdr msg;
struct iovec iov[8];
int i;
struct os_mbuf *m;
uint8_t ch;

memset(&msg, 0, sizeof(msg));
memset(iov, 0, sizeof(iov));

msg.msg_iov = iov;

ch = BLE_HCI_UART_H4_ISO;
iov[0].iov_len = 1;
iov[0].iov_base = &ch;
i = 1;
for (m = om; m; m = SLIST_NEXT(m, om_next)) {
iov[i].iov_base = m->om_data;
iov[i].iov_len = m->om_len;
i++;
}
msg.msg_iovlen = i;

STATS_INC(hci_sock_stats, omsg);
STATS_INC(hci_sock_stats, oiso);
STATS_INCN(hci_sock_stats, obytes, OS_MBUF_PKTLEN(om) + 1);
i = sendmsg(ble_hci_sock_state.sock, &msg, 0);
os_mbuf_free_chain(om);
if (i != OS_MBUF_PKTLEN(om) + 1) {
if (i < 0) {
dprintf(1, "sendmsg() failed : %d\n", errno);
} else {
dprintf(1, "sendmsg() partial write: %d\n", i);
}
STATS_INC(hci_sock_stats, oerr);
return BLE_ERR_MEM_CAPACITY;
}
return 0;
}
#endif /* BLE_SOCK_USE_LINUX_BLUE */

#if MYNEWT_VAL(BLE_SOCK_USE_LINUX_BLUE)
static int
ble_hci_sock_cmdevt_tx(uint8_t *hci_ev, uint8_t h4_type)
{
struct msghdr msg;
Expand Down Expand Up @@ -871,6 +915,12 @@ ble_hci_sock_init(void)
SYSINIT_PANIC_ASSERT(rc == 0);
}

int
ble_transport_to_ll_iso_impl(struct os_mbuf *om)
{
return ble_hci_sock_iso_tx(om);
}

void
ble_transport_ll_init(void)
{
Expand Down

0 comments on commit 1925040

Please sign in to comment.