Ctools Use Case Library
Functions
CTOOLS_USECASE Functions

Functions

ctools_Result ctools_dsptrace_init (void)
 
ctools_Result ctools_dsptrace_shutdown (void)
 
ctools_Result ctools_systemtrace_init (const ctools_sys_trace_opts_e sys_trace_options)
 
ctools_Result ctools_systemtrace_getdcmdata (STM_DCM_InfoObj *DCM_Info)
 
ctools_Result ctools_systemtrace_shutdown (const ctools_sys_trace_opts_e sys_trace_options)
 
ctools_Result ctools_cpt_syslatprofile_open (const ctools_cpt_sysprofilecfg *SysProfile_params)
 
ctools_Result ctools_cpt_sysbwprofile_open (const ctools_cpt_sysprofilecfg *SysProfile_params)
 
ctools_Result ctools_cpt_eventtrace_open (const ctools_cpt_eventtracecfg *EventTrace_params)
 
ctools_Result ctools_cpt_masterprofile_open (const ctools_cpt_masterprofilecfg *MasterProfile_params)
 
ctools_Result ctools_cpt_totalprofile_open (const ctools_cpt_totalprofilecfg *TotalProfile_params)
 
ctools_Result ctools_cpt_singlestart (eCPT_ModID CPT_ModId)
 
ctools_Result ctools_cpt_singlestop (eCPT_ModID CPT_ModId)
 
ctools_Result ctools_cpt_singleclose (eCPT_ModID CPT_ModId)
 
ctools_Result ctools_cpt_globalstart (void)
 
ctools_Result ctools_cpt_globalstop (void)
 
ctools_Result ctools_cpt_globalclose (void)
 
ctools_Result ctools_etb_init (const ctools_etb_drain_e etb_drain_opt, const ctools_etb_config_t *config, ctools_etb_types_e etb_type)
 
ctools_Result ctools_etb_cpu_drain (const void *data_p, uint32_t size_in, uint32_t *size_out, uint32_t *wrap_flag, ctools_etb_types_e etb_type)
 
ctools_Result ctools_etb_edma_drain (ctools_edma_result_t *pct_res, ctools_etb_types_e etb_type)
 
ctools_Result ctools_edma_resrc_get (uint32_t *num_params, uint32_t *num_channels)
 
ctools_Result ctools_memwatch_store_pc_setup (uint32_t *data_StartAddress, uint32_t *data_EndAddress)
 
ctools_Result ctools_memwatch_aetint_setup (uint32_t *data_StartAddress, uint32_t *data_EndAddress)
 
ctools_Result ctools_memwatch_disable (void)
 
ctools_Result ctools_memwatch_enable (void)
 
ctools_Result ctools_memwatch_close (void)
 
ctools_Result ctools_pct_start_exc (void)
 
ctools_Result ctools_pct_setup (const void *pct_start_symb, const void *pct_stop_symb)
 
ctools_Result ctools_pct_start_now (void)
 
ctools_Result ctools_pct_stop_now (void)
 
ctools_Result ctools_pct_terminate_all (void)
 
ctools_Result ctools_pct_close (void)
 
ctools_Result ctools_stat_prof_start (uint32_t SamplingPeriod)
 
ctools_Result ctools_stat_prof_end (void)
 

Detailed Description

Function Documentation

ctools_Result ctools_cpt_eventtrace_open ( const ctools_cpt_eventtracecfg EventTrace_params)

Description

Opens CP Tracer New Request event capture, based on user configuration inputs.

Parameters
[in]EventTrace_paramsctools_cpt_eventtracecfg provides user defined configuration structure for New Request event capture.
Return values
Success- CTOOLS_SOK
Failure- CTOOLS_CPT_ENABLE_ERROR, CTOOLS_CPT_EVTPROFILE_ERROR and CTOOLS_CPT_EVTPROFILE_BUSY
Details:

Example API call:

