/* Copyright (C) 2006 Ikanos Communications * See IKANOS_PROP_LICENSE.txt for license information. */ #ifndef __DEFINES_H__ #define __DEFINES_H__ # include # include #ifndef INT8 typedef int8_t INT8; #endif #ifndef INT16 typedef int16_t INT16; #endif #ifndef INT32 typedef int32_t INT32; #endif #ifndef UINT16 typedef u_int16_t UINT16; #endif #ifndef UINT32 typedef u_int32_t UINT32; #endif #ifndef UINT8 typedef u_int8_t UINT8; #endif #ifndef CHAR typedef char CHAR; #endif #ifndef VOID typedef void VOID; #endif #ifndef UINT64 typedef u_int64_t UINT64; #endif #ifndef UCHAR typedef u_char UCHAR; #endif #ifndef BOOL typedef unsigned char BOOL; #endif #ifndef UINT typedef unsigned int UINT; #endif #ifndef USHORT typedef unsigned short USHORT; #endif #ifndef INT typedef int INT; #endif #ifndef ULONG typedef unsigned long ULONG; #endif typedef void (*FUNCPTR)(void); # define WAIT 0x00000001 # define NOWAIT 0x00000002 # define SUCCESS 0 # define FAILURE (-1) # ifndef NULL # define NULL (void *) 0 # endif # ifndef TRUE # define TRUE (BOOL) 1 # endif # ifndef FALSE # define FALSE (BOOL) 0 # endif # define MSECPERSEC 1000 # define PRI_HIGH 1 # define PRI_LOW 2 # define PRI_DMA 3 #ifndef PHYS_TO_K1 # define PHYS_TO_K1 KSEG1ADDR #endif #ifndef K0_TO_K1 # define K0_TO_K1 KSEG1ADDR #endif #ifndef K1_TO_K1 # define K1_TO_K0 KSEG0ADDR #endif /* Prevent the 32->64->32 bit madness from addrspace.h */ #if defined(PHYS_TO_K0) # undef PHYS_TO_K0 #endif #define PHYS_TO_K0 KSEG0ADDR #ifndef K0_TO_PHYS # define K0_TO_PHYS CPHYSADDR #endif #ifndef K1_TO_PHYS # define K1_TO_PHYS CPHYSADDR #endif # define SETBIT(var, bit, val) if (val) var |= (1 << bit ## _BIT ); else var &= ~(1 << bit ## _BIT) # define GETBIT(var, bit) (((var) >> bit ## _BIT) & 0x1) # define ZEROMASK(fld) ((1 << (fld ## _LEN)) - 1) # define FLDMASK(fld) (ZEROMASK(fld) << (fld ## _FST)) # define SETFIELD(var, fld, val) (var = (var & ~FLDMASK(fld)) | (((val) & ZEROMASK(fld)) << fld ## _FST)) # define GETFIELD(var, fld) (((var) & FLDMASK(fld)) >> fld ## _FST) // Local additions to make register setting simpler # define VAL(bit) (1 << (bit ## _BIT)) # define bcopy(s,d,l) memmove(d,s,l) #endif // __DEFINES_H__