1
2
3
4
5
6
7#ifndef __ECORE_UTILS_H__
8#define __ECORE_UTILS_H__
9
10
11
12
13
14#define PTR_LO(x) ((u32)(((osal_uintptr_t)(x)) & 0xffffffff))
15#define PTR_HI(x) ((u32)((((osal_uintptr_t)(x)) >> 16) >> 16))
16
17#define DMA_LO(x) ((u32)(((dma_addr_t)(x)) & 0xffffffff))
18#define DMA_HI(x) ((u32)(((dma_addr_t)(x)) >> 32))
19
20#define DMA_LO_LE(x) OSAL_CPU_TO_LE32(DMA_LO(x))
21#define DMA_HI_LE(x) OSAL_CPU_TO_LE32(DMA_HI(x))
22
23
24
25
26#define DMA_REGPAIR_LE(x, val) (x).hi = DMA_HI_LE((val)); \
27 (x).lo = DMA_LO_LE((val))
28
29#define HILO_GEN(hi, lo, type) ((((type)(hi)) << 32) + (lo))
30#define HILO_DMA(hi, lo) HILO_GEN(hi, lo, dma_addr_t)
31#define HILO_64(hi, lo) HILO_GEN(hi, lo, u64)
32#define HILO_DMA_REGPAIR(regpair) (HILO_DMA(regpair.hi, regpair.lo))
33#define HILO_64_REGPAIR(regpair) (HILO_64(regpair.hi, regpair.lo))
34
35#endif
36