/Zephyr-latest/lib/utils/ |
D | winstream.c | 31 return idx >= ws->len ? idx - ws->len : idx; in idx_mod() 37 return idx_mod(ws, a + (ws->len - b)); in idx_sub() 41 const char *data, uint32_t len) in sys_winstream_write() argument 43 uint32_t len0 = len, suffix; in sys_winstream_write() 50 if (len > ws->len - 1) { in sys_winstream_write() 52 len = ws->len - 1; in sys_winstream_write() 58 len = MIN(len, ws->len); in sys_winstream_write() 60 uint32_t avail = (ws->len - 1) - idx_sub(ws, end, start); in sys_winstream_write() 62 if (len > avail) { in sys_winstream_write() 63 ws->start = idx_mod(ws, start + (len - avail)); in sys_winstream_write() [all …]
|
/Zephyr-latest/include/zephyr/sys/ |
D | crc.h | 93 uint16_t crc16(uint16_t poly, uint16_t seed, const uint8_t *src, size_t len); 123 uint16_t crc16_reflect(uint16_t poly, uint16_t seed, const uint8_t *src, size_t len); 139 uint8_t crc8(const uint8_t *src, size_t len, uint8_t polynomial, uint8_t initial_value, 173 uint16_t crc16_ccitt(uint16_t seed, const uint8_t *src, size_t len); 210 uint16_t crc16_itu_t(uint16_t seed, const uint8_t *src, size_t len); 223 static inline uint16_t crc16_ansi(const uint8_t *src, size_t len) in crc16_ansi() argument 225 return crc16_reflect(0xA001, 0xffff, src, len); in crc16_ansi() 237 uint32_t crc32_ieee(const uint8_t *data, size_t len); 249 uint32_t crc32_ieee_update(uint32_t crc, const uint8_t *data, size_t len); 264 size_t len, bool first_pkt, bool last_pkt); [all …]
|
/Zephyr-latest/tests/bsim/bluetooth/ll/edtt/gatt_test_app/src/gatt/ |
D | service_c_2_1.c | 168 uint16_t len, uint16_t offset) in read_value_v10() argument 172 return bt_gatt_attr_read(conn, attr, buf, len, offset, value, in read_value_v10() 190 uint16_t len, uint16_t offset) in read_str_value() argument 194 return bt_gatt_attr_read(conn, attr, buf, len, offset, value, in read_str_value() 213 uint16_t len, uint16_t offset, uint8_t flags) in write_value_v2() argument 220 if (offset + len > sizeof(value_v2_value)) { in write_value_v2() 224 memcpy(value + offset, buf, len); in write_value_v2() 226 return len; in write_value_v2() 243 uint16_t len, uint16_t offset) in read_long_des_v2d1() argument 247 return bt_gatt_attr_read(conn, attr, buf, len, offset, value, in read_long_des_v2d1() [all …]
|
D | service_c_2_2.c | 82 uint16_t len, uint16_t offset) in read_value_v10() argument 86 return bt_gatt_attr_read(conn, attr, buf, len, offset, value, in read_value_v10() 104 uint16_t len, uint16_t offset) in read_str_value() argument 108 return bt_gatt_attr_read(conn, attr, buf, len, offset, value, in read_str_value() 127 uint16_t len, uint16_t offset, uint8_t flags) in write_value_v2() argument 134 if (offset + len > sizeof(value_v2_value)) { in write_value_v2() 138 memcpy(value + offset, buf, len); in write_value_v2() 140 return len; in write_value_v2() 158 const void *buf, uint16_t len, uint16_t offset, in write_value_v2_1() argument 166 if (offset + len > sizeof(value_v2_1_value)) { in write_value_v2_1() [all …]
|
D | service_c_2_3.c | 82 uint16_t len, uint16_t offset) in read_value_v10() argument 86 return bt_gatt_attr_read(conn, attr, buf, len, offset, value, in read_value_v10() 104 uint16_t len, uint16_t offset) in read_str_value() argument 108 return bt_gatt_attr_read(conn, attr, buf, len, offset, value, in read_str_value() 127 uint16_t len, uint16_t offset, uint8_t flags) in write_value_v2() argument 134 if (offset + len > sizeof(value_v2_value)) { in write_value_v2() 138 memcpy(value + offset, buf, len); in write_value_v2() 140 return len; in write_value_v2() 158 const void *buf, uint16_t len, uint16_t offset, in write_value_v2_1() argument 166 if (offset + len > sizeof(value_v2_1_value)) { in write_value_v2_1() [all …]
|
D | service_b_5_1.c | 64 uint16_t len, uint16_t offset) in read_value_v8() argument 68 return bt_gatt_attr_read(conn, attr, buf, len, offset, value, in read_value_v8() 87 uint16_t len, uint16_t offset, uint8_t flags) in write_value_v8() argument 94 if (offset + len > sizeof(value_v8_value)) { in write_value_v8() 98 memcpy(value + offset, buf, len); in write_value_v8() 100 return len; in write_value_v8() 117 uint16_t len, uint16_t offset) in read_des_v8d1() argument 121 return bt_gatt_attr_read(conn, attr, buf, len, offset, value, in read_des_v8d1() 140 uint16_t len, uint16_t offset, uint8_t flags) in write_des_v8d1() argument 147 if (offset + len > sizeof(des_v8d1_value)) { in write_des_v8d1() [all …]
|
D | service_b_1_1.c | 71 uint16_t len, uint16_t offset) in read_value_v4() argument 75 return bt_gatt_attr_read(conn, attr, buf, len, offset, value, in read_value_v4() 94 uint16_t len, uint16_t offset, uint8_t flags) in write_value_v4() argument 101 if (offset + len > sizeof(value_v4_value)) { in write_value_v4() 105 memcpy(value + offset, buf, len); in write_value_v4() 107 return len; in write_value_v4() 124 uint16_t len, uint16_t offset) in read_value_v4_1() argument 128 return bt_gatt_attr_read(conn, attr, buf, len, offset, value, in read_value_v4_1() 147 const void *buf, uint16_t len, uint16_t offset, in write_value_v4_1() argument 155 if (offset + len > sizeof(value_v4_1_value)) { in write_value_v4_1() [all …]
|
/Zephyr-latest/tests/net/lib/lwm2m/content_raw_cbor/src/ |
D | main.c | 17 size_t len; member 67 static void test_payload_set(const uint8_t *payload, size_t len) in test_payload_set() argument 69 memcpy(test_payload + 1, payload, len); in test_payload_set() 70 test_packet.offset = len + 1; in test_payload_set() 85 .len = 1 in ZTEST() 91 .len = 1 in ZTEST() 98 .len = 2 in ZTEST() 105 .len = 2 in ZTEST() 111 zassert_equal(ret, expected_payload[i].len, in ZTEST() 115 expected_payload[i].len, in ZTEST() [all …]
|
/Zephyr-latest/subsys/bluetooth/mesh/ |
D | op_agg.c | 21 if (msg->len > LENGTH_SHORT_MAX) { in bt_mesh_op_agg_encode_msg() 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() 42 uint16_t len; in bt_mesh_op_agg_decode_msg() local 45 if (buf->len < 2) { in bt_mesh_op_agg_decode_msg() 49 len = net_buf_simple_pull_le16(buf) >> 1; in bt_mesh_op_agg_decode_msg() 51 if (buf->len < 1) { in bt_mesh_op_agg_decode_msg() [all …]
|
D | sol_pdu_rpl_srv.c | 20 uint8_t len) in sol_rpl_status_rsp() argument 22 BT_MESH_MODEL_BUF_DEFINE(buf, OP_SOL_PDU_RPL_ITEM_STATUS, 2 + (len < 2 ? 0 : 1)); in sol_rpl_status_rsp() 28 if (len >= 2) { in sol_rpl_status_rsp() 29 net_buf_simple_add_u8(&buf, len); in sol_rpl_status_rsp() 41 uint8_t len = 0; in item_clear() local 45 if (buf->len > 3) { in item_clear() 52 LOG_DBG("Start address: 0x%02x, %d", primary, buf->len); in item_clear() 54 if (buf->len == 0) { in item_clear() 58 len = net_buf_simple_pull_u8(buf); in item_clear() 60 if (len < 2) { in item_clear() [all …]
|
/Zephyr-latest/subsys/bluetooth/services/ |
D | dis.c | 132 uint16_t len, uint16_t offset) in read_str() argument 134 return bt_gatt_attr_read(conn, attr, buf, len, offset, attr->user_data, in read_str() 140 uint16_t len, uint16_t offset) in read_pnp_id() argument 142 return bt_gatt_attr_read(conn, attr, buf, len, offset, &dis_pnp_id, sizeof(dis_pnp_id)); in read_pnp_id() 148 uint16_t len, uint16_t offset) in read_system_id() argument 150 return bt_gatt_attr_read(conn, attr, buf, len, offset, dis_system_id, in read_system_id() 170 uint16_t *index, uint16_t len, uint16_t offset) in read_udi_subval() argument 177 if (*bytes_read == len) { in read_udi_subval() 187 if (*index >= offset && *bytes_read < len) { in read_udi_subval() 198 uint16_t len, uint16_t offset) in read_udi() argument [all …]
|
/Zephyr-latest/drivers/flash/ |
D | soc_flash_nrf_rram.c | 100 static int write_synchronously(off_t addr, const void *data, size_t len); 104 static inline bool is_within_bounds(off_t addr, size_t len, off_t boundary_start, in is_within_bounds() argument 108 (len <= (boundary_start + boundary_size - addr))); in is_within_bounds() 112 static void commit_changes(off_t addr, size_t len) in commit_changes() argument 121 if ((len % (WRITE_BUFFER_MAX_SIZE)) == 0) { in commit_changes() 146 volatile uint8_t dummy_read = *(volatile uint8_t *)(addr + len - 1); in commit_changes() 154 static void rram_write(off_t addr, const void *data, size_t len) in rram_write() argument 163 memcpy((void *)addr, data, len); in rram_write() 165 memset((void *)addr, ERASE_VALUE, len); in rram_write() 171 commit_changes(addr, len); in rram_write() [all …]
|
D | soc_flash_nrf.c | 50 static int write_synchronously(off_t addr, const void *data, size_t len); 89 static int write(off_t addr, const void *data, size_t len); 97 static inline bool is_within_bounds(off_t addr, size_t len, off_t boundary_start, in is_within_bounds() argument 102 (len <= (boundary_start + boundary_size - addr))); in is_within_bounds() 105 static inline bool is_regular_addr_valid(off_t addr, size_t len) in is_regular_addr_valid() argument 107 return is_within_bounds(addr, len, 0, nrfx_nvmc_flash_size_get()); in is_regular_addr_valid() 110 static inline bool is_uicr_addr_valid(off_t addr, size_t len) in is_uicr_addr_valid() argument 113 return is_within_bounds(addr, len, (off_t)NRF_UICR, sizeof(*NRF_UICR)); in is_uicr_addr_valid() 131 static void nrf_buffer_read_91_uicr(void *data, off_t addr, size_t len) in nrf_buffer_read_91_uicr() argument 134 nrf_nvmc_buffer_read(data, (uint32_t)addr, len); in nrf_buffer_read_91_uicr() [all …]
|
/Zephyr-latest/tests/lib/math/interpolation/src/ |
D | main.c | 15 uint8_t len = ARRAY_SIZE(x_axis); in ZTEST() local 19 zassert_equal(y_axis[0], linear_interpolate(x_axis, y_axis, len, INT32_MIN)); in ZTEST() 20 zassert_equal(y_axis[0], linear_interpolate(x_axis, y_axis, len, -1)); in ZTEST() 21 zassert_equal(y_axis[0], linear_interpolate(x_axis, y_axis, len, 0)); in ZTEST() 22 zassert_equal(y_axis[0], linear_interpolate(x_axis, y_axis, len, x_axis[0] - 1)); in ZTEST() 24 zassert_equal(y_axis[4], linear_interpolate(x_axis, y_axis, len, x_axis[4] + 1)); in ZTEST() 25 zassert_equal(y_axis[4], linear_interpolate(x_axis, y_axis, len, 100)); in ZTEST() 26 zassert_equal(y_axis[4], linear_interpolate(x_axis, y_axis, len, INT32_MAX)); in ZTEST() 33 uint8_t len = ARRAY_SIZE(x_axis); in ZTEST() local 39 zassert_equal(y_axis[i], linear_interpolate(x_axis, y_axis, len, x_axis[i])); in ZTEST() [all …]
|
/Zephyr-latest/subsys/settings/src/ |
D | settings_runtime.c | 15 size_t len; member 18 static ssize_t settings_runtime_read_cb(void *cb_arg, void *data, size_t len) in settings_runtime_read_cb() argument 22 memcpy(data, arg->data, MIN(arg->len, len)); in settings_runtime_read_cb() 23 return MIN(arg->len, len); in settings_runtime_read_cb() 26 int settings_runtime_set(const char *name, const void *data, size_t len) in settings_runtime_set() argument 38 arg.len = len; in settings_runtime_set() 39 return ch->h_set(name_key, len, settings_runtime_read_cb, (void *)&arg); in settings_runtime_set() 42 int settings_runtime_get(const char *name, void *data, size_t len) in settings_runtime_get() argument 56 return ch->h_get(name_key, data, len); in settings_runtime_get()
|
/Zephyr-latest/subsys/bluetooth/host/ |
D | settings.c | 49 size_t len = 3; in bt_settings_encode_key() local 52 if (len < path_size) { in bt_settings_encode_key() 57 strncpy(&path[len], subsys, path_size - len); in bt_settings_encode_key() 58 len = strlen(path); in bt_settings_encode_key() 59 if (len < path_size) { in bt_settings_encode_key() 60 path[len] = '/'; in bt_settings_encode_key() 61 len++; in bt_settings_encode_key() 64 for (int8_t i = 5; i >= 0 && len < path_size; i--) { in bt_settings_encode_key() 65 len += bin2hex(&addr->a.val[i], 1, &path[len], in bt_settings_encode_key() 66 path_size - len); in bt_settings_encode_key() [all …]
|
/Zephyr-latest/drivers/sensor/st/stmemsc/ |
D | stmemsc_spi.c | 21 uint8_t reg_addr, uint8_t *value, uint8_t len) in stmemsc_spi_read() argument 26 const struct spi_buf tx_buf = { .buf = buffer_tx, .len = 2, }; in stmemsc_spi_read() 34 { .buf = NULL, .len = 1, }, in stmemsc_spi_read() 35 { .buf = value, .len = len, } in stmemsc_spi_read() 46 uint8_t reg_addr, uint8_t *value, uint8_t len) in stmemsc_spi_write() argument 55 { .buf = buffer_tx, .len = 1, }, in stmemsc_spi_write() 56 { .buf = value, .len = len, } in stmemsc_spi_write() 64 uint8_t reg_addr, uint8_t *value, uint8_t len) in stmemsc_spi_read_incr() argument 67 return stmemsc_spi_read(stmemsc, reg_addr, value, len); in stmemsc_spi_read_incr() 71 uint8_t reg_addr, uint8_t *value, uint8_t len) in stmemsc_spi_write_incr() argument [all …]
|
/Zephyr-latest/tests/unit/base64/ |
D | main.c | 65 size_t len; in ZTEST() local 75 rc = base64_encode(buffer, sizeof(buffer), &len, src, 64); in ZTEST() 83 rc = base64_decode(buffer, sizeof(buffer), &len, src, 88); in ZTEST() 89 rc = base64_encode(buffer, sizeof(buffer), &len, src, 0); in ZTEST() 91 zassert_equal(len, 0, "Error: slen: length value"); in ZTEST() 94 rc = base64_encode(buffer, sizeof(buffer), &len, src, slen); in ZTEST() 96 zassert_equal(len, -1, "Error: n: length value"); in ZTEST() 101 rc = base64_encode(buffer, sizeof(buffer), &len, src, slen); in ZTEST() 103 zassert_equal(len, n + 1, "Error: dlen: length value"); in ZTEST() 107 rc = base64_decode(buffer, sizeof(buffer), &len, src, 88); in ZTEST() [all …]
|
/Zephyr-latest/lib/os/ |
D | spsc_pbuf.c | 40 static uint32_t idx_occupied(uint32_t len, uint32_t a, uint32_t b) in idx_occupied() argument 43 return (b > a) ? (len - (b - a)) : (a - b); in idx_occupied() 46 static inline void cache_wb(void *data, size_t len, uint32_t flags) in cache_wb() argument 50 sys_cache_data_flush_range(data, len); in cache_wb() 54 static inline void cache_inv(void *data, size_t len, uint32_t flags) in cache_inv() argument 58 sys_cache_data_invd_range(data, len); in cache_inv() 89 uint32_t len = blen - sizeof(struct spsc_pbuf_common); in get_len() local 93 return len - sizeof(struct spsc_pbuf_ext_cache); in get_len() 96 return len - sizeof(struct spsc_pbuf_ext_nocache); in get_len() 124 pb->common.len = get_len(blen, flags); in spsc_pbuf_init() [all …]
|
/Zephyr-latest/tests/modules/uoscore/src/oscore_testvector_tests/ |
D | oscore_tests.c | 25 .master_secret.len = T1__MASTER_SECRET_LEN, in ZTEST() 27 .sender_id.len = T1__SENDER_ID_LEN, in ZTEST() 29 .recipient_id.len = T1__RECIPIENT_ID_LEN, in ZTEST() 31 .master_salt.len = T1__MASTER_SALT_LEN, in ZTEST() 33 .id_context.len = T1__ID_CONTEXT_LEN, in ZTEST() 58 c_client.sc.sender_key.len, in ZTEST() 62 c_client.rc.recipient_key.len, in ZTEST() 66 c_client.cc.common_iv.len, in ZTEST() 84 .master_secret.len = T3__MASTER_SECRET_LEN, in ZTEST() 86 .sender_id.len = T3__SENDER_ID_LEN, in ZTEST() [all …]
|
/Zephyr-latest/tests/net/lib/lwm2m/content_oma_tlv/src/ |
D | main.c | 25 size_t len; member 77 static void test_payload_set(const uint8_t *payload, size_t len) in test_payload_set() argument 79 memcpy(test_payload + 1, payload, len); in test_payload_set() 80 test_packet.offset = len + 1; in test_payload_set() 102 .len = 3 in ZTEST() 110 .len = 3 in ZTEST() 119 .len = 4 in ZTEST() 127 zassert_equal(ret, expected_payload[i].len, in ZTEST() 131 expected_payload[i].len, in ZTEST() 134 offset += expected_payload[i].len; in ZTEST() [all …]
|
/Zephyr-latest/tests/subsys/fs/fcb/src/ |
D | fcb_test_append_too_big.c | 15 uint32_t len; in ZTEST() local 37 len = MIN(FCB_MAX_LEN in ZTEST() 44 rc = fcb_append(fcb, len, &elem_loc); in ZTEST() 48 len--; in ZTEST() 49 rc = fcb_append(fcb, len, &elem_loc); in ZTEST() 53 len -= fcb_len_in_flash(fcb, sizeof(struct fcb_disk_area)); in ZTEST() 54 rc = fcb_append(fcb, len, &elem_loc); in ZTEST() 62 len = MIN(FCB_MAX_LEN, fcb->f_active.fe_sector->fs_size - overhead); in ZTEST() 63 len = fcb->f_align * (len / fcb->f_align); in ZTEST() 65 rc = fcb_append(fcb, len, &elem_loc); in ZTEST() [all …]
|
/Zephyr-latest/subsys/shell/ |
D | shell_history.c | 43 uint16_t len; member 54 uint8_t *dst, uint16_t *len) in z_shell_history_get() argument 60 *len = 0U; in z_shell_history_get() 67 *len = 0U; in z_shell_history_get() 85 memcpy(dst, h_item->data, h_item->len); in z_shell_history_get() 86 *len = h_item->len; in z_shell_history_get() 87 dst[*len] = '\0'; in z_shell_history_get() 91 *len = 0U; in z_shell_history_get() 97 uint8_t *src, size_t len, uint16_t padding) in add_to_head() argument 99 item->len = len; in add_to_head() [all …]
|
/Zephyr-latest/subsys/net/lib/lwm2m/ |
D | lwm2m_rw_link_format.c | 105 int ret, len; in put_corelink_version() local 107 len = snprintk(buf, buflen, ";ver=%u.%u", obj->version_major, in put_corelink_version() 109 if (len < 0 || len >= buflen) { in put_corelink_version() 113 ret = buf_append(CPKT_BUF_WRITE(out->out_cpkt), buf, len); in put_corelink_version() 118 return len; in put_corelink_version() 125 int ret, inst_count = 0, len = 0; in put_corelink_dimension() local 135 len = snprintk(buf, buflen, ";dim=%d", inst_count); in put_corelink_dimension() 136 if (len < 0 || len >= buflen) { in put_corelink_dimension() 140 ret = buf_append(CPKT_BUF_WRITE(out->out_cpkt), buf, len); in put_corelink_dimension() 146 return len; in put_corelink_dimension() [all …]
|
/Zephyr-latest/subsys/bluetooth/controller/ll_sw/ |
D | ll_settings.c | 47 ssize_t len; in ctlr_set() local 55 len = read_cb(store, &company_id, sizeof(company_id)); in ctlr_set() 56 if (len < 0) { in ctlr_set() 58 " (err %zd)", len); in ctlr_set() 65 len = read_cb(store, &subversion, sizeof(subversion)); in ctlr_set() 66 if (len < 0) { in ctlr_set() 68 " (err %zd)", len); in ctlr_set() 78 len = read_cb(store, &smi_tx, sizeof(smi_tx)); in ctlr_set() 79 if (len < 0) { in ctlr_set() 81 " (err %zd)", len); in ctlr_set()
|