mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #396 from Sissors/master
[KLxxZ] Increased KLxxZs interrupt handling speedpull/397/head
commit
ffef32f2bc
|
|
@ -30,21 +30,27 @@ static gpio_irq_handler irq_handler;
|
||||||
#define IRQ_FALLING_EDGE PORT_PCR_IRQC(10)
|
#define IRQ_FALLING_EDGE PORT_PCR_IRQC(10)
|
||||||
#define IRQ_EITHER_EDGE PORT_PCR_IRQC(11)
|
#define IRQ_EITHER_EDGE PORT_PCR_IRQC(11)
|
||||||
|
|
||||||
static void handle_interrupt_in(PORT_Type *port, int ch_base) {
|
const uint32_t search_bits[] = {0x0000FFFF, 0x000000FF, 0x0000000F, 0x00000003, 0x00000001};
|
||||||
uint32_t mask = 0, i;
|
|
||||||
|
|
||||||
for (i = 0; i < 32; i++) {
|
static void handle_interrupt_in(PORT_Type *port, int ch_base) {
|
||||||
uint32_t pmask = (1 << i);
|
uint32_t isfr;
|
||||||
if (port->ISFR & pmask) {
|
uint8_t location;
|
||||||
mask |= pmask;
|
|
||||||
uint32_t id = channel_ids[ch_base + i];
|
while((isfr = port->ISFR) != 0) {
|
||||||
|
location = 0;
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
if (!(isfr & (search_bits[i] << location)))
|
||||||
|
location += 1 << (4 - i);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t id = channel_ids[ch_base + location];
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
FGPIO_Type *gpio;
|
FGPIO_Type *gpio;
|
||||||
gpio_irq_event event = IRQ_NONE;
|
gpio_irq_event event = IRQ_NONE;
|
||||||
switch (port->PCR[i] & PORT_PCR_IRQC_MASK) {
|
switch (port->PCR[location] & PORT_PCR_IRQC_MASK) {
|
||||||
case IRQ_RAISING_EDGE:
|
case IRQ_RAISING_EDGE:
|
||||||
event = IRQ_RISE;
|
event = IRQ_RISE;
|
||||||
break;
|
break;
|
||||||
|
|
@ -55,16 +61,15 @@ static void handle_interrupt_in(PORT_Type *port, int ch_base) {
|
||||||
|
|
||||||
case IRQ_EITHER_EDGE:
|
case IRQ_EITHER_EDGE:
|
||||||
gpio = (port == PORTA) ? (FPTA) : (FPTB);
|
gpio = (port == PORTA) ? (FPTA) : (FPTB);
|
||||||
event = (gpio->PDIR & pmask) ? (IRQ_RISE) : (IRQ_FALL);
|
event = (gpio->PDIR & (1 << location)) ? (IRQ_RISE) : (IRQ_FALL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (event != IRQ_NONE) {
|
if (event != IRQ_NONE) {
|
||||||
irq_handler(id, event);
|
irq_handler(id, event);
|
||||||
}
|
}
|
||||||
|
port->ISFR = 1 << location;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
port->ISFR = mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* IRQ only on PORTA and PORTB */
|
/* IRQ only on PORTA and PORTB */
|
||||||
void gpio_irqA(void) {
|
void gpio_irqA(void) {
|
||||||
|
|
|
||||||
|
|
@ -30,21 +30,27 @@ static gpio_irq_handler irq_handler;
|
||||||
#define IRQ_FALLING_EDGE PORT_PCR_IRQC(10)
|
#define IRQ_FALLING_EDGE PORT_PCR_IRQC(10)
|
||||||
#define IRQ_EITHER_EDGE PORT_PCR_IRQC(11)
|
#define IRQ_EITHER_EDGE PORT_PCR_IRQC(11)
|
||||||
|
|
||||||
static void handle_interrupt_in(PORT_Type *port, int ch_base) {
|
const uint32_t search_bits[] = {0x0000FFFF, 0x000000FF, 0x0000000F, 0x00000003, 0x00000001};
|
||||||
uint32_t mask = 0, i;
|
|
||||||
|
|
||||||
for (i = 0; i < 32; i++) {
|
static void handle_interrupt_in(PORT_Type *port, int ch_base) {
|
||||||
uint32_t pmask = (1 << i);
|
uint32_t isfr;
|
||||||
if (port->ISFR & pmask) {
|
uint8_t location;
|
||||||
mask |= pmask;
|
|
||||||
uint32_t id = channel_ids[ch_base + i];
|
while((isfr = port->ISFR) != 0) {
|
||||||
|
location = 0;
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
if (!(isfr & (search_bits[i] << location)))
|
||||||
|
location += 1 << (4 - i);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t id = channel_ids[ch_base + location];
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
FGPIO_Type *gpio;
|
FGPIO_Type *gpio;
|
||||||
gpio_irq_event event = IRQ_NONE;
|
gpio_irq_event event = IRQ_NONE;
|
||||||
switch (port->PCR[i] & PORT_PCR_IRQC_MASK) {
|
switch (port->PCR[location] & PORT_PCR_IRQC_MASK) {
|
||||||
case IRQ_RAISING_EDGE:
|
case IRQ_RAISING_EDGE:
|
||||||
event = IRQ_RISE;
|
event = IRQ_RISE;
|
||||||
break;
|
break;
|
||||||
|
|
@ -55,16 +61,15 @@ static void handle_interrupt_in(PORT_Type *port, int ch_base) {
|
||||||
|
|
||||||
case IRQ_EITHER_EDGE:
|
case IRQ_EITHER_EDGE:
|
||||||
gpio = (port == PORTA) ? (FPTA) : (FPTD);
|
gpio = (port == PORTA) ? (FPTA) : (FPTD);
|
||||||
event = (gpio->PDIR & pmask) ? (IRQ_RISE) : (IRQ_FALL);
|
event = (gpio->PDIR & (1 << location)) ? (IRQ_RISE) : (IRQ_FALL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (event != IRQ_NONE) {
|
if (event != IRQ_NONE) {
|
||||||
irq_handler(id, event);
|
irq_handler(id, event);
|
||||||
}
|
}
|
||||||
|
port->ISFR = 1 << location;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
port->ISFR = mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gpio_irqA(void) {handle_interrupt_in(PORTA, 0);}
|
void gpio_irqA(void) {handle_interrupt_in(PORTA, 0);}
|
||||||
void gpio_irqD(void) {handle_interrupt_in(PORTD, 32);}
|
void gpio_irqD(void) {handle_interrupt_in(PORTD, 32);}
|
||||||
|
|
|
||||||
|
|
@ -30,21 +30,27 @@ static gpio_irq_handler irq_handler;
|
||||||
#define IRQ_FALLING_EDGE PORT_PCR_IRQC(10)
|
#define IRQ_FALLING_EDGE PORT_PCR_IRQC(10)
|
||||||
#define IRQ_EITHER_EDGE PORT_PCR_IRQC(11)
|
#define IRQ_EITHER_EDGE PORT_PCR_IRQC(11)
|
||||||
|
|
||||||
static void handle_interrupt_in(PORT_Type *port, int ch_base) {
|
const uint32_t search_bits[] = {0x0000FFFF, 0x000000FF, 0x0000000F, 0x00000003, 0x00000001};
|
||||||
uint32_t mask = 0, i;
|
|
||||||
|
|
||||||
for (i = 0; i < 32; i++) {
|
static void handle_interrupt_in(PORT_Type *port, int ch_base) {
|
||||||
uint32_t pmask = (1 << i);
|
uint32_t isfr;
|
||||||
if (port->ISFR & pmask) {
|
uint8_t location;
|
||||||
mask |= pmask;
|
|
||||||
uint32_t id = channel_ids[ch_base + i];
|
while((isfr = port->ISFR) != 0) {
|
||||||
|
location = 0;
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
if (!(isfr & (search_bits[i] << location)))
|
||||||
|
location += 1 << (4 - i);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t id = channel_ids[ch_base + location];
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
FGPIO_Type *gpio;
|
FGPIO_Type *gpio;
|
||||||
gpio_irq_event event = IRQ_NONE;
|
gpio_irq_event event = IRQ_NONE;
|
||||||
switch (port->PCR[i] & PORT_PCR_IRQC_MASK) {
|
switch (port->PCR[location] & PORT_PCR_IRQC_MASK) {
|
||||||
case IRQ_RAISING_EDGE:
|
case IRQ_RAISING_EDGE:
|
||||||
event = IRQ_RISE;
|
event = IRQ_RISE;
|
||||||
break;
|
break;
|
||||||
|
|
@ -61,14 +67,14 @@ static void handle_interrupt_in(PORT_Type *port, int ch_base) {
|
||||||
} else {
|
} else {
|
||||||
gpio = FPTD;
|
gpio = FPTD;
|
||||||
}
|
}
|
||||||
event = (gpio->PDIR & pmask) ? (IRQ_RISE) : (IRQ_FALL);
|
event = (gpio->PDIR & (1<<location)) ? (IRQ_RISE) : (IRQ_FALL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (event != IRQ_NONE)
|
if (event != IRQ_NONE) {
|
||||||
irq_handler(id, event);
|
irq_handler(id, event);
|
||||||
}
|
}
|
||||||
|
port->ISFR = 1 << location;
|
||||||
}
|
}
|
||||||
port->ISFR = mask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpio_irqA(void) {
|
void gpio_irqA(void) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue