mirror of
https://github.com/markqvist/OpenModem.git
synced 2025-05-03 15:05:12 -04:00
Implemented checksumming
This commit is contained in:
parent
b350d3cd8c
commit
0c4bc75be9
6 changed files with 67 additions and 16 deletions
|
@ -4,9 +4,10 @@
|
|||
#include <cfg/compiler.h>
|
||||
#include <io/kfile.h>
|
||||
|
||||
// Frame sizing
|
||||
#define MP1_MIN_FRAME_LENGTH 1
|
||||
// Frame sizing & checksum
|
||||
#define MP1_MIN_FRAME_LENGTH 3
|
||||
#define MP1_MAX_FRAME_LENGTH 300
|
||||
#define MP1_CHECKSUM_INIT 0xAA
|
||||
|
||||
// We need to know some basic HDLC flag bytes
|
||||
#define HDLC_FLAG 0x7E
|
||||
|
@ -26,6 +27,8 @@ typedef struct MP1 {
|
|||
KFile *modem; // KFile access to the modem
|
||||
size_t packetLength; // Counter for received packet length
|
||||
mp1_callback_t callback; // The function to call when a packet has been received
|
||||
uint8_t checksum_in; // Rolling checksum for incoming packets
|
||||
uint8_t checksum_out; // Rolling checksum for outgoing packets
|
||||
bool reading; // True when we have seen a HDLC flag
|
||||
bool escape; // We need to know if we are in an escape sequence
|
||||
} MP1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue