1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:47:34 +00:00

Kernel: Add a GPIO class for aarch64

This allows configuring the alternate pin functions and pin
pull up/down states, which is needed for using the UART.
This commit is contained in:
Nico Weber 2021-09-25 17:53:42 -04:00 committed by Linus Groh
parent 5ac82efbe1
commit fdc86ddae5
6 changed files with 187 additions and 2 deletions

View file

@ -5,6 +5,7 @@
*/
#include <AK/Types.h>
#include <Kernel/Prekernel/Arch/aarch64/GPIO.h>
#include <Kernel/Prekernel/Arch/aarch64/Mailbox.h>
extern "C" [[noreturn]] void halt();
@ -12,6 +13,12 @@ extern "C" [[noreturn]] void halt();
extern "C" [[noreturn]] void init();
extern "C" [[noreturn]] void init()
{
auto& gpio = Prekernel::GPIO::the();
gpio.set_pin_function(14, Prekernel::GPIO::PinFunction::Alternate0);
gpio.set_pin_function(15, Prekernel::GPIO::PinFunction::Alternate0);
gpio.set_pin_pull_up_down_state(Array { 14, 15 }, Prekernel::GPIO::PullUpDownState::Disable);
[[maybe_unused]] u32 firmware_version = Prekernel::Mailbox::query_firmware_version();
halt();
}
@ -32,3 +39,8 @@ void __stack_chk_fail()
{
halt();
}
[[noreturn]] void __assertion_failed(char const*, char const*, unsigned int, char const*)
{
halt();
}