Feature/makefile add apps library (#218)

* add BACnet stack library at apps/lib

* convert apps to use apps/lib for smaller binary

* fix -DBACDL_ALL=1 build

* fix piface build

* datalink MAX_MPDU and MAX_HEADER cleanup

* add bip6 to git workflow

* fix system library dependency of BACnet library

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Steve Karg
2022-01-29 15:55:40 -06:00
committed by GitHub
parent 9c72572692
commit 295f127c2b
79 changed files with 917 additions and 1104 deletions
+3 -3
View File
@@ -77,14 +77,14 @@ static bool run_thread;
/* local MS/TP port data - shared with RS-485 */
static volatile struct mstp_port_struct_t MSTP_Port;
/* buffers needed by mstp port struct */
static uint8_t TxBuffer[MAX_MPDU];
static uint8_t RxBuffer[MAX_MPDU];
static uint8_t TxBuffer[DLMSTP_MPDU_MAX];
static uint8_t RxBuffer[DLMSTP_MPDU_MAX];
/* data structure for MS/TP PDU Queue */
struct mstp_pdu_packet {
bool data_expecting_reply;
uint8_t destination_mac;
uint16_t length;
uint8_t buffer[MAX_MPDU];
uint8_t buffer[DLMSTP_MPDU_MAX];
};
/* count must be a power of 2 for ringbuf library */
#ifndef MSTP_PDU_PACKET_COUNT
+6 -6
View File
@@ -40,8 +40,8 @@
#include "bacnet/basic/sys/ringbuf.h"
/* defines specific to MS/TP */
/* preamble+type+dest+src+len+crc8+crc16 */
#define MAX_HEADER (2+1+1+1+2+1+2)
#define MAX_MPDU (MAX_HEADER+MAX_PDU)
#define DLMSTP_HEADER_MAX (2+1+1+1+2+1+2)
#define DLMSTP_MPDU_MAX (DLMSTP_HEADER_MAX+MAX_PDU)
/* count must be a power of 2 for ringbuf library */
#ifndef MSTP_PDU_PACKET_COUNT
@@ -53,7 +53,7 @@ typedef struct dlmstp_packet {
BACNET_ADDRESS address; /* source address */
uint8_t frame_type; /* type of message */
uint16_t pdu_len; /* packet length */
uint8_t pdu[MAX_MPDU]; /* packet */
uint8_t pdu[DLMSTP_MPDU_MAX]; /* packet */
} DLMSTP_PACKET;
/* data structure for MS/TP PDU Queue */
@@ -61,7 +61,7 @@ struct mstp_pdu_packet {
bool data_expecting_reply;
uint8_t destination_mac;
uint16_t length;
uint8_t buffer[MAX_MPDU];
uint8_t buffer[DLMSTP_MPDU_MAX];
};
typedef struct shared_mstp_data {
@@ -85,8 +85,8 @@ typedef struct shared_mstp_data {
pthread_cond_t Master_Done_Flag;
pthread_mutex_t Master_Done_Mutex;
/* buffers needed by mstp port struct */
uint8_t TxBuffer[MAX_MPDU];
uint8_t RxBuffer[MAX_MPDU];
uint8_t TxBuffer[DLMSTP_MPDU_MAX];
uint8_t RxBuffer[DLMSTP_MPDU_MAX];
/* The minimum time without a DataAvailable or ReceiveError event */
/* that a node must wait for a station to begin replying to a */
/* confirmed request: 255 milliseconds. (Implementations may use */
+3 -3
View File
@@ -226,7 +226,7 @@ int ethernet_send_pdu(BACNET_ADDRESS *dest, /* destination address */
int i = 0; /* counter */
int bytes = 0;
BACNET_ADDRESS src = { 0 }; /* source address for npdu */
uint8_t mtu[MAX_MPDU] = { 0 }; /* our buffer */
uint8_t mtu[ETHERNET_MPDU_MAX] = { 0 }; /* our buffer */
int mtu_len = 0;
(void)npdu_data;
@@ -265,7 +265,7 @@ int ethernet_send_pdu(BACNET_ADDRESS *dest, /* destination address */
mtu[15] = 0x82; /* SSAP for BACnet */
mtu[16] = 0x03; /* Control byte in header */
mtu_len = 17;
if ((mtu_len + pdu_len) > MAX_MPDU) {
if ((mtu_len + pdu_len) > ETHERNET_MPDU_MAX) {
fprintf(stderr, "ethernet: PDU is too big to send!\n");
return -4;
}
@@ -293,7 +293,7 @@ uint16_t ethernet_receive(BACNET_ADDRESS *src, /* source address */
unsigned timeout)
{ /* number of milliseconds to wait for a packet */
int received_bytes;
uint8_t buf[MAX_MPDU] = { 0 }; /* data */
uint8_t buf[ETHERNET_MPDU_MAX] = { 0 }; /* data */
uint16_t pdu_len = 0; /* return value */
fd_set read_fds;
int max;
+2 -2
View File
@@ -61,8 +61,8 @@
/* local port data - shared with RS-485 */
static volatile struct mstp_port_struct_t MSTP_Port;
/* buffers needed by mstp port struct */
static uint8_t RxBuffer[MAX_MPDU];
static uint8_t TxBuffer[MAX_MPDU];
static uint8_t RxBuffer[DLMSTP_MPDU_MAX];
static uint8_t TxBuffer[DLMSTP_MPDU_MAX];
static struct mstimer Silence_Timer;
static uint32_t Timer_Silence(void *pArg)
+2 -2
View File
@@ -69,8 +69,8 @@
/* local port data - shared with RS-485 */
static volatile struct mstp_port_struct_t MSTP_Port;
/* buffers needed by mstp port struct */
static uint8_t RxBuffer[MAX_MPDU];
static uint8_t TxBuffer[MAX_MPDU];
static uint8_t RxBuffer[DLMSTP_MPDU_MAX];
static uint8_t TxBuffer[DLMSTP_MPDU_MAX];
static uint16_t SilenceTime;
#define INCREMENT_AND_LIMIT_UINT16(x) \
{ \