Renesas M16C/6N Manual do Utilizador Página 16

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 27
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 15
QDK™
M16C/Neutrino-NC30
www.state-machine.com/m16c
4 The QK Port
The QP port with the preemptive kernel (QK) is remarkably simple and very similar to the “vanilla”
port. In particular, the interrupt locking/unlocking policy is the same, and the BSP is identical, ex-
cept some small additions to the ISRs.
The DPP example for the QK port is provided in the directory
<qp>\examples\m16c\qk\-
nc30\dpp_qk_neutrino
.
NOTE: QK incurs far less overhead and provides responsiveness exceeding that of any tradi-
tional multiple-stack real-time kernel, at the fraction of the RAM/ROM footprint (see the article
“Build a Super Simple Tasker”, [Samek+ 06]). The non-blocking restrictions of this kernel type
are irrelevant for executing state machines.
4.1 The qk_port.h Header File
In the QK port, you use very similar configuration as the “Vanilla” port described earlier. This sec-
tion describes only the differences, specific to the QK component.
You configure and customize QK through the header file
qk_port.h
, which is located in the QP ports
directory
<qp>\ports\m16c\qk\nc30\
.
/* interrupt entry code, see NOTE01 */
(1) #define QK_ISR_ENTRY() do { \
(2) ++QK_intNest_; \
(3) _asm("FSET I"); \
} while (0)
/* interrupt exit code, see NOTE01 and NOTE02 */
(4) #define QK_ISR_EXIT() do { \
(5) _asm("LDC #0,FLG"); \
(6) --QK_intNest_; \
(7) if (QK_intNest_ == (uint8_t)0) { \
(8) QK_schedule_(); \
} \
} while (0)
(9) #include "qk.h" /* QK platform-independent public interface */
Listing 6 qk_porth.h header file
(1) The macro
QK_ISR_ENTRY()
is designed to be called upon the entry to an ISR programmed in C.
The macro informs the QK preemptive kernel about entering an interrupt.
(2) The QK interrupt nesting up-down counter
QK_intNest_
is incremented to account for entering a
new interrupt level. This informs the QK scheduler about the interrupt context, so that if a QF
API is called or another interrupt preempts this one, the QK scheduler will not be called.
(3) The interrupts are unlocked.
NOTE: The hardware interrupt entry sequence for M16C includes clearing the global interrupt
enable flag in the FLAGS register, so that interrupts remain locked unless unlocked explicitly.
(4) The macro
QK_ISR_EXIT()
is designed to be called upon the exit from an ISR programmed in C.
The macro informs the QK preemptive kernel about exiting an interrupt.
Copyright © Quantum Leaps, LLC. All Rights Reserved.
14 of 25
Vista de página 15
1 2 ... 11 12 13 14 15 16 17 18 19 20 21 ... 26 27

Comentários a estes Manuais

Sem comentários