comparison include/cmd_proto.h @ 10:cc106f278d7d

Get identify of components
author Thinker K.F. Li <thinker@branda.to>
date Tue, 24 Feb 2009 13:32:04 +0800
parents 61f27549de57
children
comparison
equal deleted inserted replaced
9:705da39cdf91 10:cc106f278d7d
19 19
20 typedef struct { 20 typedef struct {
21 int seq; 21 int seq;
22 cp_ccode_t code; 22 cp_ccode_t code;
23 int data_sz; 23 int data_sz;
24 char *data; 24 unsigned char *data;
25 } cp_cmd_t; 25 } cp_cmd_t;
26 26
27 typedef struct { 27 typedef struct {
28 cp_cmd_t cmds[2]; 28 cp_cmd_t cmds[2];
29 int receiving; 29 int receiving;
30 int status; 30 int status;
31 int seq; 31 int seq;
32 int cnt; 32 int cnt;
33 int len; 33 int len;
34 char *bufs[2]; 34 unsigned char *bufs[2];
35 } cmd_proto_t; 35 } cmd_proto_t;
36 36
37 extern cmd_proto_t *cmd_proto_new(void); 37 extern cmd_proto_t *cmd_proto_new(void);
38 extern void cmd_proto_free(cmd_proto_t *cp); 38 extern void cmd_proto_free(cmd_proto_t *cp);
39 extern cp_cmd_t *cmd_proto_rcv(cmd_proto_t *cp, int c); 39 extern cp_cmd_t *cmd_proto_rcv(cmd_proto_t *cp, int c);
40 /* 40 /*
41 * \return size of filled command. 41 * \return size of filled command.
42 */ 42 */
43 extern int cmd_proto_cmd_fill(char *buf, int seq, 43 extern int cmd_proto_cmd_fill(unsigned char *buf, int seq,
44 cp_ccode_t code, int data_sz); 44 cp_ccode_t code, int data_sz);
45 extern cp_cmd_t BAD_CMD; 45 extern cp_cmd_t BAD_CMD;
46 extern cp_cmd_t CSUM_ERR_CMD; 46 extern cp_cmd_t CSUM_ERR_CMD;
47 47
48 #define CP_CMD_HEAD_SZ 5 48 #define CP_CMD_HEAD_SZ 5