1 // Copyright 2018 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #pragma once
6 
7 #include <zircon/device/ioctl-wrapper.h>
8 #include <zircon/device/ioctl.h>
9 
10 typedef struct clk_freq_info {
11     char clk_name[30];
12     uint32_t clk_freq;
13 } clk_freq_info_t;
14 
15 // Measure clock frequency.
16 #define IOCTL_CLK_MEASURE \
17     IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_CLK, 1)
18 // Get count of number of clocks.
19 #define IOCTL_CLK_GET_COUNT \
20     IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_CLK, 2)
21 
22 // size_t ioctl_clk_get_count(int fd, uint32_t* count);
23 IOCTL_WRAPPER_OUT(ioctl_clk_get_count, IOCTL_CLK_GET_COUNT, uint32_t);
24 // size_t ioctl_clk_measure(int fd, uint32_t index, clk_freq_info_t* clk_info);
25 IOCTL_WRAPPER_INOUT(ioctl_clk_measure, IOCTL_CLK_MEASURE, uint32_t, clk_freq_info_t);
26