]> mj.ucw.cz Git - pciutils.git/commitdiff
bitops.h moved to root
authorMartin Mares <mj@ucw.cz>
Sun, 18 Feb 2024 11:07:50 +0000 (12:07 +0100)
committerMartin Mares <mj@ucw.cz>
Sun, 18 Feb 2024 11:07:50 +0000 (12:07 +0100)
It is a part of the utilities, not of libpci.

bitops.h [new file with mode: 0644]
lib/bitops.h [deleted file]
lmr/lmr.h
pciutils.h

diff --git a/bitops.h b/bitops.h
new file mode 100644 (file)
index 0000000..029741e
--- /dev/null
+++ b/bitops.h
@@ -0,0 +1,39 @@
+/*
+ *     The PCI Utilities -- Decode bits and bit fields
+ *
+ *     Copyright (c) 2023 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 2023 KNS Group LLC (YADRO)
+ *
+ *     Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ *     SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef _BITOPS_H
+#define _BITOPS_H
+
+#ifndef _PCI_LIB_H
+#error Import only from pci.h
+#endif
+
+/* Useful macros for decoding of bits and bit fields */
+
+#define FLAG(x, y) ((x & y) ? '+' : '-')
+
+// Generate mask
+
+#define BIT(at) ((u64)1 << (at))
+// Boundaries inclusive
+#define MASK(h, l)   ((((u64)1 << ((h) + 1)) - 1) & ~(((u64)1 << (l)) - 1))
+
+// Get/set from register
+
+#define BITS(x, at, width)      (((x) >> (at)) & ((1 << (width)) - 1))
+#define GET_REG_MASK(reg, mask) (((reg) & (mask)) / ((mask) & ~((mask) << 1)))
+#define SET_REG_MASK(reg, mask, val)                                                               \
+  (((reg) & ~(mask)) | (((val) * ((mask) & ~((mask) << 1))) & (mask)))
+
+#define TABLE(tab, x, buf)                                                                         \
+  ((x) < sizeof(tab) / sizeof((tab)[0]) ? (tab)[x] : (sprintf((buf), "??%d", (x)), (buf)))
+
+#endif
diff --git a/lib/bitops.h b/lib/bitops.h
deleted file mode 100644 (file)
index 029741e..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *     The PCI Utilities -- Decode bits and bit fields
- *
- *     Copyright (c) 2023 Martin Mares <mj@ucw.cz>
- *     Copyright (c) 2023 KNS Group LLC (YADRO)
- *
- *     Can be freely distributed and used under the terms of the GNU GPL v2+.
- *
- *     SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-#ifndef _BITOPS_H
-#define _BITOPS_H
-
-#ifndef _PCI_LIB_H
-#error Import only from pci.h
-#endif
-
-/* Useful macros for decoding of bits and bit fields */
-
-#define FLAG(x, y) ((x & y) ? '+' : '-')
-
-// Generate mask
-
-#define BIT(at) ((u64)1 << (at))
-// Boundaries inclusive
-#define MASK(h, l)   ((((u64)1 << ((h) + 1)) - 1) & ~(((u64)1 << (l)) - 1))
-
-// Get/set from register
-
-#define BITS(x, at, width)      (((x) >> (at)) & ((1 << (width)) - 1))
-#define GET_REG_MASK(reg, mask) (((reg) & (mask)) / ((mask) & ~((mask) << 1)))
-#define SET_REG_MASK(reg, mask, val)                                                               \
-  (((reg) & ~(mask)) | (((val) * ((mask) & ~((mask) << 1))) & (mask)))
-
-#define TABLE(tab, x, buf)                                                                         \
-  ((x) < sizeof(tab) / sizeof((tab)[0]) ? (tab)[x] : (sprintf((buf), "??%d", (x)), (buf)))
-
-#endif
index f728fca78d1e8ab9d0ea8d00ccf103a1a67d7e8a..7375c33f6358a7b676c4c00daee000309aa0fc78 100644 (file)
--- a/lmr/lmr.h
+++ b/lmr/lmr.h
@@ -14,7 +14,6 @@
 #include <stdbool.h>
 
 #include "pciutils.h"
-#include "lib/bitops.h"
 
 #define MARGIN_STEP_MS 1000
 
index 9e8508900fcdc8829bbd580144636708a4808791..036f0dc9e78c187bccca43bd83391b4d31616a3b 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "lib/pci.h"
 #include "lib/sysdep.h"
-#include "lib/bitops.h"
+#include "bitops.h"
 
 /*
  * gcc predefines macro __MINGW32__ for all MinGW targets.