Running fix_code_style.sh on the requested source files.

This commit is contained in:
jwilson
2016-06-21 06:50:27 -07:00
committed by Julian Oes
parent acc1f04b67
commit 9794bb2f2f
4 changed files with 67 additions and 60 deletions
+12 -10
View File
@@ -50,7 +50,7 @@ extern int dspal_main(int argc, char *argv[]);
extern struct shmem_info *shmem_info_p;
extern int get_shmem_lock(const char *caller_file_name, int caller_line_number);
extern void release_shmem_lock(const char *caller_file_name,
int caller_line_number);
int caller_line_number);
extern void init_shared_memory(void);
__END_DECLS
int px4muorb_orb_initialize()
@@ -61,7 +61,7 @@ int px4muorb_orb_initialize()
uORB::Manager::initialize();
// Register the fastrpc muorb with uORBManager.
uORB::Manager::get_instance()->set_uorb_communicator(
uORB::FastRpcChannel::GetInstance());
uORB::FastRpcChannel::GetInstance());
// Now continue with the usual dspal startup.
const char *argv[] = { "dspal", "start" };
@@ -85,7 +85,7 @@ int px4muorb_get_absolute_time(uint64_t *time_us)
/*update value and param's change bit in shared memory*/
int px4muorb_param_update_to_shmem(uint32_t param, const uint8_t *value,
int data_len_in_bytes)
int data_len_in_bytes)
{
unsigned int byte_changed, bit_changed;
union param_value_u *param_value = (union param_value_u *) value;
@@ -115,8 +115,9 @@ int px4muorb_param_update_index_from_shmem(unsigned char *data,
{
unsigned int i;
if (!shmem_info_p)
if (!shmem_info_p) {
return -1;
}
if (get_shmem_lock(__FILE__, __LINE__) != 0) {
PX4_INFO("Could not get shmem lock\n");
@@ -138,8 +139,9 @@ int px4muorb_param_update_value_from_shmem(uint32_t param, const uint8_t *value,
unsigned int byte_changed, bit_changed;
union param_value_u *param_value = (union param_value_u *) value;
if (!shmem_info_p)
if (!shmem_info_p) {
return -1;
}
if (get_shmem_lock(__FILE__, __LINE__) != 0) {
PX4_INFO("Could not get shmem lock\n");
@@ -197,7 +199,7 @@ int px4muorb_remove_subscriber(const char *name)
}
int px4muorb_send_topic_data(const char *name, const uint8_t *data,
int data_len_in_bytes)
int data_len_in_bytes)
{
int rc = 0;
uORB::FastRpcChannel *channel = uORB::FastRpcChannel::GetInstance();
@@ -229,7 +231,7 @@ int px4muorb_is_subscriber_present(const char *topic_name, int *status)
}
int px4muorb_receive_msg(int *msg_type, char *topic_name, int topic_name_len,
uint8_t *data, int data_len_in_bytes, int *bytes_returned)
uint8_t *data, int data_len_in_bytes, int *bytes_returned)
{
int rc = 0;
int32_t local_msg_type = 0;
@@ -237,14 +239,14 @@ int px4muorb_receive_msg(int *msg_type, char *topic_name, int topic_name_len,
uORB::FastRpcChannel *channel = uORB::FastRpcChannel::GetInstance();
//PX4_DEBUG( "topic_namePtr: [0x%p] dataPtr: [0x%p]", topic_name, data );
rc = channel->get_data(&local_msg_type, topic_name, topic_name_len, data,
data_len_in_bytes, &local_bytes_returned);
data_len_in_bytes, &local_bytes_returned);
*msg_type = (int) local_msg_type;
*bytes_returned = (int) local_bytes_returned;
return rc;
}
int px4muorb_receive_bulk_data(uint8_t *bulk_transfer_buffer,
int max_size_in_bytes, int *returned_length_in_bytes, int *topic_count)
int max_size_in_bytes, int *returned_length_in_bytes, int *topic_count)
{
int rc = 0;
int32_t local_bytes_returned = 0;
@@ -252,7 +254,7 @@ int px4muorb_receive_bulk_data(uint8_t *bulk_transfer_buffer,
uORB::FastRpcChannel *channel = uORB::FastRpcChannel::GetInstance();
//PX4_DEBUG( "topic_namePtr: [0x%p] dataPtr: [0x%p]", topic_name, data );
rc = channel->get_bulk_data(bulk_transfer_buffer, max_size_in_bytes,
&local_bytes_returned, &local_topic_count);
&local_bytes_returned, &local_topic_count);
*returned_length_in_bytes = (int) local_bytes_returned;
*topic_count = (int) local_topic_count;
return rc;
@@ -62,7 +62,7 @@ static bool _Initialized = false;
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;
_MAX_TOPIC_DATA_BUFFER_SIZE * _MAX_TOPICS;
static uint8_t *_BulkTransferBuffer = 0;
unsigned char *adsp_changed_index = 0;
@@ -104,7 +104,7 @@ int calc_timer_diff_to_dsp_us(int32_t *time_diff_us)
timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
uint64_t time_appsproc = ((uint64_t) ts.tv_sec) * 1000000llu
+ (ts.tv_nsec / 1000);
+ (ts.tv_nsec / 1000);
close(fd);
@@ -122,8 +122,8 @@ int calc_timer_diff_to_dsp_us(int32_t *time_diff_us)
// Before casting to in32_t, check if it fits.
uint64_t abs_diff =
(time_appsproc > time_dsp) ?
(time_appsproc - time_dsp) : (time_dsp - time_appsproc);
(time_appsproc > time_dsp) ?
(time_appsproc - time_dsp) : (time_dsp - time_appsproc);
if (abs_diff > INT32_MAX) {
PX4_ERR("Timer difference too big");
@@ -133,9 +133,9 @@ int calc_timer_diff_to_dsp_us(int32_t *time_diff_us)
*time_diff_us = time_appsproc - time_dsp;
PX4_DEBUG("found time_dsp: %llu us, time_appsproc: %llu us",
time_dsp, time_appsproc);
time_dsp, time_appsproc);
PX4_DEBUG("found time_diff: %li us, %.6f s",
*time_diff_us, ((double)*time_diff_us) / 1e6);
*time_diff_us, ((double)*time_diff_us) / 1e6);
return 0;
}
@@ -158,24 +158,24 @@ bool px4muorb::KraitRpcWrapper::Initialize()
PX4_DEBUG("%s Now calling rpcmem_alloc...", __FUNCTION__);
_BulkTransferBuffer = (uint8_t *) rpcmem_alloc(MUORB_KRAIT_FASTRPC_HEAP_ID,
MUORB_KRAIT_FASTRPC_MEM_FLAGS,
_MAX_BULK_TRANSFER_BUFFER_SIZE * sizeof(uint8_t));
MUORB_KRAIT_FASTRPC_MEM_FLAGS,
_MAX_BULK_TRANSFER_BUFFER_SIZE * sizeof(uint8_t));
rc = (_BulkTransferBuffer != NULL) ? true : false;
if (!rc) {
PX4_ERR("%s rpcmem_alloc failed! for bulk transfer buffers",
__FUNCTION__);
__FUNCTION__);
return rc;
} else {
PX4_DEBUG(
"%s rpcmem_alloc passed for Bulk transfer buffers buffer_size: %d addr: %p",
__FUNCTION__, (_MAX_BULK_TRANSFER_BUFFER_SIZE * sizeof(uint8_t)), _BulkTransferBuffer);
"%s rpcmem_alloc passed for Bulk transfer buffers buffer_size: %d addr: %p",
__FUNCTION__, (_MAX_BULK_TRANSFER_BUFFER_SIZE * sizeof(uint8_t)), _BulkTransferBuffer);
}
_TopicNameBuffer = (char *) rpcmem_alloc(MUORB_KRAIT_FASTRPC_HEAP_ID,
MUORB_KRAIT_FASTRPC_MEM_FLAGS,
_MAX_TOPIC_NAME_BUFFER * sizeof(char));
MUORB_KRAIT_FASTRPC_MEM_FLAGS,
_MAX_TOPIC_NAME_BUFFER * sizeof(char));
rc = (_TopicNameBuffer != NULL) ? true : false;
@@ -190,8 +190,8 @@ bool px4muorb::KraitRpcWrapper::Initialize()
// now allocate the data buffer.
_DataBuffer = (uint8_t *) rpcmem_alloc(MUORB_KRAIT_FASTRPC_HEAP_ID,
MUORB_KRAIT_FASTRPC_MEM_FLAGS,
_MAX_DATA_BUFFER_SIZE * sizeof(uint8_t));
MUORB_KRAIT_FASTRPC_MEM_FLAGS,
_MAX_DATA_BUFFER_SIZE * sizeof(uint8_t));
rc = (_DataBuffer != NULL) ? true : false;
@@ -208,12 +208,13 @@ bool px4muorb::KraitRpcWrapper::Initialize()
}
adsp_changed_index = (uint8_t *) rpcmem_alloc(MUORB_KRAIT_FASTRPC_HEAP_ID,
MUORB_KRAIT_FASTRPC_MEM_FLAGS, PARAM_BUFFER_SIZE * sizeof(uint8_t));
MUORB_KRAIT_FASTRPC_MEM_FLAGS, PARAM_BUFFER_SIZE * sizeof(uint8_t));
rc = (adsp_changed_index != NULL) ? true : false;
if (!rc) {
PX4_ERR("%s rpcmem_alloc failed! for adsp_changed_index", __FUNCTION__);
} else {
memset(adsp_changed_index, 0, PARAM_BUFFER_SIZE * sizeof(uint8_t));
}
@@ -228,7 +229,7 @@ bool px4muorb::KraitRpcWrapper::Initialize()
// call muorb initialize routine.
if (px4muorb_orb_initialize() != 0) {
PX4_ERR("%s Error calling the uorb fastrpc initalize method..",
__FUNCTION__);
__FUNCTION__);
rc = false;
return rc;
}
@@ -244,7 +245,7 @@ bool px4muorb::KraitRpcWrapper::Initialize()
int diff = (time_dsp - time_appsproc);
PX4_DEBUG("time_dsp: %llu us, time appsproc: %llu us, diff: %d us",
time_dsp, time_appsproc, diff);
time_dsp, time_appsproc, diff);
_Initialized = true;
return rc;
@@ -296,7 +297,7 @@ int32_t px4muorb::KraitRpcWrapper::SendData(const char *topic,
int32_t length_in_bytes, const uint8_t *data)
{
return (_Initialized ?
px4muorb_send_topic_data(topic, data, length_in_bytes) : -1);
px4muorb_send_topic_data(topic, data, length_in_bytes) : -1);
}
int32_t px4muorb::KraitRpcWrapper::ReceiveData(int32_t *msg_type, char **topic,
@@ -306,8 +307,8 @@ int32_t px4muorb::KraitRpcWrapper::ReceiveData(int32_t *msg_type, char **topic,
if (_Initialized) {
rc = px4muorb_receive_msg(msg_type, _TopicNameBuffer,
_MAX_TOPIC_NAME_BUFFER, _DataBuffer, _MAX_DATA_BUFFER_SIZE,
length_in_bytes);
_MAX_TOPIC_NAME_BUFFER, _DataBuffer, _MAX_DATA_BUFFER_SIZE,
length_in_bytes);
if (rc == 0) {
*topic = _TopicNameBuffer;
@@ -332,7 +333,7 @@ int32_t px4muorb::KraitRpcWrapper::ReceiveBulkData(uint8_t **bulk_data,
if (_Initialized) {
//rc = px4muorb_receive_msg( msg_type, _TopicNameBuffer, _MAX_TOPIC_NAME_BUFFER, _DataBuffer, _MAX_DATA_BUFFER_SIZE, length_in_bytes );
rc = px4muorb_receive_bulk_data(_BulkTransferBuffer,
_MAX_BULK_TRANSFER_BUFFER_SIZE, length_in_bytes, topic_count);
_MAX_BULK_TRANSFER_BUFFER_SIZE, length_in_bytes, topic_count);
if (rc == 0) {
*bulk_data = _BulkTransferBuffer;