HAL_SITL: cope with cygwin64

This commit is contained in:
Andrew Tridgell 2018-03-02 15:28:15 +11:00
parent d75e47a4d8
commit 403ba0c325
2 changed files with 11 additions and 7 deletions

View File

@ -63,7 +63,7 @@ void SITL_State::_sitl_setup(const char *home_str)
{
_home_str = home_str;
#ifndef __CYGWIN__
#if !defined(__CYGWIN__) && !defined(__CYGWIN64__)
_parent_pid = getppid();
#endif
_rcout_addr.sin_family = AF_INET;

View File

@ -19,7 +19,11 @@
#include "UARTDriver.h"
#if defined(__CYGWIN__) || defined(__APPLE__)
#if defined(__CYGWIN__) || defined(__CYGWIN64__) || defined(__APPLE__)
#define USE_TERMIOS
#endif
#ifdef USE_TERMIOS
#include <termios.h>
#else
#include <asm/termbits.h>
@ -35,7 +39,7 @@ bool HALSITL::UARTDriver::set_speed(int speed)
if (_fd < 0) {
return false;
}
#if defined(__CYGWIN__) || defined(__APPLE__)
#ifdef USE_TERMIOS
struct termios t;
tcgetattr(_fd, &t);
cfsetspeed(&t, speed);
@ -68,7 +72,7 @@ void HALSITL::UARTDriver::configure_parity(uint8_t v)
if (_fd < 0) {
return;
}
#if defined(__CYGWIN__) || defined(__APPLE__)
#ifdef USE_TERMIOS
struct termios t;
tcgetattr(_fd, &t);
@ -93,7 +97,7 @@ void HALSITL::UARTDriver::configure_parity(uint8_t v)
t.c_cflag &= ~PARENB;
}
#if defined(__CYGWIN__) || defined(__APPLE__)
#ifdef USE_TERMIOS
tcsetattr(_fd, TCSANOW, &t);
#else
ioctl(_fd, TCSETS2, &t);
@ -105,7 +109,7 @@ void HALSITL::UARTDriver::set_stop_bits(int n)
if (_fd < 0) {
return;
}
#if defined(__CYGWIN__) || defined(__APPLE__)
#ifdef USE_TERMIOS
struct termios t;
tcgetattr(_fd, &t);
@ -123,7 +127,7 @@ void HALSITL::UARTDriver::set_stop_bits(int n)
t.c_cflag &= ~CSTOPB;
}
#if defined(__CYGWIN__) || defined(__APPLE__)
#ifdef USE_TERMIOS
tcsetattr(_fd, TCSANOW, &t);
#else
ioctl(_fd, TCSETS2, &t);