module ti.uiactools.runtime.BufferPacketizer

A logger which stores Log events in a non-blocking, streamable circular buffer

C synopsis target-domain sourced in ti/uiactools/runtime/BufferPacketizer.xdc
#include <ti/uiactools/runtime/BufferPacketizer.h>
Functions
Void
Void
Void
Void 
SizeT 
Bool 
macro Void 
Bool 
Void
Void 
Bool 
BufferPacketizer_setBufferToUpload// Assigns a buffer to upload to System Analyzer (in Maus)(BufferPacketizer_Handle handle, UInt32 *pBuffer, UInt32 bufferSizeInWords, Ptr pUploaderContext);
Void 
Functions common to all IUIAPacketTransfer modules
Bool 
Bool 
Bool 
UInt32 
Bool 
Bool 
Bool 
Functions common to all target instances
Functions common to all target modules
Typedefs
typedef enum
typedef Ptr 
typedef struct
typedef struct
typedef Ptr 
typedef struct
typedef enum
typedef enum
Constants
extern const String 
 
 
enum BufferPacketizer_BufferType

Used to specify the type of ETB to drain

C synopsis target-domain
typedef enum BufferPacketizer_BufferType {
    BufferPacketizer_BufferType_MEMORY,
    BufferPacketizer_BufferType_CPUTRACE_ETB,
    BufferPacketizer_BufferType_STM_ETB
} BufferPacketizer_BufferType;
 
DETAILS
This enum is used by the instrumentation host to determine what the ETB type is.
 
enum BufferPacketizer_TransferType
C synopsis target-domain
typedef enum BufferPacketizer_TransferType {
    BufferPacketizer_TransferType_RELIABLE,
    BufferPacketizer_TransferType_LOSSY
} BufferPacketizer_TransferType;
 
 
enum BufferPacketizer_TransportType

Used to specify the type of transport to use

C synopsis target-domain
typedef enum BufferPacketizer_TransportType {
    BufferPacketizer_TransportType_UART,
    BufferPacketizer_TransportType_USB,
    BufferPacketizer_TransportType_UDP,
    BufferPacketizer_TransportType_TCP,
    BufferPacketizer_TransportType_CUSTOM
} BufferPacketizer_TransportType;
 
DETAILS
This enum is used by the instrumentation host to determine what the transport is. It is not used by the target code.
 
typedef BufferPacketizer_ExchangeFxnType

Typedef for the exchange function pointer

C synopsis target-domain
typedef Ptr (*BufferPacketizer_ExchangeFxnType)(Ptr,Ptr);
 
VALUES
Ptr — first pointer is for the object instance handle second pointer is the just-filled buffer containing the ETB packet to be sent
 
typedef BufferPacketizer_PrimeFxnType

Typedef for the exchange function pointer

C synopsis target-domain
typedef Ptr (*BufferPacketizer_PrimeFxnType)(Ptr);
 
VALUES
Ptr — first pointer is for the object instance handle
 
config BufferPacketizer_customTransportType  // module-wide

Custom transport used to send the records to an instrumentation host

C synopsis target-domain
extern const String BufferPacketizer_customTransportType;
 
DETAILS
If the desired transport is not in the TransportType enum, and transportType is set to TransportType_CUSTOM, this parameter must be filled in with the correct transport name.
If transportType is NOT set to TransportType_CUSTOM, this parameter is ignored.
 
config BufferPacketizer_transportType  // module-wide

Transport used to send the records to an instrumentation host

C synopsis target-domain
extern const BufferPacketizer_TransportType BufferPacketizer_transportType;
 
DETAILS
This parameter is used to specify the transport that the exchangeFxn function will use to send the buffer to an instrumentation host (e.g. System Analyzer in CCS).
This parameter is placed into the generated UIA XML file. The instrumentation host can use the XML file to help it auto-detect as much as possible and act accordingly.
If the desired transport is not in the TransportType enum, select TransportType_CUSTOM and set the customTransport string with the desired string.
 
