Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ETS_GPIO_INUM not defined anywhere #13

Closed
MakerAsia opened this issue Sep 17, 2016 · 1 comment
Closed

ETS_GPIO_INUM not defined anywhere #13

MakerAsia opened this issue Sep 17, 2016 · 1 comment
Labels
Resolution: Done Issue is done internally Status: Resolved Issue is done internally

Comments

@MakerAsia
Copy link

ETS_GPIO_INUM was used in esp_intr.h and ets.sys.h but it does not be defined anywhere.

I tried to do GPIO interrupt and due to no gpio_pin_intr_state_set function available, so, I tried to write the register for this but can not do.

@igrr
Copy link
Member

igrr commented Sep 20, 2016

Indeed, these definitions were removed, but we forgot to remove their usage from esp_intr.h.

Unlike the 8266, interrupt numbers on each CPU are not connected directly to interrupt sources. Instead, they are routed via an interrupt matrix, which allows connecting arbitrary interrupt source to an arbitrary interrupt input of any of the CPUs.

Possible interrupt numbers (from 0 to 31) and their properties (interrupt level, and trigger mode: edge/level triggered) are defined in this table:
https://github.com/espressif/esp-idf/blob/master/components/esp32/include/soc/soc.h#L259-L294

Apart from the slots which are reserved, you can choose any interrupt number with the level and trigger mode you need, and attach it to the interrupt source. Interrupt sources are defined in the same file:
https://github.com/espressif/esp-idf/blob/master/components/esp32/include/soc/soc.h#L187-L257

Here's the function which allows you to attach interrupt sources to inputs, intr_matrix_set:
https://github.com/espressif/esp-idf/tree/master/components/esp32/include/rom/ets_sys.h#L502-L518

Once interrupt is attached, you can use xt_set_interrupt_handler and xt_ints_on to attach interrupt handler and enable interrupt input of the CPU.

In most cases you also need to unmask some of the interrupts in peripheral registers, e.g.
https://github.com/espressif/esp-idf/blob/master/components/esp32/include/soc/gpio_struct.h#L161

Edit: we are planning to add a run-time or compile-time mechanism of allocating interrupt numbers, but details have not been finalized yet.

adpalmer pushed a commit to adpalmer/esp-idf that referenced this issue Jan 13, 2022
* Native build befixes

* Address review feedback; cargo fmt

* Master patch now applies cleanly; fix the ULP handling

* Document why we are passing targets to clang explicitly

* Clippy again

Co-authored-by: imarkov <imarkov@vmware.com>
@espressif-bot espressif-bot added the Status: Opened Issue is new label Jan 28, 2022
@espressif-bot espressif-bot added Status: In Progress Work is in progress Status: Reviewing Issue is being reviewed and removed Status: Opened Issue is new Status: In Progress Work is in progress labels Feb 23, 2022
@espressif-bot espressif-bot added Resolution: Done Issue is done internally Status: Resolved Issue is done internally and removed Status: Reviewing Issue is being reviewed labels Mar 17, 2022
tannewt added a commit to tannewt/esp-idf that referenced this issue Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Resolved Issue is done internally
Projects
None yet
Development

No branches or pull requests

2 participants