blob: e860893e3b55a1d1069f406c4ac5d4648c03f2c7 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#ifndef DEVMODE_H
#define DEVMODE_H
#include <zeta.h>
#ifdef __GNUC__
#define PACKED __attribute__((packed))
#else
#define PACKED
#endif
enum header_type {
CMD_PING,
CMD_INFO,
CMD_BOOT,
CMD_READ,
CMD_WRITE,
CMD_IO_READ,
CMD_IO_WRITE,
CMD_ECHO
};
struct header {
u8 type;
u8 bank;
u16 address;
u16 length;
u16 checksum;
} PACKED;
// static_assert(sizeof(struct header) == 8, "struct header is not PACKED");
enum error {
ERR_TIMEOUT = -1
};
#define MAX_PACKET_SIZE 256
#define TIMEOUT_MS 500
#define MAX_ATTEMPTS 3
#define MAX_TRANS_ATTEMPTS 5
#endif // DEVMODE_H
|