Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions boards/modalai/fc-v2/default.px4board
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_POWER_MONITOR_VOXLPM=y
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_DRIVERS_RC_CRSF_RC=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_COMMON_TELEMETRY=y
CONFIG_MODULES_AIRSPEED_SELECTOR=y
Expand Down
5 changes: 5 additions & 0 deletions boards/modalai/fc-v2/scripts/run_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

# Run this from the px4 project top level directory
docker run -it --rm --privileged -v `pwd`:/usr/local/workspace px4io/px4-dev-nuttx-focal:2022-08-12

1 change: 1 addition & 0 deletions boards/modalai/voxl2/default.px4board
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CONFIG_DRIVERS_ACTUATORS_VOXL_ESC=y
CONFIG_DRIVERS_GPS=y
CONFIG_DRIVERS_OSD_MSP_OSD=y
CONFIG_DRIVERS_QSHELL_POSIX=y
CONFIG_DRIVERS_RC_CRSF_RC=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_VOXL2_IO=y
CONFIG_MODULES_COMMANDER=y
Expand Down
27 changes: 3 additions & 24 deletions platforms/nuttx/src/px4/common/SerialImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,11 @@ SerialImpl::~SerialImpl()
}
}

bool SerialImpl::validateBaudrate(uint32_t baudrate)
{
return ((baudrate == 9600) ||
(baudrate == 19200) ||
(baudrate == 38400) ||
(baudrate == 57600) ||
(baudrate == 115200) ||
(baudrate == 230400) ||
(baudrate == 460800) ||
(baudrate == 921600));
}

