Software APIs
sim_dv.c
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #include <stdint.h>
6 
7 #include "dt/dt_api.h" // Generated
8 
9 static const uint32_t clock_freqs[kDtClockCount] = {
10  [kDtClockMain] = 100 * 1000 * 1000, [kDtClockIo] = 96 * 1000 * 1000,
11  [kDtClockUsb] = 48 * 1000 * 1000, [kDtClockAon] = 200 * 1000,
12  [kDtClockIoDiv2] = 48 * 1000 * 1000, [kDtClockIoDiv4] = 24 * 1000 * 1000,
13 };
14 
15 uint32_t dt_clock_frequency(dt_clock_t clk) {
16  if (clk < kDtClockCount) {
17  return clock_freqs[clk];
18  }
19  return 0;
20 }