Infineon Logo AIROC BTSDK v4.4 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
brcm_fw_types.h File Reference

Defines basic but size-specific types, and prohibits the use of certain constructs. More...

Macros

#define PAD_EMPTY_FUNCTION()
 
#define DIV_ROUND_UP(n, d)   ( ( (n) + (d)-1 ) / (d) )
 Macro to divide numerator by denominator, rounding up.
 
#define DIV_ROUND_NEAREST(n, d)   ( ( (n) + (d)/2 ) / (d) )
 Macro to divide numerator by denominator, rounding to the nearest number.
 
#define ABS(v)   ( ( (v) < 0 ) ? ( 0-(v) ) : (v) )
 Macro to obtain the absolute value of an integer.
 
#define MIN(a, b)   ( ( (a) < (b) ) ? (a) : (b) )
 Macro to obtain the minimum (smaller) of two numbers.
 
#define MAX(a, b)   ( ( (a) > (b) ) ? (a) : (b) )
 Macro to obtain the maximum (larger) of two numbers.
 
#define SWAP_ENDIAN_16(x)   ((((x) << 8) | (((x) >> 8) & 0xFF)))
 Macro to swap the endianness of a 16 bit value.
 
#define SWAP_ENDIAN_32(x)
 Macro to swap the endianness of a 32 bit value. More...
 
#define SWAP_ENDIAN_64(x)
 Macro to swap the endianness of a 64 bit value. More...
 
#define REG32(address)   ( *(volatile UINT32*)(address) )
 The REG32 macro is a convenient way to access a 32-bit hardware register. More...
 
#define TRUE   1
 Macro representing a boolean true condition. More...
 
#define FALSE   0
 Macro representing a boolean false condition.
 
#define IN   const
 A pseudo-qualifier on a pointer argument indicating that the parameter is an input, not output. More...
 
#define OUT
 A pseudo-qualifier on a pointer argument indicating that the parameter is an output, not input. More...
 
#define INOUT
 A pseudo-qualifier on a pointer argument indicating that the parameter is an input and output. More...
 
#define TAKES
 A pseudo-qualifier on a pointer argument to take possession from the caller. More...
 
#define GIVES
 A pseudo-qualifier on a pointer returned from a function to give ownership to the caller. More...
 
#define MAY_BE_STATIC
 A pseudo-qualifier to make static functions and variables to non static.
 
#define LITTLE_TO_CPU_ENDIAN_16(x)   SWAP_ENDIAN_16(x)
 Macro to convert a 16 bit little endian value to the CPU's endianness. More...
 
#define CPU_TO_LITTLE_ENDIAN_16(x)   SWAP_ENDIAN_16(x)
 Macro to convert a 16 bit value from CPU endianness to little endian. More...
 
#define BIG_TO_CPU_ENDIAN_16(x)   (x)
 Macro to convert a 16 bit big endian value to the CPU's endianness. More...
 
#define CPU_TO_BIG_ENDIAN_16(x)   (x)
 Macro to convert a 16 bit value from CPU endianness to big endian. More...
 
#define LITTLE_TO_CPU_ENDIAN_32(x)   SWAP_ENDIAN_32(x)
 Macro to convert a 32 bit little endian value to the CPU's endianness. More...
 
#define CPU_TO_LITTLE_ENDIAN_32(x)   SWAP_ENDIAN_32(x)
 Macro to convert a 32 bit value from CPU endianness to little endian. More...
 
#define BIG_TO_CPU_ENDIAN_32(x)   (x)
 Macro to convert a 32 bit big endian value to the CPU's endianness. More...
 
#define CPU_TO_BIG_ENDIAN_32(x)   (x)
 Macro to convert a 32 bit value from CPU endianness to big endian. More...
 
#define LITTLE_TO_CPU_ENDIAN_64(x)   SWAP_ENDIAN_64(x)
 Macro to convert a 64 bit little endian value to the CPU's endianness. More...
 
#define CPU_TO_LITTLE_ENDIAN_64(x)   SWAP_ENDIAN_64(x)
 Macro to convert a 64 bit value from CPU endianness to little endian. More...
 
#define BIG_TO_CPU_ENDIAN_64(x)   (x)
 Macro to convert a 64 bit big endian value to the CPU's endianness. More...
 
#define CPU_TO_BIG_ENDIAN_64(x)   (x)
 Macro to convert a 64 bit value from CPU endianness to big endian. More...
 
