mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
Kernel: Add Mailbox::set_clock_rate()
This commit is contained in:
parent
43d378940f
commit
44c787e88b
2 changed files with 39 additions and 0 deletions
|
@ -75,6 +75,7 @@ bool Mailbox::call(u8 channel, u32 volatile* __attribute__((aligned(16))) messag
|
|||
}
|
||||
|
||||
constexpr u32 MBOX_TAG_GET_FIRMWARE_VERSION = 0x0000'0001;
|
||||
constexpr u32 MBOX_TAG_SET_CLOCK_RATE = 0x0003'8002;
|
||||
|
||||
u32 Mailbox::query_firmware_version()
|
||||
{
|
||||
|
@ -96,4 +97,23 @@ u32 Mailbox::query_firmware_version()
|
|||
return 0xffff'ffff;
|
||||
}
|
||||
|
||||
u32 Mailbox::set_clock_rate(ClockID clock_id, u32 rate_hz, bool skip_setting_turbo)
|
||||
{
|
||||
u32 __attribute__((aligned(16))) message[9];
|
||||
message[0] = sizeof(message);
|
||||
message[1] = MBOX_REQUEST;
|
||||
|
||||
message[2] = MBOX_TAG_SET_CLOCK_RATE;
|
||||
message[3] = 12; // Tag data size.
|
||||
message[4] = MBOX_REQUEST;
|
||||
message[5] = static_cast<u32>(clock_id);
|
||||
message[6] = rate_hz;
|
||||
message[7] = skip_setting_turbo ? 1 : 0;
|
||||
|
||||
message[8] = 0;
|
||||
|
||||
call(ARM_TO_VIDEOCORE_CHANNEL, message);
|
||||
return message[6];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue