274781a8bc
* Updated the Makefile for mstpcap to accomodate macOS and to build the bacnet lib. Compiling working version of mstpcap on macOS 14, although compiling should work on many earlier versions. The --extcap-interfaces flag now works for macOS which allows one to use mstpcap as an extcap for Wireshark while listing the available serial ports and baud rates. * note: Had to use uname to figure out if one is on Darwin/macOS vs vanilla BSD. From there, macOS specific supported features and location are used. For instance, the 76800 baud rate is natively supported. * note: MacOS doesn't like placing the mstpcap executable in the global extcap plugin directory as it corrupts the Wireshark executable from an xattr and SIP (System Integrity Protection) perspective and macOS will refuse to run it calling it 'corrupt'. One could turn off xattr stuff, using xattr -cr, but could be risky long term. A safer, permissible workaround is to place the executable in the user .local extcap directory: '/Users/<your_user_name>/.local/lib/wireshark/extcap/'. If the directory doesn't exist just create it and copy the executable there. * note: make the executable from the root or apps folder, as there are defines in the apps folder that are common to all the apps. The mstpcap executable is copied to bacnet-stack/bin/ folder. --------- Co-authored-by: Michael O'Neill <em.pee.oh@gmail.com>
55 lines
1.3 KiB
C
55 lines
1.3 KiB
C
/**
|
|
* @file port/bsd/rs485.h
|
|
* @brief Provides BSD/Darwin(macOS) specific functions for RS-485 serial
|
|
* operation
|
|
* @author Steve Karg <skarg@users.sourceforge.net>
|
|
* @author Michael O'Neill <em.pee.oh@gmail.com>
|
|
* @date 2004, 2024
|
|
*
|
|
* @copyright SPDX-License-Identifier: MIT
|
|
*/
|
|
#ifndef RS485_H
|
|
#define RS485_H
|
|
|
|
#include <stdint.h>
|
|
#include "bacnet/bacnet_stack_exports.h"
|
|
#include "bacnet/datalink/mstp.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif /* __cplusplus */
|
|
|
|
BACNET_STACK_EXPORT
|
|
void RS485_Set_Interface(char *ifname);
|
|
BACNET_STACK_EXPORT
|
|
const char *RS485_Interface(void);
|
|
|
|
BACNET_STACK_EXPORT
|
|
void RS485_Initialize(void);
|
|
|
|
BACNET_STACK_EXPORT
|
|
void RS485_Send_Frame(
|
|
struct mstp_port_struct_t *mstp_port, /* port specific data */
|
|
uint8_t *buffer, /* frame to send (up to 501 bytes of data) */
|
|
uint16_t nbytes); /* number of bytes of data (up to 501) */
|
|
|
|
BACNET_STACK_EXPORT
|
|
void RS485_Check_UART_Data(
|
|
struct mstp_port_struct_t *mstp_port); /* port specific data */
|
|
BACNET_STACK_EXPORT
|
|
uint32_t RS485_Get_Port_Baud_Rate(struct mstp_port_struct_t *mstp_port);
|
|
BACNET_STACK_EXPORT
|
|
uint32_t RS485_Get_Baud_Rate(void);
|
|
BACNET_STACK_EXPORT
|
|
bool RS485_Set_Baud_Rate(uint32_t baud);
|
|
|
|
BACNET_STACK_EXPORT
|
|
void RS485_Cleanup(void);
|
|
BACNET_STACK_EXPORT
|
|
void RS485_Print_Ports(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif /* __cplusplus */
|
|
#endif
|