75 lines
3.0 KiB
Zig
75 lines
3.0 KiB
Zig
const C = @cImport({
|
|
@cInclude("uacpi/event.h");
|
|
@cInclude("uacpi/io.h");
|
|
@cInclude("uacpi/namespace.h");
|
|
@cInclude("uacpi/notify.h");
|
|
@cInclude("uacpi/opregion.h");
|
|
@cInclude("uacpi/osi.h");
|
|
@cInclude("uacpi/resources.h");
|
|
@cInclude("uacpi/sleep.h");
|
|
@cInclude("uacpi/status.h");
|
|
@cInclude("uacpi/tables.h");
|
|
@cInclude("uacpi/types.h");
|
|
@cInclude("uacpi/uacpi.h");
|
|
@cInclude("uacpi/utilities.h");
|
|
});
|
|
|
|
pub const Status = enum(C.uacpi_status) {
|
|
ok = C.UACPI_STATUS_OK,
|
|
mapping_failed = C.UACPI_STATUS_MAPPING_FAILED,
|
|
out_of_memory = C.UACPI_STATUS_OUT_OF_MEMORY,
|
|
bad_checksum = C.UACPI_STATUS_BAD_CHECKSUM,
|
|
invalid_signature = C.UACPI_STATUS_INVALID_SIGNATURE,
|
|
invalid_table_length = C.UACPI_STATUS_INVALID_TABLE_LENGTH,
|
|
not_found = C.UACPI_STATUS_NOT_FOUND,
|
|
invalid_argument = C.UACPI_STATUS_INVALID_ARGUMENT,
|
|
unimplemented = C.UACPI_STATUS_UNIMPLEMENTED,
|
|
already_exists = C.UACPI_STATUS_ALREADY_EXISTS,
|
|
internal_error = C.UACPI_STATUS_INTERNAL_ERROR,
|
|
type_mismatch = C.UACPI_STATUS_TYPE_MISMATCH,
|
|
init_level_mismatch = C.UACPI_STATUS_INIT_LEVEL_MISMATCH,
|
|
namespace_node_dangling = C.UACPI_STATUS_NAMESPACE_NODE_DANGLING,
|
|
no_handler = C.UACPI_STATUS_NO_HANDLER,
|
|
no_resource_end_tag = C.UACPI_STATUS_NO_RESOURCE_END_TAG,
|
|
compiled_out = C.UACPI_STATUS_COMPILED_OUT,
|
|
hardware_timeout = C.UACPI_STATUS_HARDWARE_TIMEOUT,
|
|
timeout = C.UACPI_STATUS_TIMEOUT,
|
|
overridden = C.UACPI_STATUS_OVERRIDDEN,
|
|
denied = C.UACPI_STATUS_DENIED,
|
|
|
|
// All errors that have bytecode-related origin should go here
|
|
aml_undefined_reference = C.UACPI_STATUS_AML_UNDEFINED_REFERENCE,
|
|
aml_invalid_namestring = C.UACPI_STATUS_AML_INVALID_NAMESTRING,
|
|
aml_object_already_exists = C.UACPI_STATUS_AML_OBJECT_ALREADY_EXISTS,
|
|
aml_invalid_opcode = C.UACPI_STATUS_AML_INVALID_OPCODE,
|
|
aml_incompatible_object_type = C.UACPI_STATUS_AML_INCOMPATIBLE_OBJECT_TYPE,
|
|
aml_bad_encoding = C.UACPI_STATUS_AML_BAD_ENCODING,
|
|
aml_out_of_bounds_index = C.UACPI_STATUS_AML_OUT_OF_BOUNDS_INDEX,
|
|
aml_sync_level_too_high = C.UACPI_STATUS_AML_SYNC_LEVEL_TOO_HIGH,
|
|
aml_invalid_resource = C.UACPI_STATUS_AML_INVALID_RESOURCE,
|
|
aml_loop_timeout = C.UACPI_STATUS_AML_LOOP_TIMEOUT,
|
|
aml_call_stack_depth_limit = C.UACPI_STATUS_AML_CALL_STACK_DEPTH_LIMIT,
|
|
};
|
|
|
|
pub const InterruptResult = enum(C.uacpi_interrupt_ret) {
|
|
not_handled = C.UACPI_INTERRUPT_NOT_HANDLED,
|
|
handled = C.UACPI_INTERRUPT_HANDLED,
|
|
};
|
|
|
|
pub const LogLevel = enum(C.uacpi_log_level) {
|
|
debug = C.UACPI_LOG_DEBUG,
|
|
err = C.UACPI_LOG_ERROR,
|
|
info = C.UACPI_LOG_INFO,
|
|
trace = C.UACPI_LOG_TRACE,
|
|
warn = C.UACPI_LOG_WARN,
|
|
};
|
|
|
|
pub const InterruptHandler = *const fn(Handle) callconv(.C) InterruptResult;
|
|
|
|
pub const Handle = C.uacpi_handle;
|
|
pub const CpuFlags = C.uacpi_cpu_flags;
|
|
pub const PhysAddr = C.uacpi_phys_addr;
|
|
pub const ThreadId = C.uacpi_thread_id;
|
|
pub const WorkType = C.uacpi_work_type;
|
|
pub const PciAddress = C.uacpi_pci_address;
|
|
pub const WorkHandler = C.uacpi_work_handler; |