Hi!
In iomacros.h there are macros defined for _BIS_SR(x) / _BIS_SR_IRQ(x)
and so on. All these macros are mapped to inline assembler functions
that accept one operand as parameter. All these inline assembler
functions do only accept parameters from type "ir" which means
"immediate constants OR register variables". I would suggest to accept
"memory variables" too (type "irm"). This would avoid an extra ASM
instruction if a memory variable (e.g. a global variable) is used as
input parameter for the macros.
With my suggestion this would change the following lines of code:
----------- iomacros.h line 113 to 117 -----------
#define _BIS_SR(x) __asm__ __volatile__("bis %0, r2" : :
"irm" ((uint16_t) x))
#define _BIC_SR(x) __asm__ __volatile__("bic %0, r2" : :
"irm" ((uint16_t) x))
#define __bis_SR_register(x) __asm__ __volatile__("bis %0, r2" : :
"irm" ((uint16_t) x))
#define __bic_SR_register(x) __asm__ __volatile__("bic %0, r2" : :
"irm" ((uint16_t) x))
----------- iomacros.h line 113 to 117 -----------
----------- iomacros.h line 136 to 158 -----------
#define _BIS_SR_IRQ(x) \
__asm__ __volatile__ ( \
"bis %0, .L__FrameOffset_" __FUNCTION__ "(r1)" \
: : "irm" ((uint16_t) x) \
)
#define _BIC_SR_IRQ(x) \
__asm__ __volatile__ ( \
"bic %0, .L__FrameOffset_" __FUNCTION__ "(r1)" \
: : "irm" ((uint16_t) x) \
)
#define __bis_SR_register_on_exit(x) \
__asm__ __volatile__ ( \
"bis %0, .L__FrameOffset_" __FUNCTION__ "(r1)" \
: : "irm" ((uint16_t) x) \
)
#define __bic_SR_register_on_exit(x) \
__asm__ __volatile__ ( \
"bic %0, .L__FrameOffset_" __FUNCTION__ "(r1)" \
: : "irm" ((uint16_t) x) \
)
----------- iomacros.h line 136 to 158 -----------
Do I miss anything? Are there any drawbacks if memory variables are allowed?
Ralf Hildebrandt