ctools_cpt_eventtracecfg EventTrace_Params = {NULL};
ctools_cpt_masteridfiltercfg MstID_Cfg = {NULL};
ctools_cpt_addressfiltercfg AddrFilter_Cfg = {NULL};
//Capture accesses to memory from 0x89112c24 to 0x89112f24
//In keystone devices, by default XMC MPAX settings map 0x8000_0000 to 0x8FFF_FFFF to 0x8_0000_0000 to 0x8_7FFF_FFFF
AddrFilter_Cfg.AddrFilterMSBs = 0x8;
AddrFilter_Cfg.CPT_FilterMode = eCPT_FilterMode_Inclusive;
AddrFilter_Cfg.EndAddrFilterLSBs = 0x09112f24;
AddrFilter_Cfg.StartAddrFilterLSBs = 0x09112c24;
eCPT_MasterID MstID_Array[] = {eCPT_MID_GEM0};
EventTrace_Params.CPT_ModId = eCPT_DDR; //Capturing New Request event @ DDR3 memory slave
MstID_Cfg.CPT_MasterID = MstID_Array;
MstID_Cfg.MasterIDgroup_Enable = 0;
MstID_Cfg.CPT_MasterIDCnt = 1;
EventTrace_Params.EventTrace_MasterID = &MstID_Cfg;
EventTrace_Params.TPEventQual = NULL;
EventTrace_Params.Address_Filter_Params = &AddrFilter_Cfg;
EventTrace_Params.AddrExportMask = 0; // Address Bits 10:0 are exported
// Open DDR3 New request event capture
if (ctools_cpt_eventtrace_open(&EventTrace_Params) != CTOOLS_SOK)
{
printf ("Error: New Request event capture open Failed\n");
return(-1);
}
ctools_Result ctools_cpt_globalclose ( void  )

Description

Close all open CP Tracer modules which are currently opened for the required use case.

Return values
Success- CTOOLS_SOK
Failure- CTOOLS_CPT_ENABLE_ERROR, CTOOLS_CPT_SINGLECLOSE_ERROR and CTOOLS_CPT_NOT_OPEN
Details:
Example API call:
// Close all CP Tracers
{
printf ("Error: ctools_cpt_globalclose Failed\n");
return(-1);
}
ctools_Result ctools_cpt_globalstart ( void  )

Description

Start all open CP Tracer modules which are currently opened for the required use case.

Return values
Success- CTOOLS_SOK
Failure- CTOOLS_CPT_ENABLE_ERROR, CTOOLS_CPT_SINGLESTART_ERROR and CTOOLS_CPT_NOT_OPEN
Details:

Example API call:

// Start all CP Tracers
{
printf ("Error: ctools_cpt_globalstart Failed\n");
return(-1);
}
ctools_Result ctools_cpt_globalstop ( void  )

Description

Stop all open CP Tracer modules which are currently opened for the required use case.

Return values
Success- CTOOLS_SOK
Failure- CTOOLS_CPT_ENABLE_ERROR, CTOOLS_CPT_SINGLESTOP_ERROR, CTOOLS_CPT_NOT_STARTED and CTOOLS_CPT_NOT_OPEN
Details:

Example API call:

// Stop all CP Tracers
{
printf ("Error: ctools_cpt_globalstop Failed\n");
return(-1);
}
ctools_Result ctools_cpt_masterprofile_open ( const ctools_cpt_masterprofilecfg MasterProfile_params)

Description

Opens CP Tracer Master bandwidth profiler based on user configuration inputs.

Parameters
[in]MasterProfile_paramsctools_cpt_masterprofilecfg provides user defined configuration structure for Master bandwidth profiling.
Return values
Success- CTOOLS_SOK
Failure- CTOOLS_CPT_ENABLE_ERROR, CTOOLS_CPT_MASTERPROFILE_ERROR and CTOOLS_CPT_MASTERPROFILE_BUSY
Details:

Example API call:

