mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +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:
parent
5ac82efbe1
commit
fdc86ddae5
Notes:
sideshowbarker
2024-07-18 03:26:47 +09:00
Author: https://github.com/nico
Commit: fdc86ddae5
Pull-request: https://github.com/SerenityOS/serenity/pull/10212
Reviewed-by: https://github.com/linusg
6 changed files with 187 additions and 2 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue