Skip to content

Commit

Permalink
cpu/sam0_common: samr30: add integer literal macros
Browse files Browse the repository at this point in the history
All the more recent vendor files have them, so include them for samr30 too.
It is expected for this to become obsolete with the next vendor file update.
  • Loading branch information
benpicco committed Feb 25, 2020
1 parent fd9a247 commit a0ac238
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cpu/sam0_common/include/vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ RIOT. The following replacements were done for compatibility with newlib:
find -name '*.h' -exec sed -ie 's/_U(/_U_(/g' {} \;
find -name '*.h' -exec sed -ie 's/_L(/_L_(/g' {} \;

## SAMR30 files

samr30: `Atmel.SAMR30_DFP.1.1.35.atpack`

Each atpack has an include subdirectory with the files we copy into
RIOT.

The PIN_($pin)_EIC_EXTINT_NUM macos and integer literal macros (_L_() etc)
were added manually.
It is expected for those to appear in the next atpack release by
Microchip.

If *_EIC_EXTINT_NUM macros are missing after an update, GPIO interrupts
not work. See 93d536f76 for how to generate them.

## SAMR34 files

samr34: `Atmel.SAMR34_DFP.1.0.11.atpacks`
Expand Down
17 changes: 17 additions & 0 deletions cpu/sam0_common/include/vendor/samr30/include/samr30e18a.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,23 @@ typedef volatile uint8_t RwReg8; /**< Read-Write 8-bit register (volati
#define REG_ACCESS(type, address) (address) /**< Assembly code: Register address */
#endif

#if !defined(SKIP_INTEGER_LITERALS)
#if defined(_U_) || defined(_L_) || defined(_UL_)
#error "Integer Literals macros already defined elsewhere"
#endif

#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
/* Macros that deal with adding suffixes to integer literal constants for C/C++ */
#define _U_(x) x ## U /**< C code: Unsigned integer literal constant value */
#define _L_(x) x ## L /**< C code: Long integer literal constant value */
#define _UL_(x) x ## UL /**< C code: Unsigned Long integer literal constant value */
#else /* Assembler */
#define _U_(x) x /**< Assembler: Unsigned integer literal constant value */
#define _L_(x) x /**< Assembler: Long integer literal constant value */
#define _UL_(x) x /**< Assembler: Unsigned Long integer literal constant value */
#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
#endif /* SKIP_INTEGER_LITERALS */

/* ************************************************************************** */
/** CMSIS DEFINITIONS FOR SAMR30E18A */
/* ************************************************************************** */
Expand Down
17 changes: 17 additions & 0 deletions cpu/sam0_common/include/vendor/samr30/include/samr30g18a.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,23 @@ typedef volatile uint8_t RwReg8; /**< Read-Write 8-bit register (volati
#define REG_ACCESS(type, address) (address) /**< Assembly code: Register address */
#endif

#if !defined(SKIP_INTEGER_LITERALS)
#if defined(_U_) || defined(_L_) || defined(_UL_)
#error "Integer Literals macros already defined elsewhere"
#endif

#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
/* Macros that deal with adding suffixes to integer literal constants for C/C++ */
#define _U_(x) x ## U /**< C code: Unsigned integer literal constant value */
#define _L_(x) x ## L /**< C code: Long integer literal constant value */
#define _UL_(x) x ## UL /**< C code: Unsigned Long integer literal constant value */
#else /* Assembler */
#define _U_(x) x /**< Assembler: Unsigned integer literal constant value */
#define _L_(x) x /**< Assembler: Long integer literal constant value */
#define _UL_(x) x /**< Assembler: Unsigned Long integer literal constant value */
#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
#endif /* SKIP_INTEGER_LITERALS */

/* ************************************************************************** */
/** CMSIS DEFINITIONS FOR SAMR30G18A */
/* ************************************************************************** */
Expand Down

0 comments on commit a0ac238

Please sign in to comment.