
QDK™
R8C/Tau-NC30
www.state-machine.com/m16c
cm13 = 1; /* Xin Xout */
cm15 = 1; /* XCIN-XCOUT drive capacity select bit : HIGH */
cm05 = 0; /* Xin on */
cm16 = 0; /* main clock = No division mode */
cm17 = 0; /* main clock = No division mode */
cm06 = 0; /* CM16 and CM17 enable */
asm("nop"); /* Wait for stable of oscillation... */
asm("nop");
asm("nop");
asm("nop");
ocd2 = 0; /* main clock change */
prcr = 0; /* protect on */
/* configure 32kHz clock..., see NOTE02 */
prc0 = 1; /* protect off */
pd4_3 = 0; /* unlock CM0 and CM1 and set GPIO to inputs (XCin/XCout) */
pd4_4 = 0; /* ... */
cm04 = 1; /* Start the 32KHz crystal */
prc0 = 0; /* protect on */
/* start Timer RE running from fc4... */
trecr1 = 0x00; /* stop Timer RE */
trecr2 = 0x00; /* output compare mode, interrupt disabled for now */
trecsr = 0x63; /* fc4 clock source, no 4-bit counter, output compare */
/* set output compare value */
tremin = (uint8_t)((fc_CLK_SPEED/4/2 + BSP_TICKS_PER_SEC/2)
/ BSP_TICKS_PER_SEC - 1);
/* enable the User LEDs */
LED0_DDR = 1;
LED1_DDR = 1;
LED2_DDR = 1;
LED3_DDR = 1;
LED0 = LED_OFF;
LED1 = LED_OFF;
LED2 = LED_OFF;
LED3 = LED_OFF;
if (QS_INIT((void *)0) == 0) { /* initialize the QS software tracing */
Q_ERROR();
}
}
5.5 Starting Interrupts in QF_onStartup()
QP-nano invokes the
QF_onStartup()
callback just before starting the event loop inside
QF_run()
.
The
QF_onStartup()
function must start the interrupts configured earlier. In this BSP only the sys-
tem tick interrupt is started.
void QF_onStartup(void) {
comie_trecr2 = 1; /* enable Timer RE output compare interrupt */
tstart_trecr1 = 1; /* start Timer RE */
treic = 3; /* TRE interrupt priority level */
#ifdef Q_SPY
tstart0_trdstr = 1; /* start the QS time-stamp timer */
#endif
}
Listing 10 Configuring and enabling interrupts in the
QF_onStartup()
callback.
Copyright © Quantum Leaps, LLC. All Rights Reserved.
20 of 26
Comentarios a estos manuales