
QDK™
M16C/Neutrino-NC30
www.state-machine.com/m16c
(2) You should adjust the QS buffer size (in bytes) to your particular application
(3) You might want to adjust the UART baud rate to your particular system (the 115200 baud rate
works well with the 20MHz f1 clock)
(4) The
l_nTimerA1Underflows
variable is used to count the number of underflows (transitions
0x0000 -> 0xFFFF) of the 16-bit TimerA1. This variable is used to generate 32-bit timestamp.
(5) The
QS_onStartup()
callback performs the initialization of QS
(6) The QS trace buffer is statically allocated to the specified size
(7) You always need to call
QS_initBuf()
from
QS_onStartup()
to initialize the trace buffer. This
particular QS port initializes USART for data transfer at the given baud rate (
BAUD_RATE = 38400
bits per second)
(8) UARTA2 is configured.
(9) Timer A1 is configured as a free-running counter running from f8 (f1/8 = 20MHz/8), which
works out to 0.4 µs per the least-significant bit of this counter.
(10) The QS filters are configured.
(11) Return 1 from
QS_onStartup()
callback means that configuration of QS output was successfull.
(12) The
QS_onCleanup()
callback performs the cleanup of QS. Here nothing needs to be done.
(13) The
QS_onFlush()
callback flushes the QS trace buffer to the host. Typically, the function busy-
waits for the transfer to complete. It is only used in the initialization phase for sending the QS
dictionary records to the host (see Chapter 11 in [PSiCC2])
(14) The
QS_getTime()
callback provides the time-stamp to the QS trace records. The QS time-
stamping implementation uses Timer A1.
(15) Here the interrupt request flag is tested to find out whether Timer A1 rolled over. This flag be-
ing set means that the timer rolled over from 0x0000 to 0xFFFF.
(16-17) In case of the rollover the number of underflows must be incremented and the flag is
cleared.
(18) The 32-bit timestamp is the combination of the rollover counter (the coarse time) and the cur-
rent value of the Timer A1 counter (the fine time). Please note that the 16-bit Timer A1 counter
is subtracted from the coarse time, because the counter counts down.
Copyright © Quantum Leaps, LLC. All Rights Reserved.
23 of 25
Comentarios a estos manuales