Fixed dlmstp ringbuffer initialization corruption (#865)

* Added ringbuf API for testing.

* Fixed basic ms/tp datalink packet ringbuffer initialization buffer overrun.

* Added basic ms/tp datalink unit test

* Added Ringbuf_Initialize() API with buffer size checking.

* Changed examples to use Ringbuf_Initialize() API for buffer size checking.
This commit is contained in:
Steve Karg
2024-12-02 07:32:57 -06:00
committed by GitHub
parent f28b03bf81
commit 001b69cbd8
11 changed files with 526 additions and 14 deletions
+22
View File
@@ -0,0 +1,22 @@
/**
* @file
* @brief Mock for MS/TP RS485 driver API
* @author Steve Karg <skarg@users.sourceforge.net>
* @date November 2024
* @copyright SPDX-License-Identifier: MIT
*/
#ifndef MSTP_RS485_H
#define MSTP_RS485_H
#include <stdint.h>
#include <stdbool.h>
void MSTP_RS485_Init(void);
void MSTP_RS485_Send(const uint8_t *payload, uint16_t payload_len);
bool MSTP_RS485_Read(uint8_t *buf);
bool MSTP_RS485_Transmitting(void);
uint32_t MSTP_RS485_Baud_Rate(void);
bool MSTP_RS485_Baud_Rate_Set(uint32_t baud);
uint32_t MSTP_RS485_Silence_Milliseconds(void);
void MSTP_RS485_Silence_Reset(void);
#endif