1 /*
2  * Trace Recorder for Tracealyzer v4.8.1
3  * Copyright 2023 Percepio AB
4  * www.percepio.com
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  *
8  * The configuration for trace streaming ("stream ports").
9  */
10 
11 #ifndef TRC_STREAM_PORT_CONFIG_H
12 #define TRC_STREAM_PORT_CONFIG_H
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 /**
19  * @def TRC_CFG_STREAM_PORT_ITM_PORT
20  *
21  * @brief Valid values: 0 - 31
22  *
23  * What ITM port to use for the ITM software events. Make sure the IDE is
24  * configured for the same channel.
25  *
26  * Default: 1 (0 is typically terminal output and 31 is used by Keil)
27  */
28 #define TRC_CFG_STREAM_PORT_ITM_PORT 1
29 
30 /**
31  * @def TRC_CFG_STREAM_PORT_USE_INTERNAL_BUFFER
32  *
33  * @brief This define will determine whether to use the internal buffer or not.
34  * If file writing creates additional trace events (i.e. it uses semaphores or mutexes),
35  * then the internal buffer must be enabled to avoid infinite recursion.
36  */
37 #define TRC_CFG_STREAM_PORT_USE_INTERNAL_BUFFER 0
38 
39 /**
40  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_SIZE
41  *
42  * @brief Configures the size of the internal buffer if used.
43  */
44 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_SIZE 5120
45 
46 /**
47  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_WRITE_MODE
48  *
49  * @brief This should be set to TRC_INTERNAL_EVENT_BUFFER_OPTION_WRITE_MODE_DIRECT for best performance.
50  */
51 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_WRITE_MODE TRC_INTERNAL_EVENT_BUFFER_OPTION_WRITE_MODE_DIRECT
52 
53 /**
54  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_TRANSFER_MODE
55  *
56  * @brief Defines if the internal buffer will attempt to transfer all data each time or limit it to a chunk size.
57  */
58 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_TRANSFER_MODE TRC_INTERNAL_EVENT_BUFFER_OPTION_TRANSFER_MODE_ALL
59 
60 /**
61  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_SIZE
62  *
63  * @brief Defines the maximum chunk size when transferring
64  * internal buffer events in chunks.
65  */
66 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_SIZE 1024
67 
68 /**
69  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_SIZE_LIMIT
70  *
71  * @brief Defines the number of transferred bytes needed to trigger another transfer.
72  * It also depends on TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_COUNT_LIMIT to set a maximum number
73  * of additional transfers this loop.
74  * This will increase throughput by immediately doing a transfer and not wait for another xTraceTzCtrl() loop.
75  */
76 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_SIZE_LIMIT 256
77 
78 /**
79  * @def TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_COUNT_LIMIT
80  *
81  * @brief Defines the maximum number of times to trigger another transfer before returning to xTraceTzCtrl().
82  * It also depends on TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_SIZE_LIMIT to see if a meaningful amount of data was
83  * transferred in the last loop.
84  * This will increase throughput by immediately doing a transfer and not wait for another xTraceTzCtrl() loop.
85  */
86 #define TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_COUNT_LIMIT 5
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif /* TRC_STREAM_PORT_CONFIG_H */
93