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
370703194e
commit
810e929841
@ -12,12 +12,12 @@ config SAM4S_XPLAINED_PRO_CDCACM_DEVMINOR
|
|||||||
|
|
||||||
config SAM4S_XPLAINED_PRO_SCHED_TIMER_DEVPATH
|
config SAM4S_XPLAINED_PRO_SCHED_TIMER_DEVPATH
|
||||||
string "Scheduler Timer Device Path"
|
string "Scheduler Timer Device Path"
|
||||||
default "/dev/tc0"
|
default "/dev/rtt0"
|
||||||
depends on TIMER && SYSTEMTICK_EXTCLK
|
depends on TIMER && SYSTEMTICK_EXTCLK
|
||||||
|
|
||||||
config SAM4S_XPLAINED_PRO_CPULOAD_TIMER_DEVPATH
|
config SAM4S_XPLAINED_PRO_CPULOAD_TIMER_DEVPATH
|
||||||
string "CPU Load Timer Device Path"
|
string "CPU Load Timer Device Path"
|
||||||
default "/dev/tc1"
|
default "/dev/tc0"
|
||||||
depends on TIMER && SCHED_CPULOAD && SCHED_CPULOAD_EXTCLK
|
depends on TIMER && SCHED_CPULOAD && SCHED_CPULOAD_EXTCLK
|
||||||
|
|
||||||
|
|
||||||
|
@ -229,6 +229,9 @@
|
|||||||
#define LED_PANIC 3 /* The system has crashed Flash @ 250ms */
|
#define LED_PANIC 3 /* The system has crashed Flash @ 250ms */
|
||||||
#define LED_IDLE 4 /* MCU is is sleep mode Not used */
|
#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,
|
/* Thus if D301 is statically on, NuttX has successfully booted and is,
|
||||||
* apparently, running normmally.
|
* apparently, running normmally.
|
||||||
*/
|
*/
|
||||||
|
@ -12,10 +12,6 @@ CONFIG_HOST_LINUX=y
|
|||||||
# CONFIG_HOST_OSX is not set
|
# CONFIG_HOST_OSX is not set
|
||||||
# CONFIG_HOST_WINDOWS is not set
|
# CONFIG_HOST_WINDOWS is not set
|
||||||
# CONFIG_HOST_OTHER 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
|
# Build Configuration
|
||||||
@ -44,36 +40,9 @@ CONFIG_RAW_BINARY=y
|
|||||||
#
|
#
|
||||||
# Debug Options
|
# Debug Options
|
||||||
#
|
#
|
||||||
CONFIG_DEBUG=y
|
# CONFIG_DEBUG is not set
|
||||||
CONFIG_ARCH_HAVE_STACKCHECK=y
|
CONFIG_ARCH_HAVE_STACKCHECK=y
|
||||||
# CONFIG_ARCH_HAVE_HEAPCHECK is not set
|
# 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_DEBUG_SYMBOLS=y
|
||||||
CONFIG_ARCH_HAVE_CUSTOMOPT=y
|
CONFIG_ARCH_HAVE_CUSTOMOPT=y
|
||||||
# CONFIG_DEBUG_NOOPT is not set
|
# CONFIG_DEBUG_NOOPT is not set
|
||||||
@ -134,21 +103,14 @@ CONFIG_ARMV7M_USEBASEPRI=y
|
|||||||
CONFIG_ARCH_HAVE_MPU=y
|
CONFIG_ARCH_HAVE_MPU=y
|
||||||
CONFIG_ARMV7M_MPU=y
|
CONFIG_ARMV7M_MPU=y
|
||||||
CONFIG_ARMV7M_MPU_NREGIONS=8
|
CONFIG_ARMV7M_MPU_NREGIONS=8
|
||||||
CONFIG_DEBUG_HARDFAULT=y
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# ARMV7M Configuration Options
|
# ARMV7M Configuration Options
|
||||||
#
|
#
|
||||||
# CONFIG_ARMV7M_TOOLCHAIN_ATOLLIC is not set
|
|
||||||
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y
|
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y
|
||||||
# CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set
|
# CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set
|
||||||
# CONFIG_ARMV7M_TOOLCHAIN_CODEREDW is not set
|
|
||||||
# CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL 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_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_ARMV7M_OABI_TOOLCHAIN is not set
|
||||||
CONFIG_ARCH_HAVE_EXTNAND=y
|
CONFIG_ARCH_HAVE_EXTNAND=y
|
||||||
CONFIG_ARCH_HAVE_EXTNOR=y
|
CONFIG_ARCH_HAVE_EXTNOR=y
|
||||||
@ -217,7 +179,7 @@ CONFIG_SAM34_HSMCI=y
|
|||||||
CONFIG_SAM34_PDCA=y
|
CONFIG_SAM34_PDCA=y
|
||||||
# CONFIG_SAM34_PWM is not set
|
# CONFIG_SAM34_PWM is not set
|
||||||
CONFIG_SAM34_RTC=y
|
CONFIG_SAM34_RTC=y
|
||||||
# CONFIG_SAM34_RTT is not set
|
CONFIG_SAM34_RTT=y
|
||||||
CONFIG_SAM34_SMC=y
|
CONFIG_SAM34_SMC=y
|
||||||
# CONFIG_SAM34_SPI0 is not set
|
# CONFIG_SAM34_SPI0 is not set
|
||||||
# CONFIG_SAM34_SSC 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
|
# AT91SAM3/4 USB Full Speed Device Controller driver (DCD) options
|
||||||
#
|
#
|
||||||
# CONFIG_SAM34_UDP_REGDEBUG is not set
|
|
||||||
CONFIG_SAM34_TC=y
|
CONFIG_SAM34_TC=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# AT91SAM3/4 Timer/Counter options
|
# AT91SAM3/4 Timer/Counter options
|
||||||
#
|
#
|
||||||
# CONFIG_SAM34_TC_REGDEBUG is not set
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# AT91SAM3/4 Watchdog Configuration
|
# AT91SAM3/4 Watchdog Configuration
|
||||||
@ -359,8 +319,8 @@ CONFIG_NSH_MMCSDSLOTNO=0
|
|||||||
# Board-Specific Options
|
# Board-Specific Options
|
||||||
#
|
#
|
||||||
CONFIG_SAM4S_XPLAINED_PRO_CDCACM_DEVMINOR=0
|
CONFIG_SAM4S_XPLAINED_PRO_CDCACM_DEVMINOR=0
|
||||||
CONFIG_SAM4S_XPLAINED_PRO_SCHED_TIMER_DEVPATH="/dev/tc0"
|
CONFIG_SAM4S_XPLAINED_PRO_SCHED_TIMER_DEVPATH="/dev/rtt0"
|
||||||
CONFIG_SAM4S_XPLAINED_PRO_CPULOAD_TIMER_DEVPATH="/dev/tc1"
|
CONFIG_SAM4S_XPLAINED_PRO_CPULOAD_TIMER_DEVPATH="/dev/tc0"
|
||||||
|
|
||||||
#
|
#
|
||||||
# RTOS Features
|
# RTOS Features
|
||||||
@ -410,7 +370,7 @@ CONFIG_NPTHREAD_KEYS=4
|
|||||||
#
|
#
|
||||||
CONFIG_SCHED_CPULOAD=y
|
CONFIG_SCHED_CPULOAD=y
|
||||||
CONFIG_SCHED_CPULOAD_EXTCLK=y
|
CONFIG_SCHED_CPULOAD_EXTCLK=y
|
||||||
CONFIG_SCHED_CPULOAD_TICKSPERSEC=333
|
CONFIG_SCHED_CPULOAD_TICKSPERSEC=222
|
||||||
CONFIG_SCHED_CPULOAD_TIMECONSTANT=2
|
CONFIG_SCHED_CPULOAD_TIMECONSTANT=2
|
||||||
# CONFIG_SCHED_INSTRUMENTATION is not set
|
# CONFIG_SCHED_INSTRUMENTATION is not set
|
||||||
|
|
||||||
@ -473,7 +433,9 @@ CONFIG_DEV_ZERO=y
|
|||||||
# CONFIG_SPI is not set
|
# CONFIG_SPI is not set
|
||||||
# CONFIG_I2S is not set
|
# CONFIG_I2S is not set
|
||||||
CONFIG_RTC=y
|
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_RTC_ALARM=y
|
||||||
CONFIG_WATCHDOG=y
|
CONFIG_WATCHDOG=y
|
||||||
CONFIG_WATCHDOG_DEVPATH="/dev/watchdog0"
|
CONFIG_WATCHDOG_DEVPATH="/dev/watchdog0"
|
||||||
@ -533,7 +495,6 @@ CONFIG_ARCH_HAVE_USART1=y
|
|||||||
CONFIG_USART1_ISUART=y
|
CONFIG_USART1_ISUART=y
|
||||||
CONFIG_MCU_SERIAL=y
|
CONFIG_MCU_SERIAL=y
|
||||||
CONFIG_STANDARD_SERIAL=y
|
CONFIG_STANDARD_SERIAL=y
|
||||||
# CONFIG_SERIAL_TIOCSERGSTRUCT is not set
|
|
||||||
# CONFIG_UART0_SERIAL_CONSOLE is not set
|
# CONFIG_UART0_SERIAL_CONSOLE is not set
|
||||||
CONFIG_UART1_SERIAL_CONSOLE=y
|
CONFIG_UART1_SERIAL_CONSOLE=y
|
||||||
# CONFIG_USART1_SERIAL_CONSOLE is not set
|
# CONFIG_USART1_SERIAL_CONSOLE is not set
|
||||||
@ -938,7 +899,6 @@ CONFIG_NSH_CONSOLE=y
|
|||||||
#
|
#
|
||||||
# USB Trace Support
|
# USB Trace Support
|
||||||
#
|
#
|
||||||
# CONFIG_NSH_USBDEV_TRACE is not set
|
|
||||||
# CONFIG_NSH_ALTCONDEV is not set
|
# CONFIG_NSH_ALTCONDEV is not set
|
||||||
CONFIG_NSH_ARCHINIT=y
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
|
||||||
@ -1028,10 +988,6 @@ CONFIG_SYSTEM_SYSINFO_STACKSIZE=1024
|
|||||||
#
|
#
|
||||||
# Stack Monitor
|
# 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
|
# USB CDC/ACM Device Commands
|
||||||
|
@ -73,9 +73,6 @@
|
|||||||
* LED_IDLE MCU is is sleep mode Not used
|
* 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
|
/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
|
||||||
* with CONFIG_DEBUG_VERBOSE too)
|
* with CONFIG_DEBUG_VERBOSE too)
|
||||||
*/
|
*/
|
||||||
@ -120,19 +117,19 @@ void board_led_on(int led)
|
|||||||
switch (led)
|
switch (led)
|
||||||
{
|
{
|
||||||
case 0: /* LED_STARTED, LED_HEAPALLOCATE, LED_IRQSENABLED - off while initializing */
|
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;
|
break;
|
||||||
|
|
||||||
case 1: /* LED_STACKCREATED - turn on when ready */
|
case 1: /* LED_STACKCREATED - turn on when ready */
|
||||||
sam_gpiowrite(GPIO_D301, LED_ON);
|
sam_gpiowrite(GPIO_D301, LED_D301_ON);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /* LED_INIRQ, LED_SIGNAL - turn off inside irqs/signal processing */
|
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;
|
return;
|
||||||
|
|
||||||
case 3: /* LED_PANIC - flash */
|
case 3: /* LED_PANIC - flash */
|
||||||
sam_gpiowrite(GPIO_D301, LED_ON);
|
sam_gpiowrite(GPIO_D301, LED_D301_ON);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -153,11 +150,11 @@ void board_led_off(int led)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /* LED_INIRQ, LED_SIGNAL - return to on after irq/signal processing */
|
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;
|
return;
|
||||||
|
|
||||||
case 3: /* LED_PANIC - flashes */
|
case 3: /* LED_PANIC - flashes */
|
||||||
sam_gpiowrite(GPIO_D301, LED_OFF);
|
sam_gpiowrite(GPIO_D301, LED_D301_OFF);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <nuttx/watchdog.h>
|
#include <nuttx/watchdog.h>
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
#include "sam4s-xplained-pro.h"
|
#include "sam4s-xplained-pro.h"
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
@ -97,6 +98,12 @@ void board_initialize(void)
|
|||||||
DEBUGASSERT(up_wdginitialize() >= 0);
|
DEBUGASSERT(up_wdginitialize() >= 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_ARCH_LEDS
|
||||||
|
/* Initialize user led */
|
||||||
|
|
||||||
|
sam_ledinit();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_TIMER
|
#ifdef CONFIG_TIMER
|
||||||
/* Registers the timers and starts any async processes (which may include the scheduler) */
|
/* Registers the timers and starts any async processes (which may include the scheduler) */
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
|
|
||||||
#include "sam_lowputc.h"
|
#include "sam_lowputc.h"
|
||||||
#include "sam_tc.h"
|
#include "sam_tc.h"
|
||||||
|
#include "sam_rtt.h"
|
||||||
|
|
||||||
#ifdef CONFIG_TIMER
|
#ifdef CONFIG_TIMER
|
||||||
|
|
||||||
@ -64,22 +65,35 @@
|
|||||||
* Definitions
|
* Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/* Configuration ************************************************************/
|
/* Configuration ************************************************************/
|
||||||
/* Watchdog hardware should be enabled */
|
|
||||||
|
|
||||||
#if !defined(CONFIG_SAM34_TC0)
|
#if !(defined(CONFIG_SAM34_TC0) || defined(CONFIG_SAM34_TC1) || defined(CONFIG_SAM34_TC2) \
|
||||||
# warning "CONFIG_SAM34_TC0 must be defined"
|
|| defined(CONFIG_SAM34_TC3) || defined(CONFIG_SAM34_TC4) || defined(CONFIG_SAM34_RTT) )
|
||||||
|
# warning "CONFIG_SAM34_TCx or CONFIG_SAM34_RTT must be defined"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Select the path to the registered watchdog timer device */
|
/* Select the path to the registered watchdog timer device */
|
||||||
|
|
||||||
#ifndef CONFIG_TIMER0_DEVPATH
|
#ifndef CONFIG_TIMER0_DEVPATH
|
||||||
# define CONFIG_TIMER0_DEVPATH "/dev/tc0"
|
# define CONFIG_TIMER0_DEVPATH "/dev/tc0"
|
||||||
|
#endif
|
||||||
|
#ifndef CONFIG_TIMER1_DEVPATH
|
||||||
# define CONFIG_TIMER1_DEVPATH "/dev/tc1"
|
# define CONFIG_TIMER1_DEVPATH "/dev/tc1"
|
||||||
|
#endif
|
||||||
|
#ifndef CONFIG_TIMER2_DEVPATH
|
||||||
# define CONFIG_TIMER2_DEVPATH "/dev/tc2"
|
# define CONFIG_TIMER2_DEVPATH "/dev/tc2"
|
||||||
|
#endif
|
||||||
|
#ifndef CONFIG_TIMER3_DEVPATH
|
||||||
# define CONFIG_TIMER3_DEVPATH "/dev/tc3"
|
# define CONFIG_TIMER3_DEVPATH "/dev/tc3"
|
||||||
|
#endif
|
||||||
|
#ifndef CONFIG_TIMER4_DEVPATH
|
||||||
# define CONFIG_TIMER4_DEVPATH "/dev/tc4"
|
# define CONFIG_TIMER4_DEVPATH "/dev/tc4"
|
||||||
|
#endif
|
||||||
|
#ifndef CONFIG_TIMER5_DEVPATH
|
||||||
# define CONFIG_TIMER5_DEVPATH "/dev/tc5"
|
# define CONFIG_TIMER5_DEVPATH "/dev/tc5"
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef CONFIG_RTT_DEVPATH
|
||||||
|
# define CONFIG_RTT_DEVPATH "/dev/rtt0"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Timer Definitions ********************************************************/
|
/* Timer Definitions ********************************************************/
|
||||||
|
|
||||||
@ -183,6 +197,11 @@ int sam_timerinitialize(void)
|
|||||||
sam_tcinitialize(CONFIG_TIMER5_DEVPATH, SAM_IRQ_TC5);
|
sam_tcinitialize(CONFIG_TIMER5_DEVPATH, SAM_IRQ_TC5);
|
||||||
#endif
|
#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) && \
|
#if defined(CONFIG_SYSTEMTICK_EXTCLK) && !defined(CONFIG_SUPPRESS_INTERRUPTS) && \
|
||||||
!defined(CONFIG_SUPPRESS_TIMER_INTS)
|
!defined(CONFIG_SUPPRESS_TIMER_INTS)
|
||||||
/* System Timer Initialization */
|
/* System Timer Initialization */
|
||||||
@ -209,7 +228,7 @@ int sam_timerinitialize(void)
|
|||||||
|
|
||||||
/* install user callback */
|
/* install user callback */
|
||||||
{
|
{
|
||||||
struct timer_capture_s tccb;
|
struct timer_sethandler_s tccb;
|
||||||
tccb.newhandler = systemtick;
|
tccb.newhandler = systemtick;
|
||||||
tccb.oldhandler = NULL;
|
tccb.oldhandler = NULL;
|
||||||
|
|
||||||
@ -260,7 +279,7 @@ int sam_timerinitialize(void)
|
|||||||
/* Install user callback */
|
/* Install user callback */
|
||||||
|
|
||||||
{
|
{
|
||||||
struct timer_capture_s tccb;
|
struct timer_sethandler_s tccb;
|
||||||
tccb.newhandler = calc_cpuload;
|
tccb.newhandler = calc_cpuload;
|
||||||
tccb.oldhandler = NULL;
|
tccb.oldhandler = NULL;
|
||||||
|
|
||||||
@ -281,13 +300,13 @@ int sam_timerinitialize(void)
|
|||||||
tcdbg("ioctl(TCIOC_START) failed: %d\n", errno);
|
tcdbg("ioctl(TCIOC_START) failed: %d\n", errno);
|
||||||
goto errout_with_dev;
|
goto errout_with_dev;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
goto success;
|
goto success;
|
||||||
errout_with_dev:
|
errout_with_dev:
|
||||||
close(fd);
|
close(fd);
|
||||||
errout:
|
errout:
|
||||||
return ERROR;
|
return ERROR;
|
||||||
#endif
|
|
||||||
|
|
||||||
success:
|
success:
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -105,18 +105,10 @@ void sam_ledinit(void)
|
|||||||
|
|
||||||
void sam_setled(int led, bool ledon)
|
void sam_setled(int led, bool ledon)
|
||||||
{
|
{
|
||||||
uint32_t ledcfg;
|
|
||||||
|
|
||||||
if (led == BOARD_D301)
|
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)
|
void sam_setleds(uint8_t ledset)
|
||||||
{
|
{
|
||||||
bool ledon;
|
sam_gpiowrite(GPIO_D301, (ledset & BOARD_D301_BIT) ? LED_D301_ON : LED_D301_OFF);
|
||||||
|
|
||||||
ledon = ((ledset & BOARD_D301_BIT) != 0);
|
|
||||||
sam_gpiowrite(GPIO_D301, !ledon); /* 0 = on, 1 = off */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !CONFIG_ARCH_LEDS */
|
#endif /* !CONFIG_ARCH_LEDS */
|
||||||
|
Loading…
Reference in New Issue
Block a user