From 752d091eccb941a2a90806cf14709dc0e6bf43dc Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 19 Oct 2015 13:51:36 +0200 Subject: [PATCH] muorb: Update code style --- src/modules/muorb/adsp/px4muorb.hpp | 20 +++---- src/modules/muorb/adsp/uORBFastRpcChannel.cpp | 6 ++ .../krait-stubs/px4muorb_KraitRpcWrapper.hpp | 56 +++++++++---------- .../muorb/krait/uORBKraitFastRpcChannel.cpp | 4 +- 4 files changed, 46 insertions(+), 40 deletions(-) diff --git a/src/modules/muorb/adsp/px4muorb.hpp b/src/modules/muorb/adsp/px4muorb.hpp index d509819570..1ec6b45566 100644 --- a/src/modules/muorb/adsp/px4muorb.hpp +++ b/src/modules/muorb/adsp/px4muorb.hpp @@ -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; } diff --git a/src/modules/muorb/adsp/uORBFastRpcChannel.cpp b/src/modules/muorb/adsp/uORBFastRpcChannel.cpp index ffbf2ea049..82a3301322 100644 --- a/src/modules/muorb/adsp/uORBFastRpcChannel.cpp +++ b/src/modules/muorb/adsp/uORBFastRpcChannel.cpp @@ -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 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 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()); diff --git a/src/modules/muorb/krait-stubs/px4muorb_KraitRpcWrapper.hpp b/src/modules/muorb/krait-stubs/px4muorb_KraitRpcWrapper.hpp index d6feab2a47..f6b64b8e54 100644 --- a/src/modules/muorb/krait-stubs/px4muorb_KraitRpcWrapper.hpp +++ b/src/modules/muorb/krait-stubs/px4muorb_KraitRpcWrapper.hpp @@ -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_ diff --git a/src/modules/muorb/krait/uORBKraitFastRpcChannel.cpp b/src/modules/muorb/krait/uORBKraitFastRpcChannel.cpp index 165705ee19..6e53f0bbfd 100644 --- a/src/modules/muorb/krait/uORBKraitFastRpcChannel.cpp +++ b/src/modules/muorb/krait/uORBKraitFastRpcChannel.cpp @@ -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) { /*