You must provide the following external functions.
extern bm_uint64 barman_ext_get_timestamp(void);
| Description | Reads 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. |
| Return value | The timestamp value in arbitrary units. |
The following functions have weak linkage implementations that can be overridden if necessary:
extern bm_uintptr barman_ext_disable_interrupts_local(void);
| Description | Disables interrupts on the local processor only. Used to allow atomic accesses to certain resources, for example PMU counters. |
| Return value | The current interrupt enablement status value. This value must be preserved and passed to barman_ext_enable_interrupts_local to restore the previous state. |
Note
A weak implementation of this function is provided that modifies DAIF on AArch64, or CPSR on AArch32.
extern void barman_ext_enable_interrupts_local(bm_uintptr previous_state);
| Description | Enables interrupts on the local processor only. |
| Parameter |
|
Note
A weak implementation of this function is provided that modifies DAIF on AArch64, or CPSR on AArch32.
The following functions must be defined if BM_CONFIG_MAX_CORES > 1:
extern bm_uint32 barman_ext_map_multiprocessor_affinity_to_core_no(bm_uintptr mpidr);
| Description | Given 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. See the following example. |
| Parameter |
|
| Return value | The processor number. |
Example
//
// 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
//
bm_uint32 barman_ext_map_multiprocessor_affinity_to_core_no(bm_uintptr mpidr)
{
return (mpidr & 0x03) + ((mpidr >> 6) & 0x4);
}
Note
This function only needs defining when BM_CONFIG_MAX_CORES > 1.
extern bm_uint32 barman_ext_map_multiprocessor_affinity_to_cluster_no(bm_uintptr mpidr);
| Description | Given 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. See the following example. |
| Parameter |
|
| Return value | The cluster number. |
Example
//
// Example implementation which is compatible with the example implementation of
// barman_ext_map_multiprocessor_affinity_to_core_no given above.
//
bm_uint32 barman_ext_map_multiprocessor_affinity_to_cluster_no(bm_uintptr mpidr)
{
return ((mpidr >> 8) & 0x1);
}
Note
This function only needs defining when BM_CONFIG_MAX_CORES > 1.
The following function must be defined if BM_CONFIG_MAX_TASK_INFOS > 0:
extern bm_task_id_t barman_ext_get_current_task_id(void);
| Description | Returns the current task ID. |
The following functions must be defined if BM_CONFIG_ENABLE_LOGGING != 0:
void barman_ext_log_info(const char * message, ...);
| Description | Prints an info message. |
| Parameter | message |
void barman_ext_log_warning(const char * message, ...);
| Description | Prints a warning message. |
| Parameter | message |
void barman_ext_log_error(const char * message, ...);
| Description | Prints an error message. |
| Parameter | message |
The following function must be defined if BM_CONFIG_ENABLE_DEBUG_LOGGING != 0:
void barman_ext_log_debug(const char * message, ...);
| Description | Prints a debug message. |
| Parameter | message |