
QDK™
M16C/Neutrino-NC30
www.state-machine.com/m16c
3 The Vanilla QP Port
The “vanilla” port shows how to use QP on a “bare metal” M16C-based system without any under-
lying multitasking kernel. In the “vanilla” version of the QP, the only component requiring platform-
specific porting is the QF. The other two components: QEP and QS require merely recompilation
and will not be discussed here. Obviously, with the vanilla port you’re not using the QK component.
In case of M16C, the “vanilla” QF port is very similar to the generic “vanilla” port described in
Chapter 9 of [PSiCC2].
3.1 The qep_port.h Header File
The QEP header file for the M16C port with the NC30 compiler is located in
<qp>\ports\m16c\-
vanilla\nc30\qep_port.h
.
/* 1-byte signal space (255 signals) */
#define QP_SIGNAL_SIZE 1
/* exact-width integer types (NC30 compiler does NOT provide <stdint.h>) */
typedef unsigned char uint8_t;
typedef signed char int8_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned long uint32_t;
typedef signed long int32_t;
#include "qep.h" /* QEP platform-independent public interface */
Listing 2 The qep_port.h header file
The event signal size
QP_SIGNAL_SIZE
is configured to use 1-byte (256 signals). The next good
choice for M16C is a 2-byte signal (64K signals). The Renesas NC30 compiler is a pre C99-standard
compiler and does not provide the exact-width integer types header file
<stdint.h>
(see C99 Stan-
dard, Section 7.18.1.1). For such a compiler, the standard types are defined using the
typedef
di-
rectives.
3.2 The qf_port.h Header File
The QF header file for the Cortex-M3 port with the IAR compiler is located in
<qp>\ports\cortex-
m3\vanilla\iar\qf_port.h
. The following sub-sections focus on explaining the QF configuration es-
tablished by the
qf_port.h
header file shown in Listing 3.
/* various QF object sizes configuration for this port, see NOTE01 */
(1) #define QF_MAX_ACTIVE 8
(2) #define QF_EVENT_SIZ_SIZE 2
(3) #define QF_EQUEUE_CTR_SIZE 1
(4) #define QF_MPOOL_SIZ_SIZE 2
(5) #define QF_MPOOL_CTR_SIZE 2
(6) #define QF_TIMEEVT_CTR_SIZE 2
/* QF critical section entry/exit */
(7) /* QF_INT_KEY_TYPE not defined, see NOTE01 */
(8) #define QF_INT_LOCK(key_) _asm("FCLR I")
(9) #define QF_INT_UNLOCK(key_) _asm("FSET I")
Copyright © Quantum Leaps, LLC. All Rights Reserved.
10 of 25
Kommentare zu diesen Handbüchern