1.1 --- a/stage2/board-nanonote.c Sat May 14 21:40:59 2016 +0200
1.2 +++ b/stage2/board-nanonote.c Sat May 14 22:47:06 2016 +0200
1.3 @@ -153,6 +153,45 @@
1.4 __tcu_clear_full_match_flag(TIMER_CHAN);
1.5 }
1.6
1.7 +/* GPIO interrupt activation. */
1.8 +
1.9 +void gpio_init_irq()
1.10 +{
1.11 +/*
1.12 + unsigned int i;
1.13 + for (i = 0; i < 7; i++) {
1.14 + __gpio_as_irq_rise_edge(GPIO_KEYIN_BASE + i);
1.15 + }
1.16 +*/
1.17 + __gpio_as_irq_low_level(GPIO_POWER);
1.18 + __intc_unmask_irq(GPIO_IRQ);
1.19 +}
1.20 +
1.21 +int gpio_have_irq(u8 gpio)
1.22 +{
1.23 + return (REG_GPIO_PXFLG(gpio / 32) & (1 << (gpio % 32)));
1.24 +}
1.25 +
1.26 +void gpio_clear(u8 gpio)
1.27 +{
1.28 + /* Clear interrupt status. */
1.29 +
1.30 + __gpio_ack_irq(gpio);
1.31 + __intc_ack_irq(GPIO_IRQ);
1.32 +}
1.33 +
1.34 +/* Miscellaneous interrupt administration. */
1.35 +
1.36 +void irq_clear()
1.37 +{
1.38 + u8 i;
1.39 +
1.40 + for (i = 0; i < 32; i++) {
1.41 + if (REG_INTC_IPR & (1 << i))
1.42 + __intc_ack_irq(i);
1.43 + }
1.44 +}
1.45 +
1.46 /* Board startup detection. */
1.47
1.48 int is_started()