summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-08-25 13:24:33 +0100
committerDamien George <damien.p.george@gmail.com>2014-08-25 13:24:33 +0100
commite5cbb70328239e58c820938eccd51f3c735fc312 (patch)
treec6f1f9d9f83327ab595e14276d4f4ab9f9a56c5d /py
parent9480138f0c917b2400991066e94636f7d8076a4c (diff)
downloadmicropython-e5cbb70328239e58c820938eccd51f3c735fc312.tar.gz
micropython-e5cbb70328239e58c820938eccd51f3c735fc312.zip
stmhal: Make enable_irq and disable_irq inline functions.
These functions are generally 1 machine instruction, and are used in critical code, so makes sense to have them inline. Also leave these functions uninverted (ie 0 means enable, 1 means disable) and provide macro constants if you really need to distinguish the states. This makes for smaller code as well (combined with inlining). Applied to teensy port as well.
Diffstat (limited to 'py')
-rw-r--r--py/objexcept.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/objexcept.c b/py/objexcept.c
index 7f9b219d56..cb01fd6e85 100644
--- a/py/objexcept.c
+++ b/py/objexcept.c
@@ -88,10 +88,10 @@ mp_obj_t mp_alloc_emergency_exception_buf(mp_obj_t size_in) {
// Update the 2 variables atomically so that an interrupt can't occur
// between the assignments.
- mp_int_t enabled = MICROPY_BEGIN_ATOMIC_SECTION();
+ mp_uint_t irq_state = MICROPY_BEGIN_ATOMIC_SECTION();
mp_emergency_exception_buf_size = size;
mp_emergency_exception_buf = buf;
- MICROPY_END_ATOMIC_SECTION(enabled);
+ MICROPY_END_ATOMIC_SECTION(irq_state);
if (old_buf != NULL) {
m_free(old_buf, old_size);