Skip to content

Commit

Permalink
zephyr: lib: add build assert on NUM_CLOCKS
Browse files Browse the repository at this point in the history
Add a build assert to ensure platform NUM_CLOCKS is set to at least
CONFIG_CORE_COUNT. This is assumed to hold in the implementation of
platform_clock_init().

Signed-off-by: Kai Vehmanen <[email protected]>
  • Loading branch information
kv2019i authored and lgirdwood committed Dec 5, 2024
1 parent 8bd2522 commit 4fde218
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions zephyr/lib/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ void platform_clock_init(struct sof *sof)

sof->clocks = platform_clocks_info;

/*
* plafforms using this clk.c implementation must
* declare the CPU clocks first, and there must be at least
* one clock per core. If this model doesn't fit, platform
* needs a custom platform_clock_init.
*/
BUILD_ASSERT(NUM_CLOCKS >= CONFIG_CORE_COUNT, "Invalid NUM_CLOCKS");

for (i = 0; i < CONFIG_CORE_COUNT; i++) {
sof->clocks[i] = (struct clock_info) {
.freqs_num = NUM_CPU_FREQ,
Expand Down

0 comments on commit 4fde218

Please sign in to comment.