BufferPacketizer_initBuffer()  // module-wide

Initializes the UIA trace packet header

C synopsis target-domain
macro Void BufferPacketizer_initBuffer(Ptr buffer, UInt16 src, UInt32 processId);
 
ARGUMENTS
buffer — Pointer to the buffer that BufferPacketizer will fill with Log events. The first four 32-bit words will contain the UIAPacket_Hdr structure.
src — Used to initialize the UIA source address. For a single core device, this will generally be 0. For multi-core devices, it generally corresponds to the DNUM (on C6xxxx deviecs) or the Ipc MultiProc id. It must be unique for all cores and match the configuration in the System Analyzer endpoint configuration.
processId — the process ID the packet is being sent by. (0 if only a single process).
DETAILS
This API is used to initialize a buffer before it is given to BufferPacketizer (via priming or exchange). The function initializes the UIAPacket portion of the buffer.
Module-Wide Built-Ins

C synopsis target-domain
Types_ModuleId BufferPacketizer_Module_id();
// Get this module's unique id
 
Bool BufferPacketizer_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle BufferPacketizer_Module_heap();
// The heap from which this module allocates memory
 
Bool BufferPacketizer_Module_hasMask();
// Test whether this module has a diagnostics mask
 
Bits16 BufferPacketizer_Module_getMask();
// Returns the diagnostics mask for this module
 
Void BufferPacketizer_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
Instance Object Types

C synopsis target-domain
typedef struct BufferPacketizer_Object BufferPacketizer_Object;
// Opaque internal representation of an instance object
 
typedef BufferPacketizer_Object *BufferPacketizer_Handle;
// Client reference to an instance object
 
typedef struct BufferPacketizer_Struct BufferPacketizer_Struct;
// Opaque client structure large enough to hold an instance object
 
BufferPacketizer_Handle BufferPacketizer_handle(BufferPacketizer_Struct *structP);
// Convert this instance structure pointer into an instance handle
 
BufferPacketizer_Struct *BufferPacketizer_struct(BufferPacketizer_Handle handle);
// Convert this instance handle into an instance structure pointer
Instance Config Parameters

C synopsis target-domain
typedef struct BufferPacketizer_Params {
// Instance config-params structure
    IInstance_Params *instance;
    // Common per-instance configs
    BufferPacketizer_BufferType bufferType;
    // Specifies the type of data that is being uploaded so that it can be properly decoded on the host
    Bits16 endpointNumber;
    // sender ID to insert in UIAPacket header Set to 0xFF if this should be set to DNUM (C6X only)
    UInt8 etbCoreId;
    // the ID for the core that the ETB services
    BufferPacketizer_ExchangeFxnType exchangeFxn;
    // Function pointer to the exchange function
    SizeT packetSizeInMAUs;
    // Number of minimum addressable units (e.g. bytes) in the trace event packet buffer
    BufferPacketizer_PrimeFxnType primeFxn;
    // Function pointer to the prime function
    IUIAPacketTransfer_TransferType transferType;
    // 
} BufferPacketizer_Params;
 
Void BufferPacketizer_Params_init(BufferPacketizer_Params *params);
// Initialize this config-params structure with supplier-specified defaults before instance creation
 
config BufferPacketizer_bufferType  // instance

Specifies the type of data that is being uploaded so that it can be properly decoded on the host

C synopsis target-domain
      ...
    BufferPacketizer_BufferType bufferType;
 
 
config BufferPacketizer_endpointNumber  // instance

sender ID to insert in UIAPacket header Set to 0xFF if this should be set to DNUM (C6X only)

C synopsis target-domain
      ...
    Bits16 endpointNumber;
 
 
config BufferPacketizer_etbCoreId  // instance

the ID for the core that the ETB services

C synopsis target-domain
      ...
    UInt8 etbCoreId;
 
DETAILS
For STM (default), use 0xFF
 
