From 4bea031527e6d0153e61b7ffd4696df8a30f006c Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Sat, 21 Jul 2012 13:08:05 -0700 Subject: [PATCH] [target] add a optional led api for simple debugging currently set up to show when anything other than the idle thread is running. --- include/target.h | 11 ++++++++++- kernel/thread.c | 4 ++++ target/init.c | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/target.h b/include/target.h index 0464d905..89ba4f32 100644 --- a/include/target.h +++ b/include/target.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008 Travis Geiselbrecht + * Copyright (c) 2008-2012 Travis Geiselbrecht * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files @@ -29,4 +29,13 @@ void target_early_init(void); /* later init, after the kernel has come up */ void target_init(void); +/* a target can optionally define a set of debug leds that can be used + * in various locations in the system. + */ +#if TARGET_HAS_DEBUG_LED +void target_set_debug_led(unsigned int led, bool on); +#else +#define target_set_debug_led(led, on) ((void)(0)) +#endif + #endif diff --git a/kernel/thread.c b/kernel/thread.c index 2a4e6eac..0cb9f82d 100644 --- a/kernel/thread.c +++ b/kernel/thread.c @@ -40,6 +40,7 @@ #include #include #include +#include #if DEBUGLEVEL > 1 #define THREAD_CHECKS 1 @@ -368,6 +369,9 @@ void thread_resched(void) } #endif + /* set some optional target debug leds */ + target_set_debug_led(0, newthread != idle_thread); + /* do the switch */ oldthread->saved_critical_section_count = critical_section_count; current_thread = newthread; diff --git a/target/init.c b/target/init.c index 7c7ffb23..d7cbe239 100644 --- a/target/init.c +++ b/target/init.c @@ -38,3 +38,7 @@ __WEAK void target_init(void) { } +__WEAK void target_set_led(unsigned int led, bool on) +{ +} +