#include #include #include #include #include #define PROPTAG_GET_CLOCK_RATE 0x00030002 #define PROPTAG_GET_CLOCK_RATE_MEASURED 0x00030047 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)); if (proptag0[6] != 0) return proptag0[6]; 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)); return proptag1[6]; }