]> rtime.felk.cvut.cz Git - sysless.git/commitdiff
Added unified interface for LEDs
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 4 Apr 2008 10:49:44 +0000 (12:49 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 4 Apr 2008 10:49:44 +0000 (12:49 +0200)
common/arch/generic/defines/deb_led.h [new file with mode: 0644]

diff --git a/common/arch/generic/defines/deb_led.h b/common/arch/generic/defines/deb_led.h
new file mode 100644 (file)
index 0000000..d99e72c
--- /dev/null
@@ -0,0 +1,79 @@
+#ifndef DEB_LED_H
+#define DEB_LED_H
+
+/**
+ * @file   deb_led.h
+ * @author Michal Sojka <sojkam1@fel.cvut.cz>
+ * @date   Fri Apr  4 09:52:41 2008
+ * 
+ * @brief  Unified interface to onboard (debugging) LEDs.
+ * 
+ * The actual functions (starting with __) must be implemented in a
+ * board specific library or as inline in deb_led_board.h. It is
+ * recomended that individual LEDs are defined as macros of name
+ * DEB_LED_something
+ */
+
+#include <deb_led_board.h>
+
+/** 
+ * Initializes onboard LEDs.
+ */
+static inline void deb_led_init()
+{
+       __deb_led_init();
+}
+
+/** 
+ * Set all LEDs to a specified state
+ * 
+ * @param leds Bits set to one determine which LEDs are switched on,
+ * bits set to zero determine which LEDs are switched off.
+ */
+static inline void
+deb_led_set(unsigned leds) {
+       __deb_led_set(leds);
+}
+
+/** 
+ * Returns the current state of LEDs
+ *
+ * @return Current state of LEDs. Bits set to one indicate the LED is
+ * on.
+ */
+static inline unsigned
+deb_led_get()
+{
+       return __deb_led_get();
+}
+
+/** 
+ * Switches on specified LEDs
+ * @param leds Bits set to one determine which LEDs are switched on.
+ */
+static inline void
+deb_led_on(unsigned leds)
+{
+       __deb_led_on(leds);
+}
+/** 
+ * Switches off specified LEDs
+ * @param leds Bits set to one determine which LEDs are switched off.
+ */
+static inline void deb_led_off(unsigned leds)
+{
+       __deb_led_off(leds);
+}
+
+/** 
+ * Change state (on/off) of specified LEDs
+ * @param leds Bits set to one determine which LEDs change the state.
+ */
+static inline void
+deb_led_change(unsigned leds)
+{
+       __deb_led_change(leds);
+}
+
+
+#endif