Home
last modified time | relevance | path

Searched refs:sequence (Results 1 – 25 of 196) sorted by relevance

12345678

/Zephyr-latest/tests/drivers/adc/adc_api/src/
Dtest_adc.c125 struct adc_sequence sequence = { in test_task_one_channel() local
131 (void)adc_sequence_init_dt(&adc_channels[0], &sequence); in test_task_one_channel()
133 ret = adc_read_dt(&adc_channels[0], &sequence); in test_task_one_channel()
152 struct adc_sequence sequence = { in test_task_multiple_channels() local
158 (void)adc_sequence_init_dt(&adc_channels[0], &sequence); in test_task_multiple_channels()
161 sequence.channels |= BIT(adc_channels[i].channel_id); in test_task_multiple_channels()
164 ret = adc_read_dt(&adc_channels[0], &sequence); in test_task_multiple_channels()
198 struct adc_sequence sequence = { in test_task_asynchronous_call() local
209 (void)adc_sequence_init_dt(&adc_channels[0], &sequence); in test_task_asynchronous_call()
211 ret = adc_read_async(adc_channels[0].dev, &sequence, &async_sig); in test_task_asynchronous_call()
[all …]
/Zephyr-latest/drivers/adc/
Dadc_handlers.c55 struct adc_sequence sequence; in z_vrfy_adc_read() local
59 K_OOPS(K_SYSCALL_VERIFY_MSG(copy_sequence(&sequence, &options, in z_vrfy_adc_read()
62 if (sequence.options != NULL) { in z_vrfy_adc_read()
63 K_OOPS(K_SYSCALL_VERIFY_MSG(sequence.options->callback == NULL, in z_vrfy_adc_read()
67 return z_impl_adc_read((const struct device *)dev, &sequence); in z_vrfy_adc_read()
76 struct adc_sequence sequence; in z_vrfy_adc_read_async() local
80 K_OOPS(K_SYSCALL_VERIFY_MSG(copy_sequence(&sequence, &options, in z_vrfy_adc_read_async()
83 if (sequence.options != NULL) { in z_vrfy_adc_read_async()
84 K_OOPS(K_SYSCALL_VERIFY_MSG(sequence.options->callback == NULL, in z_vrfy_adc_read_async()
89 return z_impl_adc_read_async((const struct device *)dev, &sequence, in z_vrfy_adc_read_async()
Dadc_nrfx_saadc.c108 static uint32_t samples_to_bytes(const struct adc_sequence *sequence, uint16_t number_of_samples) in samples_to_bytes() argument
110 if (NRF_SAADC_8BIT_SAMPLE_WIDTH == 8 && sequence->resolution == 8) { in samples_to_bytes()
320 if (ctx->sequence.calibrate) { in adc_context_start_sampling()
337 samples_to_bytes(&ctx->sequence, nrfy_saadc_amount_get(NRF_SAADC)); in adc_context_update_buffer_pointer()
341 samples_to_bytes(&ctx->sequence, nrfy_saadc_amount_get(NRF_SAADC)); in adc_context_update_buffer_pointer()
347 static int set_resolution(const struct adc_sequence *sequence) in set_resolution() argument
351 switch (sequence->resolution) { in set_resolution()
366 sequence->resolution); in set_resolution()
374 static int set_oversampling(const struct adc_sequence *sequence, in set_oversampling() argument
379 if ((active_channels > 1) && (sequence->oversampling > 0)) { in set_oversampling()
[all …]
Dadc_smartbond_sdadc.c157 if (ctx->sequence.calibrate) { in adc_context_start_sampling()
164 val |= (ctx->sequence.oversampling - 7) << SDADC_SDADC_CTRL_REG_SDADC_OSR_Pos; in adc_context_start_sampling()
181 static int check_buffer_size(const struct adc_sequence *sequence, in check_buffer_size() argument
187 if (sequence->options) { in check_buffer_size()
188 needed_buffer_size *= (1 + sequence->options->extra_samplings); in check_buffer_size()
191 if (sequence->buffer_size < needed_buffer_size) { in check_buffer_size()
193 sequence->buffer_size, needed_buffer_size); in check_buffer_size()
201 const struct adc_sequence *sequence) in start_read() argument
206 if (sequence->oversampling < 7U || sequence->oversampling > 10) { in start_read()
211 if ((sequence->channels == 0) || in start_read()
[all …]
Dadc_mcux_gau_adc.c190 const struct adc_sequence *sequence) in mcux_gau_adc_do_read() argument
198 if (sequence->channels & (0xFFFF << NUM_ADC_CHANNELS)) { in mcux_gau_adc_do_read()
205 num_channels += ((sequence->channels & (0x1 << i)) ? 1 : 0); in mcux_gau_adc_do_read()
209 if ((sequence->options != NULL && sequence->buffer_size < in mcux_gau_adc_do_read()
210 ((1 + sequence->options->extra_samplings) * num_channels)) || in mcux_gau_adc_do_read()
211 (sequence->options == NULL && sequence->buffer_size < num_channels)) { in mcux_gau_adc_do_read()
224 if (sequence->channels & (0x1 << channel)) { in mcux_gau_adc_do_read()
234 if (sequence->resolution == 12 || sequence->resolution == 11) { in mcux_gau_adc_do_read()
236 } else if (sequence->resolution == 14 || sequence->resolution == 13) { in mcux_gau_adc_do_read()
238 } else if (sequence->resolution == 16 || sequence->resolution == 15) { in mcux_gau_adc_do_read()
[all …]
Dadc_ene_kb1200.c37 static bool adc_kb1200_validate_buffer_size(const struct adc_sequence *sequence) in adc_kb1200_validate_buffer_size() argument
44 if (chan_mask & sequence->channels) { in adc_kb1200_validate_buffer_size()
51 if (sequence->options) { in adc_kb1200_validate_buffer_size()
52 buff_need *= 1 + sequence->options->extra_samplings; in adc_kb1200_validate_buffer_size()
55 if (buff_need > sequence->buffer_size) { in adc_kb1200_validate_buffer_size()
69 static int adc_kb1200_start_read(const struct device *dev, const struct adc_sequence *sequence) in adc_kb1200_start_read() argument
75 if (!sequence->channels || (sequence->channels & ~BIT_MASK(ADC_MAX_CHAN))) { in adc_kb1200_start_read()
80 if (sequence->resolution != ADC_RESOLUTION) { in adc_kb1200_start_read()
85 if (!adc_kb1200_validate_buffer_size(sequence)) { in adc_kb1200_start_read()
91 data->buffer = sequence->buffer; in adc_kb1200_start_read()
[all …]
Dadc_nrfx_adc.c133 static int check_buffer_size(const struct adc_sequence *sequence, in check_buffer_size() argument
139 if (sequence->options) { in check_buffer_size()
140 needed_buffer_size *= (1 + sequence->options->extra_samplings); in check_buffer_size()
143 if (sequence->buffer_size < needed_buffer_size) { in check_buffer_size()
145 sequence->buffer_size, needed_buffer_size); in check_buffer_size()
153 const struct adc_sequence *sequence) in start_read() argument
156 uint32_t selected_channels = sequence->channels; in start_read()
171 if (sequence->oversampling != 0U) { in start_read()
176 switch (sequence->resolution) { in start_read()
188 sequence->resolution); in start_read()
[all …]
Dadc_smartbond_gpadc.c151 if (ctx->sequence.calibrate) { in adc_context_start_sampling()
175 static int check_buffer_size(const struct adc_sequence *sequence, in check_buffer_size() argument
181 if (sequence->options) { in check_buffer_size()
182 needed_buffer_size *= (1 + sequence->options->extra_samplings); in check_buffer_size()
185 if (sequence->buffer_size < needed_buffer_size) { in check_buffer_size()
187 sequence->buffer_size, needed_buffer_size); in check_buffer_size()
195 const struct adc_sequence *sequence) in start_read() argument
200 if (sequence->oversampling > 7U) { in start_read()
205 if ((sequence->channels == 0) || in start_read()
206 ((sequence->channels & ~BIT_MASK(SMARTBOND_ADC_CHANNEL_COUNT)) != 0)) { in start_read()
[all …]
Dadc_ads7052.c68 const struct adc_sequence *sequence) in ads7052_validate_buffer_size() argument
73 channels = POPCOUNT(sequence->channels); in ads7052_validate_buffer_size()
76 if (sequence->options) { in ads7052_validate_buffer_size()
77 needed *= (1 + sequence->options->extra_samplings); in ads7052_validate_buffer_size()
80 if (sequence->buffer_size < needed) { in ads7052_validate_buffer_size()
110 static int ads7052_start_read(const struct device *dev, const struct adc_sequence *sequence) in ads7052_start_read() argument
116 if (sequence->resolution != ADS7052_RESOLUTION) { in ads7052_start_read()
117 LOG_ERR("unsupported resolution %d", sequence->resolution); in ads7052_start_read()
121 if (find_msb_set(sequence->channels) > config->channels) { in ads7052_start_read()
122 LOG_ERR("unsupported channels in mask: 0x%08x", sequence->channels); in ads7052_start_read()
[all …]
Dadc_rpi_pico.c137 const struct adc_sequence *sequence) in adc_rpi_check_buffer_size() argument
145 if (mask & sequence->channels) { in adc_rpi_check_buffer_size()
151 if (sequence->options) { in adc_rpi_check_buffer_size()
152 needed *= (1 + sequence->options->extra_samplings); in adc_rpi_check_buffer_size()
155 if (sequence->buffer_size < needed) { in adc_rpi_check_buffer_size()
176 const struct adc_sequence *sequence) in adc_rpi_start_read() argument
182 if (sequence->resolution > ADC_RPI_MAX_RESOLUTION || in adc_rpi_start_read()
183 sequence->resolution == 0) { in adc_rpi_start_read()
184 LOG_ERR("unsupported resolution %d", sequence->resolution); in adc_rpi_start_read()
188 if (find_msb_set(sequence->channels) > config->num_channels) { in adc_rpi_start_read()
[all …]
Dadc_ifx_cat1.c156 static int validate_buffer_size(const struct adc_sequence *sequence) in validate_buffer_size() argument
162 if (sequence->channels & BIT(i)) { in validate_buffer_size()
169 if (sequence->options) { in validate_buffer_size()
170 total_buffer_size *= (1 + sequence->options->extra_samplings); in validate_buffer_size()
173 if (sequence->buffer_size < total_buffer_size) { in validate_buffer_size()
181 const struct adc_sequence *sequence) in start_read() argument
184 uint32_t channels = sequence->channels; in start_read()
187 if (sequence->resolution != ADC_CAT1_RESOLUTION) { in start_read()
188 LOG_ERR("Invalid ADC resolution (%d)", sequence->resolution); in start_read()
197 if (sequence->oversampling) { in start_read()
[all …]
Dadc_renesas_ra.c156 static int adc_ra_check_buffer_size(const struct device *dev, const struct adc_sequence *sequence) in adc_ra_check_buffer_size() argument
164 if (mask & sequence->channels) { in adc_ra_check_buffer_size()
170 if (sequence->options) { in adc_ra_check_buffer_size()
171 needed *= (1 + sequence->options->extra_samplings); in adc_ra_check_buffer_size()
174 if (sequence->buffer_size < needed) { in adc_ra_check_buffer_size()
194 static int adc_ra_start_read(const struct device *dev, const struct adc_sequence *sequence) in adc_ra_start_read() argument
200 if (sequence->resolution > ADC_RA_MAX_RESOLUTION || sequence->resolution == 0) { in adc_ra_start_read()
201 LOG_ERR("unsupported resolution %d", sequence->resolution); in adc_ra_start_read()
205 if (find_msb_set(sequence->channels) > config->num_channels) { in adc_ra_start_read()
206 LOG_ERR("unsupported channels in mask: 0x%08x", sequence->channels); in adc_ra_start_read()
[all …]
Dadc_sam_afec.c157 data->channels = ctx->sequence.channels; in adc_context_start_sampling()
172 static int check_buffer_size(const struct adc_sequence *sequence, in check_buffer_size() argument
177 if (sequence->options) { in check_buffer_size()
178 needed_buffer_size *= (1 + sequence->options->extra_samplings); in check_buffer_size()
180 if (sequence->buffer_size < needed_buffer_size) { in check_buffer_size()
182 sequence->buffer_size, needed_buffer_size); in check_buffer_size()
189 const struct adc_sequence *sequence) in start_read() argument
193 uint32_t channels = sequence->channels; in start_read()
206 if (sequence->oversampling != 0U) { in start_read()
211 if (sequence->resolution != 12U) { in start_read()
[all …]
Dadc_sam.c159 data->num_active_channels = count_bits(ctx->sequence.channels); in adc_context_start_sampling()
165 adc->ADC_CHER = ctx->sequence.channels; in adc_context_start_sampling()
181 static int check_buffer_size(const struct adc_sequence *sequence, in check_buffer_size() argument
186 if (sequence->options) { in check_buffer_size()
187 needed_buffer_size *= (1 + sequence->options->extra_samplings); in check_buffer_size()
190 if (sequence->buffer_size < needed_buffer_size) { in check_buffer_size()
192 sequence->buffer_size, needed_buffer_size); in check_buffer_size()
200 const struct adc_sequence *sequence) in start_read() argument
203 uint32_t channels = sequence->channels; in start_read()
215 if (sequence->oversampling != 0U) { in start_read()
[all …]
Dadc_ambiq.c70 static int adc_ambiq_slot_config(const struct device *dev, const struct adc_sequence *sequence, in adc_ambiq_slot_config() argument
76 if (adc_ambiq_set_resolution(&ADCSlotConfig.ePrecisionMode, sequence->resolution) != 0) { in adc_ambiq_slot_config()
77 LOG_ERR("unsupported resolution %d", sequence->resolution); in adc_ambiq_slot_config()
127 static int adc_ambiq_check_buffer_size(const struct adc_sequence *sequence, uint8_t active_channels) in adc_ambiq_check_buffer_size() argument
133 if (sequence->options) { in adc_ambiq_check_buffer_size()
134 needed_buffer_size *= (1 + sequence->options->extra_samplings); in adc_ambiq_check_buffer_size()
137 if (sequence->buffer_size < needed_buffer_size) { in adc_ambiq_check_buffer_size()
138 LOG_DBG("Provided buffer is too small (%u/%u)", sequence->buffer_size, in adc_ambiq_check_buffer_size()
146 static int adc_ambiq_start_read(const struct device *dev, const struct adc_sequence *sequence) in adc_ambiq_start_read() argument
157 if (sequence->channels & ~BIT_MASK(cfg->num_channels)) { in adc_ambiq_start_read()
[all …]
Dadc_sam0.c299 static int check_buffer_size(const struct adc_sequence *sequence, in check_buffer_size() argument
305 if (sequence->options) { in check_buffer_size()
306 needed_buffer_size *= (1U + sequence->options->extra_samplings); in check_buffer_size()
309 if (sequence->buffer_size < needed_buffer_size) { in check_buffer_size()
311 sequence->buffer_size, needed_buffer_size); in check_buffer_size()
318 const struct adc_sequence *sequence) in start_read() argument
325 if (sequence->oversampling > 10U) { in start_read()
330 adc->AVGCTRL.reg = ADC_AVGCTRL_SAMPLENUM(sequence->oversampling); in start_read()
338 if (sequence->oversampling > 4U && DSU->DID.bit.REVISION < 3) { in start_read()
339 adc->AVGCTRL.bit.ADJRES = sequence->oversampling - 4U; in start_read()
[all …]
Dadc_mcp320x.c81 const struct adc_sequence *sequence) in mcp320x_validate_buffer_size() argument
89 if (mask & sequence->channels) { in mcp320x_validate_buffer_size()
95 if (sequence->options) { in mcp320x_validate_buffer_size()
96 needed *= (1 + sequence->options->extra_samplings); in mcp320x_validate_buffer_size()
99 if (sequence->buffer_size < needed) { in mcp320x_validate_buffer_size()
107 const struct adc_sequence *sequence) in mcp320x_start_read() argument
113 if (sequence->resolution != MCP320X_RESOLUTION) { in mcp320x_start_read()
114 LOG_ERR("unsupported resolution %d", sequence->resolution); in mcp320x_start_read()
118 if (find_msb_set(sequence->channels) > config->channels) { in mcp320x_start_read()
120 sequence->channels); in mcp320x_start_read()
[all …]
Dadc_ad559x.c65 const struct adc_sequence *sequence) in adc_ad559x_validate_buffer_size() argument
70 channels = POPCOUNT(sequence->channels); in adc_ad559x_validate_buffer_size()
73 if (sequence->buffer_size < needed) { in adc_ad559x_validate_buffer_size()
80 static int adc_ad559x_start_read(const struct device *dev, const struct adc_sequence *sequence) in adc_ad559x_start_read() argument
85 if (sequence->resolution != AD559X_ADC_RESOLUTION) { in adc_ad559x_start_read()
86 LOG_ERR("invalid resolution %d", sequence->resolution); in adc_ad559x_start_read()
90 if (find_msb_set(sequence->channels) > AD559X_PIN_MAX) { in adc_ad559x_start_read()
91 LOG_ERR("invalid channels in mask: 0x%08x", sequence->channels); in adc_ad559x_start_read()
95 ret = adc_ad559x_validate_buffer_size(dev, sequence); in adc_ad559x_start_read()
101 data->buffer = sequence->buffer; in adc_ad559x_start_read()
[all …]
Dadc_nxp_s32_adc_sar.c121 const struct adc_sequence *sequence) in adc_nxp_s32_validate_buffer_size() argument
126 active_channels = POPCOUNT(sequence->channels); in adc_nxp_s32_validate_buffer_size()
129 if (sequence->options) { in adc_nxp_s32_validate_buffer_size()
130 needed_size *= (1 + sequence->options->extra_samplings); in adc_nxp_s32_validate_buffer_size()
133 if (sequence->buffer_size < needed_size) { in adc_nxp_s32_validate_buffer_size()
203 const struct adc_sequence *sequence) in adc_nxp_s32_start_read_async() argument
211 if (find_msb_set(sequence->channels) > data->num_channels) { in adc_nxp_s32_start_read_async()
216 error = adc_nxp_s32_validate_buffer_size(dev, sequence); in adc_nxp_s32_start_read_async()
223 error = adc_nxp_s32_set_averaging(dev, sequence->oversampling); in adc_nxp_s32_start_read_async()
228 if (sequence->oversampling) { in adc_nxp_s32_start_read_async()
[all …]
Dadc_b91.c47 static int adc_b91_validate_buffer_size(const struct adc_sequence *sequence) in adc_b91_validate_buffer_size() argument
51 if (sequence->options) { in adc_b91_validate_buffer_size()
52 needed *= (1 + sequence->options->extra_samplings); in adc_b91_validate_buffer_size()
55 if (sequence->buffer_size < needed) { in adc_b91_validate_buffer_size()
63 static int adc_b91_validate_sequence(const struct adc_sequence *sequence) in adc_b91_validate_sequence() argument
67 if (sequence->channels != BIT(0)) { in adc_b91_validate_sequence()
72 if (sequence->oversampling) { in adc_b91_validate_sequence()
77 status = adc_b91_validate_buffer_size(sequence); in adc_b91_validate_sequence()
175 static int adc_b91_adc_start_read(const struct device *dev, const struct adc_sequence *sequence) in adc_b91_adc_start_read() argument
181 status = adc_b91_validate_sequence(sequence); in adc_b91_adc_start_read()
[all …]
Dadc_cc32xx.c85 data->channels = ctx->sequence.channels; in adc_context_start_sampling()
89 if (ctx->sequence.channels & BIT(i)) { in adc_context_start_sampling()
174 const struct adc_sequence *sequence, in cc32xx_read() argument
182 if (sequence->resolution != 12) { in cc32xx_read()
184 sequence->resolution); in cc32xx_read()
190 if (!(sequence->channels & BIT(i))) { in cc32xx_read()
196 if (sequence->options) { in cc32xx_read()
197 exp_size *= (1 + sequence->options->extra_samplings); in cc32xx_read()
200 if (sequence->buffer_size < exp_size) { in cc32xx_read()
202 exp_size, sequence->buffer_size); in cc32xx_read()
[all …]
Dadc_xmc4xxx.c87 static int adc_xmc4xxx_validate_buffer_size(const struct adc_sequence *sequence) in adc_xmc4xxx_validate_buffer_size() argument
93 if (sequence->channels & BIT(i)) { in adc_xmc4xxx_validate_buffer_size()
100 if (sequence->options) { in adc_xmc4xxx_validate_buffer_size()
101 total_buffer_size *= (1 + sequence->options->extra_samplings); in adc_xmc4xxx_validate_buffer_size()
104 if (sequence->buffer_size < total_buffer_size) { in adc_xmc4xxx_validate_buffer_size()
112 const struct adc_sequence *sequence) in start_read() argument
118 uint32_t requested_channels = sequence->channels; in start_read()
119 uint8_t resolution = sequence->resolution; in start_read()
133 if (sequence->oversampling) { in start_read()
138 ret = adc_xmc4xxx_validate_buffer_size(sequence); in start_read()
[all …]
Dadc_cc13xx_cc26xx.c192 const struct adc_sequence *sequence, in cc13xx_cc26xx_read() argument
200 if (sequence->resolution != 12) { in cc13xx_cc26xx_read()
202 sequence->resolution); in cc13xx_cc26xx_read()
207 if (sequence->options) { in cc13xx_cc26xx_read()
208 exp_size *= (1 + sequence->options->extra_samplings); in cc13xx_cc26xx_read()
211 if (sequence->buffer_size < exp_size) { in cc13xx_cc26xx_read()
213 exp_size, sequence->buffer_size); in cc13xx_cc26xx_read()
217 data->buffer = sequence->buffer; in cc13xx_cc26xx_read()
220 adc_context_start_read(&data->ctx, sequence); in cc13xx_cc26xx_read()
227 const struct adc_sequence *sequence) in adc_cc13xx_cc26xx_read() argument
[all …]
/Zephyr-latest/samples/boards/google/twinkie_v2/pda/src/
Dmeas.c28 struct adc_sequence sequence = { in meas_vbus_v() local
34 adc_sequence_init_dt(&adc_vbus_v.port, &sequence); in meas_vbus_v()
36 ret = adc_read_dt(&adc_vbus_v.port, &sequence); in meas_vbus_v()
61 struct adc_sequence sequence = { in meas_vbus_c() local
67 adc_sequence_init_dt(&adc_vbus_c.port, &sequence); in meas_vbus_c()
69 ret = adc_read(adc_vbus_c.port.dev, &sequence); in meas_vbus_c()
/Zephyr-latest/tests/drivers/adc/adc_rescale/src/
Dmain.c66 struct adc_sequence sequence = { in test_task_voltage_divider() local
70 adc_sequence_init_dt(&adc_node_0.port, &sequence); in test_task_voltage_divider()
72 ret = adc_read_dt(&adc_node_0.port, &sequence); in test_task_voltage_divider()
106 struct adc_sequence sequence = { in test_task_current_sense_shunt() local
110 adc_sequence_init_dt(&adc_node_1.port, &sequence); in test_task_current_sense_shunt()
112 ret = adc_read_dt(&adc_node_1.port, &sequence); in test_task_current_sense_shunt()
146 struct adc_sequence sequence = { in test_task_current_sense_amplifier() local
150 adc_sequence_init_dt(&adc_node_2.port, &sequence); in test_task_current_sense_amplifier()
152 ret = adc_read_dt(&adc_node_2.port, &sequence); in test_task_current_sense_amplifier()

12345678