mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2024-10-01 03:15:39 -04:00
Larger packet queue. Fixed FIFO16 overflow and memory inits.
This commit is contained in:
parent
4bfcfb5dc8
commit
ab99c2abd9
5
Config.h
5
Config.h
@ -4,7 +4,7 @@
|
|||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
#define MAJ_VERS 0x01
|
#define MAJ_VERS 0x01
|
||||||
#define MIN_VERS 0x0F
|
#define MIN_VERS 0x10
|
||||||
|
|
||||||
#define MCU_1284P 0x91
|
#define MCU_1284P 0x91
|
||||||
|
|
||||||
@ -34,9 +34,10 @@
|
|||||||
const int pin_led_rx = 12;
|
const int pin_led_rx = 12;
|
||||||
const int pin_led_tx = 13;
|
const int pin_led_tx = 13;
|
||||||
|
|
||||||
|
// TODO: Reset
|
||||||
#define CONFIG_UART_BUFFER_SIZE 6144
|
#define CONFIG_UART_BUFFER_SIZE 6144
|
||||||
#define CONFIG_QUEUE_SIZE 6144
|
#define CONFIG_QUEUE_SIZE 6144
|
||||||
#define CONFIG_QUEUE_MAX_LENGTH 128
|
#define CONFIG_QUEUE_MAX_LENGTH 250
|
||||||
|
|
||||||
#define EEPROM_SIZE 4096
|
#define EEPROM_SIZE 4096
|
||||||
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
|
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
|||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
|
|
||||||
FIFOBuffer serialFIFO;
|
FIFOBuffer serialFIFO;
|
||||||
uint8_t serialBuffer[CONFIG_UART_BUFFER_SIZE];
|
uint8_t serialBuffer[CONFIG_UART_BUFFER_SIZE+1];
|
||||||
|
|
||||||
FIFOBuffer16 packet_starts;
|
FIFOBuffer16 packet_starts;
|
||||||
size_t packet_starts_buf[CONFIG_QUEUE_MAX_LENGTH+1];
|
size_t packet_starts_buf[CONFIG_QUEUE_MAX_LENGTH+1];
|
||||||
@ -27,7 +27,7 @@ void setup() {
|
|||||||
|
|
||||||
// Initialise serial communication
|
// Initialise serial communication
|
||||||
memset(serialBuffer, 0, sizeof(serialBuffer));
|
memset(serialBuffer, 0, sizeof(serialBuffer));
|
||||||
fifo_init(&serialFIFO, serialBuffer, sizeof(serialBuffer));
|
fifo_init(&serialFIFO, serialBuffer, CONFIG_UART_BUFFER_SIZE);
|
||||||
|
|
||||||
Serial.begin(serial_baudrate);
|
Serial.begin(serial_baudrate);
|
||||||
while (!Serial);
|
while (!Serial);
|
||||||
@ -43,11 +43,12 @@ void setup() {
|
|||||||
memset(cbuf, 0, sizeof(cbuf));
|
memset(cbuf, 0, sizeof(cbuf));
|
||||||
|
|
||||||
memset(packet_queue, 0, sizeof(packet_queue));
|
memset(packet_queue, 0, sizeof(packet_queue));
|
||||||
memset(packet_starts_buf, 0, sizeof(packet_starts));
|
|
||||||
memset(packet_lengths_buf, 0, sizeof(packet_lengths));
|
|
||||||
|
|
||||||
fifo16_init(&packet_starts, packet_starts_buf, sizeof(packet_starts_buf));
|
memset(packet_starts_buf, 0, sizeof(packet_starts_buf));
|
||||||
fifo16_init(&packet_lengths, packet_lengths_buf, sizeof(packet_lengths_buf));
|
fifo16_init(&packet_starts, packet_starts_buf, CONFIG_QUEUE_MAX_LENGTH);
|
||||||
|
|
||||||
|
memset(packet_lengths_buf, 0, sizeof(packet_starts_buf));
|
||||||
|
fifo16_init(&packet_lengths, packet_lengths_buf, CONFIG_QUEUE_MAX_LENGTH);
|
||||||
|
|
||||||
// Set chip select, reset and interrupt
|
// Set chip select, reset and interrupt
|
||||||
// pins for the LoRa module
|
// pins for the LoRa module
|
||||||
|
@ -542,7 +542,7 @@ static inline unsigned char fifo_pop_locked(FIFOBuffer *f) {
|
|||||||
|
|
||||||
inline void fifo_init(FIFOBuffer *f, unsigned char *buffer, size_t size) {
|
inline void fifo_init(FIFOBuffer *f, unsigned char *buffer, size_t size) {
|
||||||
f->head = f->tail = f->begin = buffer;
|
f->head = f->tail = f->begin = buffer;
|
||||||
f->end = buffer + size -1;
|
f->end = buffer + size;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t fifo_len(FIFOBuffer *f) {
|
inline size_t fifo_len(FIFOBuffer *f) {
|
||||||
@ -620,10 +620,10 @@ static inline size_t fifo16_pop_locked(FIFOBuffer16 *f) {
|
|||||||
|
|
||||||
inline void fifo16_init(FIFOBuffer16 *f, size_t *buffer, size_t size) {
|
inline void fifo16_init(FIFOBuffer16 *f, size_t *buffer, size_t size) {
|
||||||
f->head = f->tail = f->begin = buffer;
|
f->head = f->tail = f->begin = buffer;
|
||||||
f->end = buffer + (size/sizeof(size_t)) - 1;
|
f->end = buffer + size;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t fifo16_len(FIFOBuffer16 *f) {
|
inline size_t fifo16_len(FIFOBuffer16 *f) {
|
||||||
return ((f->end - f->begin));
|
return (f->end - f->begin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user