mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-01 06:20:36 +08:00
committed by
Julian Oes
parent
3b58cfb89d
commit
8b22bde071
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user