annotate 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
rev   line source
1
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 #ifndef __CMD_PROTO_H_
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 #define __CMD_PROTO_H_
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 #define CP_MAGIC "JC"
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5 #define CP_MAX_SZ 0x255
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 typedef enum {
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7 CPCMD_DUMMY,
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8 CPCMD_PING,
2
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents: 1
diff changeset
9 CPCMD_SHIFT_TDI,
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents: 1
diff changeset
10 CPCMD_SHIFT_TMS,
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents: 1
diff changeset
11 CPCMD_SHIFT_TDI_TDO,
7
61f27549de57 Support TRST.
Thinker K.F. Li <thinker@branda.to>
parents: 2
diff changeset
12 CPCMD_TRST,
1
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 CPCMD_PONG,
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 CPCMD_DATA,
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15 CPCMD_ACK,
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 CPCMD_NAK,
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17 CPCMD_MAX
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18 } cp_ccode_t;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20 typedef struct {
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 int seq;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22 cp_ccode_t code;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23 int data_sz;
10
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents: 7
diff changeset
24 unsigned char *data;
1
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25 } cp_cmd_t;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 typedef struct {
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 cp_cmd_t cmds[2];
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 int receiving;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30 int status;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 int seq;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32 int cnt;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 int len;
10
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents: 7
diff changeset
34 unsigned char *bufs[2];
1
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
35 } cmd_proto_t;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
36
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
37 extern cmd_proto_t *cmd_proto_new(void);
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
38 extern void cmd_proto_free(cmd_proto_t *cp);
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
39 extern cp_cmd_t *cmd_proto_rcv(cmd_proto_t *cp, int c);
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
40 /*
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
41 * \return size of filled command.
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
42 */
10
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents: 7
diff changeset
43 extern int cmd_proto_cmd_fill(unsigned char *buf, int seq,
1
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
44 cp_ccode_t code, int data_sz);
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
45 extern cp_cmd_t BAD_CMD;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
46 extern cp_cmd_t CSUM_ERR_CMD;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
47
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
48 #define CP_CMD_HEAD_SZ 5
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
49 #define CP_CMD_TAIL_SZ 1
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
50 #define CP_CMD_OVERHEAD (CP_CMD_HEAD_SZ + CP_CMD_TAIL_SZ)
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
51
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
52 #endif /* __CMD_PROTO_H_ */