mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 11:06:04 +08:00
Provide impelmentation of px4muorb_KraitRpcWrapper
The Terminate function is not properly implemented yet. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
committed by
Julian Oes
parent
7389ea7648
commit
01d0543e0a
@@ -1,24 +1,11 @@
|
|||||||
include(posix/px4_impl_posix)
|
include(posix/px4_impl_posix)
|
||||||
|
|
||||||
# Use build stubs unless explicitly set not to
|
|
||||||
if("${DSPAL_STUBS_ENABLE}" STREQUAL "")
|
|
||||||
set(DSPAL_STUBS_ENABLE "1")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if ("${QRL_SDK_DIR}" STREQUAL "")
|
|
||||||
set(QRL_SDK_DIR /opt/qrlsdk)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_PROGRAM_PATH
|
|
||||||
"${QRL_SDK_DIR}/gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabihf/bin"
|
|
||||||
${CMAKE_PROGRAM_PATH}
|
|
||||||
)
|
|
||||||
|
|
||||||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake)
|
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake)
|
||||||
|
|
||||||
set(CONFIG_SHMEM "1")
|
set(CONFIG_SHMEM "1")
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_SHMEM")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_SHMEM")
|
||||||
|
include(${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/qurt_app.cmake)
|
||||||
|
|
||||||
set(config_module_list
|
set(config_module_list
|
||||||
drivers/device
|
drivers/device
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ set(CMAKE_SYSTEM_VERSION 1)
|
|||||||
|
|
||||||
# specify the cross compiler
|
# specify the cross compiler
|
||||||
find_program(C_COMPILER arm-linux-gnueabihf-gcc
|
find_program(C_COMPILER arm-linux-gnueabihf-gcc
|
||||||
PATHS ${HEXAGON_SDK_ROOT}/gcc-linaro-arm-linux-gnueabihf-4.8-2013.08_linux/bin
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
)
|
)
|
||||||
if(NOT C_COMPILER)
|
if(NOT C_COMPILER)
|
||||||
message(FATAL_ERROR "could not find arm-linux-gnueabihf-gcc compiler")
|
message(FATAL_ERROR "could not find arm-linux-gnueabihf-gcc compiler")
|
||||||
@@ -46,8 +44,6 @@ endif()
|
|||||||
cmake_force_c_compiler(${C_COMPILER} GNU)
|
cmake_force_c_compiler(${C_COMPILER} GNU)
|
||||||
|
|
||||||
find_program(CXX_COMPILER arm-linux-gnueabihf-g++
|
find_program(CXX_COMPILER arm-linux-gnueabihf-g++
|
||||||
PATHS ${HEXAGON_SDK_ROOT}/gcc-linaro-arm-linux-gnueabihf-4.8-2013.08_linux/bin
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
)
|
)
|
||||||
if(NOT CXX_COMPILER)
|
if(NOT CXX_COMPILER)
|
||||||
message(FATAL_ERROR "could not find arm-linux-gnueabihf-g++ compiler")
|
message(FATAL_ERROR "could not find arm-linux-gnueabihf-g++ compiler")
|
||||||
@@ -58,8 +54,6 @@ cmake_force_cxx_compiler(${CXX_COMPILER} GNU)
|
|||||||
foreach(tool objcopy nm ld)
|
foreach(tool objcopy nm ld)
|
||||||
string(TOUPPER ${tool} TOOL)
|
string(TOUPPER ${tool} TOOL)
|
||||||
find_program(${TOOL} arm-linux-gnueabihf-${tool}
|
find_program(${TOOL} arm-linux-gnueabihf-${tool}
|
||||||
PATHS ${HEXAGON_SDK_ROOT}/gcc-linaro-arm-linux-gnueabihf-4.8-2013.08_linux/bin
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
)
|
)
|
||||||
if(NOT ${TOOL})
|
if(NOT ${TOOL})
|
||||||
message(FATAL_ERROR "could not find arm-linux-gnueabihf-${tool}")
|
message(FATAL_ERROR "could not find arm-linux-gnueabihf-${tool}")
|
||||||
|
|||||||
@@ -7,11 +7,13 @@ px4_posix_generate_builtin_commands(
|
|||||||
if ("${BOARD}" STREQUAL "eagle")
|
if ("${BOARD}" STREQUAL "eagle")
|
||||||
FASTRPC_STUB_GEN(../qurt/px4muorb.idl)
|
FASTRPC_STUB_GEN(../qurt/px4muorb.idl)
|
||||||
|
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-prototypes -Wno-missing-declarations")
|
||||||
QURT_APP(
|
QURT_APP(
|
||||||
APP_NAME mainapp
|
APP_NAME mainapp
|
||||||
IDL_NAME px4muorb
|
IDL_NAME px4muorb
|
||||||
APPS_DEST "/home/linaro"
|
APPS_DEST "/home/linaro"
|
||||||
SOURCES
|
SOURCES
|
||||||
|
px4muorb_stub.c
|
||||||
${CMAKE_SOURCE_DIR}/src/platforms/posix/main.cpp
|
${CMAKE_SOURCE_DIR}/src/platforms/posix/main.cpp
|
||||||
apps.h
|
apps.h
|
||||||
LINK_LIBS
|
LINK_LIBS
|
||||||
@@ -19,6 +21,7 @@ if ("${BOARD}" STREQUAL "eagle")
|
|||||||
${module_libraries}
|
${module_libraries}
|
||||||
df_driver_framework
|
df_driver_framework
|
||||||
${df_driver_libraries}
|
${df_driver_libraries}
|
||||||
|
${FASTRPC_ARM_LIBS}
|
||||||
pthread m rt
|
pthread m rt
|
||||||
-Wl,--end-group
|
-Wl,--end-group
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2982,7 +2982,7 @@ set_control_mode()
|
|||||||
/* set vehicle_control_mode according to set_navigation_state */
|
/* set vehicle_control_mode according to set_navigation_state */
|
||||||
control_mode.flag_armed = armed.armed;
|
control_mode.flag_armed = armed.armed;
|
||||||
control_mode.flag_external_manual_override_ok = (!status.is_rotary_wing && !status.is_vtol);
|
control_mode.flag_external_manual_override_ok = (!status.is_rotary_wing && !status.is_vtol);
|
||||||
control_mode.flag_system_hil_enabled = status.hil_state == vehicle_status_s::HIL_STATE_ON;
|
//control_mode.flag_system_hil_enabled = status.hil_state == vehicle_status_s::HIL_STATE_ON;
|
||||||
control_mode.flag_control_offboard_enabled = false;
|
control_mode.flag_control_offboard_enabled = false;
|
||||||
|
|
||||||
switch (status.nav_state) {
|
switch (status.nav_state) {
|
||||||
|
|||||||
@@ -30,12 +30,15 @@
|
|||||||
# POSSIBILITY OF SUCH DAMAGE.
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
include_directories(${CMAKE_BINARY_DIR}/src/firmware/posix)
|
||||||
|
include_directories(${HEXAGON_SDK_ROOT}/inc/stddef)
|
||||||
|
|
||||||
px4_add_module(
|
px4_add_module(
|
||||||
MODULE modules__muorb__krait
|
MODULE modules__muorb__krait
|
||||||
MAIN muorb
|
MAIN muorb
|
||||||
SRCS
|
SRCS
|
||||||
uORBKraitFastRpcChannel.cpp
|
uORBKraitFastRpcChannel.cpp
|
||||||
|
px4muorb_KraitRpcWrapper.cpp
|
||||||
muorb_main.cpp
|
muorb_main.cpp
|
||||||
DEPENDS
|
DEPENDS
|
||||||
platforms__common
|
platforms__common
|
||||||
|
|||||||
+64
-34
@@ -30,47 +30,77 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifndef _px4muorb_KraitRpcWrapper_hpp_
|
|
||||||
#define _px4muorb_KraitRpcWrapper_hpp_
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "px4muorb_KraitRpcWrapper.hpp"
|
||||||
|
#include "px4muorb.h"
|
||||||
|
|
||||||
namespace px4muorb
|
using namespace px4muorb;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
KraitRpcWrapper::KraitRpcWrapper() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* destructor
|
||||||
|
*/
|
||||||
|
KraitRpcWrapper::~KraitRpcWrapper() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiatizes the rpc channel px4 muorb
|
||||||
|
*/
|
||||||
|
bool KraitRpcWrapper::Initialize()
|
||||||
{
|
{
|
||||||
class KraitRpcWrapper;
|
return (px4muorb_orb_initialize() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
class px4muorb::KraitRpcWrapper
|
/**
|
||||||
|
* Terminate to clean up the resources. This should be called at program exit
|
||||||
|
*/
|
||||||
|
bool KraitRpcWrapper::Terminate()
|
||||||
{
|
{
|
||||||
public:
|
// FIXME - TBD
|
||||||
/**
|
return true;
|
||||||
* Constructor
|
}
|
||||||
*/
|
|
||||||
KraitRpcWrapper() {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* destructor
|
* Muorb related functions to pub/sub of orb topic from krait to adsp
|
||||||
*/
|
*/
|
||||||
~KraitRpcWrapper() {}
|
int32_t KraitRpcWrapper::AddSubscriber(const char *topic)
|
||||||
|
{
|
||||||
|
return px4muorb_add_subscriber(topic);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
int32_t KraitRpcWrapper::RemoveSubscriber(const char *topic)
|
||||||
* Initiatizes the rpc channel px4 muorb
|
{
|
||||||
*/
|
return px4muorb_remove_subscriber(topic);
|
||||||
bool Initialize() { return true; }
|
}
|
||||||
|
|
||||||
/**
|
int32_t KraitRpcWrapper::SendData(const char *topic, int32_t length_in_bytes, const uint8_t *data)
|
||||||
* Terminate to clean up the resources. This should be called at program exit
|
{
|
||||||
*/
|
return px4muorb_send_topic_data(topic, data, length_in_bytes);
|
||||||
bool Terminate() { return true; }
|
}
|
||||||
|
|
||||||
|
int32_t KraitRpcWrapper::ReceiveData(int32_t *msg_type, char **topic, int32_t *length_in_bytes, uint8_t **data)
|
||||||
|
{
|
||||||
|
// FIXME ??
|
||||||
|
int topic_nameLen = 0;
|
||||||
|
int rv = px4muorb_receive_msg(msg_type, *topic, topic_nameLen, *data, *length_in_bytes, length_in_bytes);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t KraitRpcWrapper::IsSubscriberPresent(const char *topic, int32_t *status)
|
||||||
|
{
|
||||||
|
return px4muorb_is_subscriber_present(topic, status);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t KraitRpcWrapper::ReceiveBulkData(uint8_t **bulk_data, int32_t *length_in_bytes, int32_t *topic_count)
|
||||||
|
{
|
||||||
|
return px4muorb_receive_bulk_data(*bulk_data, *length_in_bytes, length_in_bytes, topic_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t KraitRpcWrapper::UnblockReceiveData()
|
||||||
|
{
|
||||||
|
return px4muorb_unblock_recieve_msg();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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_
|
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
//=============================================================================
|
||||||
|
// File: px4muorb_KraitRpcWrapper.hpp
|
||||||
|
//
|
||||||
|
// @@-COPYRIGHT-START-@@
|
||||||
|
//
|
||||||
|
// Copyright 2015 Qualcomm Technologies, Inc. All rights reserved.
|
||||||
|
// Confidential & Proprietary - Qualcomm Technologies, Inc. ("QTI")
|
||||||
|
//
|
||||||
|
// The party receiving this software directly from QTI (the "Recipient")
|
||||||
|
// may use this software as reasonably necessary solely for the purposes
|
||||||
|
// set forth in the agreement between the Recipient and QTI (the
|
||||||
|
// "Agreement"). The software may be used in source code form solely by
|
||||||
|
// the Recipient's employees (if any) authorized by the Agreement. Unless
|
||||||
|
// expressly authorized in the Agreement, the Recipient may not sublicense,
|
||||||
|
// assign, transfer or otherwise provide the source code to any third
|
||||||
|
// party. Qualcomm Technologies, Inc. retains all ownership rights in and
|
||||||
|
// to the software
|
||||||
|
//
|
||||||
|
// This notice supersedes any other QTI notices contained within the software
|
||||||
|
// except copyright notices indicating different years of publication for
|
||||||
|
// different portions of the software. This notice does not supersede the
|
||||||
|
// application of any third party copyright notice to that third party's
|
||||||
|
// code.
|
||||||
|
//
|
||||||
|
// @@-COPYRIGHT-END-@@
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
#ifndef _px4muorb_KraitRpcWrapper_hpp_
|
||||||
|
#define _px4muorb_KraitRpcWrapper_hpp_
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
namespace px4muorb
|
||||||
|
{
|
||||||
|
class KraitRpcWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
class px4muorb::KraitRpcWrapper
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
KraitRpcWrapper();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* destructor
|
||||||
|
*/
|
||||||
|
~KraitRpcWrapper();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiatizes the rpc channel px4 muorb
|
||||||
|
*/
|
||||||
|
bool Initialize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Terminate to clean up the resources. This should be called at program exit
|
||||||
|
*/
|
||||||
|
bool Terminate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Muorb related functions to pub/sub of orb topic from krait to adsp
|
||||||
|
*/
|
||||||
|
int32_t AddSubscriber( const char* topic );
|
||||||
|
int32_t RemoveSubscriber( const char* topic );
|
||||||
|
int32_t SendData( const char* topic, int32_t length_in_bytes, const uint8_t* data );
|
||||||
|
int32_t ReceiveData( int32_t* msg_type, char** topic, int32_t* length_in_bytes, uint8_t** data );
|
||||||
|
int32_t IsSubscriberPresent( const char* topic, int32_t* status );
|
||||||
|
int32_t ReceiveBulkData( uint8_t** bulk_data, int32_t* length_in_bytes, int32_t* topic_count );
|
||||||
|
int32_t UnblockReceiveData();
|
||||||
|
};
|
||||||
|
#endif // _px4muorb_KraitWrapper_hpp_
|
||||||
Reference in New Issue
Block a user