ctools_cpt_masterprofilecfg Master_Profile_Params = {NULL};
ctools_cpt_masteridfiltercfg MstID0_Cfg = {NULL};
ctools_cpt_masteridfiltercfg MstID1_Cfg = {NULL};
eCPT_MasterID MstID0_Array[] = {eCPT_MID_GEM0}; // Master core
eCPT_MasterID MstID1_Array[] = {eCPT_MID_GEM1, eCPT_MID_GEM2, eCPT_MID_GEM3}; // Slave cores
Master_Profile_Params.CPT_ModId = eCPT_DDR; //Profiling accesses to DDR3 memory
MstID0_Cfg.CPT_MasterID = MstID0_Array;
MstID0_Cfg.MasterIDgroup_Enable = 0;
MstID1_Cfg.CPT_MasterID = MstID1_Array;
MstID1_Cfg.MasterIDgroup_Enable = 0;
MstID0_Cfg.CPT_MasterIDCnt = 1;
MstID1_Cfg.CPT_MasterIDCnt = 3;
Master_Profile_Params.TPCnt0_MasterID = &MstID0_Cfg;
Master_Profile_Params.TPCnt1_MasterID = &MstID1_Cfg;
Master_Profile_Params.TPCnt0Qual = NULL;
Master_Profile_Params.TPCnt1Qual = NULL;
Master_Profile_Params.Address_Filter_Params = NULL; //Address filtering is disabled
Master_Profile_Params.CPUClockRateMhz = 983;
Master_Profile_Params.SampleWindowSize = 81916;
// Open DDR3 Master bandwidth profiler
if (ctools_cpt_masterprofile_open(&Master_Profile_Params) != CTOOLS_SOK)
{
printf ("Error: ctools_cpt_masterprofile_open failed\n");
return(-1);
}
ctools_Result ctools_cpt_singleclose ( eCPT_ModID  CPT_ModId)

Description

Close the specified CP Tracer module and release all associated resources.

Parameters
[in]CPT_ModIdeCPT_ModID provides the CPT module ID for which its associated use-case needs to be started.
Return values
Success- CTOOLS_SOK
Failure- CTOOLS_CPT_ENABLE_ERROR, CTOOLS_CPT_SINGLECLOSE_ERROR and CTOOLS_CPT_NOT_OPEN
Details:

Example API call:

// Close DDR3 CP Tracer
if (ctools_cpt_singleclose(eCPT_DDR) < 0)
{
printf ("Error: DDR3 CP Tracer ctools_cpt_singleclose Failed\n");
return(-1);
}
ctools_Result ctools_cpt_singlestart ( eCPT_ModID  CPT_ModId)

Description

Start the use-case associated with CPT module passed as an input. The use-case gets associated with an CPT module from the Open API call (CPT_EventTrace_open, CPT_MasterProfile_open and CPT_TotalProfile_open).

Parameters
[in]CPT_ModIdeCPT_ModID provides the CPT module ID for which its associated use-case needs to be started.
Return values
Success- CTOOLS_SOK
Failure- CTOOLS_CPT_ENABLE_ERROR, CTOOLS_CPT_SINGLESTART_ERROR and CTOOLS_CPT_NOT_OPEN
Details:

Example API call:

// Start DDR3 CP Tracer
{
printf ("Error: DDR3 CP Tracer ctools_cpt_singlestart Failed\n");
return(-1);
}
ctools_Result ctools_cpt_singlestop ( eCPT_ModID  CPT_ModId)

Description

Stop the use-case associated with CPT module passed as an input. The use-case gets associated with an CPT module from the Open API call (CPT_EventTrace_open, CPT_MasterProfile_open and CPT_TotalProfile_open).

Parameters
[in]CPT_ModIdeCPT_ModID provides the CPT module ID for which its associated use-case needs to be started.
Return values
Success- CTOOLS_SOK
Failure- CTOOLS_CPT_ENABLE_ERROR, CTOOLS_CPT_SINGLESTOP_ERROR, CTOOLS_CPT_NOT_STARTED and CTOOLS_CPT_NOT_OPEN
Details:

Example API call:

// Stop DDR3 CP Tracer
{
printf ("Error: DDR3 CP Tracer ctools_cpt_singlestop Failed\n");
return(-1);
}
ctools_Result ctools_cpt_sysbwprofile_open ( const ctools_cpt_sysprofilecfg SysProfile_params)

Description

Opens CP Tracer System bandwidth profiler based on user configuration inputs.

Parameters
[in]SysProfile_paramsctools_cpt_sysprofilecfg provides user defined configuration structure for System bandwidth profiling.
Return values
Success- CTOOLS_SOK
Failure- CTOOLS_CPT_ENABLE_ERROR, CTOOLS_CPT_SYSPROFILE_ERROR and CTOOLS_CPT_SYSPROFILE_BUSY
Details:

Example API call:

