]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/streamports/TCPIP/include/trcStreamingPort.h
Update to the latest trace recorder library.
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-Trace / streamports / TCPIP / include / trcStreamingPort.h
1 /*******************************************************************************\r
2  * Trace Recorder Library for Tracealyzer v3.1.2\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 use TCP/IP as streaming channel.\r
9  * The example is for lwIP.\r
10  *\r
11  * Terms of Use\r
12  * This file is part of the trace recorder library (RECORDER), which is the \r
13  * intellectual property of Percepio AB (PERCEPIO) and provided under a\r
14  * license as follows.\r
15  * The RECORDER may be used free of charge for the purpose of recording data\r
16  * intended for analysis in PERCEPIO products. It may not be used or modified\r
17  * for other purposes without explicit permission from PERCEPIO.\r
18  * You may distribute the RECORDER in its original source code form, assuming\r
19  * this text (terms of use, disclaimer, copyright notice) is unchanged. You are\r
20  * allowed to distribute the RECORDER with minor modifications intended for\r
21  * configuration or porting of the RECORDER, e.g., to allow using it on a \r
22  * specific processor, processor family or with a specific communication\r
23  * interface. Any such modifications should be documented directly below\r
24  * this comment block.  \r
25  *\r
26  * Disclaimer\r
27  * The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty\r
28  * as to its use or performance. PERCEPIO does not and cannot warrant the \r
29  * performance or results you may obtain by using the RECORDER or documentation.\r
30  * PERCEPIO make no warranties, express or implied, as to noninfringement of\r
31  * third party rights, merchantability, or fitness for any particular purpose.\r
32  * In no event will PERCEPIO, its technology partners, or distributors be liable\r
33  * to you for any consequential, incidental or special damages, including any\r
34  * lost profits or lost savings, even if a representative of PERCEPIO has been\r
35  * advised of the possibility of such damages, or for any claim by any third\r
36  * party. Some jurisdictions do not allow the exclusion or limitation of\r
37  * incidental, consequential or special damages, or the exclusion of implied\r
38  * warranties or limitations on how long an implied warranty may last, so the\r
39  * above limitations may not apply to you.\r
40  *\r
41  * Tabs are used for indent in this file (1 tab = 4 spaces)\r
42  *\r
43  * Copyright Percepio AB, 2017.\r
44  * www.percepio.com\r
45  ******************************************************************************/\r
46 \r
47 #ifndef TRC_STREAMING_PORT_H\r
48 #define TRC_STREAMING_PORT_H\r
49 \r
50 #ifdef __cplusplus\r
51 extern "C" {\r
52 #endif\r
53 \r
54 /*******************************************************************************\r
55  * TRC_RECORDER_TRANSFER_METHOD_TCPIP\r
56  * \r
57  * This stream port for TCP/IP uses a temporary buffer consisting of multiple \r
58  * pages, that are transmitted periodically by the TzCtrl task. You can modify \r
59  * the supporting functions to match your system. See trcStreamingPort.c\r
60  ******************************************************************************/\r
61 \r
62 int32_t trcTcpWrite(void* data, uint32_t size, int32_t *ptrBytesWritten);\r
63 int32_t trcTcpRead(void* data, uint32_t size, int32_t *ptrBytesRead);\r
64 \r
65 #if TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_STATIC\r
66 #define TRC_STREAM_PORT_ALLOCATE_FIELDS() static char _TzTraceData[TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT * TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE];       /* Static allocation. */\r
67 #define TRC_STREAM_PORT_MALLOC() /* Static allocation. Not used. */\r
68 #else\r
69 #define TRC_STREAM_PORT_ALLOCATE_FIELDS() static char* _TzTraceData = NULL;     /* Dynamic allocation. */\r
70 #define TRC_STREAM_PORT_MALLOC() _TzTraceData = TRC_PORT_MALLOC(TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT * TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE);\r
71 #endif\r
72 \r
73 #define TRC_STREAM_PORT_INIT() \\r
74         TRC_STREAM_PORT_MALLOC(); /*Dynamic allocation or empty if static */ \\r
75         prvPagedEventBufferInit(_TzTraceData);\r
76 \r
77 #define TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) _type* _ptrData; _ptrData = (_type*)prvPagedEventBufferGetWritePointer(_size);\r
78 #define TRC_STREAM_PORT_ALLOCATE_DYNAMIC_EVENT(_type, _ptrData, _size) TRC_STREAM_PORT_ALLOCATE_EVENT(_type, _ptrData, _size) /* We do the same thing as for non-dynamic event sizes */\r
79 #define TRC_STREAM_PORT_COMMIT_EVENT(_ptrData, _size) /* Not needed since we write immediately into the buffer received above by TRC_STREAM_PORT_ALLOCATE_EVENT, and the TRC_STREAM_PORT_PERIODIC_SEND_DATA defined below will take care of the actual trace transfer. */\r
80 #define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) trcTcpRead(_ptrData, _size, _ptrBytesRead);\r
81 #define TRC_STREAM_PORT_PERIODIC_SEND_DATA(_ptrBytesSent) prvPagedEventBufferTransfer(trcTcpWrite, _ptrBytesSent);\r
82 \r
83 #define TRC_STREAM_PORT_ON_TRACE_BEGIN() prvPagedEventBufferInit(_TzTraceData);\r
84 #define TRC_STREAM_PORT_ON_TRACE_END() /* Do nothing */\r
85 \r
86 #ifdef __cplusplus\r
87 }\r
88 #endif\r
89 \r
90 #endif /* TRC_STREAMING_PORT_H */\r