Loading...
Searching...
No Matches
clk.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021 Inria
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
16
17#include <assert.h>
18#include <stdint.h>
19#include "periph_conf.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
30static inline uint32_t coreclk(void) {
31#if defined(CLOCK_CORECLOCK)
32 return CLOCK_CORECLOCK;
33#else
34 extern uint32_t cpu_coreclk;
35 assert(cpu_coreclk != 0);
36 return cpu_coreclk;
37#endif
38}
39
40#ifdef __cplusplus
41}
42#endif
43
#define CLOCK_CORECLOCK
Clock configuration.
Definition periph_cpu.h:28
POSIX.1-2008 compliant version of the assert macro.
#define assert(cond)
abort the program if assertion is false
Definition assert.h:143
static uint32_t coreclk(void)
Get the current system core clock frequency in Hz.
Definition clk.h:30