[syslinux:master] acpi: moving flags_to_string to base code
syslinux-bot for Erwan Velu
erwanaliasr1 at gmail.com
Mon Apr 25 15:28:45 PDT 2011
Commit-ID: c09eb315a9c426bc9fbb7bfe036648befb65fbd7
Gitweb: http://syslinux.zytor.com/commit/c09eb315a9c426bc9fbb7bfe036648befb65fbd7
Author: Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Mon, 4 Apr 2011 20:13:13 +0200
Committer: Erwan Velu <erwanaliasr1 at gmail.com>
CommitDate: Mon, 4 Apr 2011 20:13:13 +0200
acpi: moving flags_to_string to base code
This code is useful for many program, let's make it generic.
---
com32/gplinclude/acpi/acpi.h | 1 +
com32/gpllib/acpi/acpi.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/com32/gplinclude/acpi/acpi.h b/com32/gplinclude/acpi/acpi.h
index 94589f3..bf3ffdb 100644
--- a/com32/gplinclude/acpi/acpi.h
+++ b/com32/gplinclude/acpi/acpi.h
@@ -95,4 +95,5 @@ void parse_madt(s_acpi * acpi);
int search_rsdp(s_acpi *acpi);
void get_acpi_description_header(uint8_t *q, s_acpi_description_header * adh);
bool parse_header(uint64_t *address, s_acpi *acpi);
+char *flags_to_string(char *buffer, uint16_t flags);
#endif
diff --git a/com32/gpllib/acpi/acpi.c b/com32/gpllib/acpi/acpi.c
index 8e5ee29..d2bf29e 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;
More information about the Syslinux-commits
mailing list