]> git.sur5r.net Git - freertos/blobdiff - 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
diff --git a/FreeRTOS-Labs/Source/FreeRTOS-Plus-Trace/streamports/File/include/trcStreamingPort.h b/FreeRTOS-Labs/Source/FreeRTOS-Plus-Trace/streamports/File/include/trcStreamingPort.h
new file mode 100644 (file)
index 0000000..2897b7c
--- /dev/null
@@ -0,0 +1,87 @@
+/*******************************************************************************\r
+ * Trace Recorder Library for Tracealyzer v4.1.5\r
+ * Percepio AB, www.percepio.com\r
+ *\r
+ * trcStreamingPort.h\r
+ *\r
+ * The interface definitions for trace streaming ("stream ports").\r
+ * This "stream port" sets up the recorder to stream the trace to file.\r
+ *\r
+ * Terms of Use\r
+ * This file is part of the trace recorder library (RECORDER), which is the \r
+ * intellectual property of Percepio AB (PERCEPIO) and provided under a\r
+ * license as follows.\r
+ * The RECORDER may be used free of charge for the purpose of recording data\r
+ * intended for analysis in PERCEPIO products. It may not be used or modified\r
+ * for other purposes without explicit permission from PERCEPIO.\r
+ * You may distribute the RECORDER in its original source code form, assuming\r
+ * this text (terms of use, disclaimer, copyright notice) is unchanged. You are\r
+ * allowed to distribute the RECORDER with minor modifications intended for\r
+ * configuration or porting of the RECORDER, e.g., to allow using it on a \r
+ * specific processor, processor family or with a specific communication\r
+ * interface. Any such modifications should be documented directly below\r
+ * this comment block.  \r
+ *\r
+ * Disclaimer\r
+ * The RECORDER is being delivered to you AS IS and PERCEPIO makes no warranty\r
+ * as to its use or performance. PERCEPIO does not and cannot warrant the \r
+ * performance or results you may obtain by using the RECORDER or documentation.\r
+ * PERCEPIO make no warranties, express or implied, as to noninfringement of\r
+ * third party rights, merchantability, or fitness for any particular purpose.\r
+ * In no event will PERCEPIO, its technology partners, or distributors be liable\r
+ * to you for any consequential, incidental or special damages, including any\r
+ * lost profits or lost savings, even if a representative of PERCEPIO has been\r
+ * advised of the possibility of such damages, or for any claim by any third\r
+ * party. Some jurisdictions do not allow the exclusion or limitation of\r
+ * incidental, consequential or special damages, or the exclusion of implied\r
+ * warranties or limitations on how long an implied warranty may last, so the\r
+ * above limitations may not apply to you.\r
+ *\r
+ * Tabs are used for indent in this file (1 tab = 4 spaces)\r
+ *\r
+ * Copyright Percepio AB, 2018.\r
+ * www.percepio.com\r
+ ******************************************************************************/\r
+\r
+#ifndef TRC_STREAMING_PORT_H\r
+#define TRC_STREAMING_PORT_H\r
+\r
+#include <stdint.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+int32_t writeToFile(void* data, uint32_t size, int32_t *ptrBytesWritten);\r
+\r
+void closeFile(void);\r
+\r
+void openFile(char* fileName);\r
+\r
+/* This define will determine whether to use the internal PagedEventBuffer or not.\r
+If file writing creates additional trace events (i.e. it uses semaphores or mutexes), \r
+then the paged event buffer must be enabled to avoid infinite recursion. */\r
+#define TRC_STREAM_PORT_USE_INTERNAL_BUFFER 1\r
+\r
+#define TRC_STREAM_PORT_READ_DATA(_ptrData, _size, _ptrBytesRead) 0 /* Does not read commands from Tz (yet) */\r
+\r
+#define TRC_STREAM_PORT_WRITE_DATA(_ptrData, _size, _ptrBytesSent) writeToFile(_ptrData, _size, _ptrBytesSent)\r
+\r
+#if (TRC_CFG_RECORDER_BUFFER_ALLOCATION == TRC_RECORDER_BUFFER_ALLOCATION_DYNAMIC)\r
+#define TRC_STREAM_PORT_MALLOC() \\r
+                       _TzTraceData = TRC_PORT_MALLOC((TRC_CFG_PAGED_EVENT_BUFFER_PAGE_COUNT) * (TRC_CFG_PAGED_EVENT_BUFFER_PAGE_SIZE));\r
+extern char* _TzTraceData;\r
+#else\r
+#define TRC_STREAM_PORT_MALLOC()  /* Custom or static allocation. Not used. */\r
+#endif\r
+#define TRC_STREAM_PORT_INIT() \\r
+               TRC_STREAM_PORT_MALLOC(); \\r
+               openFile("trace.psf")\r
+\r
+#define TRC_STREAM_PORT_ON_TRACE_END() closeFile()\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* TRC_STREAMING_PORT_H */\r