Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/audio/module_adapter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ endif()
iadk/module_initial_settings_concrete.cpp
iadk/iadk_module_adapter.cpp
iadk/system_agent.cpp
iadk/timestamping_service_provider.cpp
library/native_system_service.c
)
if(CONFIG_INTEL_MODULES AND CONFIG_COMP_KPB)
Expand Down
8 changes: 8 additions & 0 deletions src/audio/module_adapter/iadk/system_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <iadk_module_adapter.h>
#include <system_agent.h>
#include <sof/audio/module_adapter/iadk/iadk_kpb_service.h>
#include <sof/audio/module_adapter/iadk/iadk_timestamping_service.h>
#include <sof/audio/module_adapter/library/native_system_service.h>
#include <sof/audio/module_adapter/library/native_system_agent.h>

Expand All @@ -47,6 +48,10 @@ static AdspErrorCode iadk_system_service_get_interface(enum interface_id id,

*iface = NULL;

if (id == INTERFACE_ID_TIMESTAMPING_SERVICE)
return GetTimestampingServiceInterface(INTERFACE_VERSION_TIMESTAMPING_SERVICE_V1,
iface);

#if CONFIG_COMP_KPB
if (id == INTERFACE_ID_KPB_SERVICE)
return GetKpbServiceInterface(INTERFACE_VERSION_KPB_SERVICE_V1, iface);
Expand All @@ -64,6 +69,9 @@ static AdspErrorCode iadk_system_service_get_interface_versioned(enum interface_

*iface = NULL;

if (id == INTERFACE_ID_TIMESTAMPING_SERVICE)
return GetTimestampingServiceInterface(version, iface);

#if CONFIG_COMP_KPB
if (id == INTERFACE_ID_KPB_SERVICE)
return GetKpbServiceInterface(version, iface);
Expand Down
40 changes: 40 additions & 0 deletions src/audio/module_adapter/iadk/timestamping_service_provider.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include <rtos/userspace_helper.h>
#include <sof/audio/module_adapter/iadk/iadk_timestamping_service.h>
#include <sof/audio/module_adapter/iadk/timestamping_interface.h>

namespace intel_adsp
{

/**
* \brief Timestamping compatibility provider with zeroed counters.
*/
class TimestampingServiceProvider final : public TimestampingInterface {
public:
ErrorCode::Type GetCurrentPosition(const ModuleHandle &,
ModuleCounters &counters) const override
{
counters = {};
return ErrorCode::NO_ERROR;
}

ErrorCode::Type AdjustPosition(const ModuleHandle &, ModuleCounters &,
int64_t ms_shift) const override
{
return ms_shift == 0 ? ErrorCode::NO_ERROR : ErrorCode::FATAL_FAILURE;
}
};

static APP_TASK_DATA TimestampingServiceProvider timestamping_service;

AdspErrorCode GetTimestampingServiceInterface(uint32_t version, struct system_service_iface **iface)
{
if (version != INTERFACE_VERSION_TIMESTAMPING_SERVICE_V1) {
*iface = nullptr;
return ADSP_SERVICE_VERSION_UNAVAILABLE;
}

*iface = reinterpret_cast<struct system_service_iface *>(&timestamping_service);
return ADSP_NO_ERROR;
}

} /* namespace intel_adsp */
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef _IADK_TIMESTAMPING_SERVICE_H_
#define _IADK_TIMESTAMPING_SERVICE_H_

#include <stdint.h>
#include <system_service.h>

namespace intel_adsp
{

/**
* \brief Get the IADK timestamping service interface.
*
* \param version Requested INTERFACE_VERSION_TIMESTAMPING_SERVICE_* version.
* \param iface Non-null location for the returned TimestampingInterface instance.
* \return ADSP_NO_ERROR, or ADSP_SERVICE_VERSION_UNAVAILABLE for unsupported versions.
*/
AdspErrorCode GetTimestampingServiceInterface(uint32_t version, struct system_service_iface **iface);

} /* namespace intel_adsp */

#endif /* _IADK_TIMESTAMPING_SERVICE_H_ */
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifndef SOF_AUDIO_MODULE_ADAPTER_IADK_TIMESTAMPING_INTERFACE_H
#define SOF_AUDIO_MODULE_ADAPTER_IADK_TIMESTAMPING_INTERFACE_H

#include <stdint.h>

#include "system_error.h"

namespace intel_adsp
{

class ModuleHandle;

/**
* \brief Snapshot of timestamping counters associated with a module.
*/
struct ModuleCounters {
uint64_t timer_value;
uint64_t linear_link_position;
uint64_t gateway_total_processed_data;
uint64_t module_total_processed_data;
};

/**
* \brief IADK timestamping service v1 ABI.
*/
class TimestampingInterface {
public:
/** \brief Retrieve the current module counters. */
virtual ErrorCode::Type GetCurrentPosition(const ModuleHandle &module_handle,
ModuleCounters &counters) const = 0;
/** \brief Adjust module counters by the requested shift in milliseconds. */
virtual ErrorCode::Type AdjustPosition(const ModuleHandle &module_handle,
ModuleCounters &counters, int64_t ms_shift) const = 0;
};

} /* namespace intel_adsp */

#endif /* SOF_AUDIO_MODULE_ADAPTER_IADK_TIMESTAMPING_INTERFACE_H */
Loading