1#pragma once
2
3#include <uacpi/types.h>
4
5// Forward declared to reduce pollution, include acpi.h if needed
6struct acpi_gas;
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#ifndef UACPI_BAREBONES_MODE
13
14uacpi_status uacpi_gas_read(const struct acpi_gas *gas, uacpi_u64 *value);
15uacpi_status uacpi_gas_write(const struct acpi_gas *gas, uacpi_u64 value);
16
17typedef struct uacpi_mapped_gas uacpi_mapped_gas;
18
19/**
20 * Map a GAS for faster access in the future. The handle returned via
21 * 'out_mapped' must be freed & unmapped using uacpi_unmap_gas() when
22 * no longer needed.
23 */
24uacpi_status uacpi_map_gas(const struct acpi_gas *gas, uacpi_mapped_gas **out_mapped);
25void uacpi_unmap_gas(uacpi_mapped_gas*);
26
27/**
28 * Same as uacpi_gas_{read,write} but operates on a pre-mapped handle for faster
29 * access and/or ability to use in critical sections/irq contexts.
30 */
31uacpi_status uacpi_gas_read_mapped(const uacpi_mapped_gas *gas, uacpi_u64 *value);
32uacpi_status uacpi_gas_write_mapped(const uacpi_mapped_gas *gas, uacpi_u64 value);
33
34#endif // !UACPI_BAREBONES_MODE
35
36#ifdef __cplusplus
37}
38#endif
39