Lines Matching refs:adc

222 	ADC_TypeDef *adc = (ADC_TypeDef *)config->base;  in adc_stm32_dma_start()  local
235 blk_cfg->source_address = (uint32_t)LL_ADC_DMA_GetRegAddr(adc, LL_ADC_DMA_REG_REGULAR_DATA); in adc_stm32_dma_start()
263 if (adc == ADC3) { in adc_stm32_dma_start()
264 LL_ADC_REG_SetDMATransferMode(adc, in adc_stm32_dma_start()
266 LL_ADC_EnableDMAReq(adc); in adc_stm32_dma_start()
268 LL_ADC_REG_SetDataTransferMode(adc, in adc_stm32_dma_start()
272 LL_ADC_REG_SetDataTransferMode(adc, LL_ADC_REG_DMA_TRANSFER_LIMITED); in adc_stm32_dma_start()
347 ADC_TypeDef *adc = (ADC_TypeDef *)config->base; in adc_stm32_start_conversion() local
353 LL_ADC_REG_StartConversion(adc); in adc_stm32_start_conversion()
355 LL_ADC_REG_StartConversionSWStart(adc); in adc_stm32_start_conversion()
404 ADC_TypeDef *adc = config->base; in adc_stm32_calib() local
412 LL_ADC_StartCalibration(adc, LL_ADC_SINGLE_ENDED); in adc_stm32_calib()
420 LL_ADC_StartCalibration(adc); in adc_stm32_calib()
422 LL_ADC_StartCalibration(adc, LL_ADC_CALIB_OFFSET); in adc_stm32_calib()
424 LL_ADC_StartCalibration(adc, LL_ADC_CALIB_OFFSET, LL_ADC_SINGLE_ENDED); in adc_stm32_calib()
429 while (LL_ADC_IsCalibrationOnGoing(adc)) { in adc_stm32_calib()
437 static void adc_stm32_disable(ADC_TypeDef *adc) in adc_stm32_disable() argument
439 if (LL_ADC_IsEnabled(adc) != 1UL) { in adc_stm32_disable()
450 if (LL_ADC_REG_IsConversionOngoing(adc)) { in adc_stm32_disable()
451 LL_ADC_REG_StopConversion(adc); in adc_stm32_disable()
452 while (LL_ADC_REG_IsConversionOngoing(adc)) { in adc_stm32_disable()
465 if (LL_ADC_INJ_IsConversionOngoing(adc)) { in adc_stm32_disable()
466 LL_ADC_INJ_StopConversion(adc); in adc_stm32_disable()
467 while (LL_ADC_INJ_IsConversionOngoing(adc)) { in adc_stm32_disable()
472 LL_ADC_Disable(adc); in adc_stm32_disable()
477 while (LL_ADC_IsEnabled(adc) == 1UL) { in adc_stm32_disable()
525 static void adc_stm32_oversampling_scope(ADC_TypeDef *adc, uint32_t ovs_scope) in adc_stm32_oversampling_scope() argument
533 if (LL_ADC_GetOverSamplingScope(adc) == ovs_scope) { in adc_stm32_oversampling_scope()
536 adc_stm32_disable(adc); in adc_stm32_oversampling_scope()
538 LL_ADC_SetOverSamplingScope(adc, ovs_scope); in adc_stm32_oversampling_scope()
546 static void adc_stm32_oversampling_ratioshift(ADC_TypeDef *adc, uint32_t ratio, uint32_t shift) in adc_stm32_oversampling_ratioshift() argument
552 if ((LL_ADC_GetOverSamplingRatio(adc) == ratio) in adc_stm32_oversampling_ratioshift()
553 && (LL_ADC_GetOverSamplingShift(adc) == shift)) { in adc_stm32_oversampling_ratioshift()
556 adc_stm32_disable(adc); in adc_stm32_oversampling_ratioshift()
558 LL_ADC_ConfigOverSamplingRatioShift(adc, ratio, shift); in adc_stm32_oversampling_ratioshift()
566 static int adc_stm32_oversampling(ADC_TypeDef *adc, uint8_t ratio) in adc_stm32_oversampling() argument
569 adc_stm32_oversampling_scope(adc, LL_ADC_OVS_DISABLE); in adc_stm32_oversampling()
572 adc_stm32_oversampling_scope(adc, LL_ADC_OVS_GRP_REGULAR_CONTINUED); in adc_stm32_oversampling()
585 if (adc != ADC3) { in adc_stm32_oversampling()
587 adc_stm32_oversampling_ratioshift(adc, 1 << ratio, shift); in adc_stm32_oversampling()
590 adc_stm32_oversampling_ratioshift(adc, table_oversampling_ratio[ratio], shift); in adc_stm32_oversampling()
594 adc_stm32_oversampling_ratioshift(adc, 1 << ratio, shift); in adc_stm32_oversampling()
597 if (adc != ADC4) { in adc_stm32_oversampling()
599 adc_stm32_oversampling_ratioshift(adc, (1 << ratio), shift); in adc_stm32_oversampling()
602 adc_stm32_oversampling_ratioshift(adc, table_oversampling_ratio[ratio], shift); in adc_stm32_oversampling()
605 adc_stm32_oversampling_ratioshift(adc, table_oversampling_ratio[ratio], shift); in adc_stm32_oversampling()
615 static int adc_stm32_enable(ADC_TypeDef *adc) in adc_stm32_enable() argument
617 if (LL_ADC_IsEnabled(adc) == 1UL) { in adc_stm32_enable()
623 LL_ADC_ClearFlag_ADRDY(adc); in adc_stm32_enable()
624 LL_ADC_Enable(adc); in adc_stm32_enable()
633 while (LL_ADC_IsActiveFlag_ADRDY(adc) == 0) { in adc_stm32_enable()
636 if (LL_ADC_IsEnabled(adc) == 0UL) { in adc_stm32_enable()
637 LL_ADC_Enable(adc); in adc_stm32_enable()
652 LL_ADC_Enable(adc); in adc_stm32_enable()
665 ADC_TypeDef *adc = (ADC_TypeDef *)config->base; local
671 if (LL_ADC_IsActiveFlag_OVR(adc) || (status >= 0)) {
684 LL_ADC_ClearFlag_OVR(adc);
693 LL_ADC_REG_StopConversion(adc);
705 ADC_TypeDef *adc = (ADC_TypeDef *)config->base; local
707 uintptr_t addr = (uintptr_t)adc + reg;
716 ADC_TypeDef *adc = (ADC_TypeDef *)config->base; local
718 uintptr_t addr = (uintptr_t)adc + reg;
727 ADC_TypeDef *adc = (ADC_TypeDef *)config->base; local
767 adc_stm32_disable(adc);
779 ADC_TypeDef *adc = (ADC_TypeDef *)config->base; local
804 LL_ADC_SetChannelPreselection(adc, channel);
806 LL_ADC_REG_SetSequencerRanks(adc, table_rank[channel_index], channel);
807 LL_ADC_REG_SetSequencerLength(adc, table_seq_len[channel_index]);
814 LL_ADC_REG_SetSequencerChannels(adc, channels_mask);
824 while (LL_ADC_IsActiveFlag_CCRDY(adc) == 0) {
826 LL_ADC_ClearFlag_CCRDY(adc);
833 LL_ADC_SetSequencersScanMode(adc, LL_ADC_SEQ_SCAN_ENABLE);
844 ADC_TypeDef *adc = (ADC_TypeDef *)config->base; local
890 err = adc_stm32_oversampling(adc, sequence->oversampling);
906 adc_stm32_disable(adc);
919 adc_stm32_enable(adc);
922 LL_ADC_ClearFlag_OVR(adc);
928 LL_ADC_REG_SetFlagEndOfConversion(adc, LL_ADC_REG_FLAG_EOC_UNITARY_CONV);
929 LL_ADC_EnableIT_EOCS(adc);
931 LL_ADC_EnableIT_EOS(adc);
933 LL_ADC_EnableIT_EOC(adc);
980 ADC_TypeDef *adc = config->base; local
983 if (LL_ADC_IsActiveFlag_EOS(adc) == 1) {
985 if (LL_ADC_IsActiveFlag_EOCS(adc) == 1) {
987 if (LL_ADC_IsActiveFlag_EOC(adc) == 1) {
989 *data->buffer++ = LL_ADC_REG_ReadConversionData32(adc);
1006 ADC_TypeDef *adc = (ADC_TypeDef *)config->base; local
1010 adc_stm32_disable(adc);
1016 LL_ADC_SetCommonPathInternalCh(__LL_ADC_COMMON_INSTANCE(adc),
1021 LL_ADC_SetChannelPreselection(adc, 0);
1083 ADC_TypeDef *adc = config->base; local
1094 LL_ADC_SetChannelSamplingTime(adc,
1101 LL_ADC_SetSamplingTimeCommonChannels(adc,
1107 LL_ADC_SetChannelSamplingTime(adc,
1110 LL_ADC_SetSamplingTimeCommonChannels(adc,
1189 ADC_TypeDef *adc = (ADC_TypeDef *)config->base; local
1191 ARG_UNUSED(adc); /* Necessary to avoid warnings on some series */
1208 LL_ADC_SetClock(adc, config->clk_prescaler);
1217 LL_ADC_SetClock(adc, config->clk_prescaler);
1219 LL_ADC_SetCommonClock(__LL_ADC_COMMON_INSTANCE(adc),
1221 LL_ADC_SetClock(adc, LL_ADC_CLOCK_ASYNC);
1224 LL_ADC_SetCommonClock(__LL_ADC_COMMON_INSTANCE(adc),
1236 ADC_TypeDef *adc = (ADC_TypeDef *)config->base; local
1293 LL_ADC_DisableDeepPowerDown(adc);
1305 LL_ADC_EnableInternalRegulator(adc);
1310 adc_stm32_disable(adc);
1315 err = adc_stm32_enable(adc);
1325 LL_ADC_REG_SetTriggerSource(adc, LL_ADC_REG_TRIG_SOFTWARE);
1336 if (adc == ADC1) {
1338 } else if (adc == ADC2) {
1349 adc, LL_ADC_CALIB_LINEARITY_WORD1 << count,
1393 bool adc_stm32_is_irq_active(ADC_TypeDef *adc) argument
1396 return LL_ADC_IsActiveFlag_EOCS(adc) ||
1398 return LL_ADC_IsActiveFlag_EOC(adc) ||
1400 LL_ADC_IsActiveFlag_OVR(adc) ||
1401 LL_ADC_IsActiveFlag_JEOS(adc) ||
1402 LL_ADC_IsActiveFlag_AWD1(adc);