-
Notifications
You must be signed in to change notification settings - Fork 1
/
bulk_samp_common.h
80 lines (67 loc) · 1.66 KB
/
bulk_samp_common.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* Shared by Linux and PRU code */
#ifndef BULK_SAMP_H
#define BULK_SAMP_H
#define RPMSG_CHAN_NAME "bulksamp-pru"
// message types
// cpu to device
#define BULK_SAMP_MSG_BUFFERS 1
#define BULK_SAMP_MSG_START 2
#define BULK_SAMP_MSG_STOP 3
// XXX pin setup? rising/falling trigger?
// device to cpu
#define BULK_SAMP_MSG_READY 20
// debug
#define BULK_SAMP_MSG_CONFIRM 40
#define BULK_SAMP_MSG_DEBUG 41
// limited by max rpmsg size for bulk_samp_msg_buffers
#define BULK_SAMP_MAX_NUM_BUFFERS 120
// must match sizes of xin/xout in pru code
#define BULK_SAMP_XFER_SIZE 32
// maximum message size is RPMSG_BUF_SIZE-16 = 496
struct
__attribute__((__packed__))
bulk_samp_msg_buffers {
uint8_t type;
uint32_t buffer_count;
uint32_t buffer_size;
uint32_t buffers[BULK_SAMP_MAX_NUM_BUFFERS];
};
struct
__attribute__((__packed__))
bulk_samp_msg_confirm {
uint8_t type;
uint8_t confirm_type;
};
// start sampling continuously
struct
__attribute__((__packed__))
bulk_samp_msg_start {
uint8_t type;
uint32_t clock_hz;
};
struct
__attribute__((__packed__))
bulk_samp_msg_stop {
uint8_t type;
};
// Sent when the buffer is full/finished
struct
__attribute__((__packed__))
bulk_samp_msg_ready {
uint8_t type;
uint8_t buffer_index;
uint32_t size; // XXX needed? probably always just buffer_size
uint32_t checksum; // checksum including magic
uint32_t magic; // written to start/end of buffer? or just included in checksum?
};
struct
__attribute__((__packed__))
bulk_samp_msg_debug {
uint8_t type;
char str1[32];
char str2[32];
uint32_t num1;
uint32_t num2;
uint32_t num3;
};
#endif // BULK_SAMP_H