Loading...
Searching...
No Matches
clk.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Inria
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
18#ifndef CLK_H
19#define CLK_H
20
21#include <assert.h>
22#include <stdint.h>
23#include "periph_conf.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
34static inline uint32_t coreclk(void) {
35#if defined(CLOCK_CORECLOCK)
36 return CLOCK_CORECLOCK;
37#else
38 extern uint32_t cpu_coreclk;
39 assert(cpu_coreclk != 0);
40 return cpu_coreclk;
41#endif
42}
43
44#ifdef __cplusplus
45}
46#endif
47
48#endif /* CLK_H */
POSIX.1-2008 compliant version of the assert macro.
#define assert(cond)
abort the program if assertion is false
Definition assert.h:137
#define CLOCK_CORECLOCK
CPU Frequency Define.
Definition periph_cpu.h:76
static uint32_t coreclk(void)
Get the current system core clock frequency in Hz.
Definition clk.h:34