diff --git a/src/modules/muorb/krait/px4muorb_KraitRpcWrapper.cpp b/src/modules/muorb/krait/px4muorb_KraitRpcWrapper.cpp index d862384398..68d3f76078 100644 --- a/src/modules/muorb/krait/px4muorb_KraitRpcWrapper.cpp +++ b/src/modules/muorb/krait/px4muorb_KraitRpcWrapper.cpp @@ -37,31 +37,22 @@ using namespace px4muorb; -/* Flags applied to the allocation of the shared memory for RPC */ -#define MUORB_KRAIT_FASTRPC_MEM_FLAGS 0 +/** + * Constructor + */ +KraitRpcWrapper::KraitRpcWrapper() {} -/* The ID of the HEAP to be used when allocating shared memory */ -//TODO This heap id is used for test purposes. We need to find out the correct one. -#define MUORB_KRAIT_FASTRPC_HEAP_ID 22 +/** + * destructor + */ +KraitRpcWrapper::~KraitRpcWrapper() {} -static char *_TopicNameBuffer = 0; -static const int32_t _MAX_TOPIC_NAME_BUFFER = 256; - -static uint8_t *_DataBuffer = 0; -static const uint32_t _MAX_DATA_BUFFER_SIZE = 2048; - -static bool _Initialized = false; - -// These numbers are based off the fact each fastrpc call for 64K packet is 94us. -// hence we are trying to allocation 64K of byte buffers. -static const uint32_t _MAX_TOPIC_DATA_BUFFER_SIZE = 1024; -static const uint32_t _MAX_TOPICS = 64; -static const uint32_t _MAX_BULK_TRANSFER_BUFFER_SIZE = _MAX_TOPIC_DATA_BUFFER_SIZE * _MAX_TOPICS; -static uint8_t *_BulkTransferBuffer = 0; - - -px4muorb::KraitRpcWrapper::KraitRpcWrapper() +/** + * Initiatizes the rpc channel px4 muorb + */ +bool KraitRpcWrapper::Initialize() { + return (px4muorb_orb_initialize() == 0); } px4muorb::KraitRpcWrapper::~KraitRpcWrapper() diff --git a/src/modules/systemlib/param/param_shmem.c b/src/modules/systemlib/param/param_shmem.c index 97e47e3cc4..fe0d377f07 100644 --- a/src/modules/systemlib/param/param_shmem.c +++ b/src/modules/systemlib/param/param_shmem.c @@ -114,7 +114,7 @@ const int bits_per_allocation_unit = (sizeof(*param_changed_storage) * 8); extern int get_shmem_lock(void); extern void release_shmem_lock(void); -struct param_wbuf_s * param_find_changed(param_t param); +struct param_wbuf_s *param_find_changed(param_t param); void init_params(void); extern void init_shared_memory(void); @@ -127,9 +127,10 @@ uint64_t sync_other_prev_time = 0, sync_other_current_time = 0; extern void update_to_shmem(param_t param, union param_value_u value); extern int update_from_shmem(param_t param, union param_value_u *value); static int param_set_internal(param_t param, const void *val, bool mark_saved, bool notify_changes); -unsigned char set_called_from_get=0; +unsigned char set_called_from_get = 0; -static int param_import_done=0; /*at startup, params are loaded from file, if present. we dont want to send notifications that time since muorb is not ready*/ +static int param_import_done = + 0; /*at startup, params are loaded from file, if present. we dont want to send notifications that time since muorb is not ready*/ static int param_load_default_no_notify(void); @@ -509,11 +510,10 @@ param_get(param_t param, void *val) union param_value_u value; - if(update_from_shmem(param, &value)) - { - set_called_from_get=1; + if (update_from_shmem(param, &value)) { + set_called_from_get = 1; param_set_internal(param, &value, true, false); - set_called_from_get=0; + set_called_from_get = 0; } diff --git a/src/platforms/posix/px4_layer/px4_posix_impl.cpp b/src/platforms/posix/px4_layer/px4_posix_impl.cpp index 1651a7ef7f..51e286e1dd 100644 --- a/src/platforms/posix/px4_layer/px4_posix_impl.cpp +++ b/src/platforms/posix/px4_layer/px4_posix_impl.cpp @@ -60,6 +60,7 @@ long PX4_TICKS_PER_SEC = sysconf(_SC_CLK_TCK); #ifdef ENABLE_SHMEM extern void init_params(void); +#endif #ifdef ENABLE_SHMEM extern void init_own_params(void); @@ -85,7 +86,7 @@ void init_once(void) #ifdef ENABLE_SHMEM PX4_INFO("Starting shared memory param sync\n"); init_own_params(); - param_sync_done=init_other_params(); + param_sync_done = init_other_params(); #endif } diff --git a/src/platforms/posix/px4_layer/shmem_posix.c b/src/platforms/posix/px4_layer/shmem_posix.c index d30caf5b40..c6ed01776f 100644 --- a/src/platforms/posix/px4_layer/shmem_posix.c +++ b/src/platforms/posix/px4_layer/shmem_posix.c @@ -58,8 +58,8 @@ int mem_fd; unsigned char *map_base, *virt_addr; -struct shmem_info* shmem_info_p; -static void* map_memory(off_t target); +struct shmem_info *shmem_info_p; +static void *map_memory(off_t target); int get_shmem_lock(void); void release_shmem_lock(void); diff --git a/src/platforms/posix/tests/vcdev_test/vcdevtest_example.cpp b/src/platforms/posix/tests/vcdev_test/vcdevtest_example.cpp index 31d7a4cf2b..b2fbe13c85 100644 --- a/src/platforms/posix/tests/vcdev_test/vcdevtest_example.cpp +++ b/src/platforms/posix/tests/vcdev_test/vcdevtest_example.cpp @@ -331,7 +331,7 @@ int VCDevExample::main() PX4_INFO("TEST: ZERO TIMEOUT POLL -----------"); - if(do_poll(fd, 0, 3, 0)) { + if (do_poll(fd, 0, 3, 0)) { ret = 1; goto fail2; goto fail2; diff --git a/src/platforms/qurt/px4_layer/main.cpp b/src/platforms/qurt/px4_layer/main.cpp index 10cc2bfd5f..5b373f0a42 100644 --- a/src/platforms/qurt/px4_layer/main.cpp +++ b/src/platforms/qurt/px4_layer/main.cpp @@ -73,30 +73,30 @@ static void run_cmd(map &apps, const vector &appargs string command = appargs[0]; //replaces app.find with iterator code to avoid null pointer exception - for (map::iterator it=apps.begin(); it!=apps.end(); ++it) - if (it->first == command) { - const char *arg[2 + 1]; + for (map::iterator it = apps.begin(); it != apps.end(); ++it) + if (it->first == command) { + const char *arg[2 + 1]; - unsigned int i = 0; + unsigned int i = 0; + + while (i < appargs.size() && appargs[i].c_str()[0] != '\0') { + arg[i] = (char *)appargs[i].c_str(); + PX4_WARN(" arg%d = '%s'\n", i, arg[i]); + ++i; + } + + arg[i] = (char *)0; + + //PX4_DEBUG_PRINTF(i); + if (apps[command] == NULL) { + PX4_ERR("Null function !!\n"); + + } else { + apps[command](i, (char **)arg); + break; + } - while (i < appargs.size() && appargs[i].c_str()[0] != '\0') { - arg[i] = (char *)appargs[i].c_str(); - PX4_WARN(" arg%d = '%s'\n", i, arg[i]); - ++i; } - - arg[i] = (char *)0; - - //PX4_DEBUG_PRINTF(i); - if (apps[command] == NULL) { - PX4_ERR("Null function !!\n"); - - } else { - apps[command](i, (char **)arg); - break; - } - - } } void eat_whitespace(const char *&b, int &i) diff --git a/src/platforms/qurt/px4_layer/px4_qurt_impl.cpp b/src/platforms/qurt/px4_layer/px4_qurt_impl.cpp index f3bed14778..abbfab1865 100644 --- a/src/platforms/qurt/px4_layer/px4_qurt_impl.cpp +++ b/src/platforms/qurt/px4_layer/px4_qurt_impl.cpp @@ -114,7 +114,7 @@ void init_once(void) /*Shared memory param sync*/ init_own_params(); - param_sync_done=init_other_params(); + param_sync_done = init_other_params(); } void init(int argc, char *argv[], const char *app_name) diff --git a/src/systemcmds/mixer/mixer.cpp b/src/systemcmds/mixer/mixer.cpp index ca77594e91..d378958f0f 100644 --- a/src/systemcmds/mixer/mixer.cpp +++ b/src/systemcmds/mixer/mixer.cpp @@ -124,6 +124,7 @@ load(const char *devname, const char *fname) #ifndef __PX4_QURT char buf[2048]; + if (load_mixer_file(fname, &buf[0], sizeof(buf)) < 0) { warnx("can't load mixer: %s", fname); return 1; @@ -132,20 +133,20 @@ load(const char *devname, const char *fname) /* XXX pass the buffer to the device */ int ret = px4_ioctl(dev, MIXERIOCLOADBUF, (unsigned long)buf); #else - char newbuf[] = - "R: 4x 10000 10000 10000 0\n" - "M: 1\n" - "O: 10000 10000 0 -10000 10000\n" - "S: 0 4 10000 10000 0 -10000 10000\n" - "M: 1\n" - "O: 10000 10000 0 -10000 10000\n" - "S: 0 5 10000 10000 0 -10000 10000\n" - "M: 1\n" - "O: 10000 10000 0 -10000 10000\n" - "S: 0 6 10000 10000 0 -10000 10000\n" - "M: 1\n" - "O: 10000 10000 0 -10000 10000\n" - "S: 0 7 10000 10000 0 -10000 10000\n"; + char newbuf[] = + "R: 4x 10000 10000 10000 0\n" + "M: 1\n" + "O: 10000 10000 0 -10000 10000\n" + "S: 0 4 10000 10000 0 -10000 10000\n" + "M: 1\n" + "O: 10000 10000 0 -10000 10000\n" + "S: 0 5 10000 10000 0 -10000 10000\n" + "M: 1\n" + "O: 10000 10000 0 -10000 10000\n" + "S: 0 6 10000 10000 0 -10000 10000\n" + "M: 1\n" + "O: 10000 10000 0 -10000 10000\n" + "S: 0 7 10000 10000 0 -10000 10000\n"; /* XXX pass the buffer to the device */ int ret = px4_ioctl(dev, MIXERIOCLOADBUF, (unsigned long)newbuf); #endif