mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Kernel: Add RPi::Timer::get_clock_rate()
This commit is contained in:
parent
d9c557d0b4
commit
3beb488887
Notes:
sideshowbarker
2024-07-18 03:20:18 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/3beb488887 Pull-request: https://github.com/SerenityOS/serenity/pull/18845 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/FireFox317 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/caoimhebyrne ✅
2 changed files with 32 additions and 0 deletions
|
@ -151,4 +151,35 @@ u32 Timer::set_clock_rate(ClockID clock_id, u32 rate_hz, bool skip_setting_turbo
|
|||
return message_queue.set_clock_rate.rate_hz;
|
||||
}
|
||||
|
||||
class GetClockRateMboxMessage : Mailbox::Message {
|
||||
public:
|
||||
u32 clock_id;
|
||||
u32 rate_hz;
|
||||
|
||||
GetClockRateMboxMessage()
|
||||
: Mailbox::Message(0x0003'0002, 8)
|
||||
{
|
||||
clock_id = 0;
|
||||
rate_hz = 0;
|
||||
}
|
||||
};
|
||||
|
||||
u32 Timer::get_clock_rate(ClockID clock_id)
|
||||
{
|
||||
struct __attribute__((aligned(16))) {
|
||||
Mailbox::MessageHeader header;
|
||||
GetClockRateMboxMessage get_clock_rate;
|
||||
Mailbox::MessageTail tail;
|
||||
} message_queue;
|
||||
|
||||
message_queue.get_clock_rate.clock_id = static_cast<u32>(clock_id);
|
||||
|
||||
if (!Mailbox::the().send_queue(&message_queue, sizeof(message_queue))) {
|
||||
dbgln("Timer::get_clock_rate() failed!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return message_queue.get_clock_rate.rate_hz;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ public:
|
|||
PIXEL_BVB = 14,
|
||||
};
|
||||
static u32 set_clock_rate(ClockID, u32 rate_hz, bool skip_setting_turbo = true);
|
||||
static u32 get_clock_rate(ClockID);
|
||||
|
||||
private:
|
||||
Timer();
|
||||
|
|
Loading…
Reference in a new issue