ctools_cpt_sysprofilecfg SysMemory_Profile_Params = {NULL};
ctools_cpt_modidqual SysMemory_ModIDQual[5];
int i;
for(i=0;i<5;i++)
{
SysMemory_ModIDQual[i].TPCntQual = NULL;
}
SysMemory_ModIDQual[0].CPT_ModId = eCPT_MSMC_0;
SysMemory_ModIDQual[1].CPT_ModId = eCPT_MSMC_1;
SysMemory_ModIDQual[2].CPT_ModId = eCPT_MSMC_2;
SysMemory_ModIDQual[3].CPT_ModId = eCPT_MSMC_3;
SysMemory_ModIDQual[4].CPT_ModId = eCPT_DDR;
//Populate SysMemory Profiler Params
SysMemory_Profile_Params.ModIDQual = SysMemory_ModIDQual;
SysMemory_Profile_Params.CPT_ModCnt = 5;
SysMemory_Profile_Params.CPUClockRateMhz = 983;
SysMemory_Profile_Params.SampleWindowSize = 81916;
// Open System memory (MSMC and DDR3) profiler
if (ctools_cpt_sysbwprofile_open(&SysMemory_Profile_Params) != CTOOLS_SOK)
{
printf ("Error: ctools_cpt_sysbandwidthprofile_open Failed\n");
return(-1);
}
ctools_Result ctools_cpt_syslatprofile_open ( const ctools_cpt_sysprofilecfg SysProfile_params)

Description

Opens CP Tracer System latency profiler based on user configuration inputs.

Parameters
[in]SysProfile_paramsctools_cpt_sysprofilecfg provides user defined configuration structure for System latency profiling.
Return values
Success- CTOOLS_SOK
Failure- CTOOLS_CPT_ENABLE_ERROR, CTOOLS_CPT_SYSPROFILE_ERROR and CTOOLS_CPT_SYSPROFILE_BUSY
Details:

Example API call:

ctools_cpt_sysprofilecfg SysMemory_Profile_Params = {NULL};
ctools_cpt_modidqual SysMemory_ModIDQual[5];
int i;
for(i=0;i<5;i++)
{
SysMemory_ModIDQual[i].TPCntQual = NULL;
}
SysMemory_ModIDQual[0].CPT_ModId = eCPT_MSMC_0;
SysMemory_ModIDQual[1].CPT_ModId = eCPT_MSMC_1;
SysMemory_ModIDQual[2].CPT_ModId = eCPT_MSMC_2;
SysMemory_ModIDQual[3].CPT_ModId = eCPT_MSMC_3;
SysMemory_ModIDQual[4].CPT_ModId = eCPT_DDR;
//Populate SysMemory Profiler Params
SysMemory_Profile_Params.ModIDQual = SysMemory_ModIDQual;
SysMemory_Profile_Params.CPT_ModCnt = 5;
SysMemory_Profile_Params.CPUClockRateMhz = 983;
SysMemory_Profile_Params.SampleWindowSize = 81916;
// Open System memory (MSMC and DDR3) profiler
if (ctools_cpt_syslatprofile_open(&SysMemory_Profile_Params) != CTOOLS_SOK)
{
printf ("Error: ctools_cpt_syslatencyprofile_open Failed\n");
return(-1);
}
ctools_Result ctools_cpt_totalprofile_open ( const ctools_cpt_totalprofilecfg TotalProfile_params)

Description

Opens CP Tracer Total bandwidth profiler based on user configuration inputs.

Parameters
[in]TotalProfile_paramsctools_cpt_totalprofilecfg provides user defined configuration structure for Total bandwidth profiling.
Return values
Success- CTOOLS_SOK
Failure- CTOOLS_CPT_ENABLE_ERROR, CTOOLS_CPT_TOTALPROFILE_ERROR and CTOOLS_CPT_TOTALPROFILE_BUSY
Details:

Example API call:

ctools_cpt_totalprofilecfg Total_Profile_Params = {NULL};
ctools_cpt_masteridfiltercfg MstID_Cfg = {NULL};
eCPT_MasterID MstID_Array[] = {eCPT_MID_GEM1};
Total_Profile_Params.CPT_ModId = eCPT_DDR; //Profiling accesses to DDR3 memory
MstID_Cfg.CPT_MasterID = MstID_Array;
MstID_Cfg.MasterIDgroup_Enable = 0;
MstID_Cfg.CPT_MasterIDCnt = 1;
Total_Profile_Params.TPCnt_MasterID = &MstID_Cfg;
Total_Profile_Params.TPCntQual = NULL;
Total_Profile_Params.Address_Filter_Params = NULL; //Address filtering is disabled
Total_Profile_Params.CPUClockRateMhz = 983;
Total_Profile_Params.SampleWindowSize = 81916;
// Open DDR3 Total bandwidth profiler
if (ctools_cpt_totalprofile_open(&Total_Profile_Params) != CTOOLS_SOK)
{
printf ("Error: ctools_cpt_totalprofile_open failed\n");
return(-1);
}
ctools_Result ctools_dsptrace_init ( void  )

