mirror of
https://github.com/markqvist/OpenModem.git
synced 2024-12-24 23:19:36 -05:00
Fixed FIFO16 buffer and inits
This commit is contained in:
parent
0b78bce168
commit
c5dad05775
6
device.h
6
device.h
@ -5,7 +5,7 @@
|
||||
|
||||
// Version info
|
||||
#define MAJ_VERSION 0x01
|
||||
#define MIN_VERSION 0x01
|
||||
#define MIN_VERSION 0x02
|
||||
|
||||
// CPU settings
|
||||
#define TARGET_CPU m1284p
|
||||
@ -26,8 +26,8 @@
|
||||
// Serial settings
|
||||
#define SERIAL_DEBUG false
|
||||
#define TX_MAXWAIT 2UL
|
||||
#define CONFIG_QUEUE_SIZE 6000
|
||||
#define CONFIG_QUEUE_MAX_LENGTH 15
|
||||
#define CONFIG_QUEUE_SIZE 5760
|
||||
#define CONFIG_QUEUE_MAX_LENGTH 32
|
||||
#define CONFIG_UART0_BUFFER_SIZE 1536
|
||||
#define CONFIG_UART1_BUFFER_SIZE 128
|
||||
#define CONFIG_SERIAL_TIMEOUT_MS 10
|
||||
|
@ -52,11 +52,12 @@ void kiss_init(AX25Ctx *ax25, Afsk *afsk, Serial *ser) {
|
||||
channel = afsk;
|
||||
|
||||
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));
|
||||
fifo16_init(&packet_lengths, packet_lengths_buf, sizeof(packet_lengths_buf));
|
||||
memset(packet_starts_buf, 0, sizeof(packet_starts));
|
||||
fifo16_init(&packet_starts, packet_starts_buf, CONFIG_QUEUE_MAX_LENGTH);
|
||||
|
||||
memset(packet_lengths_buf, 0, sizeof(packet_lengths));
|
||||
fifo16_init(&packet_lengths, packet_lengths_buf, CONFIG_QUEUE_MAX_LENGTH);
|
||||
}
|
||||
|
||||
void kiss_poll(void) {
|
||||
|
@ -75,7 +75,7 @@ static inline unsigned char fifo_pop_locked(FIFOBuffer *f) {
|
||||
|
||||
inline void fifo_init(FIFOBuffer *f, unsigned char *buffer, size_t size) {
|
||||
f->head = f->tail = f->begin = buffer;
|
||||
f->end = buffer + size -1;
|
||||
f->end = buffer + size;
|
||||
}
|
||||
|
||||
inline size_t fifo_len(FIFOBuffer *f) {
|
||||
|
@ -77,11 +77,11 @@ static inline size_t fifo16_pop_locked(FIFOBuffer16 *f) {
|
||||
|
||||
inline void fifo16_init(FIFOBuffer16 *f, size_t *buffer, size_t size) {
|
||||
f->head = f->tail = f->begin = buffer;
|
||||
f->end = buffer + (size/sizeof(size_t)) - 2;
|
||||
f->end = buffer + size;
|
||||
}
|
||||
|
||||
inline size_t fifo16_len(FIFOBuffer16 *f) {
|
||||
return ((f->end - f->begin))/sizeof(size_t);
|
||||
return (f->end - f->begin);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user