System Trace Module(STM) Library API Reference Guide
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
StmLibrary.h
Go to the documentation of this file.
1 /*
2  * StmLibrary.h
3  *
4  * STM Library public API Definitions.
5  *
6  * Copyright (C) 2009-2012 Texas Instruments Incorporated - http://www.ti.com/
7  *
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  *
16  * Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in the
18  * documentation and/or other materials provided with the
19  * distribution.
20  *
21  * Neither the name of Texas Instruments Incorporated nor the names of
22  * its contributors may be used to endorse or promote products derived
23  * from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  *
37 */
38 #ifndef __STMLLIBRARY_H
39 #define __STMLLIBRARY_H
40 
41 #ifdef _CIO
42 #include <stdio.h>
43 #endif
44 #include <stdint.h>
45 #include <stdarg.h>
46 #include <stdbool.h>
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 
209 // Note - the version definitions must have the end of line immediately after the value (packaging script requirement)
210 #define STMLIB_MAJOR_VERSION (0x5)
211 
212 #define STMLIB_MINOR_VERSION (0x1)
213 
221 #ifndef __bool_true_false_are_defined
222 typedef enum
223 {
224  false = 0,
225  true = 1
226 
227 }bool;
228 #endif
229 
235 typedef enum{
236 
246  eSTM_ERROR_FIFO_NOTEMPTY = -8
247 
248 }eSTM_STATUS;
249 
255 typedef enum
256 {
257  eByte = 1,
258  eShort = 2,
259  eWord = 4
261 
267 #ifdef _CIO
268 typedef struct _STMBufObj
269 {
270  char * pFileName; // Used in eBlockingCIO case only! CIO filename for STM destination.
271  // if NULL stdout used
272  bool fileAppend; // Preserve contents of file and append
273  char * pMasterId; // Used in eBlockingCIO case only! Pointer to client provided master name
274 
275 }STMBufObj;
276 #else
277 typedef struct _STMBufObj
278 {
279  bool notUsed; // Not used in normal mode but we need to keep the API backward compatible
280 }STMBufObj;
281 #endif
282 
299 typedef void(*STMXport_callback)(const char * funcName, eSTM_STATUS);
300 
306 typedef enum
307 {
311 
322 typedef struct _STMConfigObj
323 {
324  uint32_t STM_XportBaseAddr;
327  uint32_t STM_CntlBaseAddr;
341 }STMConfigObj;
342 
343 
344 typedef enum
345 {
355 
356 #ifdef _CS_STM
357 typedef struct _CS_ConfigObj
358 {
359  uint32_t TraceBufSize;
361 }STM_CS_ConfigObj;
362 #endif
363 #ifdef _MIPI_STM
364 typedef struct _MIPI_ConfigObj
365 {
366  uint32_t TraceBufSize;
367  uint32_t SW_MasterMapping;
369  uint32_t SW_MasterMask;
371  uint32_t HW_MasterMapping;
374 }STM_MIPI_ConfigObj;
375 #endif
376 typedef struct _DCM_InfoObj
377 {
378  uint32_t stm_data_flip;
379  uint32_t stpVersion;
380  bool atb_head_required;
381  uint32_t atb_head_present_0;
382  uint32_t atb_head_pointer_0;
383  uint32_t atb_head_present_1;
384  uint32_t atb_head_pointer_1;
385 
387 
392 //This is an incomplete structure used to make the contents of the handle private to the library
393 typedef struct _STMHandle STMHandle;
394 
395 
396 // Public Functions Interfaces
397 
453 STMHandle* STMXport_open( STMBufObj * pSTMBufObj, STMConfigObj * pSTM_ConfigObj);
454 
455 #ifdef _CS_STM
456 
478 eSTM_STATUS STMXport_config_CS(STMHandle* pSTMHandle, STM_CS_ConfigObj * pCS_configObj);
479 #endif
480 #ifdef _MIPI_STM
481 
503 eSTM_STATUS STMXport_config_MIPI(STMHandle* pSTMHandle, STM_MIPI_ConfigObj * pMIPI_configObj);
504 #endif
505 
520 eSTM_STATUS STMXport_getDCMInfo(STMHandle* pSTMHandle, STM_DCM_InfoObj * pDCM_InfoObj);
521 
571 eSTM_STATUS STMXport_printf(STMHandle* pSTMHandle, int32_t chNum, const char* pMsgString, ... );
572 
602 eSTM_STATUS STMXport_printfV(STMHandle* pSTMHandle, int32_t chNum, const char* pMsgString, va_list arg_addr);
603 
638 eSTM_STATUS STMXport_putMsg(STMHandle* pSTMHandle, int32_t chNum, const char* pMsgString, int32_t iMsgByteCount);
639 
671 eSTM_STATUS STMXport_putBuf(STMHandle* pSTMHandle, int32_t chNum,
672  void* pDataBuf, eSTMElementSize elementSize, int32_t elementCount);
673 
703 eSTM_STATUS STMXport_putTwoBufs(STMHandle* pSTMHandle, int32_t chNum,
704  void* pDataBuf1, eSTMElementSize elementSize1, int32_t elementCount1,
705  void* pDataBuf2, eSTMElementSize elementSize2, int32_t elementCount2);
706 
736 eSTM_STATUS STMXport_getBufInfo(STMHandle* pSTMHandle, uint32_t * msgCnt, uint32_t * curMsgBufSize);
737 
759 
776 
802 eSTM_STATUS STMXport_getVersion(STMHandle* pSTMHandle, uint32_t * pSTMLibMajorVersion, uint32_t * pSTMLibMinorVersion);
803 
824 eSTM_STATUS STMXport_putWord(STMHandle* pSTMHandle, int32_t chNum, uint32_t data);
825 
846 eSTM_STATUS STMXport_putShort(STMHandle* pSTMHandle, int32_t chNum, uint16_t data);
847 
868 eSTM_STATUS STMXport_putByte(STMHandle* pSTMHandle, int32_t chNum, uint8_t data);
869 
902 eSTM_STATUS STMXport_logMsg(STMHandle* pSTMHandle, int32_t chNum, const char* pMsgString, ...);
903 
927 eSTM_STATUS STMXport_logMsg0(STMHandle* pSTMHandle, int32_t chNum, const char* pMsgString);
928 
956 eSTM_STATUS STMXport_logMsg1(STMHandle* pSTMHandle, int32_t chNum, const char* pMsgString, uint32_t parm1);
957 
984 eSTM_STATUS STMXport_logMsg2(STMHandle* pSTMHandle, int32_t chNum, const char* pMsgString, uint32_t parm1, uint32_t parm2);
985 
1003 eSTM_STATUS STMXport_setMetaState(STMHandle* pSTMHandle, bool onDemand);
1004 
1018 eSTM_STATUS STMXport_getMetaState(STMHandle* pSTMHandle, bool * onDemand);
1019 
1040 
1041 
1042 
1043 #ifdef __cplusplus
1044 }
1045 #endif
1046 
1047 #endif /* __STMLLIBARY_H */
bool
Definition: StmLibrary.h:222
eSTM_STATUS STMXport_putWord(STMHandle *pSTMHandle, int32_t chNum, uint32_t data)
eSTM_XmitPrintfMode
Definition: StmLibrary.h:306
eSTM_STATUS STMXport_getVersion(STMHandle *pSTMHandle, uint32_t *pSTMLibMajorVersion, uint32_t *pSTMLibMinorVersion)
eSTMElementSize
Definition: StmLibrary.h:255
eSTM_STATUS STMXport_printfV(STMHandle *pSTMHandle, int32_t chNum, const char *pMsgString, va_list arg_addr)
struct _STMHandle STMHandle
Definition: StmLibrary.h:393
Definition: StmLibrary.h:350
Definition: StmLibrary.h:308
Definition: StmLibrary.h:243
uint32_t STM_XportBaseAddr
Definition: StmLibrary.h:324
Definition: StmLibrary.h:237
eSTM_STATUS STMXport_logMsg1(STMHandle *pSTMHandle, int32_t chNum, const char *pMsgString, uint32_t parm1)
eSTM_STATUS STMXport_putTwoBufs(STMHandle *pSTMHandle, int32_t chNum, void *pDataBuf1, eSTMElementSize elementSize1, int32_t elementCount1, void *pDataBuf2, eSTMElementSize elementSize2, int32_t elementCount2)
Definition: StmLibrary.h:347
void(* STMXport_callback)(const char *funcName, eSTM_STATUS)
Definition: StmLibrary.h:299
eSTM_STATUS STMXport_getBufInfo(STMHandle *pSTMHandle, uint32_t *msgCnt, uint32_t *curMsgBufSize)
eSTM_STATUS STMXport_setMetaState(STMHandle *pSTMHandle, bool onDemand)
Definition: StmLibrary.h:241
eSTM_STATUS STMXport_putByte(STMHandle *pSTMHandle, int32_t chNum, uint8_t data)
eSTM_STATUS STMXport_putShort(STMHandle *pSTMHandle, int32_t chNum, uint16_t data)
Definition: StmLibrary.h:349
eSTM_STATUS STMXport_getDCMInfo(STMHandle *pSTMHandle, STM_DCM_InfoObj *pDCM_InfoObj)
eSTM_STATUS
Definition: StmLibrary.h:235
Definition: StmLibrary.h:346
eSTM_STATUS STMXport_sendMetaOnDemand(STMHandle *pSTMHandle)
Definition: StmLibrary.h:322
eSTM_STATUS STMXport_close(STMHandle *pSTMHandle)
Definition: StmLibrary.h:348
Definition: StmLibrary.h:240
Definition: StmLibrary.h:259
Definition: StmLibrary.h:245
eSTM_STATUS STMXport_putBuf(STMHandle *pSTMHandle, int32_t chNum, void *pDataBuf, eSTMElementSize elementSize, int32_t elementCount)
eSTM_ExportBufSize
Definition: StmLibrary.h:344
eSTM_STATUS STMXport_logMsg0(STMHandle *pSTMHandle, int32_t chNum, const char *pMsgString)
Definition: StmLibrary.h:309
eSTM_STATUS STMXport_logMsg(STMHandle *pSTMHandle, int32_t chNum, const char *pMsgString,...)
Definition: StmLibrary.h:352
Definition: StmLibrary.h:239
Definition: StmLibrary.h:257
eSTM_XmitPrintfMode xmit_printf_mode
Definition: StmLibrary.h:330
struct _STMConfigObj STMConfigObj
Definition: StmLibrary.h:244
Definition: StmLibrary.h:376
Definition: StmLibrary.h:238
eSTM_STATUS STMXport_flush(STMHandle *pSTMHandle)
eSTM_STATUS STMXport_getMetaState(STMHandle *pSTMHandle, bool *onDemand)
STMHandle * STMXport_open(STMBufObj *pSTMBufObj, STMConfigObj *pSTM_ConfigObj)
eSTM_STATUS STMXport_logMsg2(STMHandle *pSTMHandle, int32_t chNum, const char *pMsgString, uint32_t parm1, uint32_t parm2)
eSTM_STATUS STMXport_printf(STMHandle *pSTMHandle, int32_t chNum, const char *pMsgString,...)
uint32_t STM_CntlBaseAddr
Definition: StmLibrary.h:327
Definition: StmLibrary.h:277
Definition: StmLibrary.h:242
bool optimize_strings
Definition: StmLibrary.h:332
uint32_t STM_ChannelResolution
Definition: StmLibrary.h:325
Definition: StmLibrary.h:258
struct _STMBufObj STMBufObj
Definition: StmLibrary.h:353
Definition: StmLibrary.h:351
eSTM_STATUS STMXport_putMsg(STMHandle *pSTMHandle, int32_t chNum, const char *pMsgString, int32_t iMsgByteCount)
STMXport_callback pCallBack
Definition: StmLibrary.h:328