OpenNSL API Guide and Reference Manual
Data Structures | Macros | Typedefs
types.h File Reference
#include <sal/compiler.h>

Go to the source code of this file.

Data Structures

union  any_t
 

Macros

#define BITS2BYTES(x)   (((x) + 7) / 8)
 
#define BITS2WORDS(x)   (((x) + 31) / 32)
 
#define BYTES2BITS(x)   ((x) * 8)
 
#define BYTES2WORDS(x)   (((x) + 3) / 4)
 
#define COUNTOF(ary)   ((int) (sizeof (ary) / sizeof ((ary)[0])))
 
#define DONT_CARE   0
 
#define FALSE   0
 
#define INT_TO_PTR(x)   ((void *)((sal_vaddr_t)(x)))
 
#define NULL   0
 
#define PTR_HI_TO_INT(x)   (0)
 
#define PTR_TO_INT(x)   ((uint32)(x))
 
#define PTR_TO_UINTPTR(x)   ((sal_vaddr_t)(x))
 
#define SAL_AXI_DEV_TYPE   0x00080 /* AXI device */
 
#define SAL_CPU_DEV_TYPE   0x00400 /* CPU device */
 
#define SAL_DEV_BDE_MASK   0xff000000
 
#define SAL_DEV_BUS_ALT   0x04000 /* Alternate access */
 
#define SAL_DEV_BUS_MSI   0x08000 /* Message-signaled interrupts */
 
#define SAL_DEV_BUS_RD_16BIT   0x01000 /* 16 bit reads on bus */
 
#define SAL_DEV_BUS_TYPE_MASK   0xf00ff /* Odd for historical reasons */
 
#define SAL_DEV_BUS_WR_16BIT   0x02000 /* 16 bit writes on bus */
 
#define SAL_DEV_FLAG_MASK   0x0f000
 
#define SAL_DEV_OP_EMMI_INIT   0x0fff1000
 
#define SAL_DEV_TYPE_MASK   0x00f00
 
#define SAL_EB_DEV_TYPE   0x00004 /* EB device */
 
#define SAL_EMMI_DEV_TYPE   0x10000 /* EMMI device */
 
#define SAL_ET_DEV_TYPE   SAL_MII_DEV_TYPE
 
#define SAL_ETHER_DEV_TYPE   0x00200 /* Ethernet device */
 
#define SAL_I2C_DEV_TYPE   0x00040 /* I2C device */
 
#define SAL_ICS_DEV_TYPE   0x00008 /* ICS device */
 
#define SAL_IP6_ADDR_FROM_UINT32(ip6, src)
 
#define SAL_IP6_ADDR_HALF_FROM_UINT32(ip6, src)
 
#define SAL_IP6_ADDR_HALF_TO_UINT32(ip6, dst)
 
#define SAL_IP6_ADDR_TO_UINT32(ip6, dst)
 
#define SAL_IPADDR_STR_LEN   16 /* Formatted IP address */
 
#define SAL_MAC_ADDR_FROM_UINT32(mac, src)
 
#define SAL_MAC_ADDR_FROM_UINT64(mac, src)
 
#define SAL_MAC_ADDR_LIST(mac)   mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]
 
#define SAL_MAC_ADDR_TO_UINT32(mac, dst)
 
#define SAL_MAC_ADDR_TO_UINT64(mac, dst)
 
#define SAL_MACADDR_STR_LEN   18 /* Formatted MAC address */
 
#define SAL_MII_DEV_TYPE   0x00010 /* MII device */
 
#define SAL_PCI_DEV_TYPE   0x00001 /* PCI device */
 
#define SAL_RCPU_DEV_TYPE   0x00020 /* RCPU device */
 
#define SAL_SPI_DEV_TYPE   0x00002 /* SPI device */
 
#define SAL_SWITCH_DEV_TYPE   0x00100 /* Switch device */
 
#define TRUE   1
 
#define UINTPTR_TO_PTR(x)   ((void *)(x))
 
#define VOL   volatile
 
#define WORDS2BITS(x)   ((x) * 32)
 
#define WORDS2BYTES(x)   ((x) * 4)
 

Typedefs

typedef signed short int16
 
typedef signed int int32
 
typedef COMPILER_INT64 int64
 
typedef signed char int8
 
typedef uint32 sal_ip_addr_t
 
typedef uint8 sal_mac_addr_t [6]
 
typedef uint32 sal_paddr_t
 
typedef uint32 sal_vaddr_t
 
typedef unsigned short uint16
 
typedef unsigned int uint32
 
typedef COMPILER_UINT64 uint64
 
typedef unsigned char uint8
 

Macro Definition Documentation

