include: zephyr: sys: Introduce IS_BIT_SET() macro
This macro is defined in a few places which leads to macro redefinition error e.g. when compiling prometheus network sample for NPCX boards. Provide one definition of IS_BIT_SET() in util_macro.h to fix the problem. Signed-off-by: Patryk Duda <patrykd@google.com>
This commit is contained in:
parent
132a24d21c
commit
22d3173a61
4 changed files with 9 additions and 4 deletions
|
@ -55,7 +55,6 @@
|
||||||
#define MAX_EBB_BANKS_IN_SEGMENT 32
|
#define MAX_EBB_BANKS_IN_SEGMENT 32
|
||||||
#define SRAM_BANK_SIZE (128 * 1024)
|
#define SRAM_BANK_SIZE (128 * 1024)
|
||||||
#define L2_SRAM_BANK_NUM (L2_SRAM_SIZE / SRAM_BANK_SIZE)
|
#define L2_SRAM_BANK_NUM (L2_SRAM_SIZE / SRAM_BANK_SIZE)
|
||||||
#define IS_BIT_SET(value, idx) ((value) & (1 << (idx)))
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate TLB entry based on physical address.
|
* Calculate TLB entry based on physical address.
|
||||||
|
|
|
@ -93,6 +93,14 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define IS_BIT_MASK(m) IS_SHIFTED_BIT_MASK(m, 0)
|
#define IS_BIT_MASK(m) IS_SHIFTED_BIT_MASK(m, 0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check if bit is set in a value
|
||||||
|
*
|
||||||
|
* @param value Value that contain checked bit
|
||||||
|
* @param bit Bit number
|
||||||
|
*/
|
||||||
|
#define IS_BIT_SET(value, bit) ((((value) >> (bit)) & (0x1)) != 0)
|
||||||
|
|
||||||
/** @brief Extract the Least Significant Bit from @p value. */
|
/** @brief Extract the Least Significant Bit from @p value. */
|
||||||
#define LSB_GET(value) ((value) & -(value))
|
#define LSB_GET(value) ((value) & -(value))
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
/*
|
/*
|
||||||
* NPCX register bit/field access operations
|
* NPCX register bit/field access operations
|
||||||
*/
|
*/
|
||||||
#define IS_BIT_SET(reg, bit) (((reg >> bit) & (0x1)) != 0)
|
|
||||||
|
|
||||||
#define GET_POS_FIELD(pos, size) pos
|
#define GET_POS_FIELD(pos, size) pos
|
||||||
#define GET_SIZE_FIELD(pos, size) size
|
#define GET_SIZE_FIELD(pos, size) size
|
||||||
|
|
|
@ -12,8 +12,7 @@ LOG_MODULE_DECLARE(net_shell);
|
||||||
#include <zephyr/net/http/server.h>
|
#include <zephyr/net/http/server.h>
|
||||||
#include <zephyr/net/http/method.h>
|
#include <zephyr/net/http/method.h>
|
||||||
#include <zephyr/net/http/parser.h>
|
#include <zephyr/net/http/parser.h>
|
||||||
|
#include <zephyr/sys/util.h>
|
||||||
#define IS_BIT_SET(val, bit) (((val >> bit) & (0x1)) != 0)
|
|
||||||
|
|
||||||
static int cmd_net_http(const struct shell *sh, size_t argc, char *argv[])
|
static int cmd_net_http(const struct shell *sh, size_t argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue