forked from DangerousPrototypes/BusPirate5-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbytecode.h
64 lines (60 loc) · 1.83 KB
/
bytecode.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//struct __attribute__((packed, aligned(sizeof(uint64_t)))) _bytecode_output{
struct _bytecode{
uint8_t number_format;
uint8_t command; //255 command options, write/write_return
uint32_t bits; //0-32 bits?
uint32_t repeat; //0-0xffff repeat
uint32_t out_data; //32 data bits
bool has_repeat;
bool has_bits;
uint8_t error; //mode flags errors. One bit to halt execution? Other bits for warnings? ccan override the halt from configuration menu?
const char *error_message;
uint32_t in_data; //up to 32bits results? BUT: how to deal with repeated reads????
const char *data_message;
bool read_with_write;
};
struct _bytecode_output{
uint8_t number_format;
uint8_t command; //255 command options, write/write_return
uint32_t bits; //0-32 bits?
uint32_t repeat; //0-0xffff repeat
uint32_t data; //32 data bits
bool has_repeat;
bool has_bits;
};
//need a way to generate multiple results from a single repeated command
//track by command ID? sequence number?
struct _bytecode_result{
struct _bytecode_output output;
uint8_t error; //mode flags errors. One bit to halt execution? Other bits for warnings? ccan override the halt from configuration menu?
const char *error_message;
uint32_t data; //up to 32bits results? BUT: how to deal with repeated reads????
const char *message;
};
enum SYNTAX_RESULT{
SRES_NONE=0,
SRES_DEBUG,
SRES_INFO,
SRES_WARN,
SRES_ERROR
};
enum SYNTAX{
SYN_WRITE=0,
SYN_READ,
SYN_START,
SYN_STOP,
SYN_START_ALT,
SYN_STOP_ALT,
SYN_TICK_CLOCK,
SYN_SET_CLK_HIGH, ///here
SYN_SET_CLK_LOW,
SYN_SET_DAT_HIGH,
SYN_SET_DAT_LOW,
SYN_READ_DAT, //here
SYN_DELAY_US,
SYN_DELAY_MS,
SYN_AUX_OUTPUT,
SYN_AUX_INPUT,
SYN_ADC,
//SYN_FREQ
};