2019-06-02 03:14:06 +08:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
2018-07-04 22:49:22 +08:00
|
|
|
*
|
2019-06-02 03:14:06 +08:00
|
|
|
* Copyright(c) 2018 Intel Corporation. All rights reserved.
|
2018-07-04 22:49:22 +08:00
|
|
|
*
|
|
|
|
* Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
|
|
|
|
*/
|
|
|
|
|
2022-08-20 04:07:29 +08:00
|
|
|
#ifndef __XTOS_RTOS_BIT_H__
|
|
|
|
#define __XTOS_RTOS_BIT_H__
|
2020-04-15 18:05:46 +08:00
|
|
|
|
2020-02-13 18:51:29 +08:00
|
|
|
#if ASSEMBLY
|
2018-07-04 22:49:22 +08:00
|
|
|
#define BIT(b) (1 << (b))
|
2020-02-13 18:51:29 +08:00
|
|
|
#else
|
|
|
|
#define BIT(b) (1UL << (b))
|
|
|
|
#endif
|
|
|
|
|
2018-11-22 02:23:55 +08:00
|
|
|
#define MASK(b_hi, b_lo) \
|
|
|
|
(((1ULL << ((b_hi) - (b_lo) + 1ULL)) - 1ULL) << (b_lo))
|
2018-07-04 22:49:22 +08:00
|
|
|
#define SET_BIT(b, x) (((x) & 1) << (b))
|
|
|
|
#define SET_BITS(b_hi, b_lo, x) \
|
2018-11-22 02:23:55 +08:00
|
|
|
(((x) & ((1ULL << ((b_hi) - (b_lo) + 1ULL)) - 1ULL)) << (b_lo))
|
2021-04-16 23:53:08 +08:00
|
|
|
#define GET_BIT(b, x) \
|
|
|
|
(((x) & (1ULL << (b))) >> (b))
|
|
|
|
#define GET_BITS(b_hi, b_lo, x) \
|
|
|
|
(((x) & MASK(b_hi, b_lo)) >> (b_lo))
|
2018-07-04 22:49:22 +08:00
|
|
|
|
2022-08-20 04:07:29 +08:00
|
|
|
#endif /* __XTOS_RTOS_BIT_H__ */
|