Lines Matching +full:tx +full:- +full:channel

2  * Copyright (c) 2020 - 2022 Nordic Semiconductor ASA
4 * SPDX-License-Identifier: Apache-2.0
22 /* This l2cap is the only OTS-file in use for OTC.
55 len = MIN(l2cap_ctx->ot_chan.tx.mtu, CONFIG_BT_OTS_L2CAP_CHAN_TX_MTU); in ots_l2cap_send()
56 len = MIN(len, l2cap_ctx->tx.len - l2cap_ctx->tx.len_sent); in ots_l2cap_send()
61 net_buf_add_mem(buf, &l2cap_ctx->tx.data[l2cap_ctx->tx.len_sent], len); in ots_l2cap_send()
63 ret = bt_l2cap_chan_send(&l2cap_ctx->ot_chan.chan, buf); in ots_l2cap_send()
68 return -ENOEXEC; in ots_l2cap_send()
71 /* Mark that L2CAP TX was accepted. */ in ots_l2cap_send()
72 l2cap_ctx->tx.len_sent += len; in ots_l2cap_send()
74 LOG_DBG("Sending TX chunk with %d bytes on L2CAP CoC", len); in ots_l2cap_send()
82 LOG_DBG("Channel %p allocating buffer", chan); in l2cap_alloc_buf()
94 LOG_DBG("Outgoing data channel %p transmitted", chan); in l2cap_sent()
98 /* Ongoing TX - sending next chunk. */ in l2cap_sent()
99 if (l2cap_ctx->tx.len != l2cap_ctx->tx.len_sent) { in l2cap_sent()
105 /* TX completed - notify upper layers and clean up. */ in l2cap_sent()
106 memset(&l2cap_ctx->tx, 0, sizeof(l2cap_ctx->tx)); in l2cap_sent()
108 LOG_DBG("Scheduled TX on L2CAP CoC is complete"); in l2cap_sent()
110 if (l2cap_ctx->tx_done) { in l2cap_sent()
111 l2cap_ctx->tx_done(l2cap_ctx, chan->conn); in l2cap_sent()
120 LOG_DBG("Incoming data channel %p received", chan); in l2cap_recv()
124 if (!l2cap_ctx->rx_done) { in l2cap_recv()
125 return -ENODEV; in l2cap_recv()
128 return l2cap_ctx->rx_done(l2cap_ctx, chan->conn, buf); in l2cap_recv()
133 LOG_DBG("Channel %p status %lu", chan, atomic_get(status)); in l2cap_status()
138 LOG_DBG("Channel %p connected", chan); in l2cap_connected()
146 LOG_DBG("Channel %p disconnected", chan); in l2cap_disconnected()
150 if (l2cap_ctx->closed) { in l2cap_disconnected()
151 l2cap_ctx->closed(l2cap_ctx, chan->conn); in l2cap_disconnected()
168 chan->rx.mtu = CONFIG_BT_OTS_L2CAP_CHAN_RX_MTU; in l2cap_chan_init()
169 chan->chan.ops = &l2cap_ops; in l2cap_chan_init()
171 LOG_DBG("RX MTU set to %u", chan->rx.mtu); in l2cap_chan_init()
179 if (l2cap_ctx->ot_chan.chan.conn) { in find_free_l2cap_ctx()
198 l2cap_chan_init(&l2cap_ctx->ot_chan); in l2cap_accept()
199 memset(&l2cap_ctx->tx, 0, sizeof(l2cap_ctx->tx)); in l2cap_accept()
201 *chan = &l2cap_ctx->ot_chan.chan; in l2cap_accept()
206 return -ENOMEM; in l2cap_accept()
234 return (l2cap_ctx->ot_chan.chan.conn == conn); in bt_gatt_ots_l2cap_is_open()
242 if (l2cap_ctx->tx.len != 0) { in bt_gatt_ots_l2cap_send()
243 LOG_ERR("L2CAP TX in progress"); in bt_gatt_ots_l2cap_send()
245 return -EAGAIN; in bt_gatt_ots_l2cap_send()
248 l2cap_ctx->tx.data = data; in bt_gatt_ots_l2cap_send()
249 l2cap_ctx->tx.len = len; in bt_gatt_ots_l2cap_send()
251 LOG_DBG("Starting TX on L2CAP CoC with %d byte packet", len); in bt_gatt_ots_l2cap_send()
265 sys_slist_append(&channels, &l2cap_ctx->node); in bt_gatt_ots_l2cap_register()
272 sys_slist_find_and_remove(&channels, &l2cap_ctx->node); in bt_gatt_ots_l2cap_unregister()
286 return -ENOTCONN; in bt_gatt_ots_l2cap_connect()
291 return -EINVAL; in bt_gatt_ots_l2cap_connect()
298 return -ENOMEM; in bt_gatt_ots_l2cap_connect()
301 l2cap_chan_init(&ctx->ot_chan); in bt_gatt_ots_l2cap_connect()
302 (void)memset(&ctx->tx, 0, sizeof(ctx->tx)); in bt_gatt_ots_l2cap_connect()
305 err = bt_l2cap_chan_connect(conn, &ctx->ot_chan.chan, BT_GATT_OTS_L2CAP_PSM); in bt_gatt_ots_l2cap_connect()
318 return bt_l2cap_chan_disconnect(&l2cap_ctx->ot_chan.chan); in bt_gatt_ots_l2cap_disconnect()