annotate include/cmd_proto.h @ 2:abf221bf3ce4

AVR JTAG server.
author Thinker K.F. Li <thinker@branda.to>
date Sat, 21 Feb 2009 23:06:50 +0800
parents f7c60e525801
children 61f27549de57
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,
1
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 CPCMD_PONG,
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 CPCMD_DATA,
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 CPCMD_ACK,
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15 CPCMD_NAK,
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 CPCMD_MAX
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17 } cp_ccode_t;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19 typedef struct {
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20 int seq;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 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
22 int data_sz;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23 char *data;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 } cp_cmd_t;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 typedef struct {
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 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
28 int receiving;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 int status;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30 int seq;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 int cnt;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32 int len;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 char *bufs[2];
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
34 } cmd_proto_t;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
35
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
36 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
37 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
38 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
39 /*
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
40 * \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
41 */
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
42 extern int cmd_proto_cmd_fill(char *buf, int seq,
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
43 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
44 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
45 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
46
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
47 #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
48 #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
49 #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
50
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
51 #endif /* __CMD_PROTO_H_ */