Contiki 2.5
platform-common.h File Reference

See Platform_common for detailed documentation. More...

Go to the source code of this file.

Macros

Generic Types
#define TRUE   1
 An alias for one, used for clarity.
 
#define FALSE   0
 An alias for zero, used for clarity.
 
#define NULL   ((void *)0)
 The null pointer.
 
Bit Manipulation Macros
#define BIT(x)   (1U << (x))
 Useful to reference a single bit of a byte.
 
#define BIT32(x)   (((int32u) 1) << (x))
 Useful to reference a single bit of an int32u type.
 
#define SETBIT(reg, bit)   reg |= BIT(bit)
 Sets bit in the reg register or byte. More...
 
#define SETBITS(reg, bits)   reg |= (bits)
 Sets the bits in the reg register or the byte as specified in the bitmask bits. More...
 
#define CLEARBIT(reg, bit)   reg &= ~(BIT(bit))
 Clears a bit in the reg register or byte. More...
 
#define CLEARBITS(reg, bits)   reg &= ~(bits)
 Clears the bits in the reg register or byte as specified in the bitmask bits. More...
 
#define READBIT(reg, bit)   (reg & (BIT(bit)))
 Returns the value of bit within the register or byte reg.
 
#define READBITS(reg, bits)   (reg & (bits))
 Returns the value of the bitmask bits within the register or byte reg.
 
Byte Manipulation Macros
#define LOW_BYTE(n)   ((int8u)((n) & 0xFF))
 Returns the low byte of the 16-bit value n as an int8u.
 
#define HIGH_BYTE(n)   ((int8u)(LOW_BYTE((n) >> 8)))
 Returns the high byte of the 16-bit value n as an int8u.
 
#define HIGH_LOW_TO_INT(high, low)
 Returns the value built from the two int8u values high and low.
 
#define BYTE_0(n)   ((int8u)((n) & 0xFF))
 Returns the low byte of the 32-bit value n as an int8u.
 
#define BYTE_1(n)   ((int8u)(BYTE_0((n) >> 8)))
 Returns the second byte of the 32-bit value n as an int8u.
 
#define BYTE_2(n)   ((int8u)(BYTE_0((n) >> 16)))
 Returns the third byte of the 32-bit value n as an int8u.
 
#define BYTE_3(n)   ((int8u)(BYTE_0((n) >> 24)))
 Returns the high byte of the 32-bit value n as an int8u.
 
Time Manipulation Macros
#define elapsedTimeInt8u(oldTime, newTime)   ((int8u) ((int8u)(newTime) - (int8u)(oldTime)))
 Returns the elapsed time between two 8 bit values. More...
 
#define elapsedTimeInt16u(oldTime, newTime)   ((int16u) ((int16u)(newTime) - (int16u)(oldTime)))
 Returns the elapsed time between two 16 bit values. More...
 
#define elapsedTimeInt32u(oldTime, newTime)   ((int32u) ((int32u)(newTime) - (int32u)(oldTime)))
 Returns the elapsed time between two 32 bit values. More...
 
#define MAX_INT8U_VALUE   0xFF
 Returns TRUE if t1 is greater than t2. More...
 
#define timeGTorEqualInt8u(t1, t2)   (elapsedTimeInt8u(t2, t1) <= ((MAX_INT8U_VALUE + 1) / 2))
 
#define MAX_INT16U_VALUE   0xFFFF
 Returns TRUE if t1 is greater than t2. More...
 
#define timeGTorEqualInt16u(t1, t2)   (elapsedTimeInt16u(t2, t1) <= ((MAX_INT16U_VALUE + 1) / 2))
 
#define MAX_INT32U_VALUE   0xFFFFFFFF
 Returns TRUE if t1 is greater than t2. More...
 
#define timeGTorEqualInt32u(t1, t2)   (elapsedTimeInt32u(t2, t1) <= ((MAX_INT32U_VALUE + 1) / 2))
 

Detailed Description

See Platform_common for detailed documentation.

Definition in file platform-common.h.