mirror of
git://nv-tegra.nvidia.com/linux-hwpm.git
synced 2025-12-22 09:12:05 +03:00
Initial change for libnvsochwpm userspace library. Change-Id: I20b11f9d253b65583db97dfebd9ff78b4d33d50c Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3267999 Reviewed-by: Vasuki Shankar <vasukis@nvidia.com> Reviewed-by: Yifei Wan <ywan@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
31 lines
1.1 KiB
C
31 lines
1.1 KiB
C
/* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
* SPDX-License-Identifier: GPL-2.0-only
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms and conditions of the GNU General Public License,
|
|
* version 2, as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
* more details.
|
|
*
|
|
*/
|
|
|
|
#ifndef __BIT_H__
|
|
#define __BIT_H__
|
|
|
|
#include <stdint.h>
|
|
|
|
#define FIELD_GET(v, m, s) ((v & m) >> s)
|
|
#define FIELD_SET(v, m, s) ((v & m) << s)
|
|
|
|
#define VAL_64(lo, hi) (uint64_t)lo | ((uint64_t)hi << 32U)
|
|
#define VAL_LO64(v) FIELD_GET(v, 0xFFFFFFFFULL, 0U)
|
|
#define VAL_HI64(v) FIELD_GET(v, 0xFFFFFFFF00000000ULL, 32U)
|
|
|
|
/* Align value up to the next multiple of alignment */
|
|
#define ALIGN_UP(value, alignment) (((value) + ((alignment) - 1)) & ~((alignment) - 1))
|
|
|
|
|
|
#endif /*__BIT_H__*/ |