Description
The very first function to be called once per system initialization for resource initializations

Return values
Success- CTOOLS_SOK
Failure- CTOOLS_DSPTRACE_OPEN_ERROR, CTOOLS_DSPTRACE_SETCLK_ERROR, CTOOLS_DSPTRACE_ENABLE_ERROR and CTOOLS_DSPETB_NOT_ENABLED
Please Note:
In a Multicore environment, the DSP trace initialization (ctools_dsptrace_init) should be done seperately from individual cores (Each core has to call its own DSP trace initialization API). A single core (master core) cannot perform DSP trace initialization for all the other cores. If user is not using Emulator (XDS560 PRO or XDS560T) for draining DSP trace, then DSP Trace initialization(::ctools_dsptrace_init) should be done on individual cores, only after the DSP ETB is initialized (using ctools_etb_init) by the individual cores. ctools_dsptrace_init will return error if DSP ETB is not yet initialized.
ctools_Result ctools_dsptrace_shutdown ( void  )

Description
The very final function to be called to release all DSP Trace related resources

Return values
Success- DBG_TOOLS_SOK
Failure- CTOOLS_DSPTRACE_DISABLE_ERROR, CTOOLS_DSPTRACE_CLOSE_ERROR and CTOOLS_AET_RELJOB_ERROR
Please Note:
In a Multicore environment, the DSP trace shutdown (ctools_dsptrace_shutdown) should be done seperately from individual cores (Each core has to call its own DSP trace shutdown API). A single core (master core) cannot perform DSP trace shutdown for all the other cores.
ctools_Result ctools_edma_resrc_get ( uint32_t *  num_params,
uint32_t *  num_channels 
)

Description
Get the EDMA resouces for the ETB drain

Parameters
[in]num_paramsnumber of parameters needed to drain ETB using EDMA
[in]num_channelsnumber of channels needed to drain ETB using EDMA
Return values
Success- DBG_TOOLS_SOK
ctools_Result ctools_etb_cpu_drain ( const void *  data_p,
uint32_t  size_in,
uint32_t *  size_out,
uint32_t *  wrap_flag,
ctools_etb_types_e  etb_type 
)

Description
CPU based draining of DSP ETB or System ETB.

Parameters
[in]data_ppointer to the linear buffer
[in]size_inSize of the 32-bit linear buffer (should be multiple of 4k)
[out]size_outnumber of valid 32-bit words in the linear buffer
[out]wrap_flagpointer to the ETB wrap flag. Specifies whether ETB is wrapped or not
[in]etb_typeSpecifies whether the ETB being drained is a DSP ETB or System ETB
Return values
Success- CTOOLS_SOK
Failure- trace job close err return status - CTOOLS_RESOURCE_CLOSE_ERROR
Please Note:
In a Multicore environment:
  • DSP ETB drain should be done seperately from individual cores (Each core has to call its own ETB drain API). A single core (master core) cannot perform ETB drain for all the other cores.
  • System ETB drain should only be done from a single core (master core which initialized the system ETB) and all other cores should not perform System ETB drain seperately.
ctools_Result ctools_etb_edma_drain ( ctools_edma_result_t pct_res,
ctools_etb_types_e  etb_type 
)

Description
EDMA based draining of DSP ETB or System ETB.

Parameters
[in]pct_respointer to the edma result structure
[in]etb_typeSpecifies whether the ETB being drained is a DSP ETB or System ETB
Return values
Success- CTOOLS_SOK
Failure- trace job close err return status - CTOOLS_RESOURCE_CLOSE_ERROR
Please Note:
In a Multicore environment:
  • DSP ETB drain should be done seperately from individual cores (Each core has to call its own ETB drain API). A single core (master core) cannot perform ETB drain for all the other cores.
  • System ETB drain should only be done from a single core (master core which initialized the system ETB) and all other cores should not perform System ETB drain seperately.
