From 65c72c805798056fadd9adca7ebdeb94b8612dfa Mon Sep 17 00:00:00 2001 From: Daniil Tatianin <99danilt@gmail.com> Date: Fri, 20 Dec 2024 02:06:38 +0300 Subject: [PATCH] tests/runner: add basic usage of event API Signed-off-by: Daniil Tatianin <99danilt@gmail.com> --- tests/runner/test_runner.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/runner/test_runner.cpp b/tests/runner/test_runner.cpp index d4a5628e..8fe9e8b8 100644 --- a/tests/runner/test_runner.cpp +++ b/tests/runner/test_runner.cpp @@ -15,6 +15,7 @@ #include #include #include +#include void run_resource_tests(); @@ -272,6 +273,14 @@ static uacpi_status handle_ec(uacpi_region_op op, uacpi_handle op_data) } } +static uacpi_interrupt_ret handle_gpe( + uacpi_handle, uacpi_namespace_node *, uacpi_u16 +) +{ + std::cout << "got a GPE" << std::endl; + return UACPI_INTERRUPT_HANDLED | UACPI_GPE_REENABLE; +} + static void ensure_ok_status(uacpi_status st) { if (st == UACPI_STATUS_OK) @@ -507,6 +516,20 @@ static void run_test( ); ensure_ok_status(st); + st = uacpi_install_gpe_handler( + UACPI_NULL, 123, UACPI_GPE_TRIGGERING_EDGE, handle_gpe, UACPI_NULL + ); + ensure_ok_status(st); + + st = uacpi_enable_gpe(UACPI_NULL, 123); + ensure_ok_status(st); + + st = uacpi_disable_gpe(UACPI_NULL, 123); + ensure_ok_status(st); + + st = uacpi_uninstall_gpe_handler(UACPI_NULL, 123, handle_gpe); + ensure_ok_status(st); + st = uacpi_namespace_initialize(); ensure_ok_status(st);