Home
last modified time | relevance | path

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

12345678910>>...68

/Zephyr-latest/lib/net_buf/
Dbuf_simple.c32 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()
47 buf->data = buf->__buf + reserve; in net_buf_simple_reserve()
[all …]
Dbuf.c1 /* buf.c - Buffer management */
62 int net_buf_id(const 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()
88 void net_buf_reset(struct net_buf *buf) in net_buf_reset() argument
[all …]
/Zephyr-latest/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-latest/tests/lib/net_buf/buf_simple/src/
Dmain.c14 NET_BUF_SIMPLE_DEFINE_STATIC(buf, 16);
36 net_buf_simple_reset(&buf); in net_buf_simple_test_suite_before()
46 net_buf_simple_clone(&buf, &clone); in ZTEST()
48 zassert_equal(buf.data, clone.data, "Incorrect clone data pointer"); in ZTEST()
53 net_buf_simple_add_mem(&buf, &le16, sizeof(le16)); in ZTEST()
55 zassert_equal(u16, net_buf_simple_pull_le16(&buf), in ZTEST()
61 net_buf_simple_add_mem(&buf, &be16, sizeof(be16)); in ZTEST()
63 zassert_equal(u16, net_buf_simple_pull_be16(&buf), in ZTEST()
69 net_buf_simple_add_le16(&buf, u16); in ZTEST()
71 zassert_mem_equal(le16, net_buf_simple_pull_mem(&buf, sizeof(le16)), in ZTEST()
[all …]
/Zephyr-latest/tests/lib/net_buf/buf/src/
Dmain.c67 static void buf_destroy(struct net_buf *buf);
68 static void fixed_destroy(struct net_buf *buf);
69 static void var_destroy(struct net_buf *buf);
75 static void buf_destroy(struct net_buf *buf) in buf_destroy() argument
77 struct net_buf_pool *pool = net_buf_pool_get(buf->pool_id); in buf_destroy()
81 net_buf_destroy(buf); in buf_destroy()
84 static void fixed_destroy(struct net_buf *buf) in fixed_destroy() argument
86 struct net_buf_pool *pool = net_buf_pool_get(buf->pool_id); in fixed_destroy()
90 net_buf_destroy(buf); in fixed_destroy()
93 static void var_destroy(struct net_buf *buf) in var_destroy() argument
[all …]
/Zephyr-latest/subsys/bluetooth/mesh/
Ddfu_metadata.c15 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()
34 metadata->comp_hash = net_buf_simple_pull_le32(buf); in bt_mesh_dfu_metadata_decode()
[all …]
Dop_agg.c16 #define IS_LENGTH_LONG(buf) ((buf)->data[0] & 1) argument
19 int bt_mesh_op_agg_encode_msg(struct net_buf_simple *msg, struct net_buf_simple *buf) in bt_mesh_op_agg_encode_msg() argument
22 if (net_buf_simple_tailroom(buf) < (msg->len + 2)) { in bt_mesh_op_agg_encode_msg()
26 net_buf_simple_add_le16(buf, (msg->len << 1) | 1); in bt_mesh_op_agg_encode_msg()
28 if (net_buf_simple_tailroom(buf) < (msg->len + 1)) { in bt_mesh_op_agg_encode_msg()
32 net_buf_simple_add_u8(buf, msg->len << 1); in bt_mesh_op_agg_encode_msg()
34 net_buf_simple_add_mem(buf, msg->data, msg->len); in bt_mesh_op_agg_encode_msg()
40 struct net_buf_simple *buf) in bt_mesh_op_agg_decode_msg() argument
44 if (IS_LENGTH_LONG(buf)) { in bt_mesh_op_agg_decode_msg()
45 if (buf->len < 2) { in bt_mesh_op_agg_decode_msg()
[all …]
/Zephyr-latest/lib/utils/
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-latest/tests/bsim/bluetooth/host/att/sequential/tester/src/
Dmain.c12 #include <zephyr/bluetooth/buf.h>
65 struct net_buf *buf; in bt_hci_cmd_create() local
69 buf = net_buf_alloc(&hci_cmd_pool, K_FOREVER); in bt_hci_cmd_create()
70 ASSERT(buf, "failed allocation"); in bt_hci_cmd_create()
72 LOG_DBG("buf %p", buf); in bt_hci_cmd_create()
74 net_buf_reserve(buf, BT_BUF_RESERVE); in bt_hci_cmd_create()
76 bt_buf_set_type(buf, BT_BUF_CMD); in bt_hci_cmd_create()
78 hdr = net_buf_add(buf, sizeof(*hdr)); in bt_hci_cmd_create()
82 return buf; in bt_hci_cmd_create()
85 static void handle_cmd_complete(struct net_buf *buf) in handle_cmd_complete() argument
[all …]
/Zephyr-latest/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-latest/tests/bsim/bluetooth/host/l2cap/reassembly/peer/src/
Dpeer.c12 #include <zephyr/bluetooth/buf.h>
62 struct net_buf *buf; in bt_hci_cmd_create() local
66 buf = net_buf_alloc(&hci_cmd_pool, K_FOREVER); in bt_hci_cmd_create()
67 TEST_ASSERT(buf, "failed allocation"); in bt_hci_cmd_create()
69 LOG_DBG("buf %p", buf); in bt_hci_cmd_create()
71 net_buf_reserve(buf, BT_BUF_RESERVE); in bt_hci_cmd_create()
73 bt_buf_set_type(buf, BT_BUF_CMD); in bt_hci_cmd_create()
75 hdr = net_buf_add(buf, sizeof(*hdr)); in bt_hci_cmd_create()
79 return buf; in bt_hci_cmd_create()
82 static void handle_cmd_complete(struct net_buf *buf) in handle_cmd_complete() argument
[all …]
/Zephyr-latest/tests/bsim/bluetooth/host/att/pipeline/tester/src/
Dmain.c12 #include <zephyr/bluetooth/buf.h>
50 typedef void (*att_handler_t)(struct net_buf *buf);
69 struct net_buf *buf; in bt_hci_cmd_create() local
73 buf = net_buf_alloc(&hci_cmd_pool, K_FOREVER); in bt_hci_cmd_create()
74 ASSERT(buf, "failed allocation"); in bt_hci_cmd_create()
76 LOG_DBG("buf %p", buf); in bt_hci_cmd_create()
78 net_buf_reserve(buf, BT_BUF_RESERVE); in bt_hci_cmd_create()
80 bt_buf_set_type(buf, BT_BUF_CMD); in bt_hci_cmd_create()
82 hdr = net_buf_add(buf, sizeof(*hdr)); in bt_hci_cmd_create()
86 return buf; in bt_hci_cmd_create()
[all …]
/Zephyr-latest/tests/bsim/bluetooth/host/misc/disconnect/tester/src/
Dmain.c12 #include <zephyr/bluetooth/buf.h>
61 struct net_buf *buf; in bt_hci_cmd_create() local
65 buf = net_buf_alloc(&hci_cmd_pool, K_FOREVER); in bt_hci_cmd_create()
66 ASSERT(buf, "failed allocation"); in bt_hci_cmd_create()
68 LOG_DBG("buf %p", buf); in bt_hci_cmd_create()
70 net_buf_reserve(buf, BT_BUF_RESERVE); in bt_hci_cmd_create()
72 bt_buf_set_type(buf, BT_BUF_CMD); in bt_hci_cmd_create()
74 hdr = net_buf_add(buf, sizeof(*hdr)); in bt_hci_cmd_create()
78 return buf; in bt_hci_cmd_create()
81 static void handle_cmd_complete(struct net_buf *buf) in handle_cmd_complete() argument
[all …]
/Zephyr-latest/tests/bsim/bluetooth/host/misc/hfc_multilink/tester/src/
Dtester.c12 #include <zephyr/bluetooth/buf.h>
55 struct net_buf *buf; in bt_hci_cmd_create() local
59 buf = net_buf_alloc(&hci_cmd_pool, K_FOREVER); in bt_hci_cmd_create()
60 __ASSERT_NO_MSG(buf); in bt_hci_cmd_create()
62 LOG_DBG("buf %p", buf); in bt_hci_cmd_create()
64 net_buf_reserve(buf, BT_BUF_RESERVE); in bt_hci_cmd_create()
66 bt_buf_set_type(buf, BT_BUF_CMD); in bt_hci_cmd_create()
68 hdr = net_buf_add(buf, sizeof(*hdr)); in bt_hci_cmd_create()
72 return buf; in bt_hci_cmd_create()
75 static void handle_cmd_complete(struct net_buf *buf) in handle_cmd_complete() argument
[all …]
/Zephyr-latest/subsys/bluetooth/host/
Dhci_raw.c15 #include <zephyr/bluetooth/buf.h>
40 static void hci_rx_buf_destroy(struct net_buf *buf) in hci_rx_buf_destroy() argument
42 net_buf_destroy(buf); in hci_rx_buf_destroy()
85 struct net_buf *buf; in bt_buf_get_rx() local
97 buf = net_buf_alloc(&hci_rx_pool, timeout); in bt_buf_get_rx()
98 if (!buf) { in bt_buf_get_rx()
99 return buf; in bt_buf_get_rx()
102 net_buf_reserve(buf, BT_BUF_RESERVE); in bt_buf_get_rx()
103 bt_buf_set_type(buf, type); in bt_buf_get_rx()
105 return buf; in bt_buf_get_rx()
[all …]
Dhci_common.c15 struct net_buf *buf; in bt_hci_evt_create() local
17 buf = bt_buf_get_evt(evt, false, K_FOREVER); in bt_hci_evt_create()
19 BT_ASSERT(buf); in bt_hci_evt_create()
21 hdr = net_buf_add(buf, sizeof(*hdr)); in bt_hci_evt_create()
25 return buf; in bt_hci_evt_create()
30 struct net_buf *buf; in bt_hci_cmd_complete_create() local
33 buf = bt_hci_evt_create(BT_HCI_EVT_CMD_COMPLETE, sizeof(*cc) + plen); in bt_hci_cmd_complete_create()
35 cc = net_buf_add(buf, sizeof(*cc)); in bt_hci_cmd_complete_create()
39 return buf; in bt_hci_cmd_complete_create()
44 struct net_buf *buf; in bt_hci_cmd_status_create() local
[all …]
/Zephyr-latest/tests/bsim/bluetooth/host/l2cap/split/tester/src/
Dmain.c12 #include <zephyr/bluetooth/buf.h>
53 struct net_buf *buf; in bt_hci_cmd_create() local
57 buf = net_buf_alloc(&hci_cmd_pool, K_FOREVER); in bt_hci_cmd_create()
58 __ASSERT_NO_MSG(buf); in bt_hci_cmd_create()
60 LOG_DBG("buf %p", buf); in bt_hci_cmd_create()
62 net_buf_reserve(buf, BT_BUF_RESERVE); in bt_hci_cmd_create()
64 bt_buf_set_type(buf, BT_BUF_CMD); in bt_hci_cmd_create()
66 hdr = net_buf_add(buf, sizeof(*hdr)); in bt_hci_cmd_create()
70 return buf; in bt_hci_cmd_create()
73 static void handle_cmd_complete(struct net_buf *buf) in handle_cmd_complete() argument
[all …]
/Zephyr-latest/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 uint8_t *cur = buf->cur; in pack_uint8()
49 uint8_t *end = buf->end; in pack_uint8()
59 buf->cur = (cur + sizeof(uint8_t)); in pack_uint8()
68 * @param[inout] buf A pointer to the buf_ctx structure containing current
74 static int pack_uint16(uint16_t val, struct buf_ctx *buf) in pack_uint16() argument
76 uint8_t *cur = buf->cur; in pack_uint16()
77 uint8_t *end = buf->end; in pack_uint16()
87 buf->cur = (cur + sizeof(uint16_t)); 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 uint8_t *cur = buf->cur; in unpack_uint8()
33 uint8_t *end = buf->end; in unpack_uint8()
42 buf->cur = (cur + sizeof(uint8_t)); in unpack_uint8()
53 * @param[inout] buf A pointer to the buf_ctx structure containing current
60 static int unpack_uint16(struct buf_ctx *buf, uint16_t *val) in unpack_uint16() argument
62 uint8_t *cur = buf->cur; in unpack_uint16()
63 uint8_t *end = buf->end; in unpack_uint16()
72 buf->cur = (cur + sizeof(uint16_t)); in unpack_uint16()
[all …]
/Zephyr-latest/tests/posix/single_process/src/
Dconfstr.c15 char buf[1]; in ZTEST() local
21 char *buf; in ZTEST() member
27 {-1, NULL, sizeof(buf)}, in ZTEST()
28 {-1, buf, 0}, in ZTEST()
29 {-1, buf, sizeof(buf)}, in ZTEST()
34 {_CS_PATH, buf, 0}, in ZTEST()
38 {_CS_PATH, NULL, sizeof(buf)}, in ZTEST()
43 zassert_equal(0, confstr(arg->name, arg->buf, arg->len)); in ZTEST()
49 buf[0] = 0xff; in ZTEST()
50 zassert_true(confstr(arg->name, arg->buf, arg->len) > 0); in ZTEST()
[all …]
/Zephyr-latest/tests/bsim/bluetooth/mesh/src/
Dgatt_common.c11 void bt_mesh_test_parse_mesh_gatt_preamble(struct net_buf_simple *buf) in bt_mesh_test_parse_mesh_gatt_preamble() argument
13 ASSERT_EQUAL(0x0201, net_buf_simple_pull_be16(buf)); in bt_mesh_test_parse_mesh_gatt_preamble()
15 (void)net_buf_simple_pull_u8(buf); in bt_mesh_test_parse_mesh_gatt_preamble()
16 ASSERT_EQUAL(0x0303, net_buf_simple_pull_be16(buf)); in bt_mesh_test_parse_mesh_gatt_preamble()
19 void bt_mesh_test_parse_mesh_pb_gatt_service(struct net_buf_simple *buf) in bt_mesh_test_parse_mesh_pb_gatt_service() argument
23 ASSERT_EQUAL(0x2718, net_buf_simple_pull_be16(buf)); in bt_mesh_test_parse_mesh_pb_gatt_service()
24 ASSERT_EQUAL(0x1516, net_buf_simple_pull_be16(buf)); in bt_mesh_test_parse_mesh_pb_gatt_service()
26 ASSERT_EQUAL(0x2718, net_buf_simple_pull_be16(buf)); in bt_mesh_test_parse_mesh_pb_gatt_service()
29 void bt_mesh_test_parse_mesh_proxy_service(struct net_buf_simple *buf) in bt_mesh_test_parse_mesh_proxy_service() argument
33 ASSERT_EQUAL(0x2818, net_buf_simple_pull_be16(buf)); in bt_mesh_test_parse_mesh_proxy_service()
[all …]
/Zephyr-latest/samples/bluetooth/hci_ipc/src/
Dmain.c23 #include <zephyr/bluetooth/buf.h>
57 struct net_buf *buf; in hci_ipc_cmd_recv() local
64 buf = bt_buf_get_tx(BT_BUF_CMD, K_NO_WAIT, hdr, sizeof(*hdr)); in hci_ipc_cmd_recv()
65 if (buf) { in hci_ipc_cmd_recv()
75 net_buf_unref(buf); in hci_ipc_cmd_recv()
79 if (remaining > net_buf_tailroom(buf)) { in hci_ipc_cmd_recv()
81 net_buf_unref(buf); in hci_ipc_cmd_recv()
86 net_buf_add_mem(buf, data, remaining); in hci_ipc_cmd_recv()
88 return buf; in hci_ipc_cmd_recv()
94 struct net_buf *buf; in hci_ipc_acl_recv() local
[all …]
/Zephyr-latest/include/zephyr/
Dnet_buf.h127 struct net_buf_simple buf; \
130 .buf.size = _size, \
139 * @param buf Buffer to initialize.
142 static inline void net_buf_simple_init(struct net_buf_simple *buf, in net_buf_simple_init() argument
145 if (!buf->__buf) { in net_buf_simple_init()
146 buf->__buf = (uint8_t *)buf + sizeof(*buf); in net_buf_simple_init()
149 buf->data = buf->__buf + reserve_head; in net_buf_simple_init()
150 buf->len = 0U; in net_buf_simple_init()
158 * @param buf Buffer to initialize.
162 void net_buf_simple_init_with_data(struct net_buf_simple *buf,
[all …]
/Zephyr-latest/drivers/bluetooth/hci/
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 …]

12345678910>>...68