rmt/driver: Sped the rmt_driver_isr_default ISR

Used __builtin_ctz function to sped ISR.
This commit is contained in:
Konstantin Kondrashov
2019-02-07 21:20:39 +08:00
committed by bot
parent 3307735bc0
commit b1b5849c4c

View File

@@ -555,17 +555,17 @@ static int IRAM_ATTR rmt_get_mem_len(rmt_channel_t channel)
static void IRAM_ATTR rmt_driver_isr_default(void* arg) static void IRAM_ATTR rmt_driver_isr_default(void* arg)
{ {
uint32_t intr_st = RMT.int_st.val; const uint32_t intr_st = RMT.int_st.val;
uint32_t i = 0; uint32_t status = intr_st;
uint8_t channel; uint8_t channel;
portBASE_TYPE HPTaskAwoken = 0; portBASE_TYPE HPTaskAwoken = 0;
for(i = 0; i < 32; i++) { while (status) {
int i = __builtin_ffs(status) - 1;
status &= ~(1 << i);
if(i < 24) { if(i < 24) {
if(intr_st & BIT(i)) {
channel = i / 3; channel = i / 3;
rmt_obj_t* p_rmt = p_rmt_obj[channel]; rmt_obj_t* p_rmt = p_rmt_obj[channel];
if(NULL == p_rmt) { if(NULL == p_rmt) {
RMT.int_clr.val = BIT(i);
continue; continue;
} }
switch(i % 3) { switch(i % 3) {
@@ -613,13 +613,9 @@ static void IRAM_ATTR rmt_driver_isr_default(void* arg)
default: default:
break; break;
} }
RMT.int_clr.val = BIT(i);
}
} else { } else {
if(intr_st & (BIT(i))) {
channel = i - 24; channel = i - 24;
rmt_obj_t* p_rmt = p_rmt_obj[channel]; rmt_obj_t* p_rmt = p_rmt_obj[channel];
RMT.int_clr.val = BIT(i);
if(p_rmt->tx_data == NULL) { if(p_rmt->tx_data == NULL) {
//skip //skip
@@ -664,7 +660,7 @@ static void IRAM_ATTR rmt_driver_isr_default(void* arg)
} }
} }
} }
} RMT.int_clr.val = intr_st;
if(HPTaskAwoken == pdTRUE) { if(HPTaskAwoken == pdTRUE) {
portYIELD_FROM_ISR(); portYIELD_FROM_ISR();
} }