Deprecated Ringbuf_Alloc, and replaced with Ringbuf_Data_Peek() and Ringbuf_Data_Put() functions. Ringbuf_Alloc() was not interrupt or thread safe.

This commit is contained in:
skarg
2015-09-09 14:54:02 +00:00
parent a36ac1ec45
commit 07bf4eba3b
11 changed files with 75 additions and 31 deletions
+4 -2
View File
@@ -155,7 +155,7 @@ int dlmstp_send_pdu(
struct mstp_pdu_packet *pkt;
unsigned i = 0;
pkt = (struct mstp_pdu_packet *) Ringbuf_Alloc(&PDU_Queue);
pkt = (struct mstp_pdu_packet *) Ringbuf_Data_Peek(&PDU_Queue);
if (pkt) {
pkt->data_expecting_reply = npdu_data->data_expecting_reply;
for (i = 0; i < pdu_len; i++) {
@@ -168,7 +168,9 @@ int dlmstp_send_pdu(
/* mac_len = 0 is a broadcast address */
pkt->destination_mac = MSTP_BROADCAST_ADDRESS;
}
bytes_sent = pdu_len;
if (Ringbuf_Data_Put(&PDU_Queue, (uint8_t *)pkt)) {
bytes_sent = pdu_len;
}
}
return bytes_sent;
+4 -2
View File
@@ -151,7 +151,7 @@ int dlmstp_send_pdu(
return 0;
}
pkt = (struct mstp_pdu_packet *) Ringbuf_Alloc(&poSharedData->PDU_Queue);
pkt = (struct mstp_pdu_packet *) Ringbuf_Data_Peek(&poSharedData->PDU_Queue);
if (pkt) {
pkt->data_expecting_reply =
BACNET_DATA_EXPECTING_REPLY(pdu[BACNET_PDU_CONTROL_BYTE_OFFSET]);
@@ -160,7 +160,9 @@ int dlmstp_send_pdu(
}
pkt->length = pdu_len;
pkt->destination_mac = dest->mac[0];
bytes_sent = pdu_len;
if (Ringbuf_Data_Put(&PDU_Queue, (uint8_t *)pkt)) {
bytes_sent = pdu_len;
}
}
return bytes_sent;