2024-12-23 00:46:17 +00:00
|
|
|
#include <assert.h>
|
|
|
|
#include <log.h>
|
2024-12-20 22:45:12 +00:00
|
|
|
#include <mbox.h>
|
2024-12-23 00:46:17 +00:00
|
|
|
#include <mem.h>
|
2024-12-20 22:45:12 +00:00
|
|
|
#include <tag.h>
|
|
|
|
|
2024-12-23 00:46:17 +00:00
|
|
|
#define PROPTAG_GET_CLOCK_RATE 0x00030002
|
2024-12-20 22:45:12 +00:00
|
|
|
#define PROPTAG_GET_CLOCK_RATE_MEASURED 0x00030047
|
|
|
|
|
2024-12-23 00:46:17 +00:00
|
|
|
uint32_t gilbraltar_get_rate_of_clock(uint32_t cid) {
|
|
|
|
uint32_t proptag0[] __attribute__((aligned(16))) = {
|
|
|
|
8 * 4, CODE_REQUEST, PROPTAG_GET_CLOCK_RATE, 2 * 4, 1 * 4, cid,
|
|
|
|
0, PROPTAG_END};
|
|
|
|
|
|
|
|
for (int i = 0; i < sizeof(proptag0) / 4; i++)
|
|
|
|
gilbraltar_log(DEBUG, "%08lx[%d]: %04x\r\n", (uintptr_t)proptag0, i,
|
|
|
|
proptag0[i]);
|
|
|
|
|
|
|
|
assert(gilbraltar_mbox_write_read((uintptr_t)&proptag0));
|
2024-12-20 22:45:12 +00:00
|
|
|
|
|
|
|
if (proptag0[6] != 0)
|
|
|
|
return proptag0[6];
|
|
|
|
|
2024-12-23 00:46:17 +00:00
|
|
|
uint32_t proptag1[] __attribute__((aligned(16))) = {
|
|
|
|
8 * 4, CODE_REQUEST, PROPTAG_GET_CLOCK_RATE_MEASURED, 2 * 4, 1 * 4, cid,
|
|
|
|
0, PROPTAG_END};
|
|
|
|
|
|
|
|
assert(gilbraltar_mbox_write_read((uintptr_t)&proptag1));
|
2024-12-20 22:45:12 +00:00
|
|
|
|
|
|
|
return proptag1[6];
|
|
|
|
}
|