SWARM-Bot Firmware  v1.0
Mobile robot OS - Embedded C/C++
compiler.h File Reference

Commonly used includes, types and macros. More...

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <parts.h>
#include "interrupt.h"
#include "progmem.h"
Include dependency graph for compiler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define UNUSED(v)   (void)(v)
 Marking v as a unused parameter or value. More...
 
#define unused(v)   do { (void)(v); } while(0)
 Marking v as a unused parameter or value. More...
 
#define barrier()   asm ("")
 Memory barrier. More...
 
#define COMPILER_PACK_RESET(alignment)
 
#define COMPILER_PACK_SET(alignment)
 
#define Assert(expr)   ((void) 0)
 This macro is used to test fatal errors. More...
 
#define CMD_ID_OCTET   (0)
 
#define CPU_ENDIAN_TO_LE16(x)   (x)
 
#define CPU_ENDIAN_TO_LE32(x)   (x)
 
#define CPU_ENDIAN_TO_LE64(x)   (x)
 
#define LE16_TO_CPU_ENDIAN(x)   (x)
 
#define LE32_TO_CPU_ENDIAN(x)   (x)
 
#define LE64_TO_CPU_ENDIAN(x)   (x)
 
#define CLE16_TO_CPU_ENDIAN(x)   (x)
 
#define CLE32_TO_CPU_ENDIAN(x)   (x)
 
#define CLE64_TO_CPU_ENDIAN(x)   (x)
 
#define CCPU_ENDIAN_TO_LE16(x)   (x)
 
#define CCPU_ENDIAN_TO_LE32(x)   (x)
 
#define CCPU_ENDIAN_TO_LE64(x)   (x)
 
#define MEMCPY_ENDIAN   memcpy
 
#define PGM_READ_BLOCK(dst, src, len)   memcpy_P((dst), (src), (len))
 
#define Swap16(u16)
 Toggles the endianism of u16 (by swapping its bytes). More...
 
#define Swap32(u32)
 Toggles the endianism of u32 (by swapping its bytes). More...
 
#define Swap64(u64)
 Toggles the endianism of u64 (by swapping its bytes). More...
 
MCU Endianism Handling
#define MSB(u16)   (((uint8_t* )&u16)[1])
 
#define LSB(u16)   (((uint8_t* )&u16)[0])
 

Typedefs

typedef uint8_t U8
 8-bit unsigned integer. More...
 
typedef uint16_t U16
 16-bit unsigned integer. More...
 
typedef uint32_t U32
 32-bit unsigned integer. More...
 
typedef unsigned long long int U64
 64-bit unsigned integer. More...
 

Detailed Description

Commonly used includes, types and macros.

Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.

\asf_license_start

Definition in file compiler.h.

Macro Definition Documentation

◆ Assert

#define Assert (   expr)    ((void) 0)

This macro is used to test fatal errors.

The macro tests if the expression is false. If it is, a fatal error is detected and the application hangs up. If TEST_SUITE_DEFINE_ASSERT_MACRO is defined, a unit test version of the macro is used, to allow execution of further tests after a false expression.

Parameters
exprExpression to evaluate and supposed to be nonzero.

◆ barrier

#define barrier ( )    asm ("")

Memory barrier.

◆ Swap16

#define Swap16 (   u16)
Value:
((U16)(((U16)(u16) >> 8) |\
((U16)(u16) << 8)))
uint16_t U16
16-bit unsigned integer.
Definition: compiler.h:301

Toggles the endianism of u16 (by swapping its bytes).

Parameters
u16U16 of which to toggle the endianism.
Returns
Value resulting from u16 with toggled endianism.
Note
More optimized if only used with values known at compile time.

◆ Swap32

#define Swap32 (   u32)
Value:
((U32)(((U32)Swap16((U32)(u32) >> 16)) |\
((U32)Swap16((U32)(u32)) << 16)))
uint32_t U32
32-bit unsigned integer.
Definition: compiler.h:302
#define Swap16(u16)
Toggles the endianism of u16 (by swapping its bytes).
Definition: compiler.h:313

Toggles the endianism of u32 (by swapping its bytes).

Parameters
u32U32 of which to toggle the endianism.
Returns
Value resulting from u32 with toggled endianism.
Note
More optimized if only used with values known at compile time.

◆ Swap64

#define Swap64 (   u64)
Value:
((U64)(((U64)Swap32((U64)(u64) >> 32)) |\
((U64)Swap32((U64)(u64)) << 32)))
unsigned long long int U64
64-bit unsigned integer.
Definition: compiler.h:303
#define Swap32(u32)
Toggles the endianism of u32 (by swapping its bytes).
Definition: compiler.h:324

Toggles the endianism of u64 (by swapping its bytes).

Parameters
u64U64 of which to toggle the endianism.
Returns
Value resulting from u64 with toggled endianism.
Note
More optimized if only used with values known at compile time.

◆ UNUSED

#define UNUSED (   v)    (void)(v)

Marking v as a unused parameter or value.

◆ unused

#define unused (   v)    do { (void)(v); } while(0)

Marking v as a unused parameter or value.

Typedef Documentation

◆ U16

typedef uint16_t U16

16-bit unsigned integer.

◆ U32

typedef uint32_t U32

32-bit unsigned integer.

◆ U64

typedef unsigned long long int U64

64-bit unsigned integer.

◆ U8

typedef uint8_t U8

8-bit unsigned integer.