]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcHardwarePort.h
Final preparation for new release:
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-Trace / Include / trcHardwarePort.h
1 /*******************************************************************************\r
2  * Tracealyzer v2.7.7 Recorder Library\r
3  * Percepio AB, www.percepio.com\r
4  *\r
5  * trcHardwarePort.h\r
6  *\r
7  * Contains together with trcHardwarePort.c all hardware portability issues of\r
8  * the trace recorder library.\r
9  *\r
10  * Terms of Use\r
11  * This software is copyright Percepio AB. The recorder library is free for\r
12  * use together with Percepio products. You may distribute the recorder library\r
13  * in its original form, including modifications in trcPort.c and trcPort.h\r
14  * given that these modification are clearly marked as your own modifications\r
15  * and documented in the initial comment section of these source files.\r
16  * This software is the intellectual property of Percepio AB and may not be\r
17  * sold or in other ways commercially redistributed without explicit written\r
18  * permission by Percepio AB.\r
19  *\r
20  * Disclaimer\r
21  * The trace tool and recorder library is being delivered to you AS IS and\r
22  * Percepio AB makes no warranty as to its use or performance. Percepio AB does\r
23  * not and cannot warrant the performance or results you may obtain by using the\r
24  * software or documentation. Percepio AB make no warranties, express or\r
25  * implied, as to noninfringement of third party rights, merchantability, or\r
26  * fitness for any particular purpose. In no event will Percepio AB, its\r
27  * technology partners, or distributors be liable to you for any consequential,\r
28  * incidental or special damages, including any lost profits or lost savings,\r
29  * even if a representative of Percepio AB has been advised of the possibility\r
30  * of such damages, or for any claim by any third party. Some jurisdictions do\r
31  * not allow the exclusion or limitation of incidental, consequential or special\r
32  * damages, or the exclusion of implied warranties or limitations on how long an\r
33  * implied warranty may last, so the above limitations may not apply to you.\r
34  *\r
35  * Tabs are used for indent in this file (1 tab = 4 spaces)\r
36  *\r
37  * Copyright Percepio AB, 2012-2015.\r
38  * www.percepio.com\r
39  ******************************************************************************/\r
40 \r
41 #ifndef TRCPORT_H\r
42 #define TRCPORT_H\r
43 #include <stdint.h>\r
44 \r
45 /* If Win32 port */\r
46 #ifdef WIN32\r
47 \r
48         #undef _WIN32_WINNT\r
49         #define _WIN32_WINNT 0x0600\r
50 \r
51         /* Standard includes. */\r
52         #include <stdio.h>\r
53         #include <windows.h>\r
54         #include <direct.h>\r
55 \r
56 /*******************************************************************************\r
57  * The Win32 port by default saves the trace to file and then kills the\r
58  * program when the recorder is stopped, to facilitate quick, simple tests\r
59  * of the recorder.\r
60  ******************************************************************************/\r
61         #define WIN32_PORT_SAVE_WHEN_STOPPED 1\r
62         #define WIN32_PORT_EXIT_WHEN_STOPPED 1\r
63 \r
64 #endif\r
65 \r
66 #define DIRECTION_INCREMENTING 1\r
67 #define DIRECTION_DECREMENTING 2\r
68 \r
69 /******************************************************************************\r
70  * Supported ports\r
71  *\r
72  * PORT_HWIndependent\r
73  * A hardware independent fallback option for event timestamping. Provides low\r
74  * resolution timestamps based on the OS tick.\r
75  * This may be used on the Win32 port, but may also be used on embedded hardware\r
76  * platforms. All time durations will be truncated to the OS tick frequency,\r
77  * typically 1 KHz. This means that a task or ISR that executes in less than\r
78  * 1 ms get an execution time of zero.\r
79  *\r
80  * PORT_APPLICATION_DEFINED\r
81  * Allows for defining the port macros in other source code files.\r
82  *\r
83  * PORT_Win32\r
84  * "Accurate" timestamping based on the Windows performance counter for Win32\r
85  * builds. Note that this gives the host machine time, not the kernel time.\r
86  *\r
87  * Hardware specific ports\r
88  * To get accurate timestamping, a hardware timer is necessary. Below are the\r
89  * available ports. Some of these are "unofficial", meaning that\r
90  * they have not yet been verified by Percepio but have been contributed by\r
91  * external developers. They should work, otherwise let us know by emailing\r
92  * support@percepio.com. Some work on any OS platform, while other are specific\r
93  * to a certain operating system.\r
94  *****************************************************************************/\r
95 \r
96 /****** Port Name ********************** Code ***** Official ** OS Platform *********/\r
97 #define PORT_APPLICATION_DEFINED                        -2      /*      -                       -                                       */\r
98 #define PORT_NOT_SET                                            -1      /*      -                       -                                       */\r
99 #define PORT_HWIndependent                                      0       /*      Yes                     Any                                     */\r
100 #define PORT_Win32                                                      1       /*      Yes                     FreeRTOS on Win32       */\r
101 #define PORT_Atmel_AT91SAM7                                     2       /*      No                      Any                                     */\r
102 #define PORT_Atmel_UC3A0                                        3       /*      No                      Any                                     */\r
103 #define PORT_ARM_CortexM                                        4       /*      Yes                     Any                                     */\r
104 #define PORT_Renesas_RX600                                      5       /*      Yes                     Any                                     */\r
105 #define PORT_Microchip_dsPIC_AND_PIC24          6       /*      Yes                     Any                                     */\r
106 #define PORT_TEXAS_INSTRUMENTS_TMS570           7       /*      No                      Any                                     */\r
107 #define PORT_TEXAS_INSTRUMENTS_MSP430           8       /*      No                      Any                                     */\r
108 #define PORT_MICROCHIP_PIC32MX                          9       /*      Yes                     Any                                     */\r
109 #define PORT_XILINX_PPC405                                      10      /*      No                      FreeRTOS                        */\r
110 #define PORT_XILINX_PPC440                                      11      /*      No                      FreeRTOS                        */\r
111 #define PORT_XILINX_MICROBLAZE                          12      /*      No                      Any                                     */\r
112 #define PORT_NXP_LPC210X                                        13      /*      No                      Any                                     */\r
113 #define PORT_MICROCHIP_PIC32MZ                          14      /*      Yes                     Any                                     */\r
114 #define PORT_ARM_CORTEX_A9                                      15      /*      No                      Any                                     */\r
115 #define PORT_ARM_CORTEX_M0                                      16      /*      Yes                     Any                                     */\r
116 \r
117 #include "trcConfig.h"\r
118 \r
119 /*******************************************************************************\r
120  * IRQ_PRIORITY_ORDER\r
121  *\r
122  * Macro which should be defined as an integer of 0 or 1.\r
123  *\r
124  * This should be 0 if lower IRQ priority values implies higher priority\r
125  * levels, such as on ARM Cortex M. If the opposite scheme is used, i.e.,\r
126  * if higher IRQ priority values means higher priority, this should be 1.\r
127  *\r
128  * This setting is not critical. It is used only to sort and colorize the\r
129  * interrupts in priority order, in case you record interrupts using\r
130  * the vTraceStoreISRBegin and vTraceStoreISREnd routines.\r
131  *\r
132  ******************************************************************************\r
133  *\r
134  * HWTC Macros\r
135  *\r
136  * These four HWTC macros provides a hardware isolation layer representing a\r
137  * generic hardware timer/counter used for driving the operating system tick,\r
138  * such as the SysTick feature of ARM Cortex M3/M4, or the PIT of the Atmel\r
139  * AT91SAM7X.\r
140  *\r
141  * HWTC_COUNT: The current value of the counter. This is expected to be reset\r
142  * a each tick interrupt. Thus, when the tick handler starts, the counter has\r
143  * already wrapped.\r
144  *\r
145  * HWTC_COUNT_DIRECTION: Should be one of:\r
146  * - DIRECTION_INCREMENTING - for hardware timer/counters of incrementing type\r
147  *      such as the PIT on Atmel AT91SAM7X.\r
148  *      When the counter value reach HWTC_PERIOD, it is reset to zero and the\r
149  *      interrupt is signaled.\r
150  * - DIRECTION_DECREMENTING - for hardware timer/counters of decrementing type\r
151  *      such as the SysTick on ARM Cortex M3/M4 chips.\r
152  *      When the counter value reach 0, it is reset to HWTC_PERIOD and the\r
153  *      interrupt is signaled.\r
154  *\r
155  * HWTC_PERIOD: The number of increments or decrements of HWTC_COUNT between\r
156  * two OS tick interrupts. This should preferably be mapped to the reload\r
157  * register of the hardware timer, to make it more portable between chips in the\r
158  * same family. The macro should in most cases be (reload register + 1).\r
159  * For FreeRTOS, this can in most cases be defined as\r
160  * #define HWTC_PERIOD (configCPU_CLOCK_HZ / configTICK_RATE_HZ)\r
161  *\r
162  * HWTC_DIVISOR: If the timer frequency is very high, like on the Cortex M chips\r
163  * (where the SysTick runs at the core clock frequency), the "differential\r
164  * timestamping" used in the recorder will more frequently insert extra XTS\r
165  * events to store the timestamps, which increases the event buffer usage.\r
166  * In such cases, to reduce the number of XTS events and thereby get longer\r
167  * traces, you use HWTC_DIVISOR to scale down the timestamps and frequency.\r
168  * Assuming a OS tick rate of 1 KHz, it is suggested to keep the effective timer\r
169  * frequency below 65 MHz to avoid an excessive amount of XTS events. Thus, a\r
170  * Cortex M chip running at 72 MHZ should use a HWTC_DIVISOR of 2, while a\r
171  * faster chip require a higher HWTC_DIVISOR value.\r
172  *\r
173  * The HWTC macros and vTracePortGetTimeStamp is the main porting issue\r
174  * or the trace recorder library. Typically you should not need to change\r
175  * the code of vTracePortGetTimeStamp if using the HWTC macros.\r
176  *\r
177  ******************************************************************************/\r
178 \r
179 #if (SELECTED_PORT == PORT_Win32)\r
180         // This can be used as a template for any free-running 32-bit counter\r
181         #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
182         #define HWTC_COUNT (ulGetRunTimeCounterValue())\r
183         #define HWTC_PERIOD 0\r
184         #define HWTC_DIVISOR 1\r
185 \r
186         // Please update according to your system...\r
187         #define IRQ_PRIORITY_ORDER 1\r
188 \r
189 #elif (SELECTED_PORT == PORT_HWIndependent)\r
190         // OS Tick only (typically 1 ms resolution)\r
191         #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
192         #define HWTC_COUNT 0\r
193         #define HWTC_PERIOD 1\r
194         #define HWTC_DIVISOR 1\r
195 \r
196         // Please update according to your system...\r
197         #define IRQ_PRIORITY_ORDER NOT_SET\r
198 \r
199 \r
200 #elif (SELECTED_PORT == PORT_ARM_CortexM)\r
201 \r
202         void prvTraceInitCortexM(void);\r
203 \r
204         #define REG_DEMCR (*(volatile unsigned int*)0xE000EDFC)\r
205         #define REG_DWT_CTRL (*(volatile unsigned int*)0xE0001000)\r
206         #define REG_DWT_CYCCNT (*(volatile unsigned int*)0xE0001004)\r
207         #define REG_DWT_EXCCNT (*(volatile unsigned int*)0xE000100C)\r
208 \r
209         /* Bit mask for TRCENA bit in DEMCR - Global enable for DWT and ITM */\r
210         #define DEMCR_TRCENA (1 << 24)\r
211 \r
212         /* Bit mask for NOPRFCNT bit in DWT_CTRL. If 1, DWT_EXCCNT is not supported */\r
213         #define DWT_CTRL_NOPRFCNT (1 << 24)\r
214 \r
215         /* Bit mask for NOCYCCNT bit in DWT_CTRL. If 1, DWT_CYCCNT is not supported */\r
216         #define DWT_CTRL_NOCYCCNT (1 << 25)\r
217 \r
218         /* Bit mask for EXCEVTENA_ bit in DWT_CTRL. Set to 1 to enable DWT_EXCCNT */\r
219         #define DWT_CTRL_EXCEVTENA (1 << 18)\r
220 \r
221         /* Bit mask for EXCEVTENA_ bit in DWT_CTRL. Set to 1 to enable DWT_CYCCNT */\r
222         #define DWT_CTRL_CYCCNTENA (1)\r
223 \r
224         #define PORT_SPECIFIC_INIT() prvTraceInitCortexM()\r
225 \r
226         extern uint32_t DWT_CYCLES_ADDED;\r
227 \r
228         #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
229         #define HWTC_COUNT (REG_DWT_CYCCNT + DWT_CYCLES_ADDED)\r
230         #define HWTC_PERIOD 0\r
231         #define HWTC_DIVISOR 4\r
232 \r
233         #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
234 \r
235 #elif (SELECTED_PORT == PORT_ARM_CORTEX_M0)\r
236     #define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING\r
237     #define HWTC_COUNT (*((uint32_t*)0xE000E018))\r
238     #define HWTC_PERIOD ((*(uint32_t*)0xE000E014) + 1)\r
239     #define HWTC_DIVISOR 2\r
240         \r
241     #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
242         \r
243 #elif (SELECTED_PORT == PORT_Renesas_RX600)\r
244 \r
245         #include "iodefine.h"\r
246 \r
247         #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
248         #define HWTC_COUNT (CMT0.CMCNT)\r
249         #define HWTC_PERIOD (CMT0.CMCOR + 1)\r
250         #define HWTC_DIVISOR 1\r
251         #define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant\r
252 \r
253 #elif ((SELECTED_PORT == PORT_MICROCHIP_PIC32MX) || (SELECTED_PORT == PORT_MICROCHIP_PIC32MZ))\r
254 \r
255         #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
256         #define HWTC_COUNT (TMR1)\r
257         #define HWTC_PERIOD (PR1 + 1)\r
258         #define HWTC_DIVISOR 1\r
259         #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
260 \r
261 #elif (SELECTED_PORT == PORT_Microchip_dsPIC_AND_PIC24)\r
262 \r
263         /* For Microchip PIC24 and dsPIC (16 bit) */\r
264 \r
265         /* Note: The trace library is designed for 32-bit MCUs and is slower than\r
266                 intended on 16-bit MCUs. Storing an event on a PIC24 takes about 70 usec.\r
267                 In comparison, this is 10-20 times faster on a 32-bit MCU... */\r
268 \r
269         #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
270         #define HWTC_COUNT (TMR1)\r
271         #define HWTC_PERIOD (PR1+1)\r
272         #define HWTC_DIVISOR 1\r
273         #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
274 \r
275 #elif (SELECTED_PORT == PORT_Atmel_AT91SAM7)\r
276 \r
277         /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
278 \r
279         #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
280         #define HWTC_COUNT ((uint32_t)(AT91C_BASE_PITC->PITC_PIIR & 0xFFFFF))\r
281         #define HWTC_PERIOD ((uint32_t)(AT91C_BASE_PITC->PITC_PIMR + 1))\r
282         #define HWTC_DIVISOR 1\r
283         #define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant\r
284 \r
285 #elif (SELECTED_PORT == PORT_Atmel_UC3A0)\r
286 \r
287         /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
288         /* For Atmel AVR32 (AT32UC3A).*/\r
289 \r
290         #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
291         #define HWTC_COUNT ((uint32_t)sysreg_read(AVR32_COUNT))\r
292         #define HWTC_PERIOD ((uint32_t)(sysreg_read(AVR32_COMPARE) + 1))\r
293         #define HWTC_DIVISOR 1\r
294         #define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant\r
295 \r
296 #elif (SELECTED_PORT == PORT_NXP_LPC210X)\r
297 \r
298         /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
299         /* Tested with LPC2106, but should work with most LPC21XX chips. */\r
300 \r
301         #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
302         #define HWTC_COUNT *((uint32_t *)0xE0004008 )\r
303         #define HWTC_PERIOD *((uint32_t *)0xE0004018 )\r
304         #define HWTC_DIVISOR 1\r
305         #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
306 \r
307 #elif (SELECTED_PORT == PORT_TEXAS_INSTRUMENTS_TMS570)\r
308 \r
309         /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
310 \r
311         #define TRC_RTIFRC0 *((uint32_t *)0xFFFFFC10)\r
312         #define TRC_RTICOMP0 *((uint32_t *)0xFFFFFC50)\r
313         #define TRC_RTIUDCP0 *((uint32_t *)0xFFFFFC54)\r
314         #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
315         #define HWTC_COUNT (TRC_RTIFRC0 - (TRC_RTICOMP0 - TRC_RTIUDCP0))\r
316         #define HWTC_PERIOD (RTIUDCP0)\r
317         #define HWTC_DIVISOR 1\r
318 \r
319         #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
320 \r
321 #elif (SELECTED_PORT == PORT_TEXAS_INSTRUMENTS_MSP430)\r
322 \r
323         /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
324 \r
325         #define HWTC_COUNT_DIRECTION DIRECTION_INCREMENTING\r
326         #define HWTC_COUNT (TA0R)\r
327         #define HWTC_PERIOD (((uint16_t)TACCR0)+1)\r
328         #define HWTC_DIVISOR 1\r
329         #define IRQ_PRIORITY_ORDER 1 // higher IRQ priority values are more significant\r
330 \r
331 #elif (SELECTED_PORT == PORT_XILINX_PPC405)\r
332 \r
333         /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
334 \r
335         #define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING\r
336         #define HWTC_COUNT mfspr(0x3db)\r
337         #if (defined configCPU_CLOCK_HZ && defined configTICK_RATE_HZ) // Check if FreeRTOS\r
338                 /* For FreeRTOS only - found no generic OS independent solution for the PPC405 architecture. */\r
339                 #define HWTC_PERIOD ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) // Same as in port.c for PPC405\r
340         #else\r
341                 /* Not defined for other operating systems yet */\r
342                 #error HWTC_PERIOD must be defined to give the number of hardware timer ticks per OS tick.\r
343         #endif\r
344         #define HWTC_DIVISOR 1\r
345         #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
346 \r
347 #elif (SELECTED_PORT == PORT_XILINX_PPC440)\r
348 \r
349         /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
350         /* This should work with most PowerPC chips */\r
351 \r
352         #define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING\r
353         #define HWTC_COUNT mfspr(0x016)\r
354         #if (defined configCPU_CLOCK_HZ && defined configTICK_RATE_HZ) // Check if FreeRTOS\r
355                 /* For FreeRTOS only - found no generic OS independent solution for the PPC440 architecture. */\r
356                 #define HWTC_PERIOD ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) // Same as in port.c for PPC440\r
357         #else\r
358                 /* Not defined for other operating systems yet */\r
359                 #error HWTC_PERIOD must be defined to give the number of hardware timer ticks per OS tick.\r
360         #endif\r
361         #define HWTC_DIVISOR 1\r
362         #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
363 \r
364 #elif (SELECTED_PORT == PORT_XILINX_MICROBLAZE)\r
365 \r
366         /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
367 \r
368         /* This should work with most Microblaze configurations.\r
369          * It uses the AXI Timer 0 - the tick interrupt source.\r
370          * If an AXI Timer 0 peripheral is available on your hardware platform, no modifications are required.\r
371          */\r
372         #include "xtmrctr_l.h"\r
373 \r
374         #define HWTC_COUNT_DIRECTION DIRECTION_DECREMENTING\r
375         #define HWTC_COUNT XTmrCtr_GetTimerCounterReg( XPAR_TMRCTR_0_BASEADDR, 0 )\r
376         #define HWTC_PERIOD (XTmrCtr_mGetLoadReg( XPAR_TMRCTR_0_BASEADDR, 0) + 1)\r
377         #define HWTC_DIVISOR 16\r
378         #define IRQ_PRIORITY_ORDER 0 // lower IRQ priority values are more significant\r
379 \r
380 #elif (SELECTED_PORT == PORT_ARM_CORTEX_A9)\r
381 \r
382         /* UNOFFICIAL PORT - NOT YET VERIFIED BY PERCEPIO */\r
383 \r
384     #define CA9_MPCORE_PRIVCTR_CONTROL_PRESCALER_MASK    0x0000FF00\r
385     #define CA9_MPCORE_PRIVCTR_CONTROL_PRESCALER_SHIFT   8\r
386 \r
387     #define CA9_MPCORE_PRIVCTR_PERIOD_REG       (*(volatile uint32_t*)(0xF8F00600 + 0))\r
388     #define CA9_MPCORE_PRIVCTR_COUNTER_REG      (*(volatile uint32_t*)(0xF8F00600 + 4))\r
389     #define CA9_MPCORE_PRIVCTR_CONTROL_REG      (*(volatile uint32_t*)(0xF8F00600 + 8))\r
390 \r
391     #define CA9_MPCORE_PRIVCTR_PRESCALER        (((CA9_MPCORE_PRIVCTR_CONTROL_REG & CA9_MPCORE_PRIVCTR_CONTROL_PRESCALER_MASK) >> CA9_MPCORE_PRIVCTR_CONTROL_PRESCALER_SHIFT) + 1)\r
392 \r
393 \r
394     #define HWTC_COUNT_DIRECTION                DIRECTION_DECREMENTING\r
395     #define HWTC_COUNT                          CA9_MPCORE_PRIVCTR_COUNTER_REG\r
396     #define HWTC_PERIOD                         ((CA9_MPCORE_PRIVCTR_PERIOD_REG * CA9_MPCORE_PRIVCTR_PRESCALER) + 1)\r
397 \r
398     //NOTE: The private timer ticks with a very high frequency (half the core-clock usually),\r
399     //but offers the possibility to apply a prescaler. Depending on the prescaler you set the\r
400     //HWTC_DIVISOR may need to be raised. Refer to the notes at the beginning of this file\r
401     //for more information.\r
402     #define HWTC_DIVISOR 1\r
403 \r
404     #define IRQ_PRIORITY_ORDER 0  // lower IRQ priority values are more significant\r
405 \r
406 #elif (SELECTED_PORT == PORT_APPLICATION_DEFINED)\r
407 \r
408         #if !( defined (HWTC_COUNT_DIRECTION) && defined (HWTC_COUNT) && defined (HWTC_PERIOD) && defined (HWTC_DIVISOR) && defined (IRQ_PRIORITY_ORDER) )\r
409                 #error SELECTED_PORT is PORT_APPLICATION_DEFINED but not all of the necessary constants have been defined.\r
410         #endif\r
411 \r
412 #elif (SELECTED_PORT != PORT_NOT_SET)\r
413 \r
414         #error "SELECTED_PORT had unsupported value!"\r
415         #define SELECTED_PORT PORT_NOT_SET\r
416 \r
417 #endif\r
418 \r
419 #if (SELECTED_PORT != PORT_NOT_SET)\r
420 \r
421         #ifndef HWTC_COUNT_DIRECTION\r
422         #error "HWTC_COUNT_DIRECTION is not set!"\r
423         #endif\r
424 \r
425         #ifndef HWTC_COUNT\r
426         #error "HWTC_COUNT is not set!"\r
427         #endif\r
428 \r
429         #ifndef HWTC_PERIOD\r
430         #error "HWTC_PERIOD is not set!"\r
431         #endif\r
432 \r
433         #ifndef HWTC_DIVISOR\r
434         #error "HWTC_DIVISOR is not set!"\r
435         #endif\r
436 \r
437         #ifndef IRQ_PRIORITY_ORDER\r
438         #error "IRQ_PRIORITY_ORDER is not set!"\r
439         #elif (IRQ_PRIORITY_ORDER != 0) && (IRQ_PRIORITY_ORDER != 1)\r
440         #error "IRQ_PRIORITY_ORDER has bad value!"\r
441         #endif\r
442 \r
443         #if (HWTC_DIVISOR < 1)\r
444         #error "HWTC_DIVISOR must be a non-zero positive value!"\r
445         #endif\r
446 \r
447 #endif\r
448 /*******************************************************************************\r
449  * vTraceConsoleMessage\r
450  *\r
451  * A wrapper for your system-specific console "printf" console output function.\r
452  * This needs to be correctly defined to see status reports from the trace\r
453  * status monitor task (this is defined in trcUser.c).\r
454  ******************************************************************************/\r
455 #define vTraceConsoleMessage(x)\r
456 \r
457 /*******************************************************************************\r
458  * vTracePortGetTimeStamp\r
459  *\r
460  * Returns the current time based on the HWTC macros which provide a hardware\r
461  * isolation layer towards the hardware timer/counter.\r
462  *\r
463  * The HWTC macros and vTracePortGetTimeStamp is the main porting issue\r
464  * or the trace recorder library. Typically you should not need to change\r
465  * the code of vTracePortGetTimeStamp if using the HWTC macros.\r
466  *\r
467  ******************************************************************************/\r
468 void vTracePortGetTimeStamp(uint32_t *puiTimestamp);\r
469 \r
470 #endif\r