#define C_ASSERT(e)   typedef char __C_ASSERT__[(e)?1:-1]
 Macro to catch asserts during compilation time.
 
#define BYTE_PACKED
 
#define PACKED
 
#define BT_PRE_PACKED_STRUCT
 
#define BT_POST_PACKED_STRUCT   __attribute__((__packed__))
 
#define ALIGN4   __attribute__((aligned(4)))
 
#define PLACE_IN_ALWAYS_ON_RAM
 If always on memory is not supported, we don't need this at all, place anywhere.
 
#define PLACE_IN_ALWAYS_ON_UNINIT_RAM
 
#define PLACE_IN_LIMITED_RAM
 
#define PLACE_IN_EPDS_AON_RAM
 
#define PLACE_IN_EPDS_AON_UNINIT_RAM
 
#define PLACE_IN_MICRO_BCS_SRAM_VAR_AREA
 
#define __weak   __attribute__((weak))
 
#define PLACE_TEXT_IN_RAM   __attribute__((section(".text_in_ram")))
 
#define bool   DO NOT USE bool
 bool should not be used, so it is defined so as to generate a compilation error. More...
 
#define assert   DO NOT USE assert
 BOOL should not be used, so it is defined so as to generate a compilation error. More...
 
#define INLINE   inline
 

Typedefs

typedef unsigned char UINT8
 Unsigned 8-bit integer.
 
typedef signed char INT8
 Signed 8-bit integer.
 
typedef unsigned short int UINT16
 Unsigned 16-bit integer.
 
typedef signed short int INT16
 Signed 16-bit integer.
 
typedef unsigned int UINT32
 Unsigned 32-bit integer.
 
typedef signed int INT32
 Signed 32-bit integer.
 
typedef unsigned long long int UINT64
 Unsigned 64-bit integer.
 
typedef signed long long int INT64
 Signed 64-bit integer.
 
typedef unsigned char BYTE
 Byte type (unsigned 8-bit integer).
 
typedef unsigned int BOOL32
 Boolean type in its most efficient form, for use in function arguments and return values.
 
typedef unsigned char BOOL8
 Boolean type in its most size-efficient form, for use in structures.
 

Detailed Description

Defines basic but size-specific types, and prohibits the use of certain constructs.

Macro Definition Documentation

#define assert   DO NOT USE assert

BOOL should not be used, so it is defined so as to generate a compilation error.

This is in order to enforce the practice of using BOOL32 for efficiency in function arguments or return values, and BOOL8 for size efficiency in structures. The same is true of bool and BOOLEAN, which are ambiguous in the size vs. efficiency tradeoff and should not be used. BOOLEAN should not be used, so it is defined so as to generate a compilation error. This is in order to enforce the practice of using BOOL32 for efficiency in function arguments or return values, and BOOL8 for size efficiency in structures. The same is true of bool and BOOL, which are ambiguous in the size vs. efficiency tradeoff and should not be used. assert should not be used, so it is defined so as to generate a compilation error. This is because in the event of failure, we want to invoke our own debug facilities for robust diagnostic output. Use ASSERT instead.

#define BIG_TO_CPU_ENDIAN_16 (   x)    (x)

Macro to convert a 16 bit big endian value to the CPU's endianness.

For a big endian processor, the value is the same.

#define BIG_TO_CPU_ENDIAN_32 (   x)    (x)

Macro to convert a 32 bit big endian value to the CPU's endianness.

For a big endian processor, the value is the same.

#define BIG_TO_CPU_ENDIAN_64 (   x)    (x)

Macro to convert a 64 bit big endian value to the CPU's endianness.

For a big endian processor, the value is the same.

#define bool   DO NOT USE bool

bool should not be used, so it is defined so as to generate a compilation error.

This is in order to enforce the practice of using BOOL32 for efficiency in function arguments or return values, and BOOL8 for size efficiency in structures. The same is true of BOOL and BOOLEAN, which are ambiguous in the size vs. efficiency tradeoff and should not be used.

#define CPU_TO_BIG_ENDIAN_16 (   x)    (x)

Macro to convert a 16 bit value from CPU endianness to big endian.

For a big endian processor, the value is the same.

#define CPU_TO_BIG_ENDIAN_32 (   x)    (x)

Macro to convert a 32 bit value from CPU endianness to big endian.

For a big endian processor, the value is the same.

#define CPU_TO_BIG_ENDIAN_64 (   x)    (x)

Macro to convert a 64 bit value from CPU endianness to big endian.

For a big endian processor, the value is the same.