ctools_Result ctools_etb_init ( const ctools_etb_drain_e  etb_drain_opt,
const ctools_etb_config_t config,
ctools_etb_types_e  etb_type 
)

Description
Initializes DSP ETB or System ETB

Parameters
[in]etb_drain_optetb drain option for the traces captured in ETB
[in]configpointer to trace configurations
[in]etb_typeSpecifies whether the ETB being initialized is a DSP ETB or System ETB
Return values
Success- CTOOLS_SOK
Result- Init failure
Please Note:
In a Multicore environment:
  • DSP ETB initialization should be done seperately from individual cores (Each core has to call its own ETB initialization API). A single core (master core) cannot perform ETB initialization for all the other cores.
  • System ETB initialization should only be done from a single core (master core). If user is not using Emulator (XDS560V2 or XDS560 PRO) for draining system trace, then before calling ctools_systemtrace_init all cores except the master core should wait until the system ETB is initialized. ctools_systemtrace_init will return error if system ETB is not yet initialized.
ctools_Result ctools_memwatch_aetint_setup ( uint32_t *  data_StartAddress,
uint32_t *  data_EndAddress 
)

Description
The function opens and enables watch point on a memory range. Whenever a write is done to the specified memory range, the AET generates an interrupt, which is applied as an input to the Core Interrupt controller (Core INTC). The Core INTC can be configured to route this interrupt as an exception to the CPU.

  • Parameters
    [in]data_StartAddressStart address of the data to be monitored
    [in]data_EndAddressEnd address of the data to be monitored
    Return values
    CTOOLS_SOK- Success
    Failure- CTOOLS_RESOURCE_BUSY, CTOOLS_AET_CLAIM_ERROR, CTOOLS_AET_SETUPJOB_ERROR and CTOOLS_AET_ENABLE_ERROR
ctools_Result ctools_memwatch_close ( void  )

Description
The function closes and free up resources allocated for memory watch point.

Return values
Success- CTOOLS_SOK
ctools_Result ctools_memwatch_disable ( void  )

Description
The function disables memory watch point.

Return values
Success- CTOOLS_SOK
ctools_Result ctools_memwatch_enable ( void  )

Description
The function enables memory watch point.

Return values
Success- CTOOLS_SOK
Failure- CTOOLS_RESOURCE_BUSY, CTOOLS_AET_CLAIM_ERROR, CTOOLS_AET_SETUPJOB_ERROR and CTOOLS_AET_ENABLE_ERROR
ctools_Result ctools_memwatch_store_pc_setup ( uint32_t *  data_StartAddress,
uint32_t *  data_EndAddress 
)

Description
The function opens and enables watch point on a memory range. For every write to the specified memory range, the AET performs a store Program Address and captures the exact location in code, where the write happened. The list of writes to the specified memory range are captured in the ETB.

  • Parameters
    [in]data_StartAddressStart address of the data to be monitored
    [in]data_EndAddressEnd address of the data to be monitored
    Return values
    CTOOLS_SOK- Success
    Failure- CTOOLS_RESOURCE_BUSY, CTOOLS_AET_CLAIM_ERROR, CTOOLS_AET_SETUPJOB_ERROR and CTOOLS_AET_ENABLE_ERROR
ctools_Result ctools_pct_close ( void  )

Description
Close PC trace jobs associated with the current active PC trace use case

Return values
Success- CTOOLS_SOK
ctools_Result ctools_pct_setup ( const void *  pct_start_symb,
const void *  pct_stop_symb 
)

Description
Open and initialize the trace job for the pc trace and timing

Parameters
[in]pct_start_symbstart function to trigger the PC trace start
[in]pct_stop_symbstart function to trigger the PC trace stop
Return values
Success- CTOOLS_SOK
Failure- CTOOLS_RESOURCE_BUSY, CTOOLS_AET_CLAIM_ERROR, CTOOLS_AET_SETUPJOB_ERROR and CTOOLS_AET_ENABLE_ERROR
ctools_Result ctools_pct_start_exc ( void  )

Description
Open and initialize the trace job for the pc and timing

