Platform-Specific API Functions#

Platform-specific functions for logging system integration.

These functions provide platform-specific functionality for power management, backend initialization, and hardware-specific operations. Implementations are provided by the platform-specific code.

Functions#

sl_status_t

Prepare logger for sleep mode.

sl_status_t

Initialize logger after wake-up.

sl_status_t

Initialize the selected logging backend.

sl_status_t
sl_log_backend_write(sl_log_event_t *buffer, uint32_t read_index, uint32_t event_count)

Write log events to backend interface.

sl_status_t

Initializes the core platform logging infrastructure.

sl_status_t

De-initializes the core platform logging infrastructure.

uint32_t

Get current timestamp counter value.

uint32_t

Get timestamp timer frequency.

sl_status_t
sl_log_set_configurations(void *args, uint8_t core_id)

Set core-specific logger configurations.

sl_status_t
sl_log_get_configurations(void *args, uint8_t core_id)

Get core-specific logger configurations.

Retrieve the logging ring buffer configuration instance.

Function Documentation#

sl_log_pre_sleep_process#

sl_status_t sl_log_pre_sleep_process (void * args)

Prepare logger for sleep mode.

Parameters
TypeDirectionArgument NameDescription
void *[in]args

void pointer for any platform-specific arguments

Configures the logging system before entering sleep mode. This typically involves flushing pending events, configuring wake-up sources, and preparing hardware for low-power operation.

Returns

  • sl_status_t Status code indicating the result of the operation.

    • SL_STATUS_OK: Sleep preparation successful

    • SL_STATUS_FAIL: Sleep preparation failed

    • SL_STATUS_NULL_POINTER: Invalid config pointer

Note

  • This function should be called before entering any sleep mode to ensure log data integrity and proper system behavior.


sl_log_post_sleep_process#

sl_status_t sl_log_post_sleep_process (void * args)

Initialize logger after wake-up.

Parameters
TypeDirectionArgument NameDescription
void *[in]args

void pointer for any platform-specific arguments

Reinitializes the logging system after waking from sleep mode. This includes restoring hardware state, reinitializing timers, and resuming normal logging operations.

Returns

  • sl_status_t Status code indicating the result of the operation.

    • SL_STATUS_OK: Wake-up initialization successful

    • SL_STATUS_FAIL: Wake-up initialization failed

    • SL_STATUS_NULL_POINTER: Invalid config pointer

Note

  • This function should be called immediately after waking from sleep mode to restore full logging functionality.


sl_log_backend_init#

sl_status_t sl_log_backend_init (void )

Initialize the selected logging backend.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Initializes the specified backend interface for log output. This function sets up the necessary hardware, communication channels, and data structures required by the selected backend.

Returns

  • sl_status_t Status code indicating the result of the operation.

    • SL_STATUS_OK: Backend initialized successfully

    • SL_STATUS_INVALID_PARAMETER: Invalid interface parameter

    • SL_STATUS_FAIL: Backend initialization failed

Note

  • This function must be called before using any backend-specific logging functionality. Different backends may have different initialization requirements and capabilities.


sl_log_backend_write#

sl_status_t sl_log_backend_write (sl_log_event_t * buffer, uint32_t read_index, uint32_t event_count)

Write log events to backend interface.

Parameters
TypeDirectionArgument NameDescription
sl_log_event_t *[in]buffer

Pointer to the ring buffer containing log events

uint32_t[in]read_index

Starting index in the buffer for reading events

uint32_t[in]event_count

Number of events to transmit from the buffer

Transmits log events from the ring buffer to the selected backend interface. This function handles ring buffer wraparound and ensures reliable transmission of all requested events to the backend.

Returns

  • sl_status_t Status code indicating the result of the operation.

    • SL_STATUS_OK: All events written successfully

    • SL_STATUS_INVALID_PARAMETER: Invalid buffer pointer or indices

    • SL_STATUS_FAIL: Backend write operation failed

Note

  • This function may be called multiple times for large event counts to handle ring buffer wraparound conditions efficiently.


sl_log_platform_core_init#

sl_status_t sl_log_platform_core_init (void )

