Fixed MacOS specific usage during FreeBSD 11.4 build (#745)

* Fixed path of exports header in BSD ports. 

* Fixed MacOS specific include in BSD ports. 

* Fixed MacOS specific IOSSIOSPEED and IOSSDATALAT usage in BSD ports
This commit is contained in:
Steve Karg
2024-08-23 17:50:30 -05:00
committed by GitHub
parent eba1def58c
commit 36b5a3be98
2 changed files with 10 additions and 2 deletions
+9 -1
View File
@@ -42,8 +42,11 @@
#include "dlmstp_bsd.h" #include "dlmstp_bsd.h"
/*macOS-darwin includes*/ #if defined(__APPLE__) || defined(__darwin__)
#include <IOKit/serial/ioss.h> #include <IOKit/serial/ioss.h>
#else
#include <sys/serial.h>
#endif
/* Posix serial programming reference: /* Posix serial programming reference:
https://www.msweet.org/serial/serial.html https://www.msweet.org/serial/serial.html
@@ -716,6 +719,8 @@ static int openSerialPort(const char *const bsdPath)
options.c_cflag &= ~CSTOPB; /* 1 Stop Bit */ options.c_cflag &= ~CSTOPB; /* 1 Stop Bit */
options.c_cflag &= ~CSIZE; options.c_cflag &= ~CSIZE;
options.c_cflag |= CS8; /* Use 8 bit words */ options.c_cflag |= CS8; /* Use 8 bit words */
#if defined(__APPLE__) || defined(__darwin__)
/* The IOSSIOSPEED ioctl can be used to set arbitrary baud rates other than /* The IOSSIOSPEED ioctl can be used to set arbitrary baud rates other than
* those specified by POSIX. The driver for the underlying serial hardware * those specified by POSIX. The driver for the underlying serial hardware
* ultimately determines which baud rates can be used. This ioctl sets both * ultimately determines which baud rates can be used. This ioctl sets both
@@ -726,6 +731,7 @@ static int openSerialPort(const char *const bsdPath)
printf("Error calling ioctl(..., IOSSIOSPEED, ...) %s - %s(%d).\n", printf("Error calling ioctl(..., IOSSIOSPEED, ...) %s - %s(%d).\n",
bsdPath, strerror(errno), errno); bsdPath, strerror(errno), errno);
} }
#endif
/* Print the new input and output baud rates. Note that the IOSSIOSPEED /* Print the new input and output baud rates. Note that the IOSSIOSPEED
ioctl interacts with the serial driver directly, bypassing the termios ioctl interacts with the serial driver directly, bypassing the termios
@@ -778,6 +784,7 @@ static int openSerialPort(const char *const bsdPath)
printf("Handshake lines currently set to %d\n", handshake); printf("Handshake lines currently set to %d\n", handshake);
#if defined(__APPLE__) || defined(__darwin__)
unsigned long mics = 1UL; unsigned long mics = 1UL;
/* Set the receive latency in microseconds. Serial drivers use this value to /* Set the receive latency in microseconds. Serial drivers use this value to
@@ -793,6 +800,7 @@ static int openSerialPort(const char *const bsdPath)
strerror(errno), errno); strerror(errno), errno);
goto error; goto error;
} }
#endif
/* Success */ /* Success */
return fileDescriptor; return fileDescriptor;
+1 -1
View File
@@ -12,7 +12,7 @@
#define RS485_H #define RS485_H
#include <stdint.h> #include <stdint.h>
#include "bacnet/bacnet_stack_exports.h" #include "bacnet/basic/sys/bacnet_stack_exports.h"
#include "bacnet/datalink/mstp.h" #include "bacnet/datalink/mstp.h"
#ifdef __cplusplus #ifdef __cplusplus