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:
Mark Charlebois 2016-01-20 21:09:37 -08:00 committed by Julian Oes
parent 7389ea7648
commit 01d0543e0a
7 changed files with 144 additions and 56 deletions

View File

@ -1,24 +1,11 @@
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(CONFIG_SHMEM "1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_SHMEM")
include(${CMAKE_SOURCE_DIR}/cmake/cmake_hexagon/qurt_app.cmake)
set(config_module_list
drivers/device

View File

@ -37,8 +37,6 @@ set(CMAKE_SYSTEM_VERSION 1)
# specify the cross compiler
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)
message(FATAL_ERROR "could not find arm-linux-gnueabihf-gcc compiler")
@ -46,8 +44,6 @@ endif()
cmake_force_c_compiler(${C_COMPILER} GNU)
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)
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)
string(TOUPPER ${tool} 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})
message(FATAL_ERROR "could not find arm-linux-gnueabihf-${tool}")

View File

@ -7,11 +7,13 @@ px4_posix_generate_builtin_commands(
if ("${BOARD}" STREQUAL "eagle")
FASTRPC_STUB_GEN(../qurt/px4muorb.idl)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-prototypes -Wno-missing-declarations")
QURT_APP(
APP_NAME mainapp
IDL_NAME px4muorb
APPS_DEST "/home/linaro"
SOURCES
px4muorb_stub.c
${CMAKE_SOURCE_DIR}/src/platforms/posix/main.cpp
apps.h
LINK_LIBS
@ -19,6 +21,7 @@ if ("${BOARD}" STREQUAL "eagle")
${module_libraries}
df_driver_framework
${df_driver_libraries}
${FASTRPC_ARM_LIBS}
pthread m rt
-Wl,--end-group
)

View File

@ -2982,7 +2982,7 @@ set_control_mode()
/* set vehicle_control_mode according to set_navigation_state */
control_mode.flag_armed = armed.armed;
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;
switch (status.nav_state) {

View File

@ -30,12 +30,15 @@
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
include_directories(${CMAKE_BINARY_DIR}/src/firmware/posix)
include_directories(${HEXAGON_SDK_ROOT}/inc/stddef)
px4_add_module(
MODULE modules__muorb__krait
MAIN muorb
SRCS
uORBKraitFastRpcChannel.cpp
px4muorb_KraitRpcWrapper.cpp
muorb_main.cpp
DEPENDS
platforms__common

View File

@ -30,47 +30,77 @@
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef _px4muorb_KraitRpcWrapper_hpp_
#define _px4muorb_KraitRpcWrapper_hpp_
#include <stdint.h>
#include "px4muorb_KraitRpcWrapper.hpp"
#include "px4muorb.h"
namespace px4muorb
{
class KraitRpcWrapper;
using namespace px4muorb;
/**
* Constructor
*/
KraitRpcWrapper::KraitRpcWrapper() {}
/**
* destructor
*/
KraitRpcWrapper::~KraitRpcWrapper() {}
/**
* Initiatizes the rpc channel px4 muorb
*/
bool KraitRpcWrapper::Initialize()
{
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:
/**
* Constructor
*/
KraitRpcWrapper() {}
// FIXME - TBD
return true;
}
/**
* destructor
*/
~KraitRpcWrapper() {}
/**
* Muorb related functions to pub/sub of orb topic from krait to adsp
*/
int32_t KraitRpcWrapper::AddSubscriber(const char *topic)
{
return px4muorb_add_subscriber(topic);
}
/**
* Initiatizes the rpc channel px4 muorb
*/
bool Initialize() { return true; }
int32_t KraitRpcWrapper::RemoveSubscriber(const char *topic)
{
return px4muorb_remove_subscriber(topic);
}
/**
* Terminate to clean up the resources. This should be called at program exit
*/
bool Terminate() { return true; }
int32_t KraitRpcWrapper::SendData(const char *topic, int32_t length_in_bytes, const uint8_t *data)
{
return px4muorb_send_topic_data(topic, data, length_in_bytes);
}
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_

View File

@ -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_