#define CPU_TO_LITTLE_ENDIAN_16 (   x)    SWAP_ENDIAN_16(x)

Macro to convert a 16 bit value from CPU endianness to little endian.

For a big endian processor, swap the two bytes.

#define CPU_TO_LITTLE_ENDIAN_32 (   x)    SWAP_ENDIAN_32(x)

Macro to convert a 32 bit value from CPU endianness to little endian.

For a big endian processor, swap the four bytes.

#define CPU_TO_LITTLE_ENDIAN_64 (   x)    SWAP_ENDIAN_64(x)

Macro to convert a 64 bit value from CPU endianness to little endian.

For a big endian processor, swap the four bytes.

#define GIVES

A pseudo-qualifier on a pointer returned from a function to give ownership to the caller.

The caller must takes possession of, and responsibility for freeing, the dynamically allocated block returned by the function. Such a function must indicate in its documentation what allocation mechanism was used, and thus what mechanism must be used to free it.

#define IN   const

A pseudo-qualifier on a pointer argument indicating that the parameter is an input, not output.

If the pointer can't be const, then it must be INOUT or TAKES. All pointer parameters must be IN, OUT, INOUT, or TAKES.

#define INOUT

A pseudo-qualifier on a pointer argument indicating that the parameter is an input and output.

All pointer parameters must be IN, OUT, INOUT, or TAKES. In a few cases, a function takes an input which it modifies but INOUT doesn't make sense if the function never returns. In such a case, the logical conclusion is typically that the function TAKES the input permanently.

#define LITTLE_TO_CPU_ENDIAN_16 (   x)    SWAP_ENDIAN_16(x)

Macro to convert a 16 bit little endian value to the CPU's endianness.

For a big endian processor, swap the two bytes.

#define LITTLE_TO_CPU_ENDIAN_32 (   x)    SWAP_ENDIAN_32(x)

Macro to convert a 32 bit little endian value to the CPU's endianness.

For a big endian processor, swap the four bytes.

#define LITTLE_TO_CPU_ENDIAN_64 (   x)    SWAP_ENDIAN_64(x)

Macro to convert a 64 bit little endian value to the CPU's endianness.

For a big endian processor, swap the four bytes.

#define OUT

A pseudo-qualifier on a pointer argument indicating that the parameter is an output, not input.

In such a case, the value before the call is irrelevant to the function and is ignored. If the function does use the input and modifies it, then the pointer should be INOUT. All pointer parameters must be IN, OUT, INOUT, or TAKES.

#define REG32 (   address)    ( *(volatile UINT32*)(address) )

The REG32 macro is a convenient way to access a 32-bit hardware register.

It merely casts the integer register address to a pointer to a volatile UINT32 and dereferences it.

#define SWAP_ENDIAN_32 (   x)
Value:
( (((x) & 0xFF000000) >> 24) | (((x) & 0x00FF0000) >> 8) | \
(((x) & 0x0000FF00) << 8) | (((x) & 0x000000FF) << 24) )

Macro to swap the endianness of a 32 bit value.

#define SWAP_ENDIAN_64 (   x)
Value:
( (((x) >> 56) & 0x00000000000000FFULL) | (((x) >> 40) & 0x000000000000FF00ULL) | \
(((x) >> 24) & 0x0000000000FF0000ULL) | (((x) >> 8) & 0x00000000FF000000ULL) | \
(((x) << 8) & 0x000000FF00000000ULL) | (((x) << 24) & 0x0000FF0000000000ULL) | \
(((x) << 40) & 0x00FF000000000000ULL) | (((x) << 56) & 0xFF00000000000000ULL) )

Macro to swap the endianness of a 64 bit value.

#define TAKES

A pseudo-qualifier on a pointer argument to take possession from the caller.

The function takes possession of, and responsibility for freeing, the dynamically allocated block passed in a parameter with this qualifier. Such a function must indicate in its documentation what allocation mechanism must have been used to allocate the block. From the caller's perspective, The object pointed to no longer exists after the call, since it may have been released already. All pointer parameters must be IN, OUT, INOUT, or TAKES. In a few cases, a function takes an input which it modifies but INOUT doesn't make sense if the function never returns. In such a case, the logical conclusion is typically that the function TAKES the input permanently.

#define TRUE   1

Macro representing a boolean true condition.

Note that it is appropriate to return TRUE, but not appropriate to compare against it because any non-zero value can legitimately be used to represent truth, especially in optimized code. Instead of if(condition == TRUE) one should simply use if(condition).