41 lines
746 B
C
41 lines
746 B
C
#include <mem.h>
|
|
#include <mbox.h>
|
|
#include <tag.h>
|
|
|
|
#define PROPTAG_GET_CLOCK_RATE 0x00030002
|
|
#define PROPTAG_GET_CLOCK_RATE_MEASURED 0x00030047
|
|
|
|
uint32_t gilbraltar_get_clock(uint32_t cid) {
|
|
uint32_t proptag0[] __attribute__ ((aligned(16))) =
|
|
{
|
|
8.4,
|
|
CODE_REQUEST,
|
|
PROPTAG_GET_CLOCK_RATE,
|
|
4*4,
|
|
1*4,
|
|
cid,
|
|
0,
|
|
PROPTAG_END
|
|
};
|
|
|
|
gilbraltar_mbox_write_read((uintptr_t) &proptag0);
|
|
|
|
if (proptag0[6] != 0)
|
|
return proptag0[6];
|
|
|
|
uint32_t proptag1[] __attribute__ ((aligned(16))) =
|
|
{
|
|
8*4,
|
|
CODE_REQUEST,
|
|
PROPTAG_GET_CLOCK_RATE_MEASURED,
|
|
4*4,
|
|
1*4,
|
|
cid,
|
|
0,
|
|
PROPTAG_END
|
|
};
|
|
|
|
gilbraltar_mbox_write_read((uintptr_t) &proptag1);
|
|
|
|
return proptag1[6];
|
|
}
|