/Zephyr-latest/tests/subsys/dsp/utils/src/ |
D | f32.c | 4 * SPDX-License-Identifier: Apache-2.0 23 #define TEST_CASES_SHIFT_F32_TO_Q7 (-1.0F, 0, -128), (1.0F, 0, 127), (1.0F, 7, 1), (-1.0F, 7, -1) 26 (-1.0F, 0, -32768), (1.0F, 0, 32767), (1.0F, 15, 1), (-1.0F, 15, -1) 29 (-1.0F, 0, -2147483648), (1.0F, 0, 2147483647), (1.0F, 31, 1), (-1.0F, 31, -1) 31 static void test_shift_f32_to_q7(const float32_t data, const uint32_t shift, in test_shift_f32_to_q7() argument 34 q7_t shifted_data = Z_SHIFT_F32_TO_Q7(data, shift); in test_shift_f32_to_q7() 37 "Conversion failed: %f shifted by %d = %d (expected %d)", (double)data, shift, in test_shift_f32_to_q7() 41 static void test_shift_f32_to_q15(const float32_t data, const uint32_t shift, in test_shift_f32_to_q15() argument 44 q15_t shifted_data = Z_SHIFT_F32_TO_Q15(data, shift); in test_shift_f32_to_q15() 47 "Conversion failed: %f shifted by %d = %d (expected %d)", (double)data, shift, in test_shift_f32_to_q15() [all …]
|
D | f64.c | 4 * SPDX-License-Identifier: Apache-2.0 23 #define TEST_CASES_SHIFT_F64_TO_Q7 (-1.0, 0, -128), (1.0, 0, 127), (1.0, 7, 1), (-1.0, 7, -1) 25 #define TEST_CASES_SHIFT_F64_TO_Q15 (-1.0, 0, -32768), (1.0, 0, 32767), (1.0, 15, 1), (-1.0, 15, -1) 28 (-1.0, 0, INT32_MIN), (1.0, 0, INT32_MAX), (1.0, 31, 1), (-1.0, 31, -1) 30 static void test_shift_f64_to_q7(const float64_t data, const uint32_t shift, in test_shift_f64_to_q7() argument 33 const q7_t shifted_data = Z_SHIFT_F64_TO_Q7(data, shift); in test_shift_f64_to_q7() 36 "Conversion failed: %f shifted by %d = %d (expected %d)", data, shift, in test_shift_f64_to_q7() 40 static void test_shift_f64_to_q15(const float64_t data, const uint32_t shift, in test_shift_f64_to_q15() argument 43 const q15_t shifted_data = Z_SHIFT_F64_TO_Q15(data, shift); in test_shift_f64_to_q15() 46 "Conversion failed: %f shifted by %d = %d (expected %d)", (double)data, shift, in test_shift_f64_to_q15() [all …]
|
D | q15.c | 4 * SPDX-License-Identifier: Apache-2.0 24 (-32768, 0, -1.0F), (32767, 0, 0.999969482421875F), (32767, 15, 32767.0F), \ 25 (-32768, 15, -32768.0F) 28 (-32768, 0, -1), (32767, 0, 0.999969482421875), (32767, 15, 32767.0), (-32768, 15, -32768.0) 30 static void test_shift_q15_to_f32(const q15_t data, const uint32_t shift, const float32_t expected) in test_shift_q15_to_f32() argument 32 const float32_t shifted_data = Z_SHIFT_Q15_TO_F32(data, shift); in test_shift_q15_to_f32() 35 "Conversion failed: 0x%08x shifted by %d = %f (expected %f)", data, shift, in test_shift_q15_to_f32() 39 static void test_shift_q15_to_f64(const q15_t data, const uint32_t shift, const float64_t expected) in test_shift_q15_to_f64() argument 41 const float64_t shifted_data = Z_SHIFT_Q15_TO_F64(data, shift); in test_shift_q15_to_f64() 44 "Conversion failed: 0x%08x shifted by %d = %f (expected %f)", data, shift, in test_shift_q15_to_f64()
|
D | q31.c | 4 * SPDX-License-Identifier: Apache-2.0 24 (2147483647, 0, 1.0F), (-2147483648, 0, -1.0F), (-2147483648, 31, -2147483648.0F), \ 28 (2147483647, 0, 0.9999999995343387), (-2147483648, 0, -1.0), \ 29 (-2147483648, 31, -2147483648.0), (2147483647, 31, 2147483647.0) 31 static void test_shift_q31_to_f32(const q31_t data, const uint32_t shift, const float32_t expected) in test_shift_q31_to_f32() argument 33 const float32_t shifted_data = Z_SHIFT_Q31_TO_F32(data, shift); in test_shift_q31_to_f32() 36 "Conversion failed: 0x%08x shifted by %d = %f (expected %f)", data, shift, in test_shift_q31_to_f32() 40 static void test_shift_q31_to_f64(const q31_t data, const uint32_t shift, const float64_t expected) in test_shift_q31_to_f64() argument 42 const float64_t shifted_data = Z_SHIFT_Q31_TO_F64(data, shift); in test_shift_q31_to_f64() 45 "Conversion failed: 0x%08x shifted by %d = %f (expected %f)", data, shift, in test_shift_q31_to_f64()
|
D | q7.c | 4 * SPDX-License-Identifier: Apache-2.0 24 (-128, 0, -1.0F), (127, 0, 0.9921875F), (127, 7, 127.0F), (-128, 7, -128.0F) 27 (-128, 0, -1.0), (127, 0, 0.9921875), (127, 7, 127.0), (-128, 7, -128.0) 29 static void test_shift_q7_to_f32(const q7_t data, const uint32_t shift, const float32_t expected) in test_shift_q7_to_f32() argument 31 const float32_t shifted_data = Z_SHIFT_Q7_TO_F32(data, shift); in test_shift_q7_to_f32() 34 "Conversion failed: 0x%08x shifted by %d = %f (expected %f)", data, shift, in test_shift_q7_to_f32() 38 static void test_shift_q7_to_f64(const q7_t data, const uint32_t shift, const float64_t expected) in test_shift_q7_to_f64() argument 40 const float64_t shifted_data = Z_SHIFT_Q7_TO_F64(data, shift); in test_shift_q7_to_f64() 43 "Conversion failed: 0x%08x shifted by %d = %f (expected %f)", data, shift, in test_shift_q7_to_f64()
|
/Zephyr-latest/drivers/sensor/bosch/bma4xx/ |
D | bma4xx_emul.c | 3 * SPDX-License-Identifier: Apache-2.0 28 /* Holds register data. */ 38 struct bma4xx_emul_data *data = target->data; in bma4xx_emul_set_reg() local 41 memcpy(data->regs + reg_addr, val, count); in bma4xx_emul_set_reg() 46 struct bma4xx_emul_data *data = target->data; in bma4xx_emul_get_reg() local 49 memcpy(val, data->regs + reg_addr, count); in bma4xx_emul_get_reg() 55 struct bma4xx_emul_data *data = target->data; in bma4xx_emul_get_interrupt_config() local 57 *int1_io_ctrl = data->regs[BMA4XX_REG_INT1_IO_CTRL]; in bma4xx_emul_get_interrupt_config() 58 *latched_mode = data->regs[BMA4XX_REG_INT_LATCH]; in bma4xx_emul_get_interrupt_config() 59 return data->regs[BMA4XX_REG_INT_MAP_DATA]; in bma4xx_emul_get_interrupt_config() [all …]
|
D | bma4xx.c | 1 /* Bosch BMA4xx 3-axis accelerometer driver 6 * SPDX-License-Identifier: Apache-2.0 29 return -ERANGE; in bma4xx_offset_to_reg_val() 42 struct bma4xx_data *bma4xx = dev->data; in bma4xx_attr_set_offset() 51 reg_addr = BMA4XX_REG_OFFSET_0 + (chan - SENSOR_CHAN_ACCEL_X); in bma4xx_attr_set_offset() 56 return bma4xx->hw_ops->write_reg(dev, reg_addr, reg_val[0]); in bma4xx_attr_set_offset() 66 return bma4xx->hw_ops->write_data(dev, reg_addr, (uint8_t *)reg_val, in bma4xx_attr_set_offset() 69 return -ENOTSUP; in bma4xx_attr_set_offset() 96 return -ERANGE; in bma4xx_odr_to_reg() 107 return -ERANGE; in bma4xx_odr_to_reg() [all …]
|
/Zephyr-latest/drivers/sensor/tdk/icm42688/ |
D | icm42688_emul.c | 3 * SPDX-License-Identifier: Apache-2.0 31 struct icm42688_emul_data *data = target->data; in icm42688_emul_set_reg() local 34 memcpy(data->reg + reg_addr, val, count); in icm42688_emul_set_reg() 39 struct icm42688_emul_data *data = target->data; in icm42688_emul_get_reg() local 42 memcpy(val, data->reg + reg_addr, count); in icm42688_emul_get_reg() 47 struct icm42688_emul_data *data = target->data; in icm42688_emul_handle_write() local 53 memset(data->reg, 0, NUM_REGS); in icm42688_emul_handle_write() 54 /* Initialized the who-am-i register */ in icm42688_emul_handle_write() 55 data->reg[REG_WHO_AM_I] = WHO_AM_I_ICM42688; in icm42688_emul_handle_write() 57 data->reg[REG_INT_STATUS] |= BIT_INT_STATUS_RESET_DONE; in icm42688_emul_handle_write() [all …]
|
D | icm42688_decoder.c | 4 * SPDX-License-Identifier: Apache-2.0 17 static int icm42688_get_shift(enum sensor_channel channel, int accel_fs, int gyro_fs, int8_t *shift) in icm42688_get_shift() argument 26 *shift = 5; in icm42688_get_shift() 29 *shift = 6; in icm42688_get_shift() 32 *shift = 7; in icm42688_get_shift() 35 *shift = 8; in icm42688_get_shift() 38 return -EINVAL; in icm42688_get_shift() 46 *shift = -1; in icm42688_get_shift() 49 *shift = 0; in icm42688_get_shift() 52 *shift = 1; in icm42688_get_shift() [all …]
|
/Zephyr-latest/drivers/gpio/ |
D | gpio_bcm2711.c | 3 * SPDX-License-Identifier: Apache-2.0 42 #define DEV_CFG(dev) ((const struct gpio_bcm2711_config *const)(dev)->config) 43 #define DEV_DATA(dev) ((struct gpio_bcm2711_data *const)(dev)->data) 45 #define RPI_PIN_NUM(dev, n) (DEV_CFG(dev)->offset + n) 71 struct gpio_bcm2711_data *data = DEV_DATA(port); in gpio_bcm2711_pin_configure() local 73 uint32_t shift; in gpio_bcm2711_pin_configure() local 77 return -ENOTSUP; in gpio_bcm2711_pin_configure() 83 shift = GPIO_REG_SHIFT(RPI_PIN_NUM(port, pin), FSEL_GROUPS, FSEL_BITS); in gpio_bcm2711_pin_configure() 85 regval = sys_read32(GPFSEL(data->base, group)); in gpio_bcm2711_pin_configure() 86 regval &= ~(BIT_MASK(FSEL_BITS) << shift); in gpio_bcm2711_pin_configure() [all …]
|
/Zephyr-latest/drivers/sensor/asahi_kasei/akm09918c/ |
D | akm09918c_emul.c | 3 * SPDX-License-Identifier: Apache-2.0 34 struct akm09918c_emul_data *data = target->data; in akm09918c_emul_set_reg() local 37 memcpy(data->reg + reg_addr, val, count); in akm09918c_emul_set_reg() 42 struct akm09918c_emul_data *data = target->data; in akm09918c_emul_get_reg() local 45 memcpy(val, data->reg + reg_addr, count); in akm09918c_emul_get_reg() 50 struct akm09918c_emul_data *data = target->data; in akm09918c_emul_reset() local 52 memset(data->reg, 0, NUM_REGS); in akm09918c_emul_reset() 53 data->reg[AKM09918C_REG_WIA1] = AKM09918C_WIA1; in akm09918c_emul_reset() 54 data->reg[AKM09918C_REG_WIA2] = AKM09918C_WIA2; in akm09918c_emul_reset() 59 struct akm09918c_emul_data *data = target->data; in akm09918c_emul_handle_write() local [all …]
|
/Zephyr-latest/drivers/sensor/bosch/bmi160/ |
D | emul_bmi160.c | 4 * SPDX-License-Identifier: Apache-2.0 27 /** Run-time data used by the emulator */ 51 const struct bmi160_emul_cfg *cfg = target->cfg; in emul_bmi160_get_reg_value() 54 return -EINVAL; in emul_bmi160_get_reg_value() 57 memcpy(out, cfg->reg + reg_number, count); in emul_bmi160_get_reg_value() 63 struct bmi160_emul_data *data = target->data; in reg_write() local 64 const struct bmi160_emul_cfg *cfg = target->cfg; in reg_write() 67 cfg->reg[regn] = val; in reg_write() 89 int shift; in reg_write() local 94 shift = BMI160_PMU_STATUS_ACC_POS; in reg_write() [all …]
|
/Zephyr-latest/drivers/sensor/amd_sb_tsi/ |
D | sb_tsi_emul.c | 3 * SPDX-License-Identifier: Apache-2.0 26 struct sb_tsi_emul_data *data = target->data; in sb_tsi_emul_set_reg() local 29 data->reg[reg] = val; in sb_tsi_emul_set_reg() 34 struct sb_tsi_emul_data *data = target->data; in sb_tsi_emul_get_reg() local 37 return data->reg[reg]; in sb_tsi_emul_get_reg() 42 struct sb_tsi_emul_data *data = target->data; in sb_tsi_emul_reset() local 44 memset(data->reg, 0, NUM_REGS); in sb_tsi_emul_reset() 56 i2c_dump_msgs_rw(target->dev, msgs, num_msgs, addr, false); in sb_tsi_emul_transfer_i2c() 59 if (msgs->flags & I2C_MSG_READ) { in sb_tsi_emul_transfer_i2c() 61 return -EIO; in sb_tsi_emul_transfer_i2c() [all …]
|
/Zephyr-latest/include/zephyr/drivers/ |
D | sensor_data_types.h | 4 * SPDX-License-Identifier: Apache-2.0 34 * Data for a sensor channel which reports on three axes. This is used by: 35 * - :c:enum:`SENSOR_CHAN_ACCEL_X` 36 * - :c:enum:`SENSOR_CHAN_ACCEL_Y` 37 * - :c:enum:`SENSOR_CHAN_ACCEL_Z` 38 * - :c:enum:`SENSOR_CHAN_ACCEL_XYZ` 39 * - :c:enum:`SENSOR_CHAN_GYRO_X` 40 * - :c:enum:`SENSOR_CHAN_GYRO_Y` 41 * - :c:enum:`SENSOR_CHAN_GYRO_Z` 42 * - :c:enum:`SENSOR_CHAN_GYRO_XYZ` [all …]
|
/Zephyr-latest/drivers/sensor/f75303/ |
D | f75303_emul.c | 3 * SPDX-License-Identifier: Apache-2.0 30 struct f75303_emul_data *data = target->data; in f75303_emul_set_reg() local 33 data->reg[reg] = val; in f75303_emul_set_reg() 38 struct f75303_emul_data *data = target->data; in f75303_emul_get_reg() local 41 return data->reg[reg]; in f75303_emul_get_reg() 46 struct f75303_emul_data *data = target->data; in f75303_emul_reset() local 48 memset(data->reg, 0, NUM_REGS); in f75303_emul_reset() 60 i2c_dump_msgs_rw(target->dev, msgs, num_msgs, addr, false); in f75303_emul_transfer_i2c() 63 if (msgs->flags & I2C_MSG_READ) { in f75303_emul_transfer_i2c() 65 return -EIO; in f75303_emul_transfer_i2c() [all …]
|
/Zephyr-latest/subsys/sensing/sensor/phy_3d_sensor/ |
D | phy_3d_sensor.c | 4 * SPDX-License-Identifier: Apache-2.0 26 static int64_t shifted_q31_to_scaled_int64(q31_t q, int8_t shift, int64_t scale) in shifted_q31_to_scaled_int64() argument 31 shifted_value = (int64_t)q << shift; in shifted_q31_to_scaled_int64() 35 FIELD_GET(GENMASK64(31 + shift, 31), shifted_value) * scale + in shifted_q31_to_scaled_int64() 39 scaled_value = -scaled_value; in shifted_q31_to_scaled_int64() 46 int8_t shift) in scaled_int64_to_shifted_q31() argument 48 return (q31_t)((val * BIT(31 - shift) / scale)); in scaled_int64_to_shifted_q31() 71 .shift = SENSING_ACCEL_Q31_SHIFT, 96 .shift = SENSING_GYRO_Q31_SHIFT, 103 const struct phy_3d_sensor_config *cfg = dev->config; in phy_3d_sensor_init() [all …]
|
/Zephyr-latest/drivers/watchdog/ |
D | wdt_wwdgt_gd32.c | 4 * SPDX-License-Identifier: Apache-2.0 31 /* mutable driver data */ 49 * count = (timeout * pclk / INTERNAL_DIVIDER * (2^prescaler_exp) ) - 1 56 const struct gd32_wwdgt_config *config = dev->config; in gd32_wwdgt_calc_ticks() 60 (clock_control_subsys_t)&config->clkid, in gd32_wwdgt_calc_ticks() 64 / (WWDGT_INTERNAL_DIVIDER * (1 << exp) * MSEC_PER_SEC) - 1) in gd32_wwdgt_calc_ticks() 76 * @return 0 on success, -EINVAL if the window-max is out of range 83 for (uint32_t shift = 0U; shift <= WWDGT_PRESCALER_EXP_MAX; shift++) { in gd32_wwdgt_calc_window() local 84 uint32_t max_count = gd32_wwdgt_calc_ticks(dev, win->max, shift); in gd32_wwdgt_calc_window() 88 *prescaler = CFG_PSC(shift); in gd32_wwdgt_calc_window() [all …]
|
D | wdt_iwdg_stm32.c | 2 * Copyright (c) 2016 Open-RnD Sp. z o.o. 7 * SPDX-License-Identifier: Apache-2.0 67 uint8_t shift = 0U; in iwdg_stm32_convert_timeout() local 73 shift++; in iwdg_stm32_convert_timeout() 74 divider = 4U << shift; in iwdg_stm32_convert_timeout() 78 * Value of the 'shift' variable corresponds to the in iwdg_stm32_convert_timeout() 81 *prescaler = shift; in iwdg_stm32_convert_timeout() 82 *reload = (uint32_t)(ticks / divider) - 1U; in iwdg_stm32_convert_timeout() 87 struct iwdg_stm32_data *data = IWDG_STM32_DATA(dev); in iwdg_stm32_setup() local 110 return -ENOTSUP; in iwdg_stm32_setup() [all …]
|
/Zephyr-latest/drivers/sensor/memsic/mmc56x3/ |
D | mmc56x3_decoder.c | 3 * SPDX-License-Identifier: Apache-2.0 13 int32_t ret = -ENOTSUP; in mmc56x3_decoder_get_frame_count() 22 *frame_count = edata->has_temp ? 1 : 0; in mmc56x3_decoder_get_frame_count() 25 *frame_count = edata->has_magn_x ? 1 : 0; in mmc56x3_decoder_get_frame_count() 28 *frame_count = edata->has_magn_y ? 1 : 0; in mmc56x3_decoder_get_frame_count() 31 *frame_count = edata->has_magn_z ? 1 : 0; in mmc56x3_decoder_get_frame_count() 35 ((edata->has_magn_x && edata->has_magn_y && edata->has_magn_z) ? 1 : 0); in mmc56x3_decoder_get_frame_count() 63 return -ENOTSUP; in mmc56x3_decoder_get_size_info() 71 const struct mmc56x3_data *data = &edata->data; in mmc56x3_decoder_decode() local 79 if (edata->has_temp) { in mmc56x3_decoder_decode() [all …]
|
/Zephyr-latest/drivers/ps2/ |
D | ps2_npcx_controller.c | 4 * SPDX-License-Identifier: Apache-2.0 14 * hardware accelerator mechanism to handle both incoming and outgoing data. 21 #include <zephyr/dt-bindings/clock/npcx_clock.h> 30 * Set WDAT3-0 and clear CLK3-0 in the PSOSIG register to 31 * reset the shift mechanism. 39 * The max duration of a PS/2 clock is about 100 micro-seconds. 51 /* Driver data */ 56 * (i.e. the bit position of CLK3-0 in the PS2_PSOSIG register) 64 * The callback function to handle the data received from PS/2 device 71 ((struct ps2_reg *)((const struct ps2_npcx_ctrl_config *)(dev)->config)->base) [all …]
|
/Zephyr-latest/include/zephyr/sensing/ |
D | sensing_datatypes.h | 2 * Copyright (c) 2022-2023 Intel Corporation. 4 * SPDX-License-Identifier: Apache-2.0 14 * @brief Data Types 23 * Each sensor value data structure should have this header 38 * If a sensor has batched data where two consecutive readings differ by 48 /** Base timestamp of this data readings, unit is micro seconds */ 50 /** Count of this data readings */ 55 * @brief Sensor value data structure types based on common data types. 60 * @brief Sensor value data structure for 3-axis sensors. 68 /** Header of the sensor value data structure. */ [all …]
|
/Zephyr-latest/include/zephyr/dsp/ |
D | utils.h | 4 * SPDX-License-Identifier: Apache-2.0 26 * @defgroup math_dsp_utils_shifts Float/Fixed point shift conversion functions 33 * Convert number Q7/Q15/Q31 to Float or Double representation with shift. 35 * There are separate functions for floating-point, Q7, Q15, and Q31 data types. 40 * @brief Convert a Q7 fixed-point value to a floating-point (float32_t) value with a left shift. 42 * @param src The input Q7 fixed-point value. 43 * @param m The number of bits to left shift the input value (0 to 7). 44 * @return The converted floating-point (float32_t) value. 49 * @brief Convert a Q15 fixed-point value to a floating-point (float32_t) value with a left shift. 51 * @param src The input Q15 fixed-point value. [all …]
|
/Zephyr-latest/drivers/fpga/ |
D | fpga_zynqmp.c | 2 * Copyright (c) 2021-2022 Antmicro <www.antmicro.com> 4 * SPDX-License-Identifier: Apache-2.0 36 struct zynqmp_fpga_data *data = dev->data; in update_part_name() local 110 snprintf(data->FPGA_info, sizeof(data->FPGA_info), "unknown"); in update_part_name() 112 snprintf(data->FPGA_info, sizeof(data->FPGA_info), "Part name: ZU%d", zu_number); in update_part_name() 122 * [key][length of data][data] 131 /* shift to the next section*/ in parse_header() 140 /* shift to the data section*/ in parse_header() 153 /* shift to the data section*/ in parse_header() 165 /* shift to the data section*/ in parse_header() [all …]
|
/Zephyr-latest/tests/drivers/build_all/sensor/src/ |
D | generic_test.c | 3 * SPDX-License-Identifier: Apache-2.0 19 * A union of all sensor data types. 60 zassert_ok(sys_bitarray_clear_region(sensor_read_rtio_ctx.block_pool->bitmap, in before() 61 sensor_read_rtio_ctx.block_pool->info.num_blocks, in before() 80 const struct emul *emul = emul_get_binding(dev->name); in run_generic_test() 113 int8_t shift; in run_generic_test() local 117 &channel_table[ch].epsilon, &shift) == 0) { in run_generic_test() 121 LOG_INF("CH %d: lower=%d, upper=%d, eps=%d, shift=%d", ch, lower, upper, in run_generic_test() 122 channel_table[ch].epsilon, shift); in run_generic_test() 131 channel_table[ch].expected_value_shift = shift; in run_generic_test() [all …]
|
/Zephyr-latest/dts/bindings/led_strip/ |
D | worldsemi,ws2812-spi.yaml | 2 # SPDX-License-Identifier: Apache-2.0 14 - spi-max-frequency 15 - spi-zero-frame 16 - spi-one-frame. 19 driver RAM overhead per bit of pixel data). 21 compatible: "worldsemi,ws2812-spi" 23 include: [spi-device.yaml, ws2812.yaml] 27 spi-one-frame: 30 description: 8-bit SPI frame to shift out for a 1 pulse. 32 spi-zero-frame: [all …]
|