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
@@ -1232,7 +1232,7 @@ int dlmstp_send_pdu(
struct mstp_pdu_packet *pkt;
uint16_t 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++) {
@@ -1245,7 +1245,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;