You must provide the following external functions.
barman_ext_get_timestampReads the current sample timestamp value, which must be provided for the time at the point of the call.
The timer must provide monotonically incrementing values from an implementation defined start point. The counter must not overflow during the period that it is used. The counter is in arbitrary units. The mechanism for converting those units to nanoseconds is described as part of the protocol data header.
Returns the timestamp value in arbitrary units.
extern bm_uint64 barman_ext_get_timestamp(void);
barman_ext_disable_interrupts_localDisables interrupts on the local processor only. Used to allow atomic accesses to certain resources, for example PMU counters.
Returns the current interrupt enablement status value. This value must be preserved and passed to barman_ext_enable_interrupts_local() to restore the previous state.
extern bm_uintptr barman_ext_disable_interrupts_local(void);
Note
This function has a weak linkage implementation that can be overridden if necessary.
A weak implementation of this function is provided that modifies DAIF on AArch64, or CPSR on AArch32.
barman_ext_enable_interrupts_localEnables interrupts on the local processor only.
extern void barman_ext_enable_interrupts_local(bm_uintptr previous_state);
The parameters are:
previous_stateThe value that was previously returned from barman_ext_disable_interrupts_local.
Note
This function has a weak linkage implementation that can be overridden if necessary
A weak implementation of this function is provided that modifies DAIF on AArch64, or CPSR on AArch32.
barman_ext_map_multiprocessor_affinity_to_core_noGiven the MPIDR register, returns a unique processor number.
The implementation must return a value between 0 and N, where N is the maximum number of processors in the system. For any valid permutation of the arguments, a unique value must be returned. This value must not change between successive calls to this function for the same argument values.
Returns the processor number.
extern bm_uint32 barman_ext_map_multiprocessor_affinity_to_core_no(bm_uintptr mpidr);
The parameters are:
mpidrThe value of the MPIDR register.
Example implementation where processors are arranged as follows:
aff2 | aff1 | aff0 | cpuno
-----+------+------+------
0 | 0 | 0 | 0
0 | 0 | 1 | 1
0 | 0 | 2 | 2
0 | 0 | 3 | 3
0 | 1 | 0 | 4
0 | 1 | 1 | 5
The corresponding function call to barman_ext_map_multiprocessor_affinity_to_core_no():
bm_uint32 barman_ext_map_multiprocessor_affinity_to_core_no(bm_uintptr mpidr)
{
return (mpidr & 0x03) + ((mpidr >> 6) & 0x4);
}
Note
This function must be defined when BM_CONFIG_MAX_CORES > 1.
barman_ext_map_multiprocessor_affinity_to_cluster_noGiven the MPIDR register, return the appropriate cluster number. Cluster IDs should be numbered from 0 to N, where N is the number of clusters in the system.
Returns the cluster number.
extern bm_uint32 barman_ext_map_multiprocessor_affinity_to_cluster_no(bm_uintptr mpidr);
The parameters are:
mpidrThe value of the MPIDR register.
Example implementation where processors are arranged as follows:
aff2 | aff1 | aff0 | cpuno
-----+------+------+------
0 | 0 | 0 | 0
0 | 0 | 1 | 1
0 | 0 | 2 | 2
0 | 0 | 3 | 3
0 | 1 | 0 | 4
0 | 1 | 1 | 5
The corresponding function call to barman_ext_map_multiprocessor_affinity_to_cluster_no():
bm_uint32 barman_ext_map_multiprocessor_affinity_to_cluster_no(bm_uintptr mpidr)
{
return ((mpidr >> 8) & 0x1);
}
Note
This function must be defined when BM_CONFIG_MAX_CORES > 1.
barman_ext_get_current_task_idReturns the current task ID. This function must be defined if BM_CONFIG_MAX_TASK_INFOS > 0.
extern bm_task_id_t barman_ext_get_current_task_id(void);
barman_ext_log_infoPrints an info message. This function must be defined if BM_CONFIG_ENABLE_LOGGING != 0.
void barman_ext_log_info(const char * message, ...);
The parameters are:
messageThe info message you want to print.
barman_ext_log_warningPrints a warning message. This function must be defined if BM_CONFIG_ENABLE_LOGGING != 0.
void barman_ext_log_warning(const char * message, ...);
The parameters are:
messageThe warning message you want to print.
barman_ext_log_errorPrints an error message. This function must be defined if BM_CONFIG_ENABLE_LOGGING != 0.
void barman_ext_log_error(const char * message, ...);
The parameters are:
messageThe error message you want to print.
barman_ext_log_debugPrints a debug message. This function must be defined if BM_CONFIG_ENABLE_DEBUG_LOGGING != 0.
void barman_ext_log_debug(const char * message, ...)
The parameters are:
messageThe debug message you want to print.