#define BITS2BYTES (   x)    (((x) + 7) / 8)

Definition at line 64 of file types.h.

#define BITS2WORDS (   x)    (((x) + 31) / 32)

Definition at line 65 of file types.h.

#define BYTES2BITS (   x)    ((x) * 8)

Definition at line 67 of file types.h.

#define BYTES2WORDS (   x)    (((x) + 3) / 4)

Definition at line 68 of file types.h.

#define COUNTOF (   ary)    ((int) (sizeof (ary) / sizeof ((ary)[0])))

Definition at line 73 of file types.h.

#define DONT_CARE   0

Definition at line 44 of file types.h.

#define FALSE   0
#define INT_TO_PTR (   x)    ((void *)((sal_vaddr_t)(x)))

Definition at line 88 of file types.h.

#define NULL   0
#define PTR_HI_TO_INT (   x)    (0)

Definition at line 85 of file types.h.

#define PTR_TO_INT (   x)    ((uint32)(x))

Definition at line 84 of file types.h.

#define PTR_TO_UINTPTR (   x)    ((sal_vaddr_t)(x))

Definition at line 90 of file types.h.

#define SAL_AXI_DEV_TYPE   0x00080 /* AXI device */

Definition at line 219 of file types.h.

#define SAL_CPU_DEV_TYPE   0x00400 /* CPU device */

Definition at line 226 of file types.h.

#define SAL_DEV_BDE_MASK   0xff000000

Definition at line 237 of file types.h.

#define SAL_DEV_BUS_ALT   0x04000 /* Alternate access */

Definition at line 232 of file types.h.

#define SAL_DEV_BUS_MSI   0x08000 /* Message-signaled interrupts */

Definition at line 233 of file types.h.

#define SAL_DEV_BUS_RD_16BIT   0x01000 /* 16 bit reads on bus */

Definition at line 230 of file types.h.

#define SAL_DEV_BUS_TYPE_MASK   0xf00ff /* Odd for historical reasons */

Definition at line 221 of file types.h.

#define SAL_DEV_BUS_WR_16BIT   0x02000 /* 16 bit writes on bus */

Definition at line 231 of file types.h.

#define SAL_DEV_FLAG_MASK   0x0f000

Definition at line 234 of file types.h.

#define SAL_DEV_OP_EMMI_INIT   0x0fff1000

Definition at line 243 of file types.h.

#define SAL_DEV_TYPE_MASK   0x00f00

Definition at line 227 of file types.h.

#define SAL_EB_DEV_TYPE   0x00004 /* EB device */

Definition at line 214 of file types.h.

#define SAL_EMMI_DEV_TYPE   0x10000 /* EMMI device */

Definition at line 220 of file types.h.

#define SAL_ET_DEV_TYPE   SAL_MII_DEV_TYPE

Definition at line 240 of file types.h.

#define SAL_ETHER_DEV_TYPE   0x00200 /* Ethernet device */

Definition at line 225 of file types.h.

#define SAL_I2C_DEV_TYPE   0x00040 /* I2C device */

Definition at line 218 of file types.h.

#define SAL_ICS_DEV_TYPE   0x00008 /* ICS device */

Definition at line 215 of file types.h.

#define SAL_IP6_ADDR_FROM_UINT32 (   ip6,
  src 
)
Value:
do {\
SAL_IP6_ADDR_HALF_FROM_UINT32(&((ip6)[8]), (src)); \
SAL_IP6_ADDR_HALF_FROM_UINT32((ip6), &((src)[2])); \
} while (0)

Definition at line 204 of file types.h.

#define SAL_IP6_ADDR_HALF_FROM_UINT32 (   ip6,
  src 
)
Value:
do {\
(ip6)[0] = (uint8) ((src)[1] >> 24); \
(ip6)[1] = (uint8) ((src)[1] >> 16 & 0xff); \
(ip6)[2] = (uint8) ((src)[1] >> 8 & 0xff); \
(ip6)[3] = (uint8) ((src)[1] & 0xff); \
(ip6)[4] = (uint8) ((src)[0] >> 24); \
(ip6)[5] = (uint8) ((src)[0] >> 16 & 0xff); \
(ip6)[6] = (uint8) ((src)[0] >> 8 & 0xff); \
(ip6)[7] = (uint8) ((src)[0] & 0xff); \
} while (0)

Definition at line 180 of file types.h.

#define SAL_IP6_ADDR_HALF_TO_UINT32 (   ip6,
  dst 
)
Value:
do {\
(dst)[1] = (((uint32)(ip6)[0]) << 24 | \
((uint32)(ip6)[1]) << 16 | \
((uint32)(ip6)[2]) << 8 | \
((uint32)(ip6)[3])); \
(dst)[0] = (((uint32)(ip6)[4]) << 24 | \
((uint32)(ip6)[5]) << 16 | \
((uint32)(ip6)[6]) << 8 | \
((uint32)(ip6)[7])); \
} while (0)

