Skip to content

Commit bcaef53

Browse files
committed
esp32/mphalport: Provide proper implementations of disable_/enable_irq.
1 parent c46c49c commit bcaef53

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

esp32/mphalport.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@
2929
#ifndef INCLUDED_MPHALPORT_H
3030
#define INCLUDED_MPHALPORT_H
3131

32+
#include "freertos/FreeRTOS.h"
3233
#include "py/ringbuf.h"
3334
#include "lib/utils/interrupt_char.h"
3435

3536
extern ringbuf_t stdin_ringbuf;
3637

37-
// TODO implement me
38-
#define disable_irq() 0
39-
#define enable_irq(irq_state) (void)(irq_state)
38+
// Note: these "critical nested" macros do not ensure cross-CPU exclusion,
39+
// the only disable interrupts on the current CPU. To full manage exclusion
40+
// one should use portENTER_CRITICAL/portEXIT_CRITICAL instead.
41+
#define disable_irq() portENTER_CRITICAL_NESTED()
42+
#define enable_irq(irq_state) portEXIT_CRITICAL_NESTED(irq_state)
4043

4144
uint32_t mp_hal_ticks_us(void);
4245
__attribute__((always_inline)) static inline uint32_t mp_hal_ticks_cpu(void) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy