mirror of
https://github.com/apache/nuttx.git
synced 2026-09-17 02:28:06 +08:00
arch/arm/src/samv7: add DMA and TC trigger support to AFEC driver
This commit adds DMA and TC support to SAMV7 AFEC driver. The AFEC (ADC) can now be triggered by Timer/counter at chosen frewuency and samples can be transfered via DMA with configurable number of samples. Timer/counter trigger is now set as a default option with the possibility to change it to software generated trigger. DMA is inspired by SAMA5 driver and also uses ping pong buffers. Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit is contained in:
+114
-4
@@ -314,10 +314,16 @@ config SAMV7_ADC
|
||||
bool "12-bit ADC Controller (ADC)"
|
||||
default n
|
||||
|
||||
config SAMV7_AFEC0
|
||||
config SAMV7_AFEC_TIOATRIG
|
||||
bool
|
||||
default n
|
||||
|
||||
menuconfig SAMV7_AFEC0
|
||||
bool "Analog Front End 0 (AFEC0)"
|
||||
default n
|
||||
select SAMV7_AFEC
|
||||
---help---
|
||||
Support for AFEC0 (ADC) driver.
|
||||
|
||||
if SAMV7_AFEC0
|
||||
|
||||
@@ -332,12 +338,65 @@ config SAMV7_AFEC0_RES
|
||||
3 OSR16
|
||||
4 OSR64
|
||||
5 OSR256
|
||||
endif
|
||||
|
||||
config SAMV7_AFEC1
|
||||
config SAMV7_AFEC_DMA
|
||||
bool "DMA Support"
|
||||
default n
|
||||
depends on SAMV7_XDMAC
|
||||
---help---
|
||||
Enables transfer of converted data over DMA.
|
||||
|
||||
config SAMV7_AFEC_DMASAMPLES
|
||||
int "Number of DMA samples"
|
||||
default 2
|
||||
depends on SAMV7_AFEC_DMA
|
||||
---help---
|
||||
Number of DMA samples to be transfered. Number of samples less than
|
||||
2 might be inneficient.
|
||||
|
||||
choice
|
||||
prompt "AFEC Trigger mode"
|
||||
default SAMV7_AFEC0_TIOATRIG
|
||||
|
||||
config SAMV7_AFEC0_TIOATRIG
|
||||
bool "Timer/counter trigger"
|
||||
select SAMV7_AFEC_TIOATRIG
|
||||
---help---
|
||||
Use output of Timer/Counter as a trigger.
|
||||
|
||||
config SAMV7_AFEC0_SWTRIG
|
||||
bool "Software trigger"
|
||||
---help---
|
||||
Use software trigger.
|
||||
|
||||
endchoice
|
||||
|
||||
if SAMV7_AFEC0_TIOATRIG
|
||||
|
||||
config SAMV7_AFEC0_TIOAFREQ
|
||||
int "AFEC sampling frequency"
|
||||
default 1000
|
||||
---help---
|
||||
This setting provides the rate at which the timer will driver AFEC
|
||||
sampling.
|
||||
|
||||
config SAMV7_AFEC0_TIOACHAN
|
||||
int "Timer/counter channel number"
|
||||
default 0
|
||||
range 0 2
|
||||
---help---
|
||||
Number of TC channel to trigger the AFEC conversion.
|
||||
|
||||
endif #SAMV7_AFEC0_TIOATRIG
|
||||
|
||||
endif # SAMV7_AFEC0
|
||||
|
||||
menuconfig SAMV7_AFEC1
|
||||
bool "Analog Front End 1 (AFEC1)"
|
||||
default n
|
||||
select SAMV7_AFEC
|
||||
---help---
|
||||
Support for AFEC1 (ADC) driver.
|
||||
|
||||
if SAMV7_AFEC1
|
||||
|
||||
@@ -352,7 +411,58 @@ config SAMV7_AFEC1_RES
|
||||
3 OSR16
|
||||
4 OSR64
|
||||
5 OSR256
|
||||
endif
|
||||
|
||||
config SAMV7_AFEC_DMA
|
||||
bool "DMA Support"
|
||||
default n
|
||||
depends on SAMV7_XDMAC
|
||||
---help---
|
||||
Enables transfer of converted data over DMA.
|
||||
|
||||
config SAMV7_AFEC_DMASAMPLES
|
||||
int "Number of DMA samples"
|
||||
default 2
|
||||
depends on SAMV7_AFEC_DMA
|
||||
---help---
|
||||
Number of DMA samples to be transfered. Number of samples less than
|
||||
2 might be inneficient.
|
||||
|
||||
choice
|
||||
prompt "AFEC Trigger mode"
|
||||
default SAMV7_AFEC1_TIOATRIG
|
||||
|
||||
config SAMV7_AFEC1_TIOATRIG
|
||||
bool "Timer/counter trigger"
|
||||
select SAMV7_AFEC_TIOATRIG
|
||||
---help---
|
||||
Use output of Timer/Counter as a trigger.
|
||||
|
||||
config SAMV7_AFEC1_SWTRIG
|
||||
bool "Software trigger"
|
||||
---help---
|
||||
Use software trigger.
|
||||
|
||||
endchoice
|
||||
|
||||
if SAMV7_AFEC1_TIOATRIG
|
||||
|
||||
config SAMV7_AFEC1_TIOAFREQ
|
||||
int "AFEC sampling frequency"
|
||||
default 1000
|
||||
---help---
|
||||
This setting provides the rate at which the timer will driver ADC
|
||||
sampling.
|
||||
|
||||
config SAMV7_AFEC1_TIOACHAN
|
||||
int "Timer/counter channel number"
|
||||
default 3
|
||||
range 3 5
|
||||
---help---
|
||||
Number of TC channel to trigger the AFEC conversion.
|
||||
|
||||
endif #SAMV7_AFEC1_TIOATRIG
|
||||
|
||||
endif # SAMV7_AFEC1
|
||||
|
||||
config SAMV7_MCAN0
|
||||
bool "CAN controller 0 (MCAN0)"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user