Commonly used includes, types and macros.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
#include <avr/io.h>
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <parts.h>
#include "unit_test/suite.h"
#include "interrupt.h"
#include "progmem.h"
Macros | |||
#define | __always_inline inline __attribute__((__always_inline__)) | ||
The function should always be inlined. More... | |||
#define | __always_optimize __attribute__((optimize(3))) | ||
The function should always be optimized. More... | |||
#define | ADDR_COPY_DST_SRC_16(dst, src) memcpy((&(dst)), (&(src)), sizeof(uint16_t)) | ||
#define | ADDR_COPY_DST_SRC_64(dst, src) memcpy((&(dst)), (&(src)), sizeof(uint64_t)) | ||
#define | barrier() asm volatile("" ::: "memory") | ||
Memory barrier. More... | |||
#define | CCPU_ENDIAN_TO_LE16(x) (x) | ||
#define | CCPU_ENDIAN_TO_LE32(x) (x) | ||
#define | CCPU_ENDIAN_TO_LE64(x) (x) | ||
#define | CLE16_TO_CPU_ENDIAN(x) (x) | ||
#define | CLE32_TO_CPU_ENDIAN(x) (x) | ||
#define | CLE64_TO_CPU_ENDIAN(x) (x) | ||
#define | CMD_ID_OCTET (0) | ||
#define | COMPILER_PACK_RESET(alignment) | ||
#define | COMPILER_PACK_SET(alignment) | ||
#define | convert_16_bit_to_byte_address(value, data) ((*(uint16_t *)(data)) = (uint16_t)(value)) | ||
#define | convert_16_bit_to_byte_array(value, data) ((*(uint16_t *)(data)) = (uint16_t)(value)) | ||
#define | convert_32_bit_to_byte_array(value, data) ((*(uint32_t *)(data)) = (uint32_t)(value)) | ||
#define | convert_64_bit_to_byte_array(value, data) memcpy((data), (&(value)), sizeof(uint64_t)) | ||
#define | convert_byte_array_to_16_bit(data) (*(uint16_t *)(data)) | ||
#define | convert_byte_array_to_32_bit(data) (*(uint32_t *)(data)) | ||
#define | convert_byte_array_to_64_bit(data) (*(uint64_t *)(data)) | ||
#define | convert_spec_16_bit_to_byte_array(value, data) ((*(uint16_t *)(data)) = (uint16_t)(value)) | ||
#define | CPU_ENDIAN_TO_LE16(x) (x) | ||
#define | CPU_ENDIAN_TO_LE32(x) (x) | ||
#define | CPU_ENDIAN_TO_LE64(x) (x) | ||
#define | FLASH_DECLARE(x) const x __attribute__((__progmem__)) | ||
#define | FLASH_EXTERN(x) extern const x | ||
#define | FORCE_INLINE(type, name,...) | ||
#define | FUNC_PTR void * | ||
#define | LE16_TO_CPU_ENDIAN(x) (x) | ||
#define | LE32_TO_CPU_ENDIAN(x) (x) | ||
#define | LE64_TO_CPU_ENDIAN(x) (x) | ||
#define | MEMCPY_ENDIAN memcpy | ||
#define | nop() do { __asm__ __volatile__ ("nop"); } while (0) | ||
#define | PGM_READ_BLOCK(dst, src, len) memcpy_P((dst), (src), (len)) | ||
#define | PGM_READ_BYTE(x) pgm_read_byte(x) | ||
#define | PGM_READ_WORD(x) pgm_read_word(x) | ||
#define | SHORTENUM __attribute__ ((packed)) | ||
#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... | |||
#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... | |||
MCU Endianism Handling | |||
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.
| |||
#define | MSB(u16) (((uint8_t* )&u16)[1]) | ||
#define | LSB(u16) (((uint8_t* )&u16)[0]) | ||
Typedefs | |
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... | |
typedef uint8_t | U8 |
8-bit unsigned integer. More... | |
#define __always_inline inline __attribute__((__always_inline__)) |
The function should always be inlined.
This annotation instructs the compiler to ignore its inlining heuristics and inline the function no matter how big it thinks it becomes.
#define __always_optimize __attribute__((optimize(3))) |
The function should always be optimized.
This annotation instructs the compiler to ignore global optimization settings and always compile the function with a high level of optimization.
#define ADDR_COPY_DST_SRC_16 | ( | dst, | |
src | |||
) | memcpy((&(dst)), (&(src)), sizeof(uint16_t)) |
#define ADDR_COPY_DST_SRC_64 | ( | dst, | |
src | |||
) | memcpy((&(dst)), (&(src)), sizeof(uint64_t)) |
#define barrier | ( | ) | asm volatile("" ::: "memory") |
Memory barrier.
Referenced by __portable_avr_delay_cycles(), and cpu_irq_restore().
#define CCPU_ENDIAN_TO_LE16 | ( | x | ) | (x) |
#define CCPU_ENDIAN_TO_LE32 | ( | x | ) | (x) |
#define CCPU_ENDIAN_TO_LE64 | ( | x | ) | (x) |
#define CLE16_TO_CPU_ENDIAN | ( | x | ) | (x) |
#define CLE32_TO_CPU_ENDIAN | ( | x | ) | (x) |
#define CLE64_TO_CPU_ENDIAN | ( | x | ) | (x) |
#define CMD_ID_OCTET (0) |
#define COMPILER_PACK_RESET | ( | alignment | ) |
#define COMPILER_PACK_SET | ( | alignment | ) |
#define convert_spec_16_bit_to_byte_array | ( | value, | |
data | |||
) | ((*(uint16_t *)(data)) = (uint16_t)(value)) |
#define CPU_ENDIAN_TO_LE16 | ( | x | ) | (x) |
#define CPU_ENDIAN_TO_LE32 | ( | x | ) | (x) |
#define CPU_ENDIAN_TO_LE64 | ( | x | ) | (x) |
#define FLASH_DECLARE | ( | x | ) | const x __attribute__((__progmem__)) |
#define FLASH_EXTERN | ( | x | ) | extern const x |
#define FORCE_INLINE | ( | type, | |
name, | |||
... | |||
) |
#define FUNC_PTR void * |
#define LE16_TO_CPU_ENDIAN | ( | x | ) | (x) |
#define LE32_TO_CPU_ENDIAN | ( | x | ) | (x) |
#define LE64_TO_CPU_ENDIAN | ( | x | ) | (x) |
#define LSB | ( | u16 | ) | (((uint8_t* )&u16)[0]) |
#define MEMCPY_ENDIAN memcpy |
#define MSB | ( | u16 | ) | (((uint8_t* )&u16)[1]) |
#define nop | ( | ) | do { __asm__ __volatile__ ("nop"); } while (0) |
#define PGM_READ_BLOCK | ( | dst, | |
src, | |||
len | |||
) | memcpy_P((dst), (src), (len)) |
#define PGM_READ_BYTE | ( | x | ) | pgm_read_byte(x) |
#define PGM_READ_WORD | ( | x | ) | pgm_read_word(x) |
#define SHORTENUM __attribute__ ((packed)) |
#define Swap16 | ( | u16 | ) |
Toggles the endianism of u16 (by swapping its bytes).
u16 | U16 of which to toggle the endianism. |
#define Swap32 | ( | u32 | ) |
Toggles the endianism of u32 (by swapping its bytes).
u32 | U32 of which to toggle the endianism. |
#define Swap64 | ( | u64 | ) |
Toggles the endianism of u64 (by swapping its bytes).
u64 | U64 of which to toggle the endianism. |
#define UNUSED | ( | v | ) | (void)(v) |
Marking v as a unused parameter or value.
Referenced by led_handling(), nlde_data_confirm(), nlme_get_confirm(), nlme_rx_enable_confirm(), nlme_set_confirm(), nlme_unpair_confirm(), nlme_unpair_indication(), nlme_update_key_confirm(), nwk_ch_agility_confirm(), nwk_ch_agility_indication(), pbp_allow_pairing(), sd_mmc_removal(), sleepmgr_lock_mode(), sleepmgr_unlock_mode(), start_awake_timer_cb(), start_cmd_disc_cb(), start_warm_reset_cb(), vendor_data_confirm(), vendor_data_ind(), vendor_data_request(), zrc_cmd_confirm(), zrc_cmd_disc_confirm(), and zrc_cmd_indication().
#define unused | ( | v | ) | do { (void)(v); } while(0) |
Marking v as a unused parameter or value.
typedef uint16_t U16 |
16-bit unsigned integer.
typedef uint32_t U32 |
32-bit unsigned integer.
typedef unsigned long long int U64 |
64-bit unsigned integer.
typedef uint8_t U8 |
8-bit unsigned integer.