config BufferPacketizer_exchangeFxn  // instance

Function pointer to the exchange function

C synopsis target-domain
      ...
    BufferPacketizer_ExchangeFxnType exchangeFxn;
 
DETAILS
exchange function must return a pointer to a buffer that is word aligned, initialized with a UIA header and the correct size. This is called in the context of a log so generally the exchange function should be quick to execute.
 
config BufferPacketizer_packetSizeInMAUs  // instance

Number of minimum addressable units (e.g. bytes) in the trace event packet buffer

C synopsis target-domain
      ...
    SizeT packetSizeInMAUs;
 
DETAILS
NOTE: the packet size must contain an integer number of 32b words (e.g. if a MAU = 1 byte, then the packet size must be a multiple of 4).
 
config BufferPacketizer_primeFxn  // instance

Function pointer to the prime function

C synopsis target-domain
      ...
    BufferPacketizer_PrimeFxnType primeFxn;
 
 
config BufferPacketizer_transferType  // instance
C synopsis target-domain
      ...
    IUIAPacketTransfer_TransferType transferType;
 
Instance Creation

C synopsis target-domain
BufferPacketizer_Handle BufferPacketizer_create(const BufferPacketizer_Params *params, Error_Block *eb);
// Allocate and initialize a new instance object and return its handle
 
Void BufferPacketizer_construct(BufferPacketizer_Struct *structP, const BufferPacketizer_Params *params, Error_Block *eb);
// Initialize a new instance object inside the provided structure
ARGUMENTS
params — per-instance config params, or NULL to select default values (target-domain only)
eb — active error-handling block, or NULL to select default policy (target-domain only)
SEE
Instance Deletion

C synopsis target-domain
Void BufferPacketizer_delete(BufferPacketizer_Handle *handleP);
// Finalize and free this previously allocated instance object, setting the referenced handle to NULL
 
Void BufferPacketizer_destruct(BufferPacketizer_Struct *structP);
// Finalize the instance object inside the provided structure
 
BufferPacketizer_disable()  // instance

Disable a log

