Common Platform (CP) Tracer Library API Reference Guide (TCI6614 Version)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
CPTLib.h
Go to the documentation of this file.
1 #ifndef __CPTLIBRARY_H
2 #define __CPTLIBRARY_H
3 /*
4  * CPTLib.h
5  *
6  * Common Platform (CP) Tracer Library API Definitions
7  *
8  * Copyright (C) 2010, 2011 Texas Instruments Incorporated - http://www.ti.com/
9  *
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  *
15  * Redistributions of source code must retain the above copyright
16  * notice, this list of conditions and the following disclaimer.
17  *
18  * Redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the
21  * distribution.
22  *
23  * Neither the name of Texas Instruments Incorporated nor the names of
24  * its contributors may be used to endorse or promote products derived
25  * from this software without specific prior written permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  *
39 */
40 
41 #include <stdlib.h>
42 #include <stdint.h> // The library uses C99 exact-width integer types
43 #include <stdbool.h>
44 
45 //Using forward slashes in the relative serach path for linux compatibility
46 
47 #ifdef _STM_Logging
48 #include "../../STMLib/include/StmLibrary.h"
49 #endif
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
290 //
292 // The following defines provide compatibility with other cToolsLibs(like ETBLib.h)when used
293 // in combination with each other.
294 //
296 #if defined(TCI6614) && !defined(_TCI6614)
297 #define _TCI6614
298 #endif
299 #if defined(TCI6612) && !defined(_TCI6612)
300 #define _TCI6612
301 #endif
302 #if defined(C6674) && !defined(_C6674)
303 #define _C6674
304 #endif
305 #if defined(C6672) && !defined(_C6672)
306 #define _C6672
307 #endif
308 #if defined(C6657) && !defined(_C6657)
309 #define _C6657
310 #endif
311 #if defined(C66AK2Hxx) && !defined(_C66AK2Hxx)
312 #define _C66AK2Hxx
313 #endif
314 #if defined(TCI6630K2L) && !defined(_TCI6630K2L)
315 #define _TCI6630K2L
316 #endif
317 #if defined(C66AK2Exx) && !defined(_66AK2Exx)
318 #define _66AK2Exx
319 #endif
320 #if defined(C66AK2Gxx) && !defined(_66AK2Gxx)
321 #define _66AK2Gxx
322 #endif
323 
324 /* C6670/8 are special cases because for some libraries,
325  * like ETBLib, the C6670/7C6678 cases are compatible with
326  * other devices (like TCI6614/TCI6612 in the C6670 case AND
327  * C6674/C6672 in the C6678 case).
328  */
329 #if defined(C6678) && !defined(_C6672) && !defined(_C6674) \
330  && !defined(_C6678)
331 #define _C6678
332 #endif
333 #if defined(C6670) && !defined(_TCI6614) && !defined(_TCI6612) \
334  && !defined(_C6670)
335 #define _C6670
336 #endif
337 
339 //
340 // Public Typedefs and Enums
341 //
343 
344 // Note - the version definitions must have the end of line immediately after the value (packaging script requirement)
345 #define CPTLIB_MAJOR_VERSION (0x0)
346 
347 #define CPTLIB_MINOR_VERSION (0xF)
348 
349 #define CPTLIB_FUNC (0xe89)
350 #define CPT_FUNC_ID_SCHEME (0x0)
352 #if defined(_C6670)
353 
354 #include "CPTLib_C6670.h"
355 
356 #elif defined(_C6671)
357 
358 #include "CPTLib_C6671.h"
359 
360 #elif defined(_C6672)
361 
362 #include "CPTLib_C6672.h"
363 
364 #elif defined(_C6674)
365 
366 #include "CPTLib_C6674.h"
367 
368 #elif defined(_C6678)
369 
370 #include "CPTLib_C6678.h"
371 
372 #elif defined(_C6657)
373 
374 #include "CPTLib_C6657.h"
375 
376 #elif defined(_TCI6614) && !defined(RUNTIME_DEVICE_SELECT)
377 
378 #include "CPTLib_TCI6614.h"
379 
380 #elif defined(_TCI6612) && !defined(RUNTIME_DEVICE_SELECT)
381 
382 #include "CPTLib_TCI6612.h"
383 
384 #elif defined(_C66AK2Hxx)
385 
386 #include "CPTLib_C66AK2Hxx.h"
387 
388 #elif defined(_TCI6630K2L)
389 
390 #include "CPTLib_TCI6630K2L.h"
391 
392 #elif defined(_66AK2Exx)
393 
394 #include "CPTLib_66AK2Exx.h"
395 
396 #elif defined(_66AK2Gxx)
397 
398 #include "CPTLib_66AK2Gxx.h"
399 
400 #endif
401 
407 typedef struct _CPT_Handle CPT_Handle_t;
408 
414 
419 typedef enum {
440 }eCPT_Error;
441 
442 
443 #ifdef RUNTIME_DEVICE_SELECT
444 
445 #include "CPTLib_TCI6612.h"
446 #include "CPTLib_TCI6614.h"
447 typedef enum {DEVID_TCI6612, DEVID_TCI6614} eCPT_DeviceID;
448 
449 eCPT_Error CPT_runtimeConfig(eCPT_DeviceID CPT_deviceID);
450 eCPT_Error CPT_getModID(char * modName, int * CPT_ModId);
451 eCPT_Error CPT_getMasterID(char * masterName, int * CPT_MasterId, int * CPT_MasterGroupCnt);
452 eCPT_Error CPT_getMetaDataSize(CPT_Handle_Pntr const pCPT_Handle, int * num_bytes);
453 eCPT_Error CPT_getMetaData(CPT_Handle_Pntr const pCPT_Handle, char * buf, int buf_size, int * num_bytes_returned);
454 eCPT_Error CPT_getDivideByFactor(int CPT_ModId, uint8_t * CPT_DivideByFactor);
455 eCPT_Error CPT_getModList(const char *** CPT_modList, int * CPT_listCnt);
456 eCPT_Error CPT_getMasterList(const char *** CPT_masterList, int * CPT_listCnt);
457 
458 struct CPT_ArmingInfo {
459  uint32_t arming_addr;
460  uint32_t arming_value;
461  uint32_t disarm_value;
462 };
463 
464 eCPT_Error CPT_getArmingInfo(CPT_Handle_Pntr const pCPT_Handle, struct CPT_ArmingInfo * pCPT_ArmingInfo );
465 #endif
466 
467 
472 typedef void(*CPT_CallBack)(const char * funcName, eCPT_Error);
473 
477 typedef enum { eCPT_MsgSelect_None = 0,
483  eCPT_MsgSelect_Num = 5
484  } eCPT_MsgSelects;
485 
489 typedef enum { eCPT_CntSelect_None = 0,
493  eCPT_CntSelect_Num = 2
494  } eCPT_CntSelects;
495 
499 typedef enum { eCPT_TrigOut_None = 0,
503  } eCPT_TrigOut;
504 
508 typedef enum { eCPT_Throughput_Cnt0 = 0,
511 
515 typedef enum { eCPT_Mstr_Disable_Grp,
526 
527 
534 typedef enum { eCPT_SrcQual_IncludeALL = 0,
538  } eCPT_SrcQual;
539 
543 typedef enum { eCPT_RWQual_None,
547  } eCPT_RWQual;
548 
552 typedef enum { eCPT_TrigInDisable,
554  } eCPT_TrigIn;
555 
559 typedef struct _CPT_Qualifiers {
562  } CPT_Qualifiers;
563 
564 
568 typedef struct _CPT_TrigQualifiers{
576 
582  } eCPT_FilterMode;
583 
587 typedef enum { eCPT_MsgPri_0,
595  } eCPT_MsgPri;
596 
600 typedef enum { eCPT_AddrMode_32bits,
605  } eCPT_AddrMode;
606 
610 typedef enum { eCPT_IntStatus_Inactive,
612  } eCPT_IntStatus;
613 
614 
615 
619 typedef enum { eCPT_IntMask_Disable,
621  } eCPT_IntMask;
622 
626 typedef enum { eCPT_WaitDisable,
627  eCPT_WaitEnable
629 
636 typedef enum { eCPT_UseCase_Raw,
668  } eCPT_UseCase;
669 
670 
674 typedef struct _CPT_CfgOptions {
681 #ifdef _STM_Logging
683  STMHandle * pSTMHandle;
686  int32_t STMMessageCh;
691 #endif
694  uint32_t SampleWindowSize;
699  uint32_t AddrExportMask;
709  int32_t CPUClockRateMhz;
715  uint32_t DataOptions;
727 
728 
730 //
731 // Public Function Definitions
732 //
734 
829 #ifndef RUNTIME_DEVICE_SELECT
830 eCPT_Error CPT_OpenModule(CPT_Handle_Pntr * const pCPT_Handle, const eCPT_ModID CPT_ModId,
831  CPT_CfgOptions const * const pCPT_CfgOptions );
832 #else
833 eCPT_Error CPT_OpenModule(CPT_Handle_Pntr * const pCPT_Handle, int CPT_ModId,
834  CPT_CfgOptions const * const pCPT_CfgOptions );
835 #endif
836 
872 eCPT_Error CPT_CloseModule(CPT_Handle_Pntr * const pCPT_Handle );
873 
906 eCPT_Error CPT_GetVersion(CPT_Handle_Pntr const pCPT_Handle, uint32_t * const pLibMajorVersion,
907  uint32_t * const pLibMinorVersion,
908  uint32_t * const pSWFuncID,
909  uint32_t * const pHwFuncID );
910 
973 eCPT_Error CPT_ModuleEnable (CPT_Handle_Pntr const pCPT_Handle, const eCPT_MsgSelects CPT_MsgEnables,
974  const eCPT_CntSelects CPT_CntEnables );
975 
1022 eCPT_Error CPT_ModuleDisable (CPT_Handle_Pntr const pCPT_Handle, eCPT_WaitSelect CPT_WaitSelect );
1023 
1071 #ifndef RUNTIME_DEVICE_SELECT
1072 eCPT_Error CPT_CfgMaster( CPT_Handle_Pntr const pCPT_Handle, const eCPT_MasterID CPT_MasterID,
1073  const eCPT_ThroughputCntID CPT_ThroughputCnt,
1074  const eCPT_MasterState CPT_MasterState );
1075 #else
1076 eCPT_Error CPT_CfgMaster( CPT_Handle_Pntr const pCPT_Handle, const int CPT_MasterID,
1077  const eCPT_ThroughputCntID CPT_ThroughputCnt,
1078  const eCPT_MasterState CPT_MasterState );
1079 #endif
1080 
1127 eCPT_Error CPT_CfgQualifiers( CPT_Handle_Pntr const pCPT_Handle, CPT_Qualifiers const * const pCPT_TPCnt0Qual,
1128  CPT_Qualifiers const * const pCPT_TPCnt1Qual,
1129  CPT_Qualifiers const * const pCPT_TPEventQual,
1130  CPT_TrigQualifiers const * const pCPT_TrigQual );
1131 
1168 eCPT_Error CPT_CfgAddrFilter( CPT_Handle_Pntr const pCPT_Handle, const uint32_t AddrFilterMSBs,
1169  const uint32_t StartAddrFilterLSBs,
1170  const uint32_t EndAddrFilterLSBs,
1171  const eCPT_FilterMode CPT_FilterMode );
1172 
1210 eCPT_Error CPT_CfgPacing ( CPT_Handle_Pntr const pCPT_Handle, const uint32_t PacingCntValue );
1211 
1241 eCPT_Error CPT_CfgMsgPriority ( CPT_Handle_Pntr const pCPT_Handle, const eCPT_MsgPri CPT_StatisticMsgsPri,
1242  const eCPT_MsgPri CPT_NewRequestEventMsgPri,
1243  const eCPT_MsgPri CPT_LastWriteEventMsgPri,
1244  const eCPT_MsgPri CPT_LastReadEventMsgPri,
1245  const eCPT_MsgPri CPT_AccessStatusMsgPri );
1246 
1271 eCPT_Error CPT_GetAddrMode( CPT_Handle_Pntr const pCPT_Handle, eCPT_AddrMode * const pAddrModeRange );
1272 
1311 eCPT_Error CPT_GetCurrentState ( CPT_Handle_Pntr const pCPT_Handle, uint32_t * const pCPT_ThroughPutCnt0,
1312  uint32_t * const pCPT_ThroughPutCnt1,
1313  uint32_t * const pCPT_WaitCnt,
1314  uint32_t * const pCPT_GrantCnt,
1315  uint32_t * const pAccessStatus );
1343 eCPT_Error CPT_CfgInt ( CPT_Handle_Pntr const pCPT_Handle, const eCPT_IntMask CPT_IntMask);
1344 
1368 eCPT_Error CPT_GetIntStatus ( CPT_Handle_Pntr const pCPT_Handle, eCPT_IntStatus * const pCPT_IntStatus);
1369 
1393 eCPT_Error CPT_ClrIntStatus ( CPT_Handle_Pntr const pCPT_Handle );
1394 
1395 #ifdef _STM_Logging
1396 
1433 eCPT_Error CPT_LogMsg(CPT_Handle_Pntr const pCPT_Handle, const char * FmtString, uint32_t * const pValue);
1434 
1435 #endif
1436 
1437 
1438 
1439 #ifdef __cplusplus
1440 }
1441 #endif
1442 
1443 #endif /* __CPTLIBARY_H */