mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-13 08:33:49 +01:00
57 lines
915 B
C
57 lines
915 B
C
/*
|
|
* SPDX-FileCopyrightText: 2020 ML!PA Consulting GmbH
|
|
* SPDX-License-Identifier: LGPL-2.1-only
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
/**
|
|
* @ingroup core_macros
|
|
* @{
|
|
*
|
|
* @file
|
|
* @brief Unit helper macros
|
|
*
|
|
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @brief A macro to return the bytes in x KiB
|
|
*/
|
|
#define KiB(x) ((unsigned long)(x) << 10)
|
|
|
|
/**
|
|
* @brief A macro to return the bytes in x MiB
|
|
*/
|
|
#define MiB(x) (KiB(x) << 10)
|
|
|
|
/**
|
|
* @brief A macro to return the bytes in x GiB
|
|
*/
|
|
#define GiB(x) ((unsigned long long)MiB(x) << 10)
|
|
|
|
/**
|
|
* @brief A macro to return the Hz in x kHz
|
|
*/
|
|
#define KHZ(x) ((x) * 1000UL)
|
|
|
|
/**
|
|
* @brief A macro to return the Hz in x MHz
|
|
*/
|
|
#define MHZ(x) (KHZ(x) * 1000UL)
|
|
|
|
/**
|
|
* @brief A macro to return the Hz in x GHz
|
|
*/
|
|
#define GHZ(x) (MHZ(x) * 1000ULL)
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
/** @} */
|