Data Accelerator Offload
|
Go to the source code of this file.
Macros | |
#define | DAO_FREE(ptr) |
#define | DAO_ROUNDUP(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) |
#define | DAO_ROUNDDOWN(x, y) ((x / y) * y) |
#define | DAO_BIT(nr) (1UL << (nr)) |
#define | DAO_BIT_ULL(nr) (1ULL << (nr)) |
#define | DAO_BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) |
#define | DAO_GENMASK_ULL(h, l) (((~0ULL) << (l)) & (~0ULL >> (DAO_BITS_PER_LONG_LONG - 1 - (h)))) |
#define | DAO_STATIC_ASSERT(s) _Static_assert(s, #s) |
#define | DAO_TAILQ_FOREACH_SAFE(var, head, field, tvar) |
Functions | |
static bool | dao_check_bit_is_set (int n, int pos) |
int | dao_pci_bdf_to_hw_func (const char *pci_bdf) |
static volatile void * | dao_dev_memcpy (volatile void *d, const volatile void *s, size_t l) |
static void | dao_dev_memset (volatile void *d, uint8_t val, size_t l) |
static void | dao_dev_memzero (volatile void *d, size_t l) |
DAO Utils
It includes some useful utilities for efficient implementation.
Definition in file dao_util.h.
#define DAO_FREE | ( | ptr | ) |
Free a pointer and assign to NULL
Definition at line 22 of file dao_util.h.
#define DAO_ROUNDUP | ( | x, | |
y | |||
) | ((((x) + ((y) - 1)) / (y)) * (y)) |
Roundup x to be exact multiple of y
Definition at line 33 of file dao_util.h.
#define DAO_ROUNDDOWN | ( | x, | |
y | |||
) | ((x / y) * y) |
Round-down x to be exact multiple of y
Definition at line 40 of file dao_util.h.
#define DAO_BIT | ( | nr | ) | (1UL << (nr)) |
Bit in unsigned long.
Definition at line 47 of file dao_util.h.
#define DAO_BIT_ULL | ( | nr | ) | (1ULL << (nr)) |
Bit in unsigned long long.
Definition at line 54 of file dao_util.h.
#define DAO_BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * 8) |
Bits in unsigned long long.
Definition at line 61 of file dao_util.h.
#define DAO_GENMASK_ULL | ( | h, | |
l | |||
) | (((~0ULL) << (l)) & (~0ULL >> (DAO_BITS_PER_LONG_LONG - 1 - (h)))) |
Unsigned long long bitmask with bits set between high and low positions.
Definition at line 68 of file dao_util.h.
#define DAO_STATIC_ASSERT | ( | s | ) | _Static_assert(s, #s) |
STATIC ASSERT API
Definition at line 75 of file dao_util.h.
#define DAO_TAILQ_FOREACH_SAFE | ( | var, | |
head, | |||
field, | |||
tvar | |||
) |
This macro permits both remove and free var within the loop safely.
Definition at line 82 of file dao_util.h.
|
inlinestatic |
Check if bit is set in a no
Check if bit at given position is set for a given no.
n | Input number |
pos | Bit position |
Definition at line 95 of file dao_util.h.
int dao_pci_bdf_to_hw_func | ( | const char * | pci_bdf | ) |
Derive HW function from its PCI BDF
Derive the Hardware func component from its PCI BDF notation
pci_bdf | PCI BDF source string |
< | 0 Failure > 0 Success: hw function value |
|
inlinestatic |
API to memcpy on volatile memory
d | Destination location |
s | Source location |
l | Length in bytes. |
Definition at line 126 of file dao_util.h.
|
inlinestatic |
API to memset on volatile memory
d | Destination location. |
val | Value to memset with. |
l | Length in bytes. |
Definition at line 152 of file dao_util.h.
|
inlinestatic |
API to zero on volatile memory
d | Destination location. |
l | Length in bytes. |
Definition at line 173 of file dao_util.h.