Skip to content
Closed
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 CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ modules/cmn/api
modules/processing/volume_control/capi/gain/api
modules/processing/volume_control/capi/soft_vol/api
modules/cmn/common/internal_api
modules/processing/PoplessEqualizer/api
)
###
### Some strings used for picking inc paths based on arch, tgt/sim & static/shared.
Expand Down
1 change: 1 addition & 0 deletions arch/linux/configs/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ CONFIG_IIR_MBDRC=y
CONFIG_GAIN=n
CONFIG_SOFT_VOL=n
CONFIG_FIR_FILTER=n
CONFIG_POPLESS_EQUALIZER=n

#
# Signal Processing Framework
Expand Down
4 changes: 2 additions & 2 deletions fwk/platform/posal/inc/linux/posal_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ typedef struct

/** posal timer structure. */
typedef struct {
uint32_t timer_obj;
/**< Timer object. */
timer_t* timer_obj;
/**< Pointer to timer object. */

uint64_t timer_start_time;

Expand Down
94 changes: 93 additions & 1 deletion fwk/platform/posal/src/linux/posal_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ INCLUDE FILES FOR MODULE
#include "posal_internal.h"
#include "posal_target_i.h"
#include <ar_osal_timer.h>
#include <time.h>

/*--------------------------------------------------------------*/
/* Macro / Global definitions */
Expand Down Expand Up @@ -61,7 +62,7 @@ static void posal_timer_expire_cb(union sigval sv)
{
posal_timer_info_t *p_timer = (posal_timer_info_t *)sv.sival_ptr;
posal_channel_internal_t *p_channel = (posal_channel_internal_t *)p_timer->pChannel;
posal_signal_set_target_inline(&p_channel->anysig, p_channel->unBitsUsedMask);
posal_signal_set_target_inline(&p_channel->anysig, p_timer->timer_sigmask);
#ifdef DEBUG_POSAL_TIMER
prev_trigger_count = trigger_counter;
trigger_counter++;
Expand Down Expand Up @@ -123,6 +124,78 @@ int32_t posal_timer_create_v2(posal_timer_t * pp_timer,
POSAL_HEAP_ID heap_id)
{
int nStatus = 0;
struct sigevent timer_event = {0};

if ((NULL == pp_timer) || (NULL == client_info_ptr) ||
(notification_type >= MAX_SUPPORTED_POSAL_TIMER_NOTIFY_OBJ_TYPES))
{
AR_MSG(DBG_ERROR_PRIO, "Bad inputarguments for timer creation");
return AR_EBADPARAM;
}

if (POSAL_TIMER_USER != clockSource)
{
AR_MSG(DBG_ERROR_PRIO, "Only USER TIMER supported for now");
return AR_EBADPARAM;
}

//Allocate posal_timer_info
posal_timer_info_t *p_timer = NULL;
if (NULL == (p_timer = (posal_timer_info_t *)posal_memory_malloc(sizeof(posal_timer_info_t), heap_id)))
{
AR_MSG(DBG_ERROR_PRIO, "Memory allocation failure");
return AR_ENOMEMORY;
}
memset(p_timer, 0, sizeof(posal_timer_info_t));

//Allocate timer id
timer_t *timerId = NULL;
if (NULL == (timerId = (posal_timer_info_t *)posal_memory_malloc(sizeof(timer_t), heap_id)))
{
AR_MSG(DBG_ERROR_PRIO, "Memory allocation failure");
posal_memory_free(p_timer);
posal_memory_free(timerId);
return AR_ENOMEMORY;
}
memset(timerId, 0, sizeof(timer_t));

// init timer structure
p_timer->istimerCreated = FALSE;
p_timer->uTimerType = (uint32_t)timerType;
p_timer->duration = ATS_TIMER_MAX_DURATION;
p_timer->heap_id = (POSAL_HEAP_ID)heap_id;
p_timer->timer_obj = timerId; //save pointer to timer

//Set signal for timer
posal_signal_t p_signal = NULL;
if (POSAL_TIMER_NOTIFY_OBJ_TYPE_SIGNAL == notification_type)
{
p_signal = client_info_ptr;
if (NULL == (p_timer->pChannel = posal_signal_get_channel(p_signal)))
{
AR_MSG(DBG_ERROR_PRIO, "Signal does not belong to any channel");
posal_memory_free(p_timer);
posal_memory_free(timerId);
return AR_EFAILED;
}
p_timer->timer_sigmask = posal_signal_get_channel_bit(p_signal);
}
//Create linux timer
timer_event.sigev_notify = SIGEV_THREAD;
timer_event.sigev_notify_function = &posal_timer_expire_cb;
timer_event.sigev_value.sival_ptr = p_timer; //Save the timer info for callback function

nStatus = timer_create(CLOCK_REALTIME, &timer_event, timerId);
if (nStatus != 0)
{
AR_MSG(DBG_ERROR_PRIO, "Failed to create timer");
posal_memory_free(p_timer);
posal_memory_free(timerId);
return AR_EFAILED;
}

p_timer->istimerCreated = TRUE;
*pp_timer = (posal_timer_t *)p_timer;

return AR_EOK;
}
Expand Down Expand Up @@ -241,6 +314,25 @@ int32_t posal_timer_oneshot_start_duration(posal_timer_t p_obj, int64_t duration
*/
int32_t posal_timer_periodic_start(posal_timer_t p_obj, int64_t duration)
{
int nStatus = 0;
posal_timer_info_t *p_timer = (posal_timer_info_t *)p_obj;
timer_t *timer = (timer_t*) p_timer->timer_obj;
struct itimerspec its = {0};

//Set the timer delay and interval
its.it_interval.tv_sec = 0;
its.it_interval.tv_nsec = duration * 1000; //Convert duration to nanoseconds
its.it_value.tv_sec = 0;
its.it_value.tv_nsec = duration * 1000; //Indicates when the timer will fire next

//Start the timer
nStatus = timer_settime(*timer, 0, &its, NULL);
if (nStatus != 0)
{
AR_MSG(DBG_ERROR_PRIO, "Failed to start timer");
return AR_EFAILED;
}

return AR_EOK;
}

Expand Down
16 changes: 14 additions & 2 deletions fwk/spf/apm/ext/proxy/proxy_vcpm/build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,22 @@
cmake_minimum_required(VERSION 3.10)

#Add the source files
set (lib_srcs_list
${LIB_ROOT}/stub_src/apm_proxy_vcpm_stub.c
set(lib_srcs_list
${LIB_ROOT}/src/apm_proxy_vcpm_cmd_rsp_handler.c
${LIB_ROOT}/src/apm_proxy_vcpm_utils.c
)

set(lib_incs_list
${LIB_ROOT}/src/apm_proxy_vcpm_utils_i.h
${LIB_ROOT}/inc/apm_proxy_vcpm_utils.h
)

include_directories(
../vcpm/inc/
)

add_subdirectory(../vcpm/build vcpm)

#Call spf_build_static_library to generate the static library
spf_build_static_library(vcpm_prxy_mgr
"${lib_incs_list}"
Expand Down
29 changes: 29 additions & 0 deletions fwk/spf/apm/ext/proxy/proxy_vcpm/vcpm/build/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#[[
@file CMakeLists.txt

@brief

@copyright
Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved.
SPDX-License-Identifier: BSD-3-Clause-Clear

]]
cmake_minimum_required(VERSION 3.10)

#add source and header files
set (lib_srcs_list
${LIB_ROOT}/stub_src/vcpm.c
)

set (lib_incs_list
${LIB_ROOT}/inc
)

#Call spf_build_static_library to generate the static library
spf_build_static_library(vcpm
"${lib_incs_list}"
"${lib_srcs_list}"
"${lib_defs_list}"
"${lib_flgs_list}"
"${lib_link_libs_list}"
)
46 changes: 46 additions & 0 deletions fwk/spf/apm/ext/proxy/proxy_vcpm/vcpm/inc/vcpm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#ifndef _VCPM_H_
#define _VCPM_H_

/**
* \file vcpm.h
* \brief
* This file contains declarations of the VCPM public API's
*
*
* \copyright
* Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/

#include "ar_error_codes.h"

#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/

/*==============================================================================
Public Function definitions
==============================================================================*/

/** Creates the command handler thread for the VCPM.

return: on success, or error code otherwise.

*/
ar_result_t vcpm_create();

/** Destroys the VCPM command handler thread and clean up
resources.

return: None
*/

void vcpm_destroy();

ar_result_t vcpm_get_spf_handle(spf_handle_t **spf_handle_pptr);

#ifdef __cplusplus
}
#endif /*__cplusplus*/

#endif /* #ifdef _VCPM_H_ */
31 changes: 31 additions & 0 deletions fwk/spf/apm/ext/proxy/proxy_vcpm/vcpm/stub_src/vcpm.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* \file vcpm.c
* \brief
* This file contains VCPM Module Implementation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just stub. Can we name vcpm_stub.c to be consistent? Also, remember to update the comment indicating it is stub implementation

*
*
* \copyright
* Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/

#include "spf_utils.h"

/**=========================================================================
Global Defines
===========================================================================*/
ar_result_t vcpm_create()
{
//return AR_EUNSUPPORTED;
return AR_EOK;
}

void vcpm_destroy()
{
return;
}

ar_result_t vcpm_get_spf_handle(spf_handle_t **spf_handle_pptr)
{
return AR_EUNSUPPORTED;
}
3 changes: 3 additions & 0 deletions modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ endif()
if(CONFIG_FIR_FILTER)
add_subdirectory(processing/filters/fir/build)
endif()
if(CONFIG_POPLESS_EQUALIZER)
add_subdirectory(processing/PoplessEqualizer/build)
endif()
4 changes: 4 additions & 0 deletions modules/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ config SOFT_VOL
config FIR_FILTER
tristate "Enable FIR_FILTER Library"
default n

config POPLESS_EQUALIZER
tristate "Enable POPLESS_EQUALIZER Library"
default n
endmenu
Loading
Loading