mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 06:39:01 +08:00
SAMA5 PWM: Driver now in build and configuration system
This commit is contained in:
@@ -5974,4 +5974,7 @@
|
||||
* arch/arm/src/sama5/sam_pwm.c and .h: Add PWM driver for SAMA5
|
||||
untested on initial checkout (not even incorporated in to build
|
||||
system) (2013-11-6).
|
||||
* arch/arm/src/sama5/Make.defs and Kconfig: SAMA5 PWM driver now
|
||||
incorporated into build and configuration system. Builds with
|
||||
no errors (2013-11-6).
|
||||
|
||||
|
||||
@@ -196,6 +196,7 @@ config SAMA5_TC1
|
||||
config SAMA5_PWM
|
||||
bool "Pulse Width Modulation Controller (PWM)"
|
||||
default n
|
||||
select PWM
|
||||
|
||||
config SAMA5_ADC
|
||||
bool "Touch Screen ADC Controller (ADC)"
|
||||
@@ -2368,6 +2369,239 @@ endif # SAMA5_TSD
|
||||
endmenu # Touchscreen Configuration
|
||||
endif # SAMA5_ADC
|
||||
|
||||
if SAMA5_PWM
|
||||
menu "PWM configuration"
|
||||
|
||||
config SAMA5_PWM_CLKA
|
||||
bool "Enable PWM CLKA"
|
||||
default n
|
||||
---help---
|
||||
Enable the PWM CLKA source.
|
||||
|
||||
config SAMA5_PWM_CLKA_FREQUENCY
|
||||
int "CLKA frequency"
|
||||
default 100
|
||||
depends on SAMA5_PWM_CLKA
|
||||
---help---
|
||||
If the CLKA source is enabled, then you must also provide the
|
||||
frequency of the CLKA. This frequency will be derived from from MCK
|
||||
using a prescaler and divider. Therefore, a wide range of
|
||||
frequencies are possible.
|
||||
|
||||
config SAMA5_PWM_CLKB
|
||||
bool "Enable PWM CLKB"
|
||||
default n
|
||||
---help---
|
||||
Enable the PWM CLKB source.
|
||||
|
||||
config SAMA5_PWM_CLKB_FREQUENCY
|
||||
int "CLKB frequency"
|
||||
default 100
|
||||
depends on SAMA5_PWM_CLKB
|
||||
---help---
|
||||
If the CLKB source is enabled, then you must also provide the
|
||||
frequency of the CLKB. This frequency will be derived from from MCK
|
||||
using a prescaler and divider. Therefore, a wide range of
|
||||
frequencies are possible.
|
||||
|
||||
config SAMA5_PWM_CHAN0
|
||||
bool "Enable PWM channel 0"
|
||||
default n
|
||||
|
||||
if SAMA5_PWM_CHAN0
|
||||
|
||||
choice
|
||||
prompt "PWM channel 0 clock source"
|
||||
default SAMA5_PWM_CHAN0_MCK
|
||||
|
||||
config SAMA5_PWM_CHAN0_MCK
|
||||
bool "MCK (divided)"
|
||||
|
||||
config SAMA5_PWM_CHAN0_CLKA
|
||||
bool "CLKA"
|
||||
depends on SAMA5_PWM_CLKA
|
||||
|
||||
config SAMA5_PWM_CHAN0_CLKB
|
||||
bool "CLKB"
|
||||
depends on SAMA5_PWM_CLKB
|
||||
|
||||
endchoice # PWM channel 0 clock source
|
||||
|
||||
config SAMA5_PWM_CHAN0_MCKDIV
|
||||
int "MCK divider"
|
||||
default 1
|
||||
depends on SAMA5_PWM_CHAN0_MCK
|
||||
---help---
|
||||
If source clock for the PWM channel is the MCK, then you must also
|
||||
specify the MCK divider to use with the MCK. The only valid options
|
||||
are 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, and 1024. Other
|
||||
selections will cause compile time errors.
|
||||
|
||||
config SAMA5_PWM_CHAN0_OUTPUTH
|
||||
bool "Configure OUTPUT H pin"
|
||||
default n
|
||||
|
||||
config SAMA5_PWM_CHAN0_OUTPUTL
|
||||
bool "Configure OUTPUT L pin"
|
||||
default n
|
||||
|
||||
config SAMA5_PWM_CHAN0_FAULTINPUT
|
||||
bool "Configure Fault Input pin"
|
||||
default n
|
||||
|
||||
endif # SAMA5_PWM_CHAN0
|
||||
|
||||
config SAMA5_PWM_CHAN1
|
||||
bool "Enable PWM channel 1"
|
||||
default n
|
||||
|
||||
if SAMA5_PWM_CHAN1
|
||||
|
||||
choice
|
||||
prompt "PWM channel 1 clock source"
|
||||
default SAMA5_PWM_CHAN1_MCK
|
||||
|
||||
config SAMA5_PWM_CHAN1_MCK
|
||||
bool "MCK (divided)"
|
||||
|
||||
config SAMA5_PWM_CHAN1_CLKA
|
||||
bool "CLKA"
|
||||
depends on SAMA5_PWM_CLKA
|
||||
|
||||
config SAMA5_PWM_CHAN1_CLKB
|
||||
bool "CLKB"
|
||||
depends on SAMA5_PWM_CLKB
|
||||
|
||||
endchoice # PWM channel 1 clock source
|
||||
|
||||
config SAMA5_PWM_CHAN1_MCKDIV
|
||||
int "MCK divider"
|
||||
default 1
|
||||
depends on SAMA5_PWM_CHAN1_MCK
|
||||
---help---
|
||||
If source clock for the PWM channel is the MCK, then you must also
|
||||
specify the MCK divider to use with the MCK. The only valid options
|
||||
are 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, and 1024. Other
|
||||
selections will cause compile time errors.
|
||||
|
||||
config SAMA5_PWM_CHAN1_OUTPUTH
|
||||
bool "Configure OUTPUT H pin"
|
||||
default n
|
||||
|
||||
config SAMA5_PWM_CHAN1_OUTPUTL
|
||||
bool "Configure OUTPUT L pin"
|
||||
default n
|
||||
|
||||
config SAMA5_PWM_CHAN1_FAULTINPUT
|
||||
bool "Configure Fault Input pin"
|
||||
default n
|
||||
|
||||
endif # SAMA5_PWM_CHAN1
|
||||
|
||||
config SAMA5_PWM_CHAN2
|
||||
bool "Enable PWM channel 2"
|
||||
default n
|
||||
|
||||
if SAMA5_PWM_CHAN2
|
||||
|
||||
choice
|
||||
prompt "PWM channel 2 clock source"
|
||||
default SAMA5_PWM_CHAN2_MCK
|
||||
|
||||
config SAMA5_PWM_CHAN2_MCK
|
||||
bool "MCK (divided)"
|
||||
|
||||
config SAMA5_PWM_CHAN2_CLKA
|
||||
bool "CLKA"
|
||||
depends on SAMA5_PWM_CLKA
|
||||
|
||||
config SAMA5_PWM_CHAN2_CLKB
|
||||
bool "CLKB"
|
||||
depends on SAMA5_PWM_CLKB
|
||||
|
||||
endchoice # PWM channel 2 clock source
|
||||
|
||||
config SAMA5_PWM_CHAN2_MCKDIV
|
||||
int "MCK divider"
|
||||
default 1
|
||||
depends on SAMA5_PWM_CHAN2_MCK
|
||||
---help---
|
||||
If source clock for the PWM channel is the MCK, then you must also
|
||||
specify the MCK divider to use with the MCK. The only valid options
|
||||
are 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, and 1024. Other
|
||||
selections will cause compile time errors.
|
||||
|
||||
config SAMA5_PWM_CHAN2_OUTPUTH
|
||||
bool "Configure OUTPUT H pin"
|
||||
default n
|
||||
|
||||
config SAMA5_PWM_CHAN2_OUTPUTL
|
||||
bool "Configure OUTPUT L pin"
|
||||
default n
|
||||
|
||||
config SAMA5_PWM_CHAN2_FAULTINPUT
|
||||
bool "Configure Fault Input pin"
|
||||
default n
|
||||
|
||||
endif # SAMA5_PWM_CHAN2
|
||||
|
||||
config SAMA5_PWM_CHAN3
|
||||
bool "Enable PWM channel 3"
|
||||
default n
|
||||
|
||||
if SAMA5_PWM_CHAN3
|
||||
|
||||
choice
|
||||
prompt "PWM channel 3 clock source"
|
||||
default SAMA5_PWM_CHAN3_MCK
|
||||
|
||||
config SAMA5_PWM_CHAN3_MCK
|
||||
bool "MCK (divided)"
|
||||
|
||||
config SAMA5_PWM_CHAN3_CLKA
|
||||
bool "CLKA"
|
||||
depends on SAMA5_PWM_CLKA
|
||||
|
||||
config SAMA5_PWM_CHAN3_CLKB
|
||||
bool "CLKB"
|
||||
depends on SAMA5_PWM_CLKB
|
||||
|
||||
endchoice # PWM channel 3 clock source
|
||||
|
||||
config SAMA5_PWM_CHAN3_MCKDIV
|
||||
int "MCK divider"
|
||||
default 1
|
||||
depends on SAMA5_PWM_CHAN3_MCK
|
||||
---help---
|
||||
If source clock for the PWM channel is the MCK, then you must also
|
||||
specify the MCK divider to use with the MCK. The only valid options
|
||||
are 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, and 1024. Other
|
||||
selections will cause compile time errors.
|
||||
|
||||
config SAMA5_PWM_CHAN3_OUTPUTH
|
||||
bool "Configure OUTPUT H pin"
|
||||
default n
|
||||
|
||||
config SAMA5_PWM_CHAN3_OUTPUTL
|
||||
bool "Configure OUTPUT L pin"
|
||||
default n
|
||||
|
||||
config SAMA5_PWM_CHAN3_FAULTINPUT
|
||||
bool "Configure Fault Input pin"
|
||||
default n
|
||||
|
||||
endif # SAMA5_PWM_CHAN3
|
||||
|
||||
config SAMA5_PWM_REGDEBUG
|
||||
bool "Enable register-level PWM debug"
|
||||
default n
|
||||
depends on DEBUG
|
||||
---help---
|
||||
Enable very low register-level debug output.
|
||||
|
||||
endmenu # PWM configuration
|
||||
endif # SAMA5_PWM
|
||||
|
||||
if SAMA5_WDT
|
||||
|
||||
menu "Watchdog Configuration"
|
||||
|
||||
@@ -205,6 +205,10 @@ CHIP_CSRCS += sam_tsd.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SAMA5_PWM),y)
|
||||
CHIP_CSRCS += sam_pwm.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SAMA5_TC0),y)
|
||||
CHIP_CSRCS += sam_tc.c
|
||||
else
|
||||
|
||||
+140
-132
File diff suppressed because it is too large
Load Diff
@@ -43,6 +43,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "chip/sam_pwm.h"
|
||||
|
||||
#ifdef CONFIG_SAMA5_PWM
|
||||
|
||||
|
||||
@@ -1215,6 +1215,7 @@ config STM32_TIM1_PWM
|
||||
bool "TIM1 PWM"
|
||||
default n
|
||||
depends on STM32_TIM1
|
||||
select ARCH_HAVE_PWM_PULSECOUNT
|
||||
---help---
|
||||
Reserve timer 1 for use by PWM
|
||||
|
||||
@@ -1236,6 +1237,7 @@ config STM32_TIM2_PWM
|
||||
bool "TIM2 PWM"
|
||||
default n
|
||||
depends on STM32_TIM2
|
||||
select ARCH_HAVE_PWM_PULSECOUNT
|
||||
---help---
|
||||
Reserve timer 2 for use by PWM
|
||||
|
||||
@@ -1257,6 +1259,7 @@ config STM32_TIM3_PWM
|
||||
bool "TIM3 PWM"
|
||||
default n
|
||||
depends on STM32_TIM3
|
||||
select ARCH_HAVE_PWM_PULSECOUNT
|
||||
---help---
|
||||
Reserve timer 3 for use by PWM
|
||||
|
||||
@@ -1278,6 +1281,7 @@ config STM32_TIM4_PWM
|
||||
bool "TIM4 PWM"
|
||||
default n
|
||||
depends on STM32_TIM4
|
||||
select ARCH_HAVE_PWM_PULSECOUNT
|
||||
---help---
|
||||
Reserve timer 4 for use by PWM
|
||||
|
||||
@@ -1299,6 +1303,7 @@ config STM32_TIM5_PWM
|
||||
bool "TIM5 PWM"
|
||||
default n
|
||||
depends on STM32_TIM5
|
||||
select ARCH_HAVE_PWM_PULSECOUNT
|
||||
---help---
|
||||
Reserve timer 5 for use by PWM
|
||||
|
||||
@@ -1320,6 +1325,7 @@ config STM32_TIM8_PWM
|
||||
bool "TIM8 PWM"
|
||||
default n
|
||||
depends on STM32_TIM8
|
||||
select ARCH_HAVE_PWM_PULSECOUNT
|
||||
---help---
|
||||
Reserve timer 8 for use by PWM
|
||||
|
||||
@@ -1341,6 +1347,7 @@ config STM32_TIM9_PWM
|
||||
bool "TIM9 PWM"
|
||||
default n
|
||||
depends on STM32_TIM9
|
||||
select ARCH_HAVE_PWM_PULSECOUNT
|
||||
---help---
|
||||
Reserve timer 9 for use by PWM
|
||||
|
||||
@@ -1362,6 +1369,7 @@ config STM32_TIM10_PWM
|
||||
bool "TIM10 PWM"
|
||||
default n
|
||||
depends on STM32_TIM10
|
||||
select ARCH_HAVE_PWM_PULSECOUNT
|
||||
---help---
|
||||
Reserve timer 10 for use by PWM
|
||||
|
||||
@@ -1383,6 +1391,7 @@ config STM32_TIM11_PWM
|
||||
bool "TIM11 PWM"
|
||||
default n
|
||||
depends on STM32_TIM11
|
||||
select ARCH_HAVE_PWM_PULSECOUNT
|
||||
---help---
|
||||
Reserve timer 11 for use by PWM
|
||||
|
||||
@@ -1404,6 +1413,7 @@ config STM32_TIM12_PWM
|
||||
bool "TIM12 PWM"
|
||||
default n
|
||||
depends on STM32_TIM12
|
||||
select ARCH_HAVE_PWM_PULSECOUNT
|
||||
---help---
|
||||
Reserve timer 12 for use by PWM
|
||||
|
||||
@@ -1425,6 +1435,7 @@ config STM32_TIM13_PWM
|
||||
bool "TIM13 PWM"
|
||||
default n
|
||||
depends on STM32_TIM13
|
||||
select ARCH_HAVE_PWM_PULSECOUNT
|
||||
---help---
|
||||
Reserve timer 13 for use by PWM
|
||||
|
||||
@@ -1446,6 +1457,7 @@ config STM32_TIM14_PWM
|
||||
bool "TIM14 PWM"
|
||||
default n
|
||||
depends on STM32_TIM14
|
||||
select ARCH_HAVE_PWM_PULSECOUNT
|
||||
---help---
|
||||
Reserve timer 14 for use by PWM
|
||||
|
||||
|
||||
@@ -80,6 +80,10 @@ config CAN_LOOPBACK
|
||||
|
||||
endif
|
||||
|
||||
config ARCH_HAVE_PWM_PULSECOUNT
|
||||
bool
|
||||
default n
|
||||
|
||||
menuconfig PWM
|
||||
bool "PWM Driver Support"
|
||||
default n
|
||||
@@ -91,6 +95,7 @@ if PWM
|
||||
config PWM_PULSECOUNT
|
||||
bool "PWM Pulse Count Support"
|
||||
default n
|
||||
depends on ARCH_HAVE_PWM_PULSECOUNT
|
||||
---help---
|
||||
Some hardware will support generation of a fixed number of pulses.
|
||||
This might be used, for example to support a stepper motor. If the
|
||||
|
||||
Reference in New Issue
Block a user