]> git.sur5r.net Git - freertos/blob - FreeRTOS-Labs/Source/FreeRTOS-Plus-Trace/streamports/File/include/trcStreamingPort.h
Add the Labs projects provided in the V10.2.1_191129 zip file.
[freertos] / FreeRTOS-Labs / Source / FreeRTOS-Plus-Trace / streamports / File / include / trcStreamingPort.h
1 /*******************************************************************************\r
2  * Trace Recorder Library for Tracealyzer v4.1.5\r
3  * Percepio AB, www.percepio.com\r
4  *\r
5  * trcStreamingPort.h\r
6  *\r
7  * The interface definitions for trace streaming ("stream ports").\r
8  * This "stream port" sets up the recorder to stream the trace to file.\r
9  *\r
10  * Terms of Use\r
11  * This file is part of the trace recorder library (RECORDER), which is the \r
12  * intellectual property of Percepio AB (PERCEPIO) and provided under a\r
13  * license as follows.\r
14  * The RECORDER may be used free of charge for the purpose of recording data\r
15  * intended for analysis in PERCEPIO products. It may not be used or modified\r
16  * for other purposes without explicit permission from PERCEPIO.\r
17  * You may distribute the RECORDER in its original source code form, assuming\r
18  * this text (terms of use, disclaimer, copyright notice) is unchanged. You are\r
19  * allowed to distribute the RECORDER with minor modifications intended for\r
20  * configuration or porting of the RECORDER, e.g., to allow using it on a \r
21  * specific processor, processor family or with a specific communication\r
22  * interface. Any such modifications should be documented directly below\r
23  * this comment block.  \r
24  *\r
25  * Disclaimer\r
26  * The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty\r
27  * as to its use or performance. PERCEPIO does not and cannot warrant the \r
28  * performance or results you may obtain by using the RECORDER or documentation.\r
29  * PERCEPIO make no warranties, express or implied, as to noninfringement of\r
30  * third party rights, merchantability, or fitness for any particular purpose.\r
31  * In no event will PERCEPIO, its technology partners, or distributors be liable\r
32  * to you for any consequential, incidental or special damages, including any\r
33  * lost profits or lost savings, even if a representative of PERCEPIO has been\r
34  * advised of the possibility of such damages, or for any claim by any third\r
35  * party. Some jurisdictions do not allow the exclusion or limitation of\r
36  * incidental, consequential or special damages, or the exclusion of implied\r
37  * warranties or limitations on how long an implied warranty may last, so the\r
38  * above limitations may not apply to you.\r
39  *\r
40  * Tabs are used for indent in this file (1 tab = 4 spaces)\r
41  *\r
42  * Copyright Percepio AB, 2018.\r
43  * www.percepio.com\r
44  ******************************************************************************/\r
45 \r
46 #ifndef TRC_STREAMING_PORT_H\r
47 #define TRC_STREAMING_PORT_H\r
48 \r
49 #include <stdint.h>\r
50 \r
51 #ifdef __cplusplus\r
52 extern "C" {\r
53 #endif\r
54 \r
55 int32_t writeToFile(void* data, uint32_t size, int32_t *ptrBytesWritten);\r
56 \r
57 void closeFile(void);\r
58 \r
59 void openFile(char* fileName);\r
60 \r
61 /* This define will determine whether to use the internal PagedEventBuffer or not.\r
62 If file writing creates additional trace events (i.e. it uses semaphores or mutexes), \r
63 then the paged event buffer must be enabled to avoid infinite recursion. */\r
64 #define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 1\r
65 \r
66 #define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) 0 /* Does not read commands from Tz (yet) */\r
67 \r
68 #define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesSent) writeToFile(_ptrData, _size, _ptrBytesSent)\r
69 \r
70 #if (TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC)\r
71 #define TRC_STREAM_PORT_MALLOC() \\r
72                         _TzTraceData = TRC_PORT_MALLOC((TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT) * (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE));\r
73 extern char* _TzTraceData;\r
74 #else\r
75 #define TRC_STREAM_PORT_MALLOC()  /* Custom or static allocation. Not used. */\r
76 #endif\r
77 #define TRC_STREAM_PORT_INIT() \\r
78                 TRC_STREAM_PORT_MALLOC(); \\r
79                 openFile("trace.psf")\r
80 \r
81 #define TRC_STREAM_PORT_ON_TRACE_END() closeFile()\r
82 \r
83 #ifdef __cplusplus\r
84 }\r
85 #endif\r
86 \r
87 #endif /* TRC_STREAMING_PORT_H */\r