From 3a66ae51c3f34108428e582ef693866d71496d16 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 28 Aug 2020 15:25:37 +0200 Subject: Expose configuration via Kconfig --- src/arch/msp430fr5994lp/Kconfig | 31 ++++++++++++++++ src/arch/msp430fr5994lp/Makefile.inc | 60 +++++++++++++++++++++++++------ src/arch/msp430fr5994lp/arch.cc | 6 ---- src/arch/msp430fr5994lp/driver/counter.cc | 4 --- src/arch/msp430fr5994lp/prompt | 1 + 5 files changed, 82 insertions(+), 20 deletions(-) create mode 100644 src/arch/msp430fr5994lp/Kconfig create mode 100644 src/arch/msp430fr5994lp/prompt (limited to 'src/arch/msp430fr5994lp') diff --git a/src/arch/msp430fr5994lp/Kconfig b/src/arch/msp430fr5994lp/Kconfig new file mode 100644 index 0000000..8831867 --- /dev/null +++ b/src/arch/msp430fr5994lp/Kconfig @@ -0,0 +1,31 @@ +config arch_msp430fr5994lp_driver_adc +bool "ADC (Analog-Digital-Converter)" +select meta_driver_adc + +config arch_msp430fr5994lp_driver_counter +bool "Cycle Counter" +select meta_driver_counter + +config arch_msp430fr5994lp_driver_i2c +bool "I2C on eUSCI_B1" +select meta_driver_i2c + +config arch_msp430fr5994lp_driver_spi_a1 +bool "SPI on eUSCI_A1" +select meta_driver_spi + +config arch_msp430fr5994lp_driver_spi_b +bool "SPI on eUSCI_B1" +select meta_driver_spi + +config arch_msp430fr5994lp_driver_stdin +bool "UART Input" +select meta_driver_stdin + +config arch_msp430fr5994lp_driver_timer +bool "Timer with Interrupts" +select meta_driver_timer + +config arch_msp430fr5994lp_driver_uptime +bool "Uptime Counter" +select meta_driver_uptime diff --git a/src/arch/msp430fr5994lp/Makefile.inc b/src/arch/msp430fr5994lp/Makefile.inc index e9d666f..0d2df46 100644 --- a/src/arch/msp430fr5994lp/Makefile.inc +++ b/src/arch/msp430fr5994lp/Makefile.inc @@ -29,6 +29,8 @@ SIZE = /opt/msp430/ti/msp430-gcc-full-linux-5.1.2.0/bin/msp430-elf-size ARCH_SHORTNAME = msp430 CXX_TARGETS += src/arch/msp430fr5994lp/arch.cc +CXX_TARGETS += src/arch/msp430fr5994lp/driver/gpio.cc +CXX_TARGETS += src/arch/msp430fr5994lp/driver/stdout.cc ifeq (${aspectc}, 1) ifeq (${msp430_large}, ) @@ -38,40 +40,78 @@ ifeq (${aspectc}, 1) endif endif +# Command-line + ifneq ($(findstring adc,${arch_drivers}), ) - CXX_TARGETS += src/arch/msp430fr5994lp/driver/adc.cc + CONFIG_arch_msp430fr5994lp_driver_adc = y endif -CXX_TARGETS += src/arch/msp430fr5994lp/driver/gpio.cc -CXX_TARGETS += src/arch/msp430fr5994lp/driver/stdout.cc -CXX_TARGETS += src/arch/msp430fr5994lp/driver/uptime.cc - ifneq ($(findstring stdin,${arch_drivers}), ) - CXX_TARGETS += src/arch/msp430fr5994lp/driver/stdin.cc + CONFIG_arch_msp430fr5994lp_driver_stdin = y endif ifneq ($(findstring softi2c,${drivers}), ) else ifneq ($(findstring i2c,${arch_drivers}), ) + CONFIG_arch_msp430fr5994lp_driver_i2c = y +endif + +ifneq ($(findstring spi_a1,${arch_drivers}), ) + CONFIG_arch_msp430fr5994lp_driver_spi_a1 = y +endif + +ifneq ($(findstring spi_b,${arch_drivers}), ) + CONFIG_arch_msp430fr5994lp_driver_spi_b = y +endif + +ifneq ($(findstring timer,${arch_drivers}), ) + CONFIG_arch_msp430fr5994lp_driver_timer = y +endif + +ifneq ($(findstring counter,${arch_drivers}), ) + CONFIG_arch_msp430fr5994lp_driver_counter = y +endif + +ifeq (${timer_s}, 1) + CONFIG_arch_msp430fr5994lp_driver_uptime = y +endif + +# Kconfig + +ifdef CONFIG_arch_msp430fr5994lp_driver_adc + CXX_TARGETS += src/arch/msp430fr5994lp/driver/adc.cc +endif + +ifdef CONFIG_arch_msp430fr5994lp_driver_stdin + CXX_TARGETS += src/arch/msp430fr5994lp/driver/stdin.cc +endif + +ifdef CONFIG_arch_msp430fr5994lp_driver_i2c CXX_TARGETS += src/arch/msp430fr5994lp/driver/i2c.cc COMMON_FLAGS += -DDRIVER_I2C endif -ifneq ($(findstring spi_a1,${arch_drivers}), ) +ifdef CONFIG_arch_msp430fr5994lp_driver_spi_a1 CXX_TARGETS += src/arch/msp430fr5994lp/driver/spi_a1.cc endif -ifneq ($(findstring spi_b,${arch_drivers}), ) +ifdef CONFIG_arch_msp430fr5994lp_driver_spi_b CXX_TARGETS += src/arch/msp430fr5994lp/driver/spi_b.cc endif -ifneq ($(findstring timer,${arch_drivers}), ) +ifdef CONFIG_arch_msp430fr5994lp_driver_timer CXX_TARGETS += src/arch/msp430fr5994lp/driver/timer.cc endif -ifneq ($(findstring counter,${arch_drivers}), ) +ifdef CONFIG_arch_msp430fr5994lp_driver_counter CXX_TARGETS += src/arch/msp430fr5994lp/driver/counter.cc endif +ifdef CONFIG_arch_msp430fr5994lp_driver_uptime + COMMON_FLAGS += -DTIMER_S + CXX_TARGETS += src/arch/msp430fr5994lp/driver/uptime.cc +endif + + ifneq ($(findstring timed_resistive_load,${arch_drivers}), ) CXX_TARGETS += src/arch/msp430fr5994lp/driver/timed_resistive_load.cc resistor1_pin ?= p3_0 diff --git a/src/arch/msp430fr5994lp/arch.cc b/src/arch/msp430fr5994lp/arch.cc index de75fbb..e7d5ff5 100644 --- a/src/arch/msp430fr5994lp/arch.cc +++ b/src/arch/msp430fr5994lp/arch.cc @@ -89,12 +89,6 @@ void Arch::setup(void) TA1CCR0 = 4096; TA1CTL |= TACLR | TAIE; #endif - -#ifdef TIMER_CYCLES - TA2CTL = TASSEL__SMCLK | ID__1 | MC__CONTINUOUS; - TA2EX0 = 0; - TA2CTL |= TACLR; -#endif } #ifdef WITH_WAKEUP diff --git a/src/arch/msp430fr5994lp/driver/counter.cc b/src/arch/msp430fr5994lp/driver/counter.cc index 98a2c4f..daa7a2d 100644 --- a/src/arch/msp430fr5994lp/driver/counter.cc +++ b/src/arch/msp430fr5994lp/driver/counter.cc @@ -1,9 +1,5 @@ #include "driver/counter.h" -#if defined(TIMER_CYCLES) -#warn "timer_cycles and counter are mutually exclusive. Expect odd behaviour." -#endif - Counter counter; #ifndef __acweaving diff --git a/src/arch/msp430fr5994lp/prompt b/src/arch/msp430fr5994lp/prompt new file mode 100644 index 0000000..60b2621 --- /dev/null +++ b/src/arch/msp430fr5994lp/prompt @@ -0,0 +1 @@ +MSP430FR5994 Launchpad -- cgit v1.2.3