SAM4S Xplained Pro: Clean-up of LED usage and also some integration of new timer features. From Bob Doiron
This commit is contained in:
parent
2cbb9b907c
commit
84d28641b7
@ -7285,3 +7285,8 @@
|
||||
adding CONFIG_NSH_ALTCONDEV: CONFIG_NSH_ALTCONDEV enables or disables
|
||||
the feature then, if enabled, CONFIG_NSH_CONDEV provides the alternative
|
||||
console device name (2014-5-5).
|
||||
* arch/arm/src/sam34/sam_rtt.c/.h: RTT driver from Bob Doiron. Also
|
||||
added high resolution RTC emulation using the RTT for the sub-second
|
||||
counter (2014-5-5).
|
||||
* configs/sam4s-xplained-pro: Clean-up of LED usage and also some
|
||||
integration of new timer features. From Bob Doiron (2014-5-5).
|
@ -12,12 +12,12 @@ config SAM4S_XPLAINED_PRO_CDCACM_DEVMINOR
|
||||
|
||||
config SAM4S_XPLAINED_PRO_SCHED_TIMER_DEVPATH
|
||||
string "Scheduler Timer Device Path"
|
||||
default "/dev/tc0"
|
||||
default "/dev/rtt0"
|
||||
depends on TIMER && SYSTEMTICK_EXTCLK
|
||||
|
||||
config SAM4S_XPLAINED_PRO_CPULOAD_TIMER_DEVPATH
|
||||
string "CPU Load Timer Device Path"
|
||||
default "/dev/tc1"
|
||||
default "/dev/tc0"
|
||||
depends on TIMER && SCHED_CPULOAD && SCHED_CPULOAD_EXTCLK
|
||||
|
||||
|
||||
|
@ -229,6 +229,9 @@
|
||||
#define LED_PANIC 3 /* The system has crashed Flash @ 250ms */
|
||||
#define LED_IDLE 4 /* MCU is is sleep mode Not used */
|
||||
|
||||
#define LED_D301_OFF true /* GPIO high for OFF */
|
||||
#define LED_D301_ON false /* GPIO low for ON */
|
||||
|
||||
/* Thus if D301 is statically on, NuttX has successfully booted and is,
|
||||
* apparently, running normmally.
|
||||
*/
|
||||
|
@ -12,10 +12,6 @@ CONFIG_HOST_LINUX=y
|
||||
# CONFIG_HOST_OSX is not set
|
||||
# CONFIG_HOST_WINDOWS is not set
|
||||
# CONFIG_HOST_OTHER is not set
|
||||
# CONFIG_WINDOWS_NATIVE is not set
|
||||
# CONFIG_WINDOWS_CYGWIN is not set
|
||||
# CONFIG_WINDOWS_MSYS is not set
|
||||
# CONFIG_WINDOWS_OTHER is not set
|
||||
|
||||
#
|
||||
# Build Configuration
|
||||
@ -44,36 +40,9 @@ CONFIG_RAW_BINARY=y
|
||||
#
|
||||
# Debug Options
|
||||
#
|
||||
CONFIG_DEBUG=y
|
||||
# CONFIG_DEBUG is not set
|
||||
CONFIG_ARCH_HAVE_STACKCHECK=y
|
||||
# CONFIG_ARCH_HAVE_HEAPCHECK is not set
|
||||
# CONFIG_DEBUG_VERBOSE is not set
|
||||
|
||||
#
|
||||
# Subsystem Debug Options
|
||||
#
|
||||
# CONFIG_DEBUG_MM is not set
|
||||
# CONFIG_DEBUG_SCHED is not set
|
||||
# CONFIG_DEBUG_USB is not set
|
||||
# CONFIG_DEBUG_FS is not set
|
||||
# CONFIG_DEBUG_LIB is not set
|
||||
# CONFIG_DEBUG_BINFMT is not set
|
||||
# CONFIG_DEBUG_GRAPHICS is not set
|
||||
# CONFIG_DEBUG_IRQ is not set
|
||||
CONFIG_DEBUG_STACK=y
|
||||
|
||||
#
|
||||
# Driver Debug Options
|
||||
#
|
||||
# CONFIG_DEBUG_LEDS is not set
|
||||
# CONFIG_DEBUG_ANALOG is not set
|
||||
# CONFIG_DEBUG_SDIO is not set
|
||||
# CONFIG_DEBUG_GPIO is not set
|
||||
# CONFIG_DEBUG_DMA is not set
|
||||
# CONFIG_DEBUG_RTC is not set
|
||||
# CONFIG_DEBUG_WATCHDOG is not set
|
||||
# CONFIG_DEBUG_TIMER is not set
|
||||
# CONFIG_DEBUG_AUDIO is not set
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_ARCH_HAVE_CUSTOMOPT=y
|
||||
# CONFIG_DEBUG_NOOPT is not set
|
||||
@ -134,21 +103,14 @@ CONFIG_ARMV7M_USEBASEPRI=y
|
||||
CONFIG_ARCH_HAVE_MPU=y
|
||||
CONFIG_ARMV7M_MPU=y
|
||||
CONFIG_ARMV7M_MPU_NREGIONS=8
|
||||
CONFIG_DEBUG_HARDFAULT=y
|
||||
|
||||
#
|
||||
# ARMV7M Configuration Options
|
||||
#
|
||||
# CONFIG_ARMV7M_TOOLCHAIN_ATOLLIC is not set
|
||||
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y
|
||||
# CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set
|
||||
# CONFIG_ARMV7M_TOOLCHAIN_CODEREDW is not set
|
||||
# CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set
|
||||
# CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW is not set
|
||||
# CONFIG_ARMV7M_TOOLCHAIN_DEVKITARM is not set
|
||||
# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL is not set
|
||||
# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW is not set
|
||||
# CONFIG_ARMV7M_TOOLCHAIN_RAISONANCE is not set
|
||||
# CONFIG_ARMV7M_OABI_TOOLCHAIN is not set
|
||||
CONFIG_ARCH_HAVE_EXTNAND=y
|
||||
CONFIG_ARCH_HAVE_EXTNOR=y
|
||||
@ -217,7 +179,7 @@ CONFIG_SAM34_HSMCI=y
|
||||
CONFIG_SAM34_PDCA=y
|
||||
# CONFIG_SAM34_PWM is not set
|
||||
CONFIG_SAM34_RTC=y
|
||||
# CONFIG_SAM34_RTT is not set
|
||||
CONFIG_SAM34_RTT=y
|
||||
CONFIG_SAM34_SMC=y
|
||||
# CONFIG_SAM34_SPI0 is not set
|
||||
# CONFIG_SAM34_SSC is not set
|
||||
@ -264,13 +226,11 @@ CONFIG_SAM34_GPIOC_IRQ=y
|
||||
#
|
||||
# AT91SAM3/4 USB Full Speed Device Controller driver (DCD) options
|
||||
#
|
||||
# CONFIG_SAM34_UDP_REGDEBUG is not set
|
||||
CONFIG_SAM34_TC=y
|
||||
|
||||
#
|
||||
# AT91SAM3/4 Timer/Counter options
|
||||
#
|
||||
# CONFIG_SAM34_TC_REGDEBUG is not set
|
||||
|
||||
#
|
||||
# AT91SAM3/4 Watchdog Configuration
|
||||
@ -359,8 +319,8 @@ CONFIG_NSH_MMCSDSLOTNO=0
|
||||
# Board-Specific Options
|
||||
#
|
||||
CONFIG_SAM4S_XPLAINED_PRO_CDCACM_DEVMINOR=0
|
||||
CONFIG_SAM4S_XPLAINED_PRO_SCHED_TIMER_DEVPATH="/dev/tc0"
|
||||
CONFIG_SAM4S_XPLAINED_PRO_CPULOAD_TIMER_DEVPATH="/dev/tc1"
|
||||
CONFIG_SAM4S_XPLAINED_PRO_SCHED_TIMER_DEVPATH="/dev/rtt0"
|
||||
CONFIG_SAM4S_XPLAINED_PRO_CPULOAD_TIMER_DEVPATH="/dev/tc0"
|
||||
|
||||
#
|
||||
# RTOS Features
|
||||
@ -410,7 +370,7 @@ CONFIG_NPTHREAD_KEYS=4
|
||||
#
|
||||
CONFIG_SCHED_CPULOAD=y
|
||||
CONFIG_SCHED_CPULOAD_EXTCLK=y
|
||||
CONFIG_SCHED_CPULOAD_TICKSPERSEC=333
|
||||
CONFIG_SCHED_CPULOAD_TICKSPERSEC=222
|
||||
CONFIG_SCHED_CPULOAD_TIMECONSTANT=2
|
||||
# CONFIG_SCHED_INSTRUMENTATION is not set
|
||||
|
||||
@ -473,7 +433,9 @@ CONFIG_DEV_ZERO=y
|
||||
# CONFIG_SPI is not set
|
||||
# CONFIG_I2S is not set
|
||||
CONFIG_RTC=y
|
||||
CONFIG_RTC_DATETIME=y
|
||||
# CONFIG_RTC_DATETIME is not set
|
||||
CONFIG_RTC_HIRES=y
|
||||
CONFIG_RTC_FREQUENCY=32768
|
||||
CONFIG_RTC_ALARM=y
|
||||
CONFIG_WATCHDOG=y
|
||||
CONFIG_WATCHDOG_DEVPATH="/dev/watchdog0"
|
||||
@ -533,7 +495,6 @@ CONFIG_ARCH_HAVE_USART1=y
|
||||
CONFIG_USART1_ISUART=y
|
||||
CONFIG_MCU_SERIAL=y
|
||||
CONFIG_STANDARD_SERIAL=y
|
||||
# CONFIG_SERIAL_TIOCSERGSTRUCT is not set
|
||||
# CONFIG_UART0_SERIAL_CONSOLE is not set
|
||||
CONFIG_UART1_SERIAL_CONSOLE=y
|
||||
# CONFIG_USART1_SERIAL_CONSOLE is not set
|
||||
@ -938,7 +899,6 @@ CONFIG_NSH_CONSOLE=y
|
||||
#
|
||||
# USB Trace Support
|
||||
#
|
||||
# CONFIG_NSH_USBDEV_TRACE is not set
|
||||
# CONFIG_NSH_ALTCONDEV is not set
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
|
||||
@ -1028,10 +988,6 @@ CONFIG_SYSTEM_SYSINFO_STACKSIZE=1024
|
||||
#
|
||||
# Stack Monitor
|
||||
#
|
||||
CONFIG_SYSTEM_STACKMONITOR=y
|
||||
CONFIG_SYSTEM_STACKMONITOR_STACKSIZE=1024
|
||||
CONFIG_SYSTEM_STACKMONITOR_PRIORITY=110
|
||||
CONFIG_SYSTEM_STACKMONITOR_INTERVAL=1
|
||||
|
||||
#
|
||||
# USB CDC/ACM Device Commands
|
||||
|
@ -73,9 +73,6 @@
|
||||
* LED_IDLE MCU is is sleep mode Not used
|
||||
*/
|
||||
|
||||
#define LED_OFF true /* GPIO high for OFF */
|
||||
#define LED_ON false /* GPIO low for ON */
|
||||
|
||||
/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
|
||||
* with CONFIG_DEBUG_VERBOSE too)
|
||||
*/
|
||||
@ -120,19 +117,19 @@ void board_led_on(int led)
|
||||
switch (led)
|
||||
{
|
||||
case 0: /* LED_STARTED, LED_HEAPALLOCATE, LED_IRQSENABLED - off while initializing */
|
||||
sam_gpiowrite(GPIO_D301, LED_OFF);
|
||||
sam_gpiowrite(GPIO_D301, LED_D301_OFF);
|
||||
break;
|
||||
|
||||
case 1: /* LED_STACKCREATED - turn on when ready */
|
||||
sam_gpiowrite(GPIO_D301, LED_ON);
|
||||
sam_gpiowrite(GPIO_D301, LED_D301_ON);
|
||||
break;
|
||||
|
||||
case 2: /* LED_INIRQ, LED_SIGNAL - turn off inside irqs/signal processing */
|
||||
sam_gpiowrite(GPIO_D301, LED_OFF);
|
||||
sam_gpiowrite(GPIO_D301, LED_D301_OFF);
|
||||
return;
|
||||
|
||||
case 3: /* LED_PANIC - flash */
|
||||
sam_gpiowrite(GPIO_D301, LED_ON);
|
||||
sam_gpiowrite(GPIO_D301, LED_D301_ON);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -153,11 +150,11 @@ void board_led_off(int led)
|
||||
break;
|
||||
|
||||
case 2: /* LED_INIRQ, LED_SIGNAL - return to on after irq/signal processing */
|
||||
sam_gpiowrite(GPIO_D301, LED_ON);
|
||||
sam_gpiowrite(GPIO_D301, LED_D301_ON);
|
||||
return;
|
||||
|
||||
case 3: /* LED_PANIC - flashes */
|
||||
sam_gpiowrite(GPIO_D301, LED_OFF);
|
||||
sam_gpiowrite(GPIO_D301, LED_D301_OFF);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <debug.h>
|
||||
#include <nuttx/watchdog.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
#include "sam4s-xplained-pro.h"
|
||||
|
||||
/************************************************************************************
|
||||
@ -97,6 +98,12 @@ void board_initialize(void)
|
||||
DEBUGASSERT(up_wdginitialize() >= 0);
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
/* Initialize user led */
|
||||
|
||||
sam_ledinit();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TIMER
|
||||
/* Registers the timers and starts any async processes (which may include the scheduler) */
|
||||
|
||||
|
@ -57,6 +57,7 @@
|
||||
|
||||
#include "sam_lowputc.h"
|
||||
#include "sam_tc.h"
|
||||
#include "sam_rtt.h"
|
||||
|
||||
#ifdef CONFIG_TIMER
|
||||
|
||||
@ -64,22 +65,35 @@
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
/* Watchdog hardware should be enabled */
|
||||
|
||||
#if !defined(CONFIG_SAM34_TC0)
|
||||
# warning "CONFIG_SAM34_TC0 must be defined"
|
||||
#if !(defined(CONFIG_SAM34_TC0) || defined(CONFIG_SAM34_TC1) || defined(CONFIG_SAM34_TC2) \
|
||||
|| defined(CONFIG_SAM34_TC3) || defined(CONFIG_SAM34_TC4) || defined(CONFIG_SAM34_RTT) )
|
||||
# warning "CONFIG_SAM34_TCx or CONFIG_SAM34_RTT must be defined"
|
||||
#endif
|
||||
|
||||
/* Select the path to the registered watchdog timer device */
|
||||
|
||||
#ifndef CONFIG_TIMER0_DEVPATH
|
||||
# define CONFIG_TIMER0_DEVPATH "/dev/tc0"
|
||||
#endif
|
||||
#ifndef CONFIG_TIMER1_DEVPATH
|
||||
# define CONFIG_TIMER1_DEVPATH "/dev/tc1"
|
||||
#endif
|
||||
#ifndef CONFIG_TIMER2_DEVPATH
|
||||
# define CONFIG_TIMER2_DEVPATH "/dev/tc2"
|
||||
#endif
|
||||
#ifndef CONFIG_TIMER3_DEVPATH
|
||||
# define CONFIG_TIMER3_DEVPATH "/dev/tc3"
|
||||
#endif
|
||||
#ifndef CONFIG_TIMER4_DEVPATH
|
||||
# define CONFIG_TIMER4_DEVPATH "/dev/tc4"
|
||||
#endif
|
||||
#ifndef CONFIG_TIMER5_DEVPATH
|
||||
# define CONFIG_TIMER5_DEVPATH "/dev/tc5"
|
||||
#endif
|
||||
#ifndef CONFIG_RTT_DEVPATH
|
||||
# define CONFIG_RTT_DEVPATH "/dev/rtt0"
|
||||
#endif
|
||||
|
||||
/* Timer Definitions ********************************************************/
|
||||
|
||||
@ -183,6 +197,11 @@ int sam_timerinitialize(void)
|
||||
sam_tcinitialize(CONFIG_TIMER5_DEVPATH, SAM_IRQ_TC5);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SAM34_RTT)
|
||||
tcvdbg("Initializing %s...\n", CONFIG_RTT_DEVPATH);
|
||||
sam_rttinitialize(CONFIG_RTT_DEVPATH);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SYSTEMTICK_EXTCLK) && !defined(CONFIG_SUPPRESS_INTERRUPTS) && \
|
||||
!defined(CONFIG_SUPPRESS_TIMER_INTS)
|
||||
/* System Timer Initialization */
|
||||
@ -209,7 +228,7 @@ int sam_timerinitialize(void)
|
||||
|
||||
/* install user callback */
|
||||
{
|
||||
struct timer_capture_s tccb;
|
||||
struct timer_sethandler_s tccb;
|
||||
tccb.newhandler = systemtick;
|
||||
tccb.oldhandler = NULL;
|
||||
|
||||
@ -260,7 +279,7 @@ int sam_timerinitialize(void)
|
||||
/* Install user callback */
|
||||
|
||||
{
|
||||
struct timer_capture_s tccb;
|
||||
struct timer_sethandler_s tccb;
|
||||
tccb.newhandler = calc_cpuload;
|
||||
tccb.oldhandler = NULL;
|
||||
|
||||
@ -281,13 +300,13 @@ int sam_timerinitialize(void)
|
||||
tcdbg("ioctl(TCIOC_START) failed: %d\n", errno);
|
||||
goto errout_with_dev;
|
||||
}
|
||||
#endif
|
||||
|
||||
goto success;
|
||||
errout_with_dev:
|
||||
close(fd);
|
||||
errout:
|
||||
return ERROR;
|
||||
#endif
|
||||
|
||||
success:
|
||||
return OK;
|
||||
|
@ -105,18 +105,10 @@ void sam_ledinit(void)
|
||||
|
||||
void sam_setled(int led, bool ledon)
|
||||
{
|
||||
uint32_t ledcfg;
|
||||
|
||||
if (led == BOARD_D301)
|
||||
{
|
||||
ledcfg = GPIO_D301;
|
||||
sam_gpiowrite(GPIO_D301, ledon ? LED_D301_ON : LED_D301_OFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sam_gpiowrite(ledcfg, !ledon); /* 0 = on, 1 = off */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -125,10 +117,7 @@ void sam_setled(int led, bool ledon)
|
||||
|
||||
void sam_setleds(uint8_t ledset)
|
||||
{
|
||||
bool ledon;
|
||||
|
||||
ledon = ((ledset & BOARD_D301_BIT) != 0);
|
||||
sam_gpiowrite(GPIO_D301, !ledon); /* 0 = on, 1 = off */
|
||||
sam_gpiowrite(GPIO_D301, (ledset & BOARD_D301_BIT) ? LED_D301_ON : LED_D301_OFF);
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
||||
|
@ -67,10 +67,10 @@ config SYSTEMTICK_EXTCLK
|
||||
depends on ARCH_HAVE_EXTCLK
|
||||
---help---
|
||||
Use external clock for system tick. When enabled, the platform-specific
|
||||
logic must start it's own timer interrupt to make periodic calls to the
|
||||
logic must start its own timer interrupt to make periodic calls to the
|
||||
sched_process_timer() or the functions called within. The purpose is
|
||||
to move the scheduling off the processor to enter low power states that
|
||||
would disable that clock. Platform-specific logic must also provide
|
||||
to move the scheduling off the processor clock to allow entering low
|
||||
power states that would disable that clock.
|
||||
|
||||
config SYSTEM_TIME64
|
||||
bool "64-bit system clock"
|
||||
|
Loading…
Reference in New Issue
Block a user