bool SerialImpl::configure()
{
/* process baud rate */
int speed;

if (! validateBaudrate(_baudrate)) {
PX4_ERR("ERR: unknown baudrate: %lu", _baudrate);
return false;
}

switch (_baudrate) {
case 9600: speed = B9600; break;

Expand All @@ -116,8 +99,9 @@ bool SerialImpl::configure()
case 921600: speed = B921600; break;

default:
PX4_ERR("ERR: unknown baudrate: %lu", _baudrate);
return false;
speed = _baudrate;
PX4_WARN("Using non-standard baudrate: %lu", _baudrate);
break;
}

struct termios uart_config;
Expand Down Expand Up @@ -374,11 +358,6 @@ uint32_t SerialImpl::getBaudrate() const

bool SerialImpl::setBaudrate(uint32_t baudrate)
{
if (! validateBaudrate(baudrate)) {
PX4_ERR("ERR: invalid baudrate: %lu", baudrate);
return false;
}

// check if already configured
if ((baudrate == _baudrate) && _open) {
return true;
Expand Down
1 change: 0 additions & 1 deletion platforms/nuttx/src/px4/common/include/SerialImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ class SerialImpl
StopBits _stopbits{StopBits::One};
FlowControl _flowcontrol{FlowControl::Disabled};

bool validateBaudrate(uint32_t baudrate);
bool configure();

bool _single_wire_mode{false};
Expand Down
1 change: 0 additions & 1 deletion platforms/posix/include/SerialImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ class SerialImpl
StopBits _stopbits{StopBits::One};
FlowControl _flowcontrol{FlowControl::Disabled};

bool validateBaudrate(uint32_t baudrate);
bool configure();

bool _single_wire_mode{false};
Expand Down
27 changes: 3 additions & 24 deletions platforms/posix/src/px4/common/SerialImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,11 @@ SerialImpl::~SerialImpl()
}
}

bool SerialImpl::validateBaudrate(uint32_t baudrate)
{
return ((baudrate == 9600) ||
(baudrate == 19200) ||
(baudrate == 38400) ||
(baudrate == 57600) ||
(baudrate == 115200) ||
(baudrate == 230400) ||
(baudrate == 460800) ||
(baudrate == 921600));
}

bool SerialImpl::configure()
{
/* process baud rate */
int speed;

if (! validateBaudrate(_baudrate)) {
PX4_ERR("ERR: unknown baudrate: %u", _baudrate);
return false;
}

switch (_baudrate) {
case 9600: speed = B9600; break;

Expand All @@ -114,8 +97,9 @@ bool SerialImpl::configure()
case 921600: speed = B921600; break;

default:
PX4_ERR("ERR: unknown baudrate: %d", _baudrate);
return false;
speed = _baudrate;
PX4_WARN("Using non-standard baudrate: %u", _baudrate);
break;
}

struct termios uart_config;
Expand Down Expand Up @@ -366,11 +350,6 @@ uint32_t SerialImpl::getBaudrate() const

bool SerialImpl::setBaudrate(uint32_t baudrate)
{
if (! validateBaudrate(baudrate)) {
PX4_ERR("ERR: invalid baudrate: %u", baudrate);
return false;
}

// check if already configured
if ((baudrate == _baudrate) && _open) {
return true;
Expand Down
6 changes: 0 additions & 6 deletions platforms/qurt/cmake/px4_impl_os.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,7 @@ endfunction()
#
function(px4_os_add_flags)

set(DSPAL_ROOT platforms/qurt/dspal)
include_directories(
${DSPAL_ROOT}/include
${DSPAL_ROOT}/sys
${DSPAL_ROOT}/sys/sys

platforms/posix/include
platforms/qurt/include
)

Expand Down
83 changes: 83 additions & 0 deletions platforms/qurt/include/crc32.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/****************************************************************************
* include/crc.h
*
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <[email protected]>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/

#ifndef __INCLUDE_CRC32_H
#define __INCLUDE_CRC32_H

/****************************************************************************
* Included Files
****************************************************************************/

#include <sys/types.h>
#include <stdint.h>

/****************************************************************************
* Public Function Prototypes
****************************************************************************/

#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif

/****************************************************************************
* Name: crc32part
*
* Description:
* Continue CRC calculation on a part of the buffer.
*
****************************************************************************/

EXTERN uint32_t crc32part(const uint8_t *src, size_t len,
uint32_t crc32val);

/****************************************************************************
* Name: crc32
*
* Description:
* Return a 32-bit CRC of the contents of the 'src' buffer, length 'len'
*
****************************************************************************/

EXTERN uint32_t crc32(const uint8_t *src, size_t len);

#undef EXTERN
#ifdef __cplusplus
}
#endif

#endif /* __INCLUDE_CRC32_H */
134 changes: 134 additions & 0 deletions platforms/qurt/include/queue.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/************************************************************************
* include/queue.h
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <[email protected]>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************/

#ifndef __INCLUDE_QUEUE_H
#define __INCLUDE_QUEUE_H

/************************************************************************
* Included Files
************************************************************************/

#include <sys/types.h>

#ifdef __cplusplus
#include <cstddef> // NULL
#else
#include <stddef.h> // NULL
#endif

/************************************************************************
* Pre-processor Definitions
************************************************************************/

#define sq_init(q) do { (q)->head = NULL; (q)->tail = NULL; } while (0)
#define dq_init(q) do { (q)->head = NULL; (q)->tail = NULL; } while (0)

#define sq_next(p) ((p)->flink)
#define dq_next(p) ((p)->flink)
#define dq_prev(p) ((p)->blink)

#define sq_empty(q) ((q)->head == NULL)
#define dq_empty(q) ((q)->head == NULL)

#define sq_peek(q) ((q)->head)
#define dq_peek(q) ((q)->head)

// Required for Linux
#define FAR

/************************************************************************
* Global Type Declarations
************************************************************************/

struct sq_entry_s {
FAR struct sq_entry_s *flink;
};
typedef struct sq_entry_s sq_entry_t;

struct dq_entry_s {
FAR struct dq_entry_s *flink;
FAR struct dq_entry_s *blink;
};
typedef struct dq_entry_s dq_entry_t;

struct sq_queue_s {
FAR sq_entry_t *head;
FAR sq_entry_t *tail;
};
typedef struct sq_queue_s sq_queue_t;

struct dq_queue_s {
FAR dq_entry_t *head;
FAR dq_entry_t *tail;
};
typedef struct dq_queue_s dq_queue_t;

/************************************************************************
* Global Function Prototypes
************************************************************************/

#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif

EXTERN void sq_addfirst(FAR sq_entry_t *node, sq_queue_t *queue);
EXTERN void dq_addfirst(FAR dq_entry_t *node, dq_queue_t *queue);
EXTERN void sq_addlast(FAR sq_entry_t *node, sq_queue_t *queue);
EXTERN void dq_addlast(FAR dq_entry_t *node, dq_queue_t *queue);
EXTERN void sq_addafter(FAR sq_entry_t *prev, FAR sq_entry_t *node,
sq_queue_t *queue);
EXTERN void dq_addafter(FAR dq_entry_t *prev, FAR dq_entry_t *node,
dq_queue_t *queue);
EXTERN void dq_addbefore(FAR dq_entry_t *next, FAR dq_entry_t *node,
dq_queue_t *queue);

EXTERN FAR sq_entry_t *sq_remafter(FAR sq_entry_t *node, sq_queue_t *queue);
EXTERN void sq_rem(FAR sq_entry_t *node, sq_queue_t *queue);
EXTERN void dq_rem(FAR dq_entry_t *node, dq_queue_t *queue);
EXTERN FAR sq_entry_t *sq_remlast(sq_queue_t *queue);
EXTERN FAR dq_entry_t *dq_remlast(dq_queue_t *queue);
EXTERN FAR sq_entry_t *sq_remfirst(sq_queue_t *queue);
EXTERN FAR dq_entry_t *dq_remfirst(dq_queue_t *queue);

#undef EXTERN
#ifdef __cplusplus
}
#endif

#endif /* __INCLUDE_QUEUE_H_ */

Loading