Code format fixes

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois 2016-01-20 22:19:45 -08:00 committed by Julian Oes
parent 3b58cfb89d
commit 8b22bde071
8 changed files with 62 additions and 69 deletions

View File

@ -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()

View File

@ -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;
}

View File

@ -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
}

View File

@ -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);

View File

@ -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;

View File

@ -73,30 +73,30 @@ static void run_cmd(map<string, px4_main_t> &apps, const vector<string> &appargs
string command = appargs[0];
//replaces app.find with iterator code to avoid null pointer exception
for (map<string,px4_main_t>::iterator it=apps.begin(); it!=apps.end(); ++it)
if (it->first == command) {
const char *arg[2 + 1];
for (map<string, px4_main_t>::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)

View File

@ -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)

View File

@ -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