C synopsis target-domain
Bool BufferPacketizer_disable(BufferPacketizer_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created BufferPacketizer instance object
DETAILS
Events written to a disabled log are silently discarded.
RETURNS
The function returns the state of the packet upload (TRUE if enabled, FALSE if disabled) before the call. This return value allows clients to restore the previous state. Note: not thread safe.
The function returns the state of the log (TRUE if enabled, FALSE if disabled) before the call. That allow clients to restore the previous state.
 
BufferPacketizer_enable()  // instance

Enable a log

C synopsis target-domain
Bool BufferPacketizer_enable(BufferPacketizer_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created BufferPacketizer instance object
RETURNS
The function returns the state of the packet upload (TRUE if enabled, FALSE if disabled) before the call. This return value allows clients to restore the previous state. Note: not thread safe.
The function returns the state of the log (TRUE if enabled, FALSE if disabled) before the call. That allow clients to restore the previous state.
 
BufferPacketizer_enableDebugMessages()  // instance
C synopsis target-domain
Void BufferPacketizer_enableDebugMessages(BufferPacketizer_Handle handle, Bool enable);
 
ARGUMENTS
handle — handle of a previously-created BufferPacketizer instance object
 
BufferPacketizer_getTransferType()  // instance
C synopsis target-domain
IUIAPacketTransfer_TransferType BufferPacketizer_getTransferType(BufferPacketizer_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created BufferPacketizer instance object
 
BufferPacketizer_getUnsentSize()  // instance

Determines how much unsent data is left to send (in Maus)

C synopsis target-domain
SizeT BufferPacketizer_getUnsentSize(BufferPacketizer_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created BufferPacketizer instance object
 
BufferPacketizer_init()  // instance
C synopsis target-domain
Bool BufferPacketizer_init(BufferPacketizer_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created BufferPacketizer instance object
NODOC
Used internally to initialize data structures as part of prime function
 
BufferPacketizer_isEmpty()  // instance

Returns true if the transfer buffer has no unread data

C synopsis target-domain
Bool BufferPacketizer_isEmpty(BufferPacketizer_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created BufferPacketizer instance object
RETURN
true if no unread data
 
BufferPacketizer_isFirstPacketFlagSet()  // instance
C synopsis target-domain
Bool BufferPacketizer_isFirstPacketFlagSet(BufferPacketizer_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created BufferPacketizer instance object
 
BufferPacketizer_poll()  // instance

Check if data is ready and, if so, trigger buffer exchange to send the data as packets. Call readyToSend after this call to check if there is data available to send

C synopsis target-domain
UInt32 BufferPacketizer_poll(BufferPacketizer_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created BufferPacketizer instance object
RETURNS
0 if success, else error code
 
BufferPacketizer_prime()  // instance

If PrimeFxn is not set the user must call prime with the first packet

C synopsis target-domain
Bool BufferPacketizer_prime(BufferPacketizer_Handle handle, Ptr packetBuffer);
 
ARGUMENTS
handle — handle of a previously-created BufferPacketizer instance object
 
BufferPacketizer_readyToSend()  // instance

check to see if the ETB drain buffer contains unsent data. If true, call transferData API to send the data

C synopsis target-domain
Bool BufferPacketizer_readyToSend(BufferPacketizer_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created BufferPacketizer instance object
RETURNS
TRUE if there is unsent data.
 
BufferPacketizer_sendPacket()  // instance

calls the exchangeFxn with the next packet payload of data

C synopsis target-domain
Void BufferPacketizer_sendPacket(BufferPacketizer_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created BufferPacketizer instance object
 
BufferPacketizer_setBufferToUpload()  // instance

Assigns a buffer to upload to System Analyzer (in Maus)

C synopsis target-domain
Bool BufferPacketizer_setBufferToUpload(BufferPacketizer_Handle handle, UInt32 *pBuffer, UInt32 bufferSizeInWords, Ptr pUploaderContext);
 
ARGUMENTS
handle — handle of a previously-created BufferPacketizer instance object
DETAILS
Returns false if another buffer is already being uploaded.
 
BufferPacketizer_transferData()  // instance

Read and Transfer ETB data move the binary data to PC host via event packets for further decoding and analysis

C synopsis target-domain
Bool BufferPacketizer_transferData(BufferPacketizer_Handle handle, UInt32 maxNumPackets);
 
ARGUMENTS
handle — handle of a previously-created BufferPacketizer instance object
maxNumPackets — maximum number of packets to send in context of this API call
maximum number of packets to send in context of this API call
 
BufferPacketizer_transferSTMConfig()  // instance
C synopsis target-domain
Void BufferPacketizer_transferSTMConfig(BufferPacketizer_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created BufferPacketizer instance object
NODOC
Status of the STM - this is required to decode the compressed data
Instance Convertors

C synopsis target-domain
IUIAPacketTransfer_Handle BufferPacketizer_Handle_upCast(BufferPacketizer_Handle handle);
// unconditionally move one level up the inheritance hierarchy
 
BufferPacketizer_Handle BufferPacketizer_Handle_downCast(IUIAPacketTransfer_Handle handle);
// conditionally move one level down the inheritance hierarchy; NULL upon failure
Instance Built-Ins

C synopsis target-domain
Int BufferPacketizer_Object_count();
// The number of statically-created instance objects
 
BufferPacketizer_Handle BufferPacketizer_Object_get(BufferPacketizer_Object *array, Int i);
// The handle of the i-th statically-created instance object (array == NULL)
 
BufferPacketizer_Handle BufferPacketizer_Object_first();
// The handle of the first dynamically-created instance object, or NULL
 
BufferPacketizer_Handle BufferPacketizer_Object_next(BufferPacketizer_Handle handle);
// The handle of the next dynamically-created instance object, or NULL
 
IHeap_Handle BufferPacketizer_Object_heap();
// The heap used to allocate dynamically-created instance objects
 
Types_Label *BufferPacketizer_Handle_label(BufferPacketizer_Handle handle, Types_Label *buf);
// The label associated with this instance object
 
String BufferPacketizer_Handle_name(BufferPacketizer_Handle handle);
// The name of this instance object
 
XDCscript usage meta-domain sourced in ti/uiactools/runtime/BufferPacketizer.xdc
var BufferPacketizer = xdc.useModule('ti.uiactools.runtime.BufferPacketizer');
module-wide constants & types
        const BufferPacketizer.BufferType_MEMORY;
        const BufferPacketizer.BufferType_STM_ETB;
 
    values of type BufferPacketizer.TransferType// 
        const BufferPacketizer.TransferType_LOSSY;
 
        const BufferPacketizer.TransportType_UART;
        const BufferPacketizer.TransportType_USB;
        const BufferPacketizer.TransportType_UDP;
        const BufferPacketizer.TransportType_TCP;
        const BufferPacketizer.TransportType_CUSTOM;
module-wide config parameters
 
per-instance config parameters
    var params = new BufferPacketizer.Params// Instance config-params object;
        params.etbCoreId// the ID for the core that the ETB services = UInt8 0xFF;
        params.exchangeFxn// Function pointer to the exchange function = Ptr(*)(Ptr,Ptr) null;
        params.primeFxn// Function pointer to the prime function = Ptr(*)(Ptr) null;
per-instance creation
    var inst = BufferPacketizer.create// Create an instance-object(params);
 
 
enum BufferPacketizer.BufferType

Used to specify the type of ETB to drain

XDCscript usage meta-domain
values of type BufferPacketizer.BufferType
    const BufferPacketizer.BufferType_MEMORY;
    const BufferPacketizer.BufferType_CPUTRACE_ETB;
    const BufferPacketizer.BufferType_STM_ETB;
 
DETAILS
This enum is used by the instrumentation host to determine what the ETB type is.
C SYNOPSIS
 
enum BufferPacketizer.TransferType
XDCscript usage meta-domain
values of type BufferPacketizer.TransferType
    const BufferPacketizer.TransferType_RELIABLE;
    const BufferPacketizer.TransferType_LOSSY;
 
C SYNOPSIS
 
enum BufferPacketizer.TransportType

Used to specify the type of transport to use

XDCscript usage meta-domain
values of type BufferPacketizer.TransportType
    const BufferPacketizer.TransportType_UART;
    const BufferPacketizer.TransportType_USB;
    const BufferPacketizer.TransportType_UDP;
    const BufferPacketizer.TransportType_TCP;
    const BufferPacketizer.TransportType_CUSTOM;
 
DETAILS
This enum is used by the instrumentation host to determine what the transport is. It is not used by the target code.
C SYNOPSIS
 
config BufferPacketizer.customTransportType  // module-wide

Custom transport used to send the records to an instrumentation host

XDCscript usage meta-domain
BufferPacketizer.customTransportType = String "None";
 
DETAILS
If the desired transport is not in the TransportType enum, and transportType is set to TransportType_CUSTOM, this parameter must be filled in with the correct transport name.
If transportType is NOT set to TransportType_CUSTOM, this parameter is ignored.
C SYNOPSIS
 
config BufferPacketizer.transportType  // module-wide

Transport used to send the records to an instrumentation host

XDCscript usage meta-domain
 
DETAILS
This parameter is used to specify the transport that the exchangeFxn function will use to send the buffer to an instrumentation host (e.g. System Analyzer in CCS).
This parameter is placed into the generated UIA XML file. The instrumentation host can use the XML file to help it auto-detect as much as possible and act accordingly.
If the desired transport is not in the TransportType enum, select TransportType_CUSTOM and set the customTransport string with the desired string.
C SYNOPSIS
 
metaonly config BufferPacketizer.common$  // module-wide

Common module configuration parameters

XDCscript usage meta-domain
BufferPacketizer.common$ = Types.Common$ undefined;
 
DETAILS
All modules have this configuration parameter. Its name contains the '$' character to ensure it does not conflict with configuration parameters declared by the module. This allows new configuration parameters to be added in the future without any chance of breaking existing modules.
Instance Config Parameters

XDCscript usage meta-domain
var params = new BufferPacketizer.Params;
// Instance config-params object
    // Specifies the type of data that is being uploaded so that it can be properly decoded on the host
    params.endpointNumber = Bits16 0xFF;
    // sender ID to insert in UIAPacket header Set to 0xFF if this should be set to DNUM (C6X only)
    params.etbCoreId = UInt8 0xFF;
    // the ID for the core that the ETB services
    params.exchangeFxn = Ptr(*)(Ptr,Ptr) null;
    // Function pointer to the exchange function
    params.packetSizeInMAUs = SizeT 1400;
    // Number of minimum addressable units (e.g. bytes) in the trace event packet buffer
    params.primeFxn = Ptr(*)(Ptr) null;
    // Function pointer to the prime function
    // 
 
config BufferPacketizer.bufferType  // instance

Specifies the type of data that is being uploaded so that it can be properly decoded on the host

XDCscript usage meta-domain
var params = new BufferPacketizer.Params;
  ...
 
C SYNOPSIS
 
config BufferPacketizer.endpointNumber  // instance

sender ID to insert in UIAPacket header Set to 0xFF if this should be set to DNUM (C6X only)

XDCscript usage meta-domain
var params = new BufferPacketizer.Params;
  ...
params.endpointNumber = Bits16 0xFF;
 
C SYNOPSIS
 
config BufferPacketizer.etbCoreId  // instance

the ID for the core that the ETB services

XDCscript usage meta-domain
var params = new BufferPacketizer.Params;
  ...
params.etbCoreId = UInt8 0xFF;
 
DETAILS
For STM (default), use 0xFF
C SYNOPSIS
 
config BufferPacketizer.exchangeFxn  // instance

Function pointer to the exchange function

XDCscript usage meta-domain
var params = new BufferPacketizer.Params;
  ...
params.exchangeFxn = Ptr(*)(Ptr,Ptr) null;
 
DETAILS
exchange function must return a pointer to a buffer that is word aligned, initialized with a UIA header and the correct size. This is called in the context of a log so generally the exchange function should be quick to execute.
C SYNOPSIS
 
config BufferPacketizer.packetSizeInMAUs  // instance

Number of minimum addressable units (e.g. bytes) in the trace event packet buffer

XDCscript usage meta-domain
var params = new BufferPacketizer.Params;
  ...
params.packetSizeInMAUs = SizeT 1400;
 
DETAILS
NOTE: the packet size must contain an integer number of 32b words (e.g. if a MAU = 1 byte, then the packet size must be a multiple of 4).
C SYNOPSIS
 
config BufferPacketizer.primeFxn  // instance

Function pointer to the prime function

XDCscript usage meta-domain
var params = new BufferPacketizer.Params;
  ...
params.primeFxn = Ptr(*)(Ptr) null;
 
C SYNOPSIS
 
config BufferPacketizer.transferType  // instance
XDCscript usage meta-domain
var params = new BufferPacketizer.Params;
  ...
 
C SYNOPSIS
Instance Creation

XDCscript usage meta-domain
var params = new BufferPacketizer.Params;
// Allocate instance config-params
params.config =   ...
// Assign individual configs
 
var inst = BufferPacketizer.create(params);
// Create an instance-object
ARGUMENTS
params — per-instance config params, or NULL to select default values (target-domain only)
eb — active error-handling block, or NULL to select default policy (target-domain only)
SEE
generated on Wed, 27 Jun 2012 04:11:41 GMT