diff --git a/trace_contract.h b/trace_contract.h
--- a/trace_contract.h
+++ b/trace_contract.h
#include <string.h>
/* OSAL Includes */
#include <ti/instrumentation/traceframework/contract_osal.h>
-/* other includes */
-#include <ti/instrumentation/traceframework/tf_loc.h>
/** @addtogroup TRACEFRAMEWORK_SYMBOL
@{
*/
+/**
+ * @brief contract cache line size
+ */
+#define TF_CONTRACT_CACHE_LINEZ 128
+
+/**
+ * @brief contract memory size requirements
+ * contract has 12 cache lines
+ */
+#define TF_CONTRACT_SIZE_BYTES (TF_CONTRACT_CACHE_LINEZ * 12)
+
/**
* @brief Alignment for the tf_contract memory
*/
#define TF_CONTRACT_BUFS_ALIGN 128
+/**
+ * @brief Ring Buffer Alignment
+ */
+#define TF_PRODUCER_LOGBUF_ALGIN 128
+
+/**
+ * @brief Maximum number of Ring buffers supported in the ring
+ */
+#define TF_MAX_RING_BUFS_SUPPORT 1024
+
+
/**
* @brief maximum consumers allowed per contract
*/
#define TF_MAX_CONSUMERS_PERCONTRACT 4
+/**
+ * @brief number of bytes allocated for the Out of Band information
+ * Out of band information is really for the application to keep some information in the traceframework contract
+ * and retrive it from either producer/consumers as it is. Traceframework does not alter any information
+ * stored in
+ */
+
+#define TF_CONTRACT_OOB_SIZE_BYTES TF_CONTRACT_CACHE_LINEZ
/**
* @brief number of bytes allocated for the name of the contract (applicable only for contract version 1)
* since contract version 2 does not handle name within traceframework
*/
-#define TF_CONTRACT_NAME_SIZE_BYTES 128
+#define TF_CONTRACT_NAME_SIZE_BYTES TF_CONTRACT_CACHE_LINEZ
/**
- * @brief number of bytes allocated for the Out of Band information
- * Out of band information is really for the application to keep some information in the traceframework contract
- * and retrive it from either producer/consumers as it is. Traceframework does not alter any information
- * stored in
+ * @defgroup tfCtrlBitMap Trace Framework Control Bit map Definitions
+ * @ingroup TRACEFRAMEWORK_API
+ * @{
+ *
+ * @name TraceFramework Control Bit Map Definitions
+ *
+ * Bitmap definition of the ctrlBitMap in @ref tf_StartCfg_t.
+ */
+/*@{*/
+/**
+ * @def tf_CONTRACT_BLK_ADDR_TYPE
+ * Control Info -- 0: The contract block (version 1) base is physical address
+ * 1: The contract block (version 1) base is virtual address
*/
+#define tf_CONTRACT_BLK_ADDR_TYPE 0x0001
-#define TF_CONTRACT_OOB_SIZE_BYTES 128
/**
@}
@{
*/
+ /**
+ * @brief Contract State added here
+ * When contracts are newly created, they are marked Available and
+ * as and when the contracts are used between producers and consumer
+ * instances, they would be marked as not available.
+ */
+ typedef enum {
+ TF_CONTRACT_AVAILABLE = 0x55555555,
+ /**< tf_contract slot is available */
+ TF_CONTRACT_NOT_AVAILABLE = 0x0
+ /**< tf_contract slot is not available */
+ }tf_contractState_e;
+
+
/**
* @brief Contract Versions added here
* Contract Version number signifies the set of APIs to be used
/**< Unknown Contract Version which Trace Framework can not understand */
}tf_contractVersion_e;
+/**
+ * @brief Contract Types added here
+ * Trace framework can support multiple contract types such as
+ * 1. Contracts having streaming producer always ( can have 4 consumers maximum)
+ * 2. Contracts having stream/freeze producer (supports only one consumer per contract)
+ */
+typedef enum {
+ TF_CONTRACT_DSP_ARM = 0,
+ /**< tf_contract between DSP and ARM, where ARM has consumer for DSP producer */
+ TF_CONTRACT_STREAM_FREEZE_PRODUCER = TF_CONTRACT_DSP_ARM,
+ /**< tf_contract has stream/freeze producer, this is same as DSP ARM contract, kept for backwards compatibility */
+ TF_CONTRACT_ARM_ARM = 1
+ /**< tf_contract between ARM and ARM, where ARM has both producer and consumers */
+ }tf_contractType_e;
+
+/**
+ * @brief Trace Framework Ring Buffer Address type
+ */
+typedef enum {
+
+ TF_CONTRACT_RING_BUF_PHYSICAL_ADDR = 0,
+ /**< trace framework contract ring buffer address configured is physical memory */
+ TF_CONTRACT_RING_BUF_NOT_PHYSICAL_ADDR = 1
+ /**< trace framework contract ring buffer address configured is not physical memory */
+ }tf_ringBufAddrType_e;
+
+/**
+ * @brief Trace Framework Contract Buffer Address type
+ */
+typedef enum {
+
+ TF_CONTRACT_BUF_PHYSICAL_ADDR = 0,
+ /**< trace framework contract buffer address configured is physical memory */
+ TF_CONTRACT_BUF_NOT_PHYSICAL_ADDR = 1
+ /**< trace framework contract buffer address configured is not physical memory */
+ }tf_contractBufAddrType_e;
+
/**
@}
} tf_contractConfig_t;
+/**
+ * @brief trace framework start configuration structure (to support multi-instance and legacy features)
+ */
+typedef struct {
+ void* instPoolBaseAddr; /**< Base address of the global shared memory pool from which global
+ LLD instance & channel instance memory is allocated */
+ uint32_t instPoolSize; /**< Pool size of the global shared memory */
+ uint32_t ctrlBitMap; /**< Control bit map @ref tfCtrlBitMap */
+} tf_StartCfg_t;
+
+
/**
* @brief get trace framework contract information interface structure
*/
@}
*/
-#define DEVICE_REG32_W(x,y) *(volatile unsigned int *)(x)=(y)
-#define DEVICE_REG32_R(x) (*(volatile unsigned int *)(x))
-
/** @addtogroup TRACEFRAMEWORK_FUNCTIONS
@{
*/
*
* =============================================================================
*/
-tf_contract_HANDLE tf_contractCreate(tf_contractConfig_t tf_contractConfig, char* name);
+tf_contract_HANDLE tf_contractCreate(tf_contractConfig_t *tf_contractConfig, char* name);
/**
* ============================================================================
@@ -249,7 +345,7 @@ tf_contract_HANDLE tf_contractCreate(tf_contractConfig_t tf_contractConfig, char
*
* =============================================================================
*/
-tf_contract_HANDLE tf_newContract(tf_contractConfig_t tf_contractConfig);
+tf_contract_HANDLE tf_newContract(tf_contractConfig_t *tf_contractConfig);
*/
/* Define below function alias names for backward compatibility */
-tf_contract_HANDLE TF_CONTRACT_CREATE(tf_contractConfig_t tf_contractConfig, char* name);
+tf_contract_HANDLE TF_CONTRACT_CREATE(tf_contractConfig_t *tf_contractConfig, char* name);
void TF_CONTRACT_INIT(void* tf_contract_base, uint32_t num);
-tf_contract_HANDLE TF_NEW_CONTRACT(tf_contractConfig_t tf_contractConfig);
+tf_contract_HANDLE TF_NEW_CONTRACT(tf_contractConfig_t *tf_contractConfig);
tf_contract_HANDLE TF_CONTRACT_FIND (void* tf_contract_start_addr, uint32_t num_contracts, char* name);
uint32_t tf_get_overrun_count(tf_contract_HANDLE contract_handle);
uint32_t tf_is_logInfo_next_buf(tf_contract_HANDLE handle);
+ /* below is kept for backwards compatibility */
+#define TRACE_CONTRACT_VERSION_2 TF_CONTRACT_VERSION_2
+#define TRACE_CONTRACT_VERSION_1 TF_CONTRACT_VERSION_1
+#define TRACE_CONTRACT_AVAILABLE TF_CONTRACT_AVAILABLE
+#define TRACE_CONTRACT_NOT_AVAILABLE TF_CONTRACT_NOT_AVAILABLE
+
+/* Local Errno for Trace Framework */
+#define TF_ERRNO_BASE -128
+#define TF_ERRNO_NO_CONTRACT_FOUND (TF_ERRNO_BASE + 1)
+#define TF_ERRNO_ALL_CONTRACTS_FULL (TF_ERRNO_NO_CONTRACT_FOUND + 1)
+#define TF_ERRNO_CONSUMER_ALLOC_FAIL (TF_ERRNO_ALL_CONTRACTS_FULL + 1)
+#define TF_ERRNO_CONSUMER_INVALID_CONFIG_PARAMS (TF_ERRNO_CONSUMER_ALLOC_FAIL + 1)
+#define TF_ERRNO_NULL_RING_BUFFER_FOUND (TF_ERRNO_CONSUMER_INVALID_CONFIG_PARAMS + 1)
+#define TF_ERRNO_MAX_RING_BUFFER_REACHED (TF_ERRNO_NULL_RING_BUFFER_FOUND + 1)
+#define TF_ERRNO_INVALID_CONSUMER_HANDLE (TF_ERRNO_MAX_RING_BUFFER_REACHED + 1)
+#define TF_ERRNO_INVALID_PRODUCER_HANDLE (TF_ERRNO_INVALID_CONSUMER_HANDLE + 1)
+#define TF_ERRNO_MAX_NUM_CONSUMERS_REACHED (TF_ERRNO_INVALID_PRODUCER_HANDLE + 1)
+#define TF_ERRNO_UNEXPECTED_NUM_CONSUMERS (TF_ERRNO_MAX_NUM_CONSUMERS_REACHED + 1)
+#define TF_ERRNO_PRODUCER_ALLOC_FAIL (TF_ERRNO_UNEXPECTED_NUM_CONSUMERS + 1)
+#define TF_ERRNO_INVALID_CONTRACT_HANDLE (TF_ERRNO_PRODUCER_ALLOC_FAIL + 1)
+#define TF_ERRNO_INVALID_CONTRACT_ELEMENTS (TF_ERRNO_INVALID_CONTRACT_HANDLE + 1)
+#define TF_ERRNO_SYNC_LOCK_ERROR_HANDLE (TF_ERRNO_INVALID_CONTRACT_ELEMENTS + 1)
+#define TF_ERRNO_SYNC_LOCK_ERROR_USER_ID (TF_ERRNO_SYNC_LOCK_ERROR_HANDLE + 1)
+#define TF_ERRNO_SYNC_LOCK_ERROR_DBL_LOCK (TF_ERRNO_SYNC_LOCK_ERROR_USER_ID + 1)
+#define TF_ERRNO_SYNC_LOCK_ERROR_DBL_UNLOCK (TF_ERRNO_SYNC_LOCK_ERROR_DBL_LOCK + 1)
+
+
#ifdef __cplusplus
}
#endif
#endif /* CONSPROD_CONTRACT_H_ */
+
/* Nothing past this point */
+