Home
last modified time | relevance | path

Searched full:buf (Results 1 – 25 of 1374) sorted by relevance

12345678910>>...55

/Zephyr-Core-3.5.0/subsys/net/
Dbuf_simple.c17 #include <zephyr/net/buf.h>
32 void net_buf_simple_init_with_data(struct net_buf_simple *buf, in net_buf_simple_init_with_data() argument
35 buf->__buf = data; in net_buf_simple_init_with_data()
36 buf->data = data; in net_buf_simple_init_with_data()
37 buf->size = size; in net_buf_simple_init_with_data()
38 buf->len = size; in net_buf_simple_init_with_data()
41 void net_buf_simple_reserve(struct net_buf_simple *buf, size_t reserve) in net_buf_simple_reserve() argument
43 __ASSERT_NO_MSG(buf); in net_buf_simple_reserve()
44 __ASSERT_NO_MSG(buf->len == 0U); in net_buf_simple_reserve()
45 NET_BUF_SIMPLE_DBG("buf %p reserve %zu", buf, reserve); in net_buf_simple_reserve()
[all …]
Dbuf.c1 /* buf.c - Buffer management */
21 #include <zephyr/net/buf.h>
62 int net_buf_id(struct net_buf *buf) in net_buf_id() argument
64 struct net_buf_pool *pool = net_buf_pool_get(buf->pool_id); in net_buf_id()
67 ptrdiff_t offset = (uint8_t *)buf - (uint8_t *)pool->__bufs; in net_buf_id()
78 struct net_buf *buf; in pool_get_uninit() local
80 buf = (struct net_buf *)(((uint8_t *)pool->__bufs) + byte_offset); in pool_get_uninit()
82 buf->pool_id = pool_id(pool); in pool_get_uninit()
83 buf->user_data_size = pool->user_data_size; in pool_get_uninit()
85 return buf; in pool_get_uninit()
[all …]
/Zephyr-Core-3.5.0/subsys/net/lib/mqtt_sn/
Dmqtt_sn_decoder.c33 * @param buf
36 static ssize_t decode_payload_length(struct net_buf_simple *buf) in decode_payload_length() argument
40 size_t buflen = buf->len; in decode_payload_length()
51 length = net_buf_simple_pull_u8(buf); in decode_payload_length()
53 length = net_buf_simple_pull_be16(buf); in decode_payload_length()
71 static void decode_flags(struct net_buf_simple *buf, struct mqtt_sn_flags *flags) in decode_flags() argument
73 uint8_t b = net_buf_simple_pull_u8(buf); in decode_flags()
86 static void decode_data(struct net_buf_simple *buf, struct mqtt_sn_data *dest) in decode_data() argument
88 dest->size = buf->len; in decode_data()
89 dest->data = net_buf_simple_pull_mem(buf, buf->len); in decode_data()
[all …]
Dmqtt_sn_encoder.c22 * @param buf Message struct to use
27 static int prepare_message(struct net_buf_simple *buf, size_t sz, enum mqtt_sn_msg_type type) in prepare_message() argument
34 size_t maxlen = net_buf_simple_max_len(buf); in prepare_message()
50 net_buf_simple_add_u8(buf, (uint8_t)sz); in prepare_message()
52 net_buf_simple_add_u8(buf, MQTT_SN_LENGTH_FIELD_EXTENDED_PREFIX); in prepare_message()
53 net_buf_simple_add_be16(buf, (uint16_t)sz); in prepare_message()
56 net_buf_simple_add_u8(buf, (uint8_t)type); in prepare_message()
61 static void encode_flags(struct net_buf_simple *buf, struct mqtt_sn_flags *flags) in encode_flags() argument
77 net_buf_simple_add_u8(buf, b); in encode_flags()
80 static int mqtt_sn_encode_msg_searchgw(struct net_buf_simple *buf, in mqtt_sn_encode_msg_searchgw() argument
[all …]
/Zephyr-Core-3.5.0/tests/net/buf_simple/src/
Dmain.c10 #include <zephyr/net/buf.h>
14 NET_BUF_SIMPLE_DEFINE_STATIC(buf, 16);
33 net_buf_simple_reset(&buf); in net_buf_simple_test_suite_before()
43 net_buf_simple_clone(&buf, &clone); in ZTEST()
45 zassert_equal(buf.data, clone.data, "Incorrect clone data pointer"); in ZTEST()
50 net_buf_simple_add_mem(&buf, &le16, sizeof(le16)); in ZTEST()
52 zassert_equal(u16, net_buf_simple_pull_le16(&buf), in ZTEST()
58 net_buf_simple_add_mem(&buf, &be16, sizeof(be16)); in ZTEST()
60 zassert_equal(u16, net_buf_simple_pull_be16(&buf), in ZTEST()
66 net_buf_simple_add_le16(&buf, u16); in ZTEST()
[all …]
/Zephyr-Core-3.5.0/tests/net/buf/src/
Dmain.c14 #include <zephyr/net/buf.h>
66 static void buf_destroy(struct net_buf *buf);
67 static void fixed_destroy(struct net_buf *buf);
68 static void var_destroy(struct net_buf *buf);
74 static void buf_destroy(struct net_buf *buf) in buf_destroy() argument
76 struct net_buf_pool *pool = net_buf_pool_get(buf->pool_id); in buf_destroy()
80 net_buf_destroy(buf); in buf_destroy()
83 static void fixed_destroy(struct net_buf *buf) in fixed_destroy() argument
85 struct net_buf_pool *pool = net_buf_pool_get(buf->pool_id); in fixed_destroy()
89 net_buf_destroy(buf); in fixed_destroy()
[all …]
/Zephyr-Core-3.5.0/subsys/bluetooth/mesh/
Ddfu_metadata.c7 #include <zephyr/net/buf.h>
15 int bt_mesh_dfu_metadata_decode(struct net_buf_simple *buf, in bt_mesh_dfu_metadata_decode() argument
18 if (buf->len < 12) { in bt_mesh_dfu_metadata_decode()
22 metadata->fw_ver.major = net_buf_simple_pull_u8(buf); in bt_mesh_dfu_metadata_decode()
23 metadata->fw_ver.minor = net_buf_simple_pull_u8(buf); in bt_mesh_dfu_metadata_decode()
24 metadata->fw_ver.revision = net_buf_simple_pull_le16(buf); in bt_mesh_dfu_metadata_decode()
25 metadata->fw_ver.build_num = net_buf_simple_pull_le32(buf); in bt_mesh_dfu_metadata_decode()
26 metadata->fw_size = net_buf_simple_pull_le24(buf); in bt_mesh_dfu_metadata_decode()
27 metadata->fw_core_type = net_buf_simple_pull_u8(buf); in bt_mesh_dfu_metadata_decode()
30 if (buf->len < 6) { in bt_mesh_dfu_metadata_decode()
[all …]
Dsar_cfg.c7 #include <zephyr/net/buf.h>
17 void bt_mesh_sar_tx_encode(struct net_buf_simple *buf, in bt_mesh_sar_tx_encode() argument
20 net_buf_simple_add_u8(buf, (tx->seg_int_step & 0xf) | in bt_mesh_sar_tx_encode()
22 net_buf_simple_add_u8(buf, (tx->unicast_retrans_without_prog_count & in bt_mesh_sar_tx_encode()
24 net_buf_simple_add_u8(buf, (tx->unicast_retrans_int_inc & 0xf) | in bt_mesh_sar_tx_encode()
26 net_buf_simple_add_u8(buf, tx->multicast_retrans_int & 0xf); in bt_mesh_sar_tx_encode()
29 void bt_mesh_sar_rx_encode(struct net_buf_simple *buf, in bt_mesh_sar_rx_encode() argument
32 net_buf_simple_add_u8(buf, (rx->seg_thresh & 0x1f) | in bt_mesh_sar_rx_encode()
34 net_buf_simple_add_u8(buf, (rx->discard_timeout & 0xf) | in bt_mesh_sar_rx_encode()
36 net_buf_simple_add_u8(buf, (rx->ack_retrans_count & 0x3)); in bt_mesh_sar_rx_encode()
[all …]
/Zephyr-Core-3.5.0/lib/os/
Dring_buffer.c12 uint32_t ring_buf_put_claim(struct ring_buf *buf, uint8_t **data, uint32_t size) in ring_buf_put_claim() argument
17 base = buf->put_base; in ring_buf_put_claim()
18 wrap_size = buf->put_head - base; in ring_buf_put_claim()
19 if (unlikely(wrap_size >= buf->size)) { in ring_buf_put_claim()
21 wrap_size -= buf->size; in ring_buf_put_claim()
22 base += buf->size; in ring_buf_put_claim()
24 wrap_size = buf->size - wrap_size; in ring_buf_put_claim()
26 free_space = ring_buf_space_get(buf); in ring_buf_put_claim()
30 *data = &buf->buffer[buf->put_head - base]; in ring_buf_put_claim()
31 buf->put_head += size; in ring_buf_put_claim()
[all …]
/Zephyr-Core-3.5.0/tests/bsim/bluetooth/host/att/sequential/tester/src/
Dmain.c11 #include <zephyr/net/buf.h>
12 #include <zephyr/bluetooth/buf.h>
64 struct net_buf *buf; in bt_hci_cmd_create() local
68 buf = net_buf_alloc(&hci_cmd_pool, K_FOREVER); in bt_hci_cmd_create()
69 ASSERT(buf, "failed allocation"); in bt_hci_cmd_create()
71 LOG_DBG("buf %p", buf); in bt_hci_cmd_create()
73 net_buf_reserve(buf, BT_BUF_RESERVE); in bt_hci_cmd_create()
75 bt_buf_set_type(buf, BT_BUF_CMD); in bt_hci_cmd_create()
77 hdr = net_buf_add(buf, sizeof(*hdr)); in bt_hci_cmd_create()
81 return buf; in bt_hci_cmd_create()
[all …]
/Zephyr-Core-3.5.0/tests/bsim/bluetooth/host/l2cap/split/tester/src/
Dmain.c11 #include <zephyr/net/buf.h>
12 #include <zephyr/bluetooth/buf.h>
52 struct net_buf *buf; in bt_hci_cmd_create() local
56 buf = net_buf_alloc(&hci_cmd_pool, K_FOREVER); in bt_hci_cmd_create()
57 __ASSERT_NO_MSG(buf); in bt_hci_cmd_create()
59 LOG_DBG("buf %p", buf); in bt_hci_cmd_create()
61 net_buf_reserve(buf, BT_BUF_RESERVE); in bt_hci_cmd_create()
63 bt_buf_set_type(buf, BT_BUF_CMD); in bt_hci_cmd_create()
65 hdr = net_buf_add(buf, sizeof(*hdr)); in bt_hci_cmd_create()
69 return buf; in bt_hci_cmd_create()
[all …]
/Zephyr-Core-3.5.0/drivers/watchdog/
Dwdt_npm6001.c53 uint8_t buf[4] = {NPM6001_WDARMEDVALUE, 1U, NPM6001_WDARMEDSTROBE, 1U}; in wdt_npm6001_disable() local
55 return i2c_write_dt(&config->bus, buf, sizeof(buf)); in wdt_npm6001_disable()
63 uint8_t buf[2]; in wdt_npm6001_install_timeout() local
80 buf[0] = NPM6001_WDPWRUPVALUE; in wdt_npm6001_install_timeout()
81 buf[1] = NPM6001_WDPWRUPVALUE_OSC_ENABLE | in wdt_npm6001_install_timeout()
84 ret = i2c_write_dt(&config->bus, buf, sizeof(buf)); in wdt_npm6001_install_timeout()
89 buf[0] = NPM6001_WDPWRUPSTROBE; in wdt_npm6001_install_timeout()
90 buf[1] = 1U; in wdt_npm6001_install_timeout()
91 ret = i2c_write_dt(&config->bus, buf, sizeof(buf)); in wdt_npm6001_install_timeout()
97 buf[0] = NPM6001_WDTRIGGERVALUE0; in wdt_npm6001_install_timeout()
[all …]
/Zephyr-Core-3.5.0/subsys/net/lib/mqtt/
Dmqtt_encoder.c40 * @param[inout] buf A pointer to the buf_ctx structure containing current
46 static int pack_uint8(uint8_t val, struct buf_ctx *buf) in pack_uint8() argument
48 if ((buf->end - buf->cur) < sizeof(uint8_t)) { in pack_uint8()
52 NET_DBG(">> val:%02x cur:%p, end:%p", val, (void *)buf->cur, (void *)buf->end); in pack_uint8()
55 *(buf->cur++) = val; in pack_uint8()
64 * @param[inout] buf A pointer to the buf_ctx structure containing current
70 static int pack_uint16(uint16_t val, struct buf_ctx *buf) in pack_uint16() argument
72 if ((buf->end - buf->cur) < sizeof(uint16_t)) { in pack_uint16()
76 NET_DBG(">> val:%04x cur:%p, end:%p", val, (void *)buf->cur, (void *)buf->end); in pack_uint16()
79 *(buf->cur++) = (val >> 8) & 0xFF; in pack_uint16()
[all …]
Dmqtt_decoder.c23 * @param[inout] buf A pointer to the buf_ctx structure containing current
30 static int unpack_uint8(struct buf_ctx *buf, uint8_t *val) in unpack_uint8() argument
32 NET_DBG(">> cur:%p, end:%p", (void *)buf->cur, (void *)buf->end); in unpack_uint8()
34 if ((buf->end - buf->cur) < sizeof(uint8_t)) { in unpack_uint8()
38 *val = *(buf->cur++); in unpack_uint8()
49 * @param[inout] buf A pointer to the buf_ctx structure containing current
56 static int unpack_uint16(struct buf_ctx *buf, uint16_t *val) in unpack_uint16() argument
58 NET_DBG(">> cur:%p, end:%p", (void *)buf->cur, (void *)buf->end); in unpack_uint16()
60 if ((buf->end - buf->cur) < sizeof(uint16_t)) { in unpack_uint16()
64 *val = *(buf->cur++) << 8; /* MSB */ in unpack_uint16()
[all …]
/Zephyr-Core-3.5.0/subsys/bluetooth/host/
Dhci_raw.c14 #include <zephyr/bluetooth/buf.h>
80 struct net_buf *buf; in bt_buf_get_rx() local
92 buf = net_buf_alloc(&hci_rx_pool, timeout); in bt_buf_get_rx()
93 if (!buf) { in bt_buf_get_rx()
94 return buf; in bt_buf_get_rx()
97 net_buf_reserve(buf, BT_BUF_RESERVE); in bt_buf_get_rx()
98 bt_buf_set_type(buf, type); in bt_buf_get_rx()
100 return buf; in bt_buf_get_rx()
107 struct net_buf *buf; in bt_buf_get_tx() local
157 buf = net_buf_alloc(pool, timeout); in bt_buf_get_tx()
[all …]
Dbuf.c8 #include <zephyr/bluetooth/buf.h>
60 struct net_buf *buf; in bt_buf_get_rx() local
73 buf = net_buf_alloc(&evt_pool, timeout); in bt_buf_get_rx()
75 buf = net_buf_alloc(&acl_in_pool, timeout); in bt_buf_get_rx()
78 buf = net_buf_alloc(&hci_rx_pool, timeout); in bt_buf_get_rx()
81 if (buf) { in bt_buf_get_rx()
82 net_buf_reserve(buf, BT_BUF_RESERVE); in bt_buf_get_rx()
83 bt_buf_set_type(buf, type); in bt_buf_get_rx()
86 return buf; in bt_buf_get_rx()
91 struct net_buf *buf; in bt_buf_get_cmd_complete() local
[all …]
Dat.c16 #include <zephyr/net/buf.h>
22 if (at->buf[at->pos] == ',') { in next_list()
27 int at_check_byte(struct net_buf *buf, char check_byte) in at_check_byte() argument
29 const unsigned char *str = buf->data; in at_check_byte()
34 net_buf_pull(buf, 1); in at_check_byte()
41 while (at->buf[at->pos] == ' ') { in skip_space()
53 isdigit((unsigned char)at->buf[at->pos]) != 0; in at_get_number()
55 *val = *val * 10U + at->buf[at->pos] - '0'; in at_get_number()
75 static int at_parse_result(const char *str, struct net_buf *buf, in at_parse_result() argument
79 if ((!strncmp(str, "OK", 2)) && (at_check_byte(buf, '\n') == 0)) { in at_parse_result()
[all …]
/Zephyr-Core-3.5.0/drivers/bluetooth/hci/
Dhci_b91.c55 struct net_buf *buf; in bt_b91_evt_recv() local
75 buf = bt_buf_get_evt(hdr.evt, discardable, K_NO_WAIT); in bt_b91_evt_recv()
76 if (!buf) { in bt_b91_evt_recv()
82 return buf; in bt_b91_evt_recv()
85 net_buf_add_mem(buf, &hdr, sizeof(hdr)); in bt_b91_evt_recv()
87 buf_tailroom = net_buf_tailroom(buf); in bt_b91_evt_recv()
90 net_buf_unref(buf); in bt_b91_evt_recv()
94 net_buf_add_mem(buf, data, len); in bt_b91_evt_recv()
96 return buf; in bt_b91_evt_recv()
102 struct net_buf *buf; in bt_b91_acl_recv() local
[all …]
Dhci_esp32.c59 struct net_buf *buf; in bt_esp_evt_recv() local
79 buf = bt_buf_get_evt(hdr.evt, discardable, K_NO_WAIT); in bt_esp_evt_recv()
80 if (!buf) { in bt_esp_evt_recv()
86 return buf; in bt_esp_evt_recv()
89 net_buf_add_mem(buf, &hdr, sizeof(hdr)); in bt_esp_evt_recv()
91 buf_tailroom = net_buf_tailroom(buf); in bt_esp_evt_recv()
94 net_buf_unref(buf); in bt_esp_evt_recv()
98 net_buf_add_mem(buf, data, remaining); in bt_esp_evt_recv()
100 return buf; in bt_esp_evt_recv()
106 struct net_buf *buf; in bt_esp_acl_recv() local
[all …]
Drpmsg.c72 struct net_buf *buf; in bt_rpmsg_evt_recv() local
93 buf = bt_buf_get_evt(hdr.evt, discardable, discardable ? K_NO_WAIT : K_SECONDS(10)); in bt_rpmsg_evt_recv()
94 if (!buf) { in bt_rpmsg_evt_recv()
97 return buf; in bt_rpmsg_evt_recv()
101 } while (!buf); in bt_rpmsg_evt_recv()
103 net_buf_add_mem(buf, &hdr, sizeof(hdr)); in bt_rpmsg_evt_recv()
105 buf_tailroom = net_buf_tailroom(buf); in bt_rpmsg_evt_recv()
108 net_buf_unref(buf); in bt_rpmsg_evt_recv()
112 net_buf_add_mem(buf, data, remaining); in bt_rpmsg_evt_recv()
114 return buf; in bt_rpmsg_evt_recv()
[all …]
Dh4.c44 struct net_buf *buf; member
68 struct net_buf *buf; member
181 static inline void copy_hdr(struct net_buf *buf) in copy_hdr() argument
183 net_buf_add_mem(buf, rx.hdr, rx.hdr_len); in copy_hdr()
215 struct net_buf *buf; in rx_thread() local
224 LOG_DBG("rx.buf %p", rx.buf); in rx_thread()
230 if (rx.have_hdr && !rx.buf) { in rx_thread()
231 rx.buf = get_rx(K_FOREVER); in rx_thread()
232 LOG_DBG("Got rx.buf %p", rx.buf); in rx_thread()
233 if (rx.remaining > net_buf_tailroom(rx.buf)) { in rx_thread()
[all …]
/Zephyr-Core-3.5.0/samples/bluetooth/hci_rpmsg/src/
Dmain.c19 #include <zephyr/net/buf.h>
23 #include <zephyr/bluetooth/buf.h>
57 struct net_buf *buf; in hci_rpmsg_cmd_recv() local
64 buf = bt_buf_get_tx(BT_BUF_CMD, K_NO_WAIT, hdr, sizeof(*hdr)); in hci_rpmsg_cmd_recv()
65 if (buf) { in hci_rpmsg_cmd_recv()
75 net_buf_unref(buf); in hci_rpmsg_cmd_recv()
79 if (remaining > net_buf_tailroom(buf)) { in hci_rpmsg_cmd_recv()
81 net_buf_unref(buf); in hci_rpmsg_cmd_recv()
86 net_buf_add_mem(buf, data, remaining); in hci_rpmsg_cmd_recv()
88 return buf; in hci_rpmsg_cmd_recv()
[all …]
/Zephyr-Core-3.5.0/include/zephyr/net/
Dbuf.h121 struct net_buf_simple buf; \
124 .buf.size = _size, \
133 * @param buf Buffer to initialize.
136 static inline void net_buf_simple_init(struct net_buf_simple *buf, in net_buf_simple_init() argument
139 if (!buf->__buf) { in net_buf_simple_init()
140 buf->__buf = (uint8_t *)buf + sizeof(*buf); in net_buf_simple_init()
143 buf->data = buf->__buf + reserve_head; in net_buf_simple_init()
144 buf->len = 0U; in net_buf_simple_init()
152 * @param buf Buffer to initialize.
156 void net_buf_simple_init_with_data(struct net_buf_simple *buf,
[all …]
/Zephyr-Core-3.5.0/tests/bsim/bluetooth/mesh/src/
Dtest_advertiser.c81 static void allocate_all_array(struct net_buf **buf, size_t num_buf, uint8_t xmit) in allocate_all_array() argument
84 *buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_LOCAL_ADV, in allocate_all_array()
87 ASSERT_FALSE_MSG(!*buf, "Out of buffers\n"); in allocate_all_array()
88 buf++; in allocate_all_array()
160 struct net_buf *buf = (struct net_buf *)cb_data; in realloc_end_cb() local
163 buf = bt_mesh_adv_create(BT_MESH_ADV_DATA, BT_MESH_LOCAL_ADV, in realloc_end_cb()
165 ASSERT_FALSE_MSG(!buf, "Out of buffers\n"); in realloc_end_cb()
187 static void parse_mesh_gatt_preamble(struct net_buf_simple *buf) in parse_mesh_gatt_preamble() argument
189 ASSERT_EQUAL(0x0201, net_buf_simple_pull_be16(buf)); in parse_mesh_gatt_preamble()
191 (void)net_buf_simple_pull_u8(buf); in parse_mesh_gatt_preamble()
[all …]
/Zephyr-Core-3.5.0/samples/bluetooth/hci_spi/src/
Dmain.c23 #include <zephyr/net/buf.h>
27 #include <zephyr/bluetooth/buf.h>
103 static inline int spi_send(struct net_buf *buf) in spi_send() argument
110 LOG_DBG("buf %p type %u len %u", buf, bt_buf_get_type(buf), buf->len); in spi_send()
112 switch (bt_buf_get_type(buf)) { in spi_send()
114 net_buf_push_u8(buf, HCI_ACL); in spi_send()
117 net_buf_push_u8(buf, HCI_EVT); in spi_send()
120 LOG_ERR("Unknown type %u", bt_buf_get_type(buf)); in spi_send()
121 net_buf_unref(buf); in spi_send()
125 if (buf->len > SPI_MAX_MSG_LEN) { in spi_send()
[all …]

12345678910>>...55