Files
mango/tools/amldecode/aml/value.h

48 lines
981 B
C
Raw Normal View History

#ifndef AML_VALUE_H_
#define AML_VALUE_H_
#include <stdint.h>
#include <stdbool.h>
#include "constants.h"
struct acpi_object;
enum aml_value_type {
AML_VALUE_NONE,
AML_VALUE_UINT8,
AML_VALUE_UINT16,
AML_VALUE_UINT32,
AML_VALUE_UINT64,
AML_VALUE_OBJECT,
AML_VALUE_NAME,
AML_VALUE_STRING,
};
struct aml_value {
enum aml_value_type type;
union {
uint8_t uint8;
uint16_t uint16;
uint32_t uint32;
uint64_t uint64;
struct acpi_object *object;
const char *name;
const char *str;
} value;
};
static inline bool aml_value_is_integer(const struct aml_value *value)
{
return value->type == AML_VALUE_UINT8 || value->type == AML_VALUE_UINT16 || value->type == AML_VALUE_UINT32 || value->type == AML_VALUE_UINT64;
}
static inline bool aml_value_is_name(const struct aml_value *value)
{
return value->type == AML_VALUE_NAME;
}
extern uint64_t aml_value_get_integer(const struct aml_value *value);
extern void aml_value_destroy(struct aml_value *value);
#endif