18 lines
578 B
C
18 lines
578 B
C
#pragma once
|
|
|
|
#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a)-1)
|
|
#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
|
|
|
|
/* @a is a power of 2 value */
|
|
#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
|
|
#define ALIGN_DOWN(x, a) __ALIGN_KERNEL((x) - ((a)-1), (a))
|
|
#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
|
|
#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
|
|
#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a)-1)) == 0)
|
|
|
|
// Virtual address
|
|
typedef unsigned long vaddr_t;
|
|
|
|
// Physical address
|
|
typedef unsigned long paddr_t;
|