px4iofirmware: convert atomic macro into methods

Reduces flash size by 744 bytes.
CPU (loop time) is not affected.
This commit is contained in:
Beat Küng
2019-11-16 11:43:42 +01:00
committed by Lorenz Meier
parent 0f2a7ad2b7
commit d965b928f8
5 changed files with 59 additions and 40 deletions
+3 -5
View File
@@ -186,11 +186,9 @@ extern output_limit_t pwm_limit;
#define PX4_CRITICAL_SECTION(cmd) { irqstate_t flags = px4_enter_critical_section(); cmd; px4_leave_critical_section(flags); }
#define PX4_ATOMIC_MODIFY_OR(target, modification) { if ((target | (modification)) != target) { PX4_CRITICAL_SECTION(target |= (modification)); } }
#define PX4_ATOMIC_MODIFY_CLEAR(target, modification) { if ((target & ~(modification)) != target) { PX4_CRITICAL_SECTION(target &= ~(modification)); } }
#define PX4_ATOMIC_MODIFY_AND(target, modification) { if ((target & (modification)) != target) { PX4_CRITICAL_SECTION(target &= (modification)); } }
void atomic_modify_or(volatile uint16_t *target, uint16_t modification);
void atomic_modify_clear(volatile uint16_t *target, uint16_t modification);
void atomic_modify_and(volatile uint16_t *target, uint16_t modification);
/*
* Mixer