Browse Source

muorb: Update code style

sbg
Lorenz Meier 9 years ago
parent
commit
752d091ecc
  1. 20
      src/modules/muorb/adsp/px4muorb.hpp
  2. 6
      src/modules/muorb/adsp/uORBFastRpcChannel.cpp
  3. 56
      src/modules/muorb/krait-stubs/px4muorb_KraitRpcWrapper.hpp
  4. 4
      src/modules/muorb/krait/uORBKraitFastRpcChannel.cpp

20
src/modules/muorb/adsp/px4muorb.hpp

@ -37,22 +37,22 @@ @@ -37,22 +37,22 @@
extern "C" {
int px4muorb_orb_initialize() __EXPORT;
int px4muorb_orb_initialize() __EXPORT;
int px4muorb_add_subscriber(const char *name) __EXPORT;
int px4muorb_add_subscriber(const char *name) __EXPORT;
int px4muorb_remove_subscriber(const char *name) __EXPORT;
int px4muorb_remove_subscriber(const char *name) __EXPORT;
int px4muorb_send_topic_data(const char *name, const uint8_t *data, int data_len_in_bytes) __EXPORT;
int px4muorb_send_topic_data(const char *name, const uint8_t *data, int data_len_in_bytes) __EXPORT;
int px4muorb_is_subscriber_present(const char *topic_name, int *status) __EXPORT;
int px4muorb_is_subscriber_present(const char *topic_name, int *status) __EXPORT;
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) __EXPORT;
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) __EXPORT;
int px4muorb_receive_bulk_data(uint8_t *_BulkTransferBuffer, int max_size_in_bytes,
int *length_in_bytes, int *topic_count) __EXPORT;
int px4muorb_receive_bulk_data(uint8_t *_BulkTransferBuffer, int max_size_in_bytes,
int *length_in_bytes, int *topic_count) __EXPORT;
int px4muorb_unblock_recieve_msg(void) __EXPORT;
int px4muorb_unblock_recieve_msg(void) __EXPORT;
}

6
src/modules/muorb/adsp/uORBFastRpcChannel.cpp

