1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-29 20:07:35 +00:00

Kernel: Move Prekernel assembly utils to aarch64/ASM_wrapper.h

By moving these functions to the ASM_wrapper.h file, we can get rid of
another Prekernel file.
This commit is contained in:
Timon Kruiper 2022-05-09 23:09:44 +02:00 committed by Linus Groh
parent e80d8d697c
commit e7c5fd978b
8 changed files with 44 additions and 77 deletions

View file

@ -4,11 +4,10 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/Arch/aarch64/ASM_wrapper.h>
#include <Kernel/Arch/aarch64/RPi/GPIO.h>
#include <Kernel/Arch/aarch64/RPi/MMIO.h>
extern "C" void wait_cycles(int n);
namespace Prekernel {
// See BCM2835-ARM-Peripherals.pdf section "6 General Purpose I/O" or bcm2711-peripherals.pdf "Chapter 5. General Purpose I/O".
@ -73,7 +72,7 @@ void GPIO::internal_enable_pins(u32 enable[2], PullUpDownState state)
m_registers->pull_up_down_enable = static_cast<u32>(state);
// 2. Wait 150 cycles this provides the required set-up time for the control signal
wait_cycles(150);
Kernel::Aarch64::Asm::wait_cycles(150);
// 3. Write to GPPUDCLK0/1 to clock the control signal into the GPIO pads you wish to
// modify NOTE only the pads which receive a clock will be modified, all others will
@ -82,7 +81,7 @@ void GPIO::internal_enable_pins(u32 enable[2], PullUpDownState state)
m_registers->pull_up_down_enable_clock.bits[1] = enable[1];
// 4. Wait 150 cycles this provides the required hold time for the control signal
wait_cycles(150);
Kernel::Aarch64::Asm::wait_cycles(150);
// 5. Write to GPPUD to remove the control signal
m_registers->pull_up_down_enable = 0;