mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 19:54:32 +02:00
pcnt: properly clear interrupt status in pcnt_intr_service
status is 0 when pcnt_hal_clear_intr_status() is called and so the interrupt will be triggered immediatly again. Store the original status and pass this as mask to pcnt_hal_clear_intr_status(). Merges https://github.com/espressif/esp-idf/pull/5929
This commit is contained in:
@@ -284,10 +284,11 @@ static inline esp_err_t _pcnt_isr_handler_remove(pcnt_port_t pcnt_port, pcnt_uni
|
|||||||
// pcnt interrupt service
|
// pcnt interrupt service
|
||||||
static void IRAM_ATTR pcnt_intr_service(void *arg)
|
static void IRAM_ATTR pcnt_intr_service(void *arg)
|
||||||
{
|
{
|
||||||
uint32_t status;
|
uint32_t status, mask = 0;
|
||||||
pcnt_port_t pcnt_port = (pcnt_port_t)arg;
|
pcnt_port_t pcnt_port = (pcnt_port_t)arg;
|
||||||
pcnt_hal_get_intr_status(&(p_pcnt_obj[pcnt_port]->hal), &status);
|
pcnt_hal_get_intr_status(&(p_pcnt_obj[pcnt_port]->hal), &status);
|
||||||
|
|
||||||
|
mask = status;
|
||||||
while (status) {
|
while (status) {
|
||||||
int unit = __builtin_ffs(status) - 1;
|
int unit = __builtin_ffs(status) - 1;
|
||||||
status &= ~(1 << unit);
|
status &= ~(1 << unit);
|
||||||
@@ -296,7 +297,7 @@ static void IRAM_ATTR pcnt_intr_service(void *arg)
|
|||||||
(pcnt_isr_func[unit].fn)(pcnt_isr_func[unit].args);
|
(pcnt_isr_func[unit].fn)(pcnt_isr_func[unit].args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pcnt_hal_clear_intr_status(&(p_pcnt_obj[pcnt_port]->hal), status);
|
pcnt_hal_clear_intr_status(&(p_pcnt_obj[pcnt_port]->hal), mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline esp_err_t _pcnt_isr_service_install(pcnt_port_t pcnt_port, int intr_alloc_flags)
|
static inline esp_err_t _pcnt_isr_service_install(pcnt_port_t pcnt_port, int intr_alloc_flags)
|
||||||
@@ -527,4 +528,4 @@ esp_err_t pcnt_isr_service_install(int intr_alloc_flags)
|
|||||||
void pcnt_isr_service_uninstall()
|
void pcnt_isr_service_uninstall()
|
||||||
{
|
{
|
||||||
_pcnt_isr_service_uninstall(PCNT_PORT_0);
|
_pcnt_isr_service_uninstall(PCNT_PORT_0);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user