Initializes the core platform logging infrastructure.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function sets up any platform-specific resources required by the logging system (e.g., timers). It is intended to be called once during system startup before any other logging APIs are used.

Returns

  • SL_STATUS_OK on successful initialization. any other platform specific error codes on failure.


sl_log_platform_core_deinit#

sl_status_t sl_log_platform_core_deinit (void )

De-initializes the core platform logging infrastructure.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function deinitializes any platform-specific resources allocated by sl_log_platform_core_init().

Returns

  • SL_STATUS_OK on successful de-initialization. any other platform specific error codes on failure.


sl_log_get_timestamp_count#

uint32_t sl_log_get_timestamp_count (uint8_t core_id)

Get current timestamp counter value.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]core_id

Core identifier (0 = host core, >0 = captive cores)

Retrieves the current value from the timestamp counter for the specified core. This function provides access to the raw timestamp value used for logging operations.

Returns

  • uint32_t Current timestamp counter value in system timer units

Note


sl_log_get_timestamp_timer_frequency#

uint32_t sl_log_get_timestamp_timer_frequency (uint8_t core_id)

Get timestamp timer frequency.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]core_id

Core identifier (0 = host core, >0 = captive cores)

Returns the frequency in Hz of the timestamp timer used for the specified core. This frequency value can be used to convert raw timestamp values to actual time units (seconds, milliseconds, etc.).

Returns

  • uint32_t Frequency of the timestamp timer in Hz

Note

  • The returned frequency depends on the underlying timer/counter hardware configuration and may vary between different cores in a multi-core system.


sl_log_set_configurations#

sl_status_t sl_log_set_configurations (void * args, uint8_t core_id)

Set core-specific logger configurations.

Parameters
TypeDirectionArgument NameDescription
void *[in]args

Pointer to core-specific configuration arguments

uint8_t[in]core_id

Core identifier (0 = host core, >0 = captive core)

Configures logging parameters for either the host core or a specific captive core. The function automatically delegates to the appropriate API (host or captive core) based on the core ID.

Returns

  • sl_status_t Status code indicating the result of the operation.

    • SL_STATUS_OK: Configuration applied successfully

    • SL_STATUS_INVALID_PARAMETER: Invalid arguments or core ID

    • SL_STATUS_NULL_POINTER: NULL args pointer provided

Note

  • The format and content of the args parameter depends on the specific core type and its configuration requirements.


sl_log_get_configurations#

sl_status_t sl_log_get_configurations (void * args, uint8_t core_id)

Get core-specific logger configurations.

Parameters
TypeDirectionArgument NameDescription
void *[out]args

Pointer to buffer for storing configuration arguments

uint8_t[in]core_id

Core identifier (0 = host core, >0 = captive core)

Retrieves current logging configuration parameters for either the host core or a specific captive core. The function automatically delegates to the appropriate API based on the core ID.

Returns

  • sl_status_t Status code indicating the result of the operation.

    • SL_STATUS_OK: Configuration retrieved successfully

    • SL_STATUS_INVALID_PARAMETER: Invalid core ID provided

    • SL_STATUS_NULL_POINTER: NULL args pointer provided

Note

  • The caller must provide a sufficiently large buffer in args to hold the core-specific configuration data.


sl_log_get_ring_buffer_config#

sl_log_ring_buffer_t * sl_log_get_ring_buffer_config (void )

Retrieve the logging ring buffer configuration instance.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Provides access to the global (singleton) ring buffer configuration used by the logging subsystem. This structure typically contains buffer size, write/read indices, pointer to ring buffer and any state needed to manage in-memory log storage.

The returned pointer refers to an internally managed object; callers MUST NOT free or modify ownership-related aspects of the structure. If mutation of fields is allowed by design, ensure proper synchronization (see Thread Safety).

Returns

  • Pointer to the logging ring buffer configuration. Returns nullptr if the configuration has not been initialized or an internal error occurred.

@thread_safety

  • If the logging system initializes the ring buffer during startup and only mutates it through its own synchronized APIs, read-only access through this pointer is typically safe.

  • If callers intend to modify the structure directly, they must ensure external synchronization to avoid data races.