Return values
Success- CTOOLS_SOK
Failure- CTOOLS_RESOURCE_BUSY, CTOOLS_AET_CLAIM_ERROR, CTOOLS_AET_SETUPJOB_ERROR and CTOOLS_AET_ENABLE_ERROR
ctools_Result ctools_pct_start_now ( void  )

Description
Start the PC trace and Timing information now

Return values
Success- CTOOLS_SOK
Failure- CTOOLS_RESOURCE_BUSY, CTOOLS_AET_CLAIM_ERROR, CTOOLS_AET_SETUPJOB_ERROR and CTOOLS_AET_ENABLE_ERROR
ctools_Result ctools_pct_stop_now ( void  )

Description
Stop the PC Trace and Timing Information capture now

Return values
Success- CTOOLS_SOK
Failure- CTOOLS_INVALID_CALL_SEQ
ctools_Result ctools_pct_terminate_all ( void  )

Description
This API can be used to gracefully terminate all current PC trace jobs and can be called at any point in one's application SW.

Return values
Success- CTOOLS_SOK
ctools_Result ctools_stat_prof_end ( void  )

Description

End and close statistical profiling trace job for profiling the application.

Return values
CTOOLS_SOK- Success
Details:

Example API call:

// End statistical profiling trace capture
{
printf ("Error: Statistical profiling End Failed\n");
return;
}
ctools_Result ctools_stat_prof_start ( uint32_t  SamplingPeriod)

Description
The function opens and initializes all trace resources required for a statistical profiling job. The Trace job is started immediately, after it is setup.

Parameters
[in]SamplingPeriodPeriodic sampling period (CPU cycles) between two PC trace captures. Please, select a prime number to reduce the probability of coinciding with a periodic event in the application. The Sampling period selected depends on maximum size of Trace buffer and the application which is profiled statistically. Please, make sure that this period doesn't coincide with other periodic events in the application.
Return values
CTOOLS_SOK- Success
Failure- CTOOLS_RESOURCE_BUSY, CTOOLS_AET_CLAIM_ERROR, CTOOLS_AET_SETUPJOB_ERROR and CTOOLS_AET_ENABLE_ERROR
Details:

Example API call:

#define SAMPLING_INTERVAL 15013 //Select a prime number
// Start statistical profiling trace capture
if (ctools_stat_prof_start(SAMPLING_INTERVAL) < 0)
{
printf ("Error: Statistical profiling Start Failed\n");
return;
}
ctools_Result ctools_systemtrace_getdcmdata ( STM_DCM_InfoObj *  DCM_Info)

Description
This function can be used by the App SW to get DCM data for the current system trace session.

Parameters
[in]DCM_InfoPointer to STM DCM info object
Return values
Success- CTOOLS_SOK
Failure- CTOOLS_INVALID_PARAM
ctools_Result ctools_systemtrace_init ( const ctools_sys_trace_opts_e  sys_trace_options)

Description
The very first function to be called once per system initialization for system trace resource initializations

Parameters
[in]sys_trace_optionsProvide option to capture either CPT or SW messages or both CPT and SW messages
Return values
Success- CTOOLS_SOK
Failure- CTOOLS_SYSTEMTRACE_ENABLE_ERROR and CTOOLS_SYSETB_NOT_ENABLED
Please Note:
In a Multicore environment, the System trace initialization (ctools_systemtrace_init) should be done seperately from individual cores (Each core has to call its own system trace initialization API). A single core (master core) cannot perform system trace initialization for all the other cores. If user is not using Emulator (XDS560V2 or XDS560 PRO) for draining system trace, then System Trace initialization(::ctools_systemtrace_init) should be done on individual cores, only after the system ETB is initialized (using ctools_etb_init) by the master core. ctools_systemtrace_init will return error if system ETB is not yet initialized.
ctools_Result ctools_systemtrace_shutdown ( const ctools_sys_trace_opts_e  sys_trace_options)

Description
The very final function to be called to release all the resources used for system trace

Parameters
[in]sys_trace_optionsProvide option to capture either CPT or SW messages or both CPT and SW messages
Return values
Success- CTOOLS_SOK
Please Note:
In a Multicore environment, the System trace shutdown (ctools_systemtrace_shutdown) should be done seperately from individual cores (Each core has to call its own System trace shutdown API). A single core (master core) cannot perform System trace shutdown for all the other cores.