@ -183,6 +183,7 @@ int16_t uORB::FastRpcChannel::send_message(const char *messageName, int32_t leng @@ -183,6 +183,7 @@ int16_t uORB::FastRpcChannel::send_message(const char *messageName, int32_t leng
}
if ((unsigned long)DataQSize() < _min_q) { _min_q = (unsigned long)DataQSize(); }
if ((unsigned long)DataQSize() > _max_q) { _max_q = (unsigned long)DataQSize(); }
_count++;
@ -367,6 +368,7 @@ int16_t uORB::FastRpcChannel::get_data @@ -367,6 +368,7 @@ int16_t uORB::FastRpcChannel::get_data
if (rc != 0) {
topic_name[0] = '\0';
}
/*
PX4_DEBUG("GetData: %30s: t1: %lu t2: %lu t3: %lu", topic_name, (unsigned long)t1, (unsigned long)t2,
(unsigned long)t3);
@ -464,9 +466,13 @@ int16_t uORB::FastRpcChannel::get_bulk_data @@ -464,9 +466,13 @@ int16_t uORB::FastRpcChannel::get_bulk_data
hrt_abstime t3 = hrt_absolute_time();
if ((unsigned long)(t3 - t1) > _get_bulk_max) { _get_bulk_max = (unsigned long)(t3 - t1); }
if ((unsigned long)(t3 - t1) < _get_bulk_min) { _get_bulk_min = (unsigned long)(t3 - t1); }
if ((unsigned long)(*topic_count) > _bulk_topic_count_max) { _bulk_topic_count_max = (unsigned long)(*topic_count); }
if ((unsigned long)(*topic_count) < _bulk_topic_count_min) { _bulk_topic_count_min = (unsigned long)(*topic_count); }
if ((unsigned long)(t3 - check_time) > 10000000) {
//PX4_DEBUG("GetData: t1: %lu t2: %lu t3: %lu", (unsigned long)t1, (unsigned long)t2, (unsigned long)t3);
//PX4_DEBUG(".... dt1: %7lu dt2: %7lu Q: %d", (unsigned long)(t2 - t1), (unsigned long)(t3 - t2), DataQSize());

56
src/modules/muorb/krait-stubs/px4muorb_KraitRpcWrapper.hpp

@ -36,41 +36,41 @@ @@ -36,41 +36,41 @@
namespace px4muorb
{
class KraitRpcWrapper;
class KraitRpcWrapper;
}
class px4muorb::KraitRpcWrapper
{
public:
/**
* Constructor
*/
KraitRpcWrapper() {}
/**
* destructor
*/
~KraitRpcWrapper() {}
/**
* Constructor
*/
KraitRpcWrapper() {}
/**
* Initiatizes the rpc channel px4 muorb
*/
bool Initialize() { return true; }
/**
* destructor
*/
~KraitRpcWrapper() {}
/**
* Terminate to clean up the resources. This should be called at program exit
*/
bool Terminate() { return true; }
/**
* Initiatizes the rpc channel px4 muorb
*/
bool Initialize() { return true; }
/**
* Muorb related functions to pub/sub of orb topic from krait to adsp
*/
int32_t AddSubscriber( const char* topic ) { return 1; }
int32_t RemoveSubscriber( const char* topic ) { return 1; }
int32_t SendData( const char* topic, int32_t length_in_bytes, const uint8_t* data ) { return 1; }
int32_t ReceiveData( int32_t* msg_type, char** topic, int32_t* length_in_bytes, uint8_t** data ) { return 1; }
int32_t IsSubscriberPresent( const char* topic, int32_t* status ) { return 1; }
int32_t ReceiveBulkData( uint8_t** bulk_data, int32_t* length_in_bytes, int32_t* topic_count ) { return 1; }
int32_t UnblockReceiveData() { return 1; }
/**
* Terminate to clean up the resources. This should be called at program exit
*/
bool Terminate() { return true; }
/**
* Muorb related functions to pub/sub of orb topic from krait to adsp
*/
int32_t AddSubscriber(const char *topic) { return 1; }
int32_t RemoveSubscriber(const char *topic) { return 1; }
int32_t SendData(const char *topic, int32_t length_in_bytes, const uint8_t *data) { return 1; }
int32_t ReceiveData(int32_t *msg_type, char **topic, int32_t *length_in_bytes, uint8_t **data) { return 1; }
int32_t IsSubscriberPresent(const char *topic, int32_t *status) { return 1; }
int32_t ReceiveBulkData(uint8_t **bulk_data, int32_t *length_in_bytes, int32_t *topic_count) { return 1; }
int32_t UnblockReceiveData() { return 1; }
};
#endif // _px4muorb_KraitWrapper_hpp_

4
src/modules/muorb/krait/uORBKraitFastRpcChannel.cpp

@ -139,11 +139,11 @@ int16_t uORB::KraitFastRpcChannel::send_message(const char *messageName, int32_t @@ -139,11 +139,11 @@ int16_t uORB::KraitFastRpcChannel::send_message(const char *messageName, int32_t
if ((t3 - t2) > _snd_msg_max) { _snd_msg_max = (t3 - t2); }
_snd_msg_avg = ((double)((_snd_msg_avg * (_snd_msg_count - 1)) +
(unsigned long)(t3 - t2))) / (double)(_snd_msg_count);
(unsigned long)(t3 - t2))) / (double)(_snd_msg_count);
}
_overall_snd_avg = ((double)((_overall_snd_avg * (_overall_snd_count - 1)) +
(unsigned long)(t4 - t1))) / (double)(_overall_snd_count);
(unsigned long)(t4 - t1))) / (double)(_overall_snd_count);
if ((t4 - _log_check_time) > _log_check_interval) {
/*

Loading…
Cancel
Save