aboutsummaryrefslogtreecommitdiffstats
path: root/com32/gpllib
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2011-04-04 20:13:13 +0200
committerErwan Velu <erwanaliasr1@gmail.com>2011-04-04 20:13:13 +0200
commitc09eb315a9c426bc9fbb7bfe036648befb65fbd7 (patch)
treed0889b5af9710698e61541d8f458fff2351af70a /com32/gpllib
parent9ccd4aa116f0616ec7a3556ee958351aa08ee257 (diff)
downloadsyslinux-c09eb315a9c426bc9fbb7bfe036648befb65fbd7.tar.gz
syslinux-c09eb315a9c426bc9fbb7bfe036648befb65fbd7.tar.xz
syslinux-c09eb315a9c426bc9fbb7bfe036648befb65fbd7.zip
acpi: moving flags_to_string to base code
This code is useful for many program, let's make it generic.
Diffstat (limited to 'com32/gpllib')
-rw-r--r--com32/gpllib/acpi/acpi.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/com32/gpllib/acpi/acpi.c b/com32/gpllib/acpi/acpi.c
index 8e5ee29c..d2bf29e5 100644
--- a/com32/gpllib/acpi/acpi.c
+++ b/com32/gpllib/acpi/acpi.c
@@ -32,6 +32,25 @@
#include <memory.h>
#include "acpi/acpi.h"
+/* M1PS flags have to be interpreted as strings */
+char *flags_to_string(char *buffer, uint16_t flags)
+{
+ memset(buffer, 0, sizeof(buffer));
+ strcpy(buffer, "default");
+ if ((flags & POLARITY_ACTIVE_HIGH) == POLARITY_ACTIVE_HIGH)
+ strcpy(buffer, "high");
+ else if ((flags & POLARITY_ACTIVE_LOW) == POLARITY_ACTIVE_LOW)
+ strcpy(buffer, "low");
+ if ((flags & TRIGGER_EDGE) == TRIGGER_EDGE)
+ strncat(buffer, " edge", 5);
+ else if ((flags & TRIGGER_LEVEL) == TRIGGER_LEVEL)
+ strncat(buffer, " level", 6);
+ else
+ strncat(buffer, " default", 8);
+
+ return buffer;
+}
+
void dbg_printf(const char *fmt, ...)
{
va_list args;