diff --git a/arch/arm/src/tiva/tiva_enableclks.h b/arch/arm/src/tiva/tiva_enableclks.h index 160d7b6c64..caac203e34 100644 --- a/arch/arm/src/tiva/tiva_enableclks.h +++ b/arch/arm/src/tiva/tiva_enableclks.h @@ -63,9 +63,9 @@ # define tiva_wdt_disableclk(p) tiva_disableclk(TIVA_SYSCON_RCGCWD,SYSCON_RCGCWD(p)) # define tiva_wdt0_enableclk() tiva_wdt_enableclk(0) -# define tiva_wdt1_enableclk() tiva_wdt_disableclk(1) +# define tiva_wdt1_enableclk() tiva_wdt_enableclk(1) -# define tiva_wdt0_disableclk() tiva_wdt_enableclk(0) +# define tiva_wdt0_disableclk() tiva_wdt_disableclk(0) # define tiva_wdt1_disableclk() tiva_wdt_disableclk(1) #else #endif diff --git a/arch/arm/src/tiva/tiva_enablepwr.h b/arch/arm/src/tiva/tiva_enablepwr.h index 0a5c64744f..f7e21be9a7 100644 --- a/arch/arm/src/tiva/tiva_enablepwr.h +++ b/arch/arm/src/tiva/tiva_enablepwr.h @@ -49,7 +49,7 @@ /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* Clocks are enabled or disabled by setting or clearing a bit (b) in a system +/* Power control is enabled or disabled by setting or clearing a bit (b) in a system * control register (a)) */ @@ -67,9 +67,9 @@ #endif #define tiva_wdt0_enablepwr() tiva_wdt_enablepwr(0) -#define tiva_wdt1_enablepwr() tiva_wdt_disablepwr(1) +#define tiva_wdt1_enablepwr() tiva_wdt_enablepwr(1) -#define tiva_wdt0_disablepwr() tiva_wdt_enablepwr(0) +#define tiva_wdt0_disablepwr() tiva_wdt_disablepwr(0) #define tiva_wdt1_disablepwr() tiva_wdt_disablepwr(1) /* 16/32-Bit Timer Power Control */ diff --git a/arch/arm/src/tiva/tiva_periphrdy.h b/arch/arm/src/tiva/tiva_periphrdy.h new file mode 100644 index 0000000000..3857d1e31b --- /dev/null +++ b/arch/arm/src/tiva/tiva_periphrdy.h @@ -0,0 +1,309 @@ +/************************************************************************************ + * arch/arm/src/tiva/tiva_periphrdy.h + * + * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_TIVA_TIVAPERIPHRDY_H +#define __ARCH_ARM_SRC_TIVA_TIVAPERIPHRDY_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "up_arch.h" +#include "chip.h" +#include "chip/tiva_syscontrol.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ +/* We deterimine if a peripheral is ready by testing a bit (b) in system control + * register (a)) + */ + +#define tiva_periphrdy(a,b) ((getreg32(a) & (b)) != 0) + +/* Watchdog Timer Power Control */ + +#ifdef TIVA_SYSCON_PRWD +# define tiva_wdt_periphrdy(p) tiva_periphrdy(TIVA_SYSCON_PRWD,SYSCON_PRWD(p)) +#else +# define tiva_wdt_periphrdy(p) (false) +#endif + +#define tiva_wdt0_periphrdy() tiva_wdt_periphrdy(0) +#define tiva_wdt1_periphrdy() tiva_wdt_periphrdy(1) + +/* 16/32-Bit Timer Power Control */ + +#ifdef TIVA_SYSCON_PRTIMER +# define tiva_tm_periphrdy(p) tiva_periphrdy(TIVA_SYSCON_PRTIMER,SYSCON_PRTIMER(p)) +#else +# define tiva_tm_periphrdy(p) (false) +#endif + +#define tiva_tm0_periphrdy() tiva_tm_periphrdy(0) +#define tiva_tm1_periphrdy() tiva_tm_periphrdy(1) +#define tiva_tm2_periphrdy() tiva_tm_periphrdy(2) +#define tiva_tm3_periphrdy() tiva_tm_periphrdy(3) +#define tiva_tm4_periphrdy() tiva_tm_periphrdy(4) +#define tiva_tm5_periphrdy() tiva_tm_periphrdy(5) +#define tiva_tm6_periphrdy() tiva_tm_periphrdy(6) +#define tiva_tm7_periphrdy() tiva_tm_periphrdy(7) + +/* GPIO Power Control */ + +#ifdef TIVA_SYSCON_PRGPIO +# define tiva_gpio_periphrdy(p) tiva_periphrdy(TIVA_SYSCON_PRGPIO,SYSCON_PRGPIO(p)) +#else +# define tiva_gpio_periphrdy(p) (false) +#endif + +#define tiva_gpioa_periphrdy() tiva_gpio_periphrdy(0) +#define tiva_gpiob_periphrdy() tiva_gpio_periphrdy(1) +#define tiva_gpioc_periphrdy() tiva_gpio_periphrdy(2) +#define tiva_gpiod_periphrdy() tiva_gpio_periphrdy(3) +#define tiva_gpioe_periphrdy() tiva_gpio_periphrdy(4) +#define tiva_gpiof_periphrdy() tiva_gpio_periphrdy(5) +#define tiva_gpiog_periphrdy() tiva_gpio_periphrdy(6) +#define tiva_gpioh_periphrdy() tiva_gpio_periphrdy(7) +#define tiva_gpioj_periphrdy() tiva_gpio_periphrdy(8) +#define tiva_gpiok_periphrdy() tiva_gpio_periphrdy(9) +#define tiva_gpiol_periphrdy() tiva_gpio_periphrdy(10) +#define tiva_gpiom_periphrdy() tiva_gpio_periphrdy(11) +#define tiva_gpion_periphrdy() tiva_gpio_periphrdy(12) +#define tiva_gpiop_periphrdy() tiva_gpio_periphrdy(13) +#define tiva_gpioq_periphrdy() tiva_gpio_periphrdy(14) +#define tiva_gpior_periphrdy() tiva_gpio_periphrdy(15) +#define tiva_gpios_periphrdy() tiva_gpio_periphrdy(16) +#define tiva_gpiot_periphrdy() tiva_gpio_periphrdy(17) + +/* μDMA Power Control */ + +#ifdef TIVA_SYSCON_PRDMA +# define tiva_udma_periphrdy() tiva_periphrdy(TIVA_SYSCON_PRDMA,SYSCON_PRDMA_R0) +#else +# define tiva_udma_periphrdy() (false) +#endif + +/* EPI Power Control */ + +#ifdef TIVA_SYSCON_PREPI +# define tiva_epi_periphrdy() tiva_periphrdy(TIVA_SYSCON_PREPI,SYSCON_PREPI_R0) +#else +# define tiva_epi_periphrdy() (false) +#endif + +/* Hibernation Power Control */ + +#ifdef TIVA_SYSCON_PRHIB +# define tiva_hib_periphrdy() tiva_periphrdy(TIVA_SYSCON_PRHIB,SYSCON_PRHIB_R0) +#else +# define tiva_hib_periphrdy() (false) +#endif + +/* UART Power Control */ + +#ifdef TIVA_SYSCON_PRUART +# define tiva_uart_periphrdy(p) tiva_periphrdy(TIVA_SYSCON_PRUART,SYSCON_PRUART(p)) +#else +# define tiva_uart_periphrdy(p) (false) +#endif + +#define tiva_uart0_periphrdy() tiva_uart_periphrdy(0) +#define tiva_uart1_periphrdy() tiva_uart_periphrdy(1) +#define tiva_uart2_periphrdy() tiva_uart_periphrdy(2) +#define tiva_uart3_periphrdy() tiva_uart_periphrdy(3) +#define tiva_uart4_periphrdy() tiva_uart_periphrdy(4) +#define tiva_uart5_periphrdy() tiva_uart_periphrdy(5) +#define tiva_uart6_periphrdy() tiva_uart_periphrdy(6) +#define tiva_uart7_periphrdy() tiva_uart_periphrdy(7) + +/* SSI Power Control */ + +#ifdef TIVA_SYSCON_PRSSI +# define tiva_ssi_periphrdy(p) tiva_periphrdy(TIVA_SYSCON_PRSSI,SYSCON_PRSSI(p)) +#else +# define tiva_ssi_periphrdy(p) (false) +#endif + +#define tiva_ssi0_periphrdy() tiva_ssi_periphrdy(0) +#define tiva_ssi1_periphrdy() tiva_ssi_periphrdy(1) +#define tiva_ssi2_periphrdy() tiva_ssi_periphrdy(2) +#define tiva_ssi3_periphrdy() tiva_ssi_periphrdy(3) + +/* I2C Power Control */ + +#ifdef TIVA_SYSCON_PRI2C +# define tiva_i2c_periphrdy(p) tiva_periphrdy(TIVA_SYSCON_PRI2C,SYSCON_PRI2C(p)) +#else +# define tiva_i2c_periphrdy(p) (false) +#endif + +#define tiva_i2c0_periphrdy() tiva_i2c_periphrdy(0) +#define tiva_i2c1_periphrdy() tiva_i2c_periphrdy(1) +#define tiva_i2c2_periphrdy() tiva_i2c_periphrdy(2) +#define tiva_i2c3_periphrdy() tiva_i2c_periphrdy(3) +#define tiva_i2c4_periphrdy() tiva_i2c_periphrdy(4) +#define tiva_i2c5_periphrdy() tiva_i2c_periphrdy(5) +#define tiva_i2c6_periphrdy() tiva_i2c_periphrdy(6) +#define tiva_i2c7_periphrdy() tiva_i2c_periphrdy(7) +#define tiva_i2c8_periphrdy() tiva_i2c_periphrdy(8) +#define tiva_i2c9_periphrdy() tiva_i2c_periphrdy(9) + +/* USB Power Control */ + +#ifdef TIVA_SYSCON_PRUSB +# define tiva_usb_periphrdy() tiva_periphrdy(TIVA_SYSCON_PRUSB,SYSCON_PRUSB_R0) +#else +# define tiva_usb_periphrdy() (false) +#endif + +/* Ethernet PHY Power Control */ + +#ifdef TIVA_SYSCON_PREPHY +# define tiva_ephy_periphrdy() tiva_periphrdy(TIVA_SYSCON_PREPHY,SYSCON_PREPHY_R0) +#else +# define tiva_ephy_periphrdy() (false) +#endif + +/* CAN RunMode Clock Gating Control */ + +#ifdef TIVA_SYSCON_PRCAN +# define tiva_can_periphrdy(p) tiva_periphrdy(TIVA_SYSCON_PRCAN,SYSCON_PRCAN(p)) +#else +# define tiva_can_periphrdy(p) (false) +#endif + +#define tiva_can0_periphrdy() tiva_can_periphrdy(0) +#define tiva_can1_periphrdy() tiva_can_periphrdy(1) + +/* ADC Power Control */ + +#ifdef TIVA_SYSCON_PRADC +# define tiva_adc_periphrdy(p) tiva_periphrdy(TIVA_SYSCON_PRADC,SYSCON_PRADC(p)) +#else +# define tiva_adc_periphrdy(p) (false) +#endif + +#define tiva_adc0_periphrdy() tiva_adc_periphrdy(0) +#define tiva_adc1_periphrdy() tiva_adc_periphrdy(1) + +/* ACMP Power Control */ + +#ifdef TIVA_SYSCON_PRACMP +# define tiva_acmp_periphrdy() tiva_periphrdy(TIVA_SYSCON_PRACMP,SYSCON_PRACMP_R0) +#else +# define tiva_acmp_periphrdy() (false) +#endif + +/* PWM Power Control */ + +#ifdef TIVA_SYSCON_PRPWM +# define tiva_pwm_periphrdy(p) tiva_periphrdy(TIVA_SYSCON_PRPWM,SYSCON_PRPWM(p)) +#else +# define tiva_pwm_periphrdy(p) (false) +#endif + +#define tiva_pwm0_periphrdy() tiva_pwm_periphrdy(0) +#define tiva_pwm1_periphrdy() tiva_pwm_periphrdy(1) + +/* QE Interface Power Control */ + +#ifdef TIVA_SYSCON_PRQEI +# define tiva_qei_periphrdy(p) tiva_periphrdy(TIVA_SYSCON_PRQEI,SYSCON_PRQEI(p)) +#else +# define tiva_qei_periphrdy(p) (false) +#endif + +#define tiva_qei0_periphrdy() tiva_qei_periphrdy(0) +#define tiva_qei1_periphrdy() tiva_qei_periphrdy(1) + +/* EEPROM Power Control */ + +#ifdef TIVA_SYSCON_PREEPROM +# define tiva_eeprom_periphrdy() tiva_periphrdy(TIVA_SYSCON_PREEPROM,SYSCON_PREEPROM_R0) +#else +# define tiva_eeprom_periphrdy() (false) +#endif + +/* 32/64-Bit Wide Timer Power Control */ + +#ifdef TIVA_SYSCON_PRWTIMER +# define tiva_wtm_periphrdy(p) tiva_periphrdy(TIVA_SYSCON_PRWTIMER,SYSCON_PRWTIMER(p)) +#else +# define tiva_wtm_periphrdy(p) (false) +#endif + +#define tiva_wtm0_periphrdy() tiva_wtm_periphrdy(0) +#define tiva_wtm1_periphrdy() tiva_wtm_periphrdy(1) +#define tiva_wtm2_periphrdy() tiva_wtm_periphrdy(2) +#define tiva_wtm3_periphrdy() tiva_wtm_periphrdy(3) +#define tiva_wtm4_periphrdy() tiva_wtm_periphrdy(4) +#define tiva_wtm5_periphrdy() tiva_wtm_periphrdy(5) + +/* CRC/Crypto Modules RunMode ClockGating Control */ + +#ifdef TIVA_SYSCON_PRCCM +# define tiva_ccm_periphrdy() tiva_periphrdy(TIVA_SYSCON_PRCCM,SYSCON_PRCCM_R0) +#else +# define tiva_ccm_periphrdy() (false) +#endif + +/* LCD Controller Power Control */ + +#ifdef TIVA_SYSCON_PRLCD +# define tiva_lcd_periphrdy() tiva_periphrdy(TIVA_SYSCON_PRLCD,SYSCON_PRLCD_R0) +#else +# define tiva_lcd_periphrdy() (false) +#endif + +/* 1-Wire Power Control */ + +#ifdef TIVA_SYSCON_PROWIRE +# define tiva_owire_periphrdy() tiva_periphrdy(TIVA_SYSCON_PROWIRE,SYSCON_PROWIRE_R0) +#else +# define tiva_owire_periphrdy() (false) +#endif + +/* Ethernet MAC Power Control */ + +#ifdef TIVA_SYSCON_PREMAC +# define tiva_emac_periphrdy() tiva_periphrdy(TIVA_SYSCON_PREMAC,SYSCON_PREMAC_R0) +#else +# define tiva_emac_periphrdy() (false) +#endif + +#endif /* __ARCH_ARM_SRC_TIVA_TIVAPERIPHRDY_H */