This source file includes following definitions.
- get_dot_command_size
- get_dot_command_timeout
1
2
3
4
5
6
7
8
9
10 #ifndef __DOT_COMMAND_H__
11 #define __DOT_COMMAND_H__
12
13
14
15
16
17
18
19
20
21 #define sp_write 0
22 #define sp_write_next 1
23 #define sp_read 2
24 #define sp_read_next 3
25 #define sp_command_response 4
26 #define sp_event 5
27 #define sp_heartbeat 6
28
29 #pragma pack(1)
30 struct dot_command_header {
31 u8 type;
32 u8 command_size;
33 u16 data_size;
34 u8 status;
35 u8 reserved;
36 };
37 #pragma pack()
38
39 static inline size_t get_dot_command_size(void *buffer)
40 {
41 struct dot_command_header *cmd = (struct dot_command_header *)buffer;
42 return sizeof(struct dot_command_header) + cmd->command_size + cmd->data_size;
43 }
44
45 static inline unsigned int get_dot_command_timeout(void *buffer)
46 {
47 struct dot_command_header *header = (struct dot_command_header *)buffer;
48 unsigned char *cmd = buffer + sizeof(struct dot_command_header);
49
50
51
52 if (header->command_size == 3) {
53 if ((cmd[0] == 6) && (cmd[1] == 3) && (cmd[2] == 1))
54 return IBMASM_CMD_TIMEOUT_EXTRA;
55 } else if (header->command_size == 2) {
56 if ((cmd[0] == 7) && (cmd[1] == 1))
57 return IBMASM_CMD_TIMEOUT_EXTRA;
58 if (cmd[0] == 8)
59 return IBMASM_CMD_TIMEOUT_EXTRA;
60 }
61 return IBMASM_CMD_TIMEOUT_NORMAL;
62 }
63
64 #endif