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