Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

Useful Macros - otStudio useful macro definitions
[Definitions automatically generated by otStudio]


Defines

#define TRACE(format,)   printf( "%s::%s(%d)" format, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__ )
 Simple trace method.
#define BIT(x)   (1<<(x))
 Bit weight.
#define SETBIT(x, p)   ((x)|(1<<(p)))
 Set a bit in the word.
#define CLEARBIT(x, p)   ((x)&(~(1<<(p))))
 Clear a bit in the word.
#define GETBIT(x, p)   (((x)>>(p))&1)
 Get a bit value of a word.
#define TOGGLEBIT(x, p)   ((x)^(1<<(p)))
 Toggle a bit in a word.
#define SSYNC   asm("ssync;")
 Cache killer.
#define NOP   asm("nop;")
 1 clock delay
#define DI   asm("cli R5;")
 Disable interrupt.
#define EI   asm("sti R5;")
 Enable interrupt.
#define LF   10
 Line feed.
#define CR   13
 Carriage return.
#define MIN(a, b)   (((a) < (b)) ? (a) : (b))
 Minimum value.
#define MAX(a, b)   (((a) < (b)) ? (a) : (b))
 Maximum value.
#define SWAP(a, b)   { U32 t = a; a = b; b = t; }
 Swap 32 bit variables contents.
#define abs(x)   ((x)<0 ? -(x) : (x))
 Absolute value.
#define constrain(amt, low, high)   ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
 Constrains a number to be within a range.
#define bitRead(value, bit)   (((value) >> (bit)) & 0x01)
#define bitSet(value, bit)   ((value) |= (1UL << (bit)))
#define bitClear(value, bit)   ((value) &= ~(1UL << (bit)))
#define bitWrite(value, bit, bitvalue)   (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
#define NULL   0
 Null pointer.
#define EOF   -1
 End-of-File, It is a macro definition of type int that expands into a negative integral constant expression (generally, -1).

Define Documentation

#define abs  )     ((x)<0 ? -(x) : (x))
 

#define BIT  )     (1<<(x))
 

#define bitClear value,
bit   )     ((value) &= ~(1UL << (bit)))
 

#define bitRead value,
bit   )     (((value) >> (bit)) & 0x01)
 

#define bitSet value,
bit   )     ((value) |= (1UL << (bit)))
 

#define bitWrite value,
bit,
bitvalue   )     (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
 

#define CLEARBIT x,
 )     ((x)&(~(1<<(p))))
 

#define constrain amt,
low,
high   )     ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
 

#define CR   13
 

#define DI   asm("cli R5;")
 

#define EI   asm("sti R5;")
 

#define EOF   -1
 

#define GETBIT x,
 )     (((x)>>(p))&1)
 

#define LF   10
 

#define MAX a,
 )     (((a) < (b)) ? (a) : (b))
 

#define MIN a,
 )     (((a) < (b)) ? (a) : (b))
 

#define NOP   asm("nop;")
 

#define NULL   0
 

#define SETBIT x,
 )     ((x)|(1<<(p)))
 

#define SSYNC   asm("ssync;")
 

#define SWAP a,
 )     { U32 t = a; a = b; b = t; }
 

#define TOGGLEBIT x,
 )     ((x)^(1<<(p)))
 

#define TRACE format   )     printf( "%s::%s(%d)" format, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__ )
 

footer

otStudio - Library Reference - (C) 2020-23 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0