mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-27 11:08:29 -04:00
HAL_SITL: fix sitl build for mac osx
This commit is contained in:
parent
8b0e9bcff4
commit
a6be19d8cf
@ -414,8 +414,11 @@ bool UARTDriver::set_unbuffered_writes(bool on) {
|
||||
// this has no effect
|
||||
unsigned v = fcntl(_fd, F_GETFL, 0);
|
||||
v &= ~O_NONBLOCK;
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
fcntl(_fd, F_SETFL | F_NOCACHE, v | O_SYNC);
|
||||
#else
|
||||
fcntl(_fd, F_SETFL, v | O_DIRECT | O_SYNC);
|
||||
|
||||
#endif
|
||||
return _unbuffered_writes;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include "UARTDriver.h"
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#if defined(__CYGWIN__) || defined(__APPLE__)
|
||||
#include <termios.h>
|
||||
#else
|
||||
#include <asm/termbits.h>
|
||||
@ -35,7 +35,7 @@ bool HALSITL::UARTDriver::set_speed(int speed)
|
||||
if (_fd < 0) {
|
||||
return false;
|
||||
}
|
||||
#ifdef __CYGWIN__
|
||||
#if defined(__CYGWIN__) || defined(__APPLE__)
|
||||
struct termios t;
|
||||
tcgetattr(_fd, &t);
|
||||
cfsetspeed(&t, speed);
|
||||
@ -68,7 +68,7 @@ void HALSITL::UARTDriver::configure_parity(uint8_t v)
|
||||
if (_fd < 0) {
|
||||
return;
|
||||
}
|
||||
#ifdef __CYGWIN__
|
||||
#if defined(__CYGWIN__) || defined(__APPLE__)
|
||||
struct termios t;
|
||||
|
||||
tcgetattr(_fd, &t);
|
||||
@ -93,7 +93,7 @@ void HALSITL::UARTDriver::configure_parity(uint8_t v)
|
||||
t.c_cflag &= ~PARENB;
|
||||
}
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#if defined(__CYGWIN__) || defined(__APPLE__)
|
||||
tcsetattr(_fd, TCSANOW, &t);
|
||||
#else
|
||||
ioctl(_fd, TCSETS2, &t);
|
||||
@ -105,7 +105,7 @@ void HALSITL::UARTDriver::set_stop_bits(int n)
|
||||
if (_fd < 0) {
|
||||
return;
|
||||
}
|
||||
#ifdef __CYGWIN__
|
||||
#if defined(__CYGWIN__) || defined(__APPLE__)
|
||||
struct termios t;
|
||||
|
||||
tcgetattr(_fd, &t);
|
||||
@ -123,7 +123,7 @@ void HALSITL::UARTDriver::set_stop_bits(int n)
|
||||
t.c_cflag &= ~CSTOPB;
|
||||
}
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#if defined(__CYGWIN__) || defined(__APPLE__)
|
||||
tcsetattr(_fd, TCSANOW, &t);
|
||||
#else
|
||||
ioctl(_fd, TCSETS2, &t);
|
||||
|
Loading…
Reference in New Issue
Block a user