[target] add a optional led api for simple debugging

currently set up to show when anything other than the idle thread is running.
This commit is contained in:
Travis Geiselbrecht
2012-07-21 13:08:05 -07:00
parent 056c869ddb
commit 4bea031527
3 changed files with 18 additions and 1 deletions

View File

@@ -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 * Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files * 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 */ /* later init, after the kernel has come up */
void target_init(void); 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 #endif

View File

@@ -40,6 +40,7 @@
#include <kernel/timer.h> #include <kernel/timer.h>
#include <kernel/dpc.h> #include <kernel/dpc.h>
#include <platform.h> #include <platform.h>
#include <target.h>
#if DEBUGLEVEL > 1 #if DEBUGLEVEL > 1
#define THREAD_CHECKS 1 #define THREAD_CHECKS 1
@@ -368,6 +369,9 @@ void thread_resched(void)
} }
#endif #endif
/* set some optional target debug leds */
target_set_debug_led(0, newthread != idle_thread);
/* do the switch */ /* do the switch */
oldthread->saved_critical_section_count = critical_section_count; oldthread->saved_critical_section_count = critical_section_count;
current_thread = newthread; current_thread = newthread;

View File

@@ -38,3 +38,7 @@ __WEAK void target_init(void)
{ {
} }
__WEAK void target_set_led(unsigned int led, bool on)
{
}