+/* * */
+static void choose_isrs(void)
+{
+ void (*pl1th_handler)(void) = pl1th_isr_fixed;
+ void (*pl2th_handler)(void) = pl2th_isr_fixed;
+ void (*vsync_handler)(void) = vsync_isr_nop;
+
+ if (g.stream_enable_to) {
+ switch (g.inc_mode) {
+ case INC_MODE_VSYNC:
+ pl1th_handler = pl1th_isr_do_to;
+ pl2th_handler = pl2th_isr_do_to_p1d;
+ vsync_handler = vsync_isr_frameinc;
+ break;
+ case INC_MODE_SHARED_PL1:
+ pl1th_handler = pl1th_isr_do_to_inc;
+ pl2th_handler = pl2th_isr_do_to_p1d;
+ break;
+ case INC_MODE_SHARED_PL2:
+ pl1th_handler = pl1th_isr_do_to;
+ pl2th_handler = pl2th_isr_do_to_inc_pl1;
+ break;
+ case INC_MODE_SEPARATE:
+ pl1th_handler = pl1th_isr_do_to_inc;
+ pl2th_handler = pl2th_isr_do_to_inc;
+ break;
+ }
+ }
+ else if (g.stream_enable_from) {
+ g.use_pending = 1;
+ switch (g.inc_mode) {
+ case INC_MODE_VSYNC:
+ vsync_handler = vsync_isr_frameinc_do_from;
+ break;
+ case INC_MODE_SHARED_PL1:
+ pl1th_handler = pl1th_isr_fixed_do_from;
+ break;
+ case INC_MODE_SHARED_PL2:
+ case INC_MODE_SEPARATE:
+ /* TODO */
+ break;
+ }
+ }
+
+ attachInterruptVector(IRQ_PORTD, pl1th_handler);
+ attachInterruptVector(IRQ_PORTC, pl2th_handler);
+ attachInterruptVector(IRQ_PORTA, vsync_handler);
+}
+
+static noinline void choose_isrs_idle(void)
+{
+ attachInterruptVector(IRQ_PORTD, pl1th_isr_fixed);
+ attachInterruptVector(IRQ_PORTC, pl2th_isr_fixed);
+ attachInterruptVector(IRQ_PORTA, vsync_isr_nop);
+}
+