parameters lib convert to c++ (#10267)

This commit is contained in:
Daniel Agar
2018-09-04 09:18:28 -04:00
committed by GitHub
parent 0c08b7035b
commit 060463e8a7
20 changed files with 600 additions and 479 deletions

View File

@@ -38,6 +38,8 @@ if (("${BOARD}" STREQUAL "eagle") OR ("${BOARD}" STREQUAL "excelsior"))
apps.cpp
LINK_LIBS
-Wl,--start-group
px4_layer
parameters
${module_libraries}
${df_driver_libs}
${FASTRPC_ARM_LIBS}

View File

@@ -38,10 +38,9 @@ if("${CONFIG_SHMEM}" STREQUAL "1")
include_directories(${HEXAGON_SDK_INCLUDES})
include_directories(${PX4_BINARY_DIR}/platforms/posix)
list(APPEND SHMEM_SRCS
shmem_posix.c
shmem_posix.cpp
)
# TODO: This didn't seem to be tracked correctly from posix_eagle_release.cmake
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCONFIG_SHMEM")
add_definitions(-DCONFIG_SHMEM=1)
set(EXTRA_DEPENDS generate_px4muorb_stubs)
endif()

View File

@@ -58,10 +58,6 @@ __BEGIN_DECLS
long PX4_TICKS_PER_SEC = sysconf(_SC_CLK_TCK);
#ifdef CONFIG_SHMEM
extern void init_params(void);
#endif
__END_DECLS
namespace px4
@@ -77,11 +73,6 @@ void init_once()
hrt_work_queue_init();
hrt_init();
param_init();
#ifdef CONFIG_SHMEM
PX4_DEBUG("Syncing params to shared memory\n");
init_params();
#endif
}
void init(int argc, char *argv[], const char *app_name)

View File

@@ -69,8 +69,7 @@ struct param_wbuf_s {
/*update value and param's change bit in shared memory*/
void update_to_shmem(param_t param, union param_value_u value)
{
if (px4muorb_param_update_to_shmem(param, (unsigned char *) &value,
sizeof(value))) {
if (px4muorb_param_update_to_shmem(param, (unsigned char *) &value, sizeof(value))) {
PX4_ERR("krait update param %u failed", param);
}
}
@@ -82,14 +81,12 @@ void update_index_from_shmem(void)
return;
}
px4muorb_param_update_index_from_shmem(adsp_changed_index,
PARAM_BUFFER_SIZE);
px4muorb_param_update_index_from_shmem(adsp_changed_index, PARAM_BUFFER_SIZE);
}
static void update_value_from_shmem(param_t param, union param_value_u *value)
{
if (px4muorb_param_update_value_from_shmem(param, (unsigned char *) value,
sizeof(union param_value_u))) {
if (px4muorb_param_update_value_from_shmem(param, (unsigned char *) value, sizeof(union param_value_u))) {
PX4_ERR("%s get param failed", __FUNCTION__);
}
}
@@ -128,4 +125,3 @@ int update_from_shmem(param_t param, union param_value_u *value)
return retval;
}

View File

@@ -43,10 +43,10 @@ else()
SOURCES
${PX4_BINARY_DIR}/apps.cpp
LINK_LIBS
modules__muorb__adsp
${module_libraries}
${df_driver_libs}
m
modules__muorb__adsp
)
add_custom_target(upload

View File

@@ -43,7 +43,7 @@ set(QURT_LAYER_SRCS
../../../posix/src/px4_layer/drv_hrt.c
qurt_stubs.c
main.cpp
shmem_qurt.c
shmem_qurt.cpp
)
if ("${QURT_ENABLE_STUBS}" STREQUAL "1")

View File

@@ -71,7 +71,6 @@ unsigned int sleep(unsigned int sec)
}
extern void hrt_init(void);
extern void init_params();
#if 0
void qurt_log(const char *fmt, ...)
@@ -108,9 +107,6 @@ void init_once(void)
hrt_work_queue_init();
hrt_init();
param_init();
/* Shared memory param sync*/
init_params();
}
void init(int argc, char *argv[], const char *app_name)

View File

@@ -56,11 +56,11 @@ unsigned char *map_base, *virt_addr;
struct shmem_info *shmem_info_p;
int get_shmem_lock(const char *caller_file_name, int caller_line_number);
void release_shmem_lock(const char *caller_file_name, int caller_line_number);
void init_shared_memory(void);
void copy_params_to_shmem(struct param_info_s *);
void init_shared_memory();
void copy_params_to_shmem(param_info_s *);
void update_to_shmem(param_t param, union param_value_u value);
int update_from_shmem(param_t param, union param_value_u *value);
void update_index_from_shmem(void);
void update_index_from_shmem();
uint64_t update_from_shmem_prev_time = 0, update_from_shmem_current_time = 0;
static unsigned char krait_changed_index[MAX_SHMEM_PARAMS / 8 + 1];
@@ -136,7 +136,7 @@ void init_shared_memory(void)
}
//virt_addr = map_memory(MAP_ADDRESS);
map_base = calloc(MAP_SIZE, 1); //16KB
map_base = (unsigned char *)calloc(MAP_SIZE, 1); //16KB
if (map_base == NULL) {
PX4_INFO("adsp memory malloc failed\n");
@@ -153,10 +153,9 @@ void init_shared_memory(void)
}
PX4_INFO("adsp memory mapped\n");
}
void copy_params_to_shmem(struct param_info_s *param_info_base)
void copy_params_to_shmem(const param_info_s *param_info_base)
{
param_t param;
unsigned int i;
@@ -350,4 +349,3 @@ int update_from_shmem(param_t param, union param_value_u *value)
return retval;
}