esp-rs / esp32

Peripheral access crate for the ESP32
Apache License 2.0
126 stars 12 forks source link

Interrupt map #14

Closed davidkern closed 4 years ago

davidkern commented 4 years ago

~Draft attempt at an interrupt map, with a few issues.~ Interrupt map with issues sorted.

davidkern commented 4 years ago

I've grouped the CPU exceptions and the two CPU timers (TIMER0/TIMER1) under an XTENSA peripheral - perhaps these will be removed entirely when xtensa-rt crate is ready.

Also corrected the typos and adjusted comments.

Fixes #12

MabezDev commented 4 years ago

I've grouped the CPU exceptions and the two CPU timers (TIMER0/TIMER1) under an XTENSA peripheral - perhaps these will be removed entirely when xtensa-rt crate is ready.

Sounds like a good idea for now.

Thanks again for taking the time on this!

(and thanks for the sponsor :))

igrr commented 4 years ago

Sorry, have not reviewed when this PR was submitted. One correction: none of the interrupts listed in the table are from the Xtensa CPU, all are peripheral interrupts.

Each interrupt signal listed here goes into the interrupt matrix, which allows mapping interrupt signals to the external interrupt inputs of the Xtensa CPU. I.e. every CPU interrupt of type "external" in this table can receive one or more peripheral interrupt signals. This connection is done using the interrupt matrix peripheral.

davidkern commented 4 years ago

@igrr thanks for that clarification. Would it be better to use the original strategy of taking the prefix of the interrupt name as the name of the originating peripheral? As an example, ETS_UART0_INTR_SOURCE clearly maps to the UART0 peripheral and most others follow the same pattern. Therefore we could presume the names of peripherals for which we lack documentation, like BT_BB and MMU.

If just keeping the same prefixes as the ETS_* definitions is the correct way forward, then it would be straightforward to do this with a regex in idf2svd against those names, along with a patch for a few renames such as TG0 -> TIMG0.

igrr commented 4 years ago

Yes, I think aside from a few inconsistencies between interrupt signal names and peripheral register names, this should work.

Notable exceptions:

Also one other observation about the changes in this PR. It seems that unlike other repeating peripherals, I2S interrupts didn't get split into two peripheral instances (there is I2C0, I2C1, but only one I2S with 2 interrupts inside).