ETB Library
ETBInterface.h
Go to the documentation of this file.
1 #ifndef __ETB_INTERFACE_H
2 #define __ETB_INTERFACE_H
3 
4 #include <stdint.h> /*ANSI C99 specific type definitions */
5 /*
6  * Embedded Trace Buffer (ETB) API
7  *
8  * Copyright (C) 2009-2012 Texas Instruments Incorporated - http://www.ti.com/
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the
18  * distribution.
19  * Neither the name of Texas Instruments Incorporated nor the names of
20  * its contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35 */
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
47 /* The mainpage for doxygen has been added to the end of this file */
48 
52 #define ETBLIB_MAJOR_VERSION (0x1)
53 
57 #define ETBLIB_MINOR_VERSION (0x16)
58 
62 #define SYS_ETB 0xFF
63 
67 #define ARM_ETB 0xAA
68 
69 #if (defined(TCI6612) || defined(TCI6614) || defined(TCI6616) || defined(TCI6618)) && !defined(C6670)
70 #define C6670
71 #endif
72 
73 #if (defined(C6671) || defined(C6672) || defined(C6674)) && !defined(C6678)
74 #define C6678
75 #endif
76 
77 
81 typedef enum _eETB_Error
82 {
83 
93 } eETB_Error ;
94 
95 
109 
110 
115 typedef enum _eETB_Mode
116 {
123 } eETB_Mode ;
124 
128 typedef enum _eDMA_Mode
129 {
132 } eDMA_Mode ;
133 
137 typedef enum _eCIC_Select
138 {
139  eCIC_0,
140  eCIC_1,
141  eCIC_2,
142  eCIC_3
143 } eCIC_Select;
144 
148 typedef struct _DMAConfig
149 {
150 #if defined(C6670) || defined(C6678)
151 
152  uint32_t cc;
153  uint16_t clrChannel;
158  uint16_t etbChannel;
163  eCIC_Select cic;
169 #endif
170 
171  uint16_t linkparam[3];
175  uint32_t dbufAddress;
176  uint32_t dbufWords;
180 } DMAConfig;
181 
191 typedef struct _DMAStatus
192 {
193  uint32_t startAddr;
196  uint32_t availableWords;
199  uint32_t isWrapped;
202  uint32_t dbufAddress;
203  uint32_t dbufWords;
204  uint32_t flushRequired;
205 } DMAStatus;
206 
212 typedef struct _ETBHandle_t ETBHandle;
213 
219 
223 typedef struct _ETBStatus
224 {
225  uint8_t canRead;
226  uint8_t isWrapped;
227  uint32_t availableWords;
229  uint32_t overflow;
231 } ETBStatus;
232 
236 typedef struct _ETBProperties
237 {
241 
266 eETB_Error ETB_open(ETB_errorCallback pErrCallBack, eETB_Mode mode, uint8_t coreID, ETBHandle** ppHandle, uint32_t* pETBSizeInWords);
267 
280 eETB_Error ETB_gethandle(uint8_t coreID, ETBHandle** ppHandle);
281 
293 eETB_Error ETB_enable(ETBHandle* pETBHandle, uint32_t triggerCount);
294 
306 eETB_Error ETB_disable(ETBHandle* pETBHandle);
307 
319 eETB_Error ETB_status(ETBHandle* pETBHandle, ETBStatus* status);
320 
343 eETB_Error ETB_read(ETBHandle* pETBHandle, uint32_t *pBuffer, uint32_t bufferLength, uint32_t startWord, uint32_t requestSize, uint32_t* pRetSize);
344 
355 eETB_Error ETB_close(ETBHandle* pETBHandle);
356 
379 eETB_Error ETB_flush(ETBHandle* pHandle);
380 
406 eETB_Error ETB_config_dma(ETBHandle* pHandle, const DMAConfig *pConfig);
407 
432 eETB_Error ETB_flush_dma(ETBHandle* pHandle, DMAStatus *pStatus);
433 
446 void ETB_setDmaStatus(ETBHandle* pHandle, DMAStatus *pStatus);
447 
458 void ETB_getProperties(ETBProperties *pProperties);
459 
460 #ifdef __cplusplus
461 }
462 #endif
463 
464 #endif //__ETB_INTERFACE_H
465 
466 /******************************************************************************/
467 /* ***** DOXYGEN ***** */
468 /******************************************************************************/