Definition at line 167 of file types.h.

#define SAL_IP6_ADDR_TO_UINT32 (   ip6,
  dst 
)
Value:
do {\
SAL_IP6_ADDR_HALF_TO_UINT32(&((ip6)[8]), (dst)); \
SAL_IP6_ADDR_HALF_TO_UINT32((ip6), &((dst)[2])); \
} while (0)

Definition at line 197 of file types.h.

#define SAL_IPADDR_STR_LEN   16 /* Formatted IP address */

Definition at line 113 of file types.h.

#define SAL_MAC_ADDR_FROM_UINT32 (   mac,
  src 
)
Value:
do {\
(mac)[0] = (uint8) ((src)[1] >> 8 & 0xff); \
(mac)[1] = (uint8) ((src)[1] & 0xff); \
(mac)[2] = (uint8) ((src)[0] >> 24); \
(mac)[3] = (uint8) ((src)[0] >> 16 & 0xff); \
(mac)[4] = (uint8) ((src)[0] >> 8 & 0xff); \
(mac)[5] = (uint8) ((src)[0] & 0xff); \
} while (0)

Definition at line 130 of file types.h.

#define SAL_MAC_ADDR_FROM_UINT64 (   mac,
  src 
)
Value:
do { \
uint32 _val[2]; \
COMPILER_64_TO_32_LO(_val[0], src); \
COMPILER_64_TO_32_HI(_val[1], src); \
SAL_MAC_ADDR_FROM_UINT32(mac, _val); \
} while (0)

Definition at line 150 of file types.h.

#define SAL_MAC_ADDR_LIST (   mac)    mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]

Definition at line 109 of file types.h.

#define SAL_MAC_ADDR_TO_UINT32 (   mac,
  dst 
)
Value:
do {\
(dst)[0] = (((uint32)(mac)[2]) << 24 | \
((uint32)(mac)[3]) << 16 | \
((uint32)(mac)[4]) << 8 | \
((uint32)(mac)[5])); \
(dst)[1] = (((uint32)(mac)[0]) << 8 | \
((uint32)(mac)[1])); \
} while (0)

Definition at line 118 of file types.h.

#define SAL_MAC_ADDR_TO_UINT64 (   mac,
  dst 
)
Value:
do { \
uint32 _val[2]; \
SAL_MAC_ADDR_TO_UINT32(mac, _val); \
COMPILER_64_SET(dst, _val[1], _val[0]); \
} while (0)

Definition at line 142 of file types.h.

#define SAL_MACADDR_STR_LEN   18 /* Formatted MAC address */

Definition at line 112 of file types.h.

#define SAL_MII_DEV_TYPE   0x00010 /* MII device */

Definition at line 216 of file types.h.

#define SAL_PCI_DEV_TYPE   0x00001 /* PCI device */

Definition at line 212 of file types.h.

#define SAL_RCPU_DEV_TYPE   0x00020 /* RCPU device */

Definition at line 217 of file types.h.

#define SAL_SPI_DEV_TYPE   0x00002 /* SPI device */

Definition at line 213 of file types.h.

#define SAL_SWITCH_DEV_TYPE   0x00100 /* Switch device */

Definition at line 224 of file types.h.

#define TRUE   1

Definition at line 32 of file types.h.

Referenced by example_is_dnx_device(), example_is_qmx_device(), and example_read_user_choice().

#define UINTPTR_TO_PTR (   x)    ((void *)(x))

Definition at line 91 of file types.h.

#define VOL   volatile

Definition at line 47 of file types.h.

#define WORDS2BITS (   x)    ((x) * 32)

Definition at line 70 of file types.h.

#define WORDS2BYTES (   x)    ((x) * 4)

Definition at line 71 of file types.h.

Typedef Documentation

typedef signed short int16

Definition at line 60 of file types.h.

typedef signed int int32

Definition at line 61 of file types.h.

Definition at line 62 of file types.h.

typedef signed char int8

Definition at line 59 of file types.h.

Definition at line 106 of file types.h.

typedef uint8 sal_mac_addr_t[6]

Definition at line 105 of file types.h.

Definition at line 75 of file types.h.

Definition at line 83 of file types.h.

typedef unsigned short uint16

Definition at line 55 of file types.h.

typedef unsigned int uint32

Definition at line 56 of file types.h.

Definition at line 57 of file types.h.

typedef unsigned char uint8

Definition at line 54 of file types.h.