annotate src/cmd_proto.c @ 13:1ea479d26fce tip

Make sure shifting phase and add bypass.py. - shifting phase is started after entering SHIFT state Transition from CAP to SHIFT does not induce shifting. - shifting phase is stoped after leaving SHIFT state. Transition from SHIFT to EXIT1 also induce a bit of shifting.
author Thinker K.F. Li <thinker@branda.to>
date Wed, 25 Feb 2009 20:08:29 +0800
parents cc106f278d7d
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 #include <stdio.h>
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 #include <stdlib.h>
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3 #include <string.h>
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 #include "cmd_proto.h"
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 enum {
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7 ST_WAIT_MAGIC0,
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8 ST_WAIT_MAGIC1,
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 ST_WAIT_SEQ,
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10 ST_WAIT_LEN,
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11 ST_WAIT_DATA,
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 ST_WAIT_CSUM
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 };
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14
3
e410832c3280 Issue of avr-ld.
Thinker K.F. Li <thinker@branda.to>
parents: 1
diff changeset
15 #define BUF_SZ 512
e410832c3280 Issue of avr-ld.
Thinker K.F. Li <thinker@branda.to>
parents: 1
diff changeset
16
1
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17 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
18 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
19
3
e410832c3280 Issue of avr-ld.
Thinker K.F. Li <thinker@branda.to>
parents: 1
diff changeset
20 cp = (cmd_proto_t *)malloc(sizeof(cmd_proto_t) + BUF_SZ);
1
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 if(cp == NULL)
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22 return NULL;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 memset(cp, 0, sizeof(cmd_proto_t));
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25 cp->bufs[0] = ((char *)cp) + sizeof(cmd_proto_t);
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 cp->bufs[1] = ((char *)cp) + sizeof(cmd_proto_t) + 256;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 cp->cmds[0].data = cp->bufs[0] + 1;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 cp->cmds[1].data = cp->bufs[1] + 1;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30 return cp;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 }
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 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
34 free(cp);
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
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
37 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
38 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
39
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
40 static
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
41 cp_cmd_t *make_cmd(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
42 char *buf = cp->bufs[cp->receiving];
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
43 cp_cmd_t *cmd;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
44 int i;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
45
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
46 if(buf[0] <= 0 || buf[0] >= CPCMD_MAX)
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
47 return &BAD_CMD;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
48
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
49 cmd = cp->cmds + cp->receiving;
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 cmd->seq = cp->seq;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
52 cmd->code = buf[0];
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
53 cmd->data_sz = cp->len - 1;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
54
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
55 cp->receiving ^= 1;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
56
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
57 return cmd;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
58 }
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
59
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
60 #define CSUM_ADD(csum, c) \
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
61 do { \
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
62 csum = ((((csum) << 3) | ((csum) >> 5)) ^ (c)) & 0xff; \
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
63 } while(0)
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
64
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
65 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
66 int i, csum;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
67 char *buf;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
68 cp_cmd_t *cmd = NULL;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
69
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
70 switch(cp->status) {
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
71 case ST_WAIT_MAGIC0:
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
72 if(c == CP_MAGIC[0])
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
73 cp->status = ST_WAIT_MAGIC1;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
74 break;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
75
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
76 case ST_WAIT_MAGIC1:
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
77 if(c == CP_MAGIC[1])
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
78 cp->status = ST_WAIT_SEQ;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
79 else if(c != CP_MAGIC[0])
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
80 cp->status = ST_WAIT_MAGIC0;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
81 break;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
82
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
83 case ST_WAIT_SEQ:
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
84 cp->seq = c;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
85 cp->status = ST_WAIT_LEN;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
86 break;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
87
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
88 case ST_WAIT_LEN:
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
89 cp->len = c;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
90 if(c > 0) {
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
91 cp->status = ST_WAIT_DATA;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
92 cp->cnt = 0;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
93 } else
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
94 cp->status = ST_WAIT_CSUM;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
95 break;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
96
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
97 case ST_WAIT_DATA:
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
98 cp->bufs[cp->receiving][cp->cnt++] = c;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
99 if(cp->cnt >= cp->len)
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
100 cp->status = ST_WAIT_CSUM;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
101 break;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
102
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
103 case ST_WAIT_CSUM:
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
104 csum = 0;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
105 buf = cp->bufs[cp->receiving];
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
106 for(i = 0; i < cp->len; i++)
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
107 CSUM_ADD(csum, buf[i]);
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
108 CSUM_ADD(csum, c);
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
109 cp->status = ST_WAIT_MAGIC0;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
110 if(csum == 0)
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
111 cmd = make_cmd(cp);
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
112 else
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
113 cmd = &CSUM_ERR_CMD;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
114 break;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
115
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
116 default:
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
117 cp->status = ST_WAIT_MAGIC0;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
118 }
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
119
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
120 return cmd;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
121 }
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
122
10
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents: 3
diff changeset
123 int cmd_proto_cmd_fill(unsigned char *buf, int seq,
cc106f278d7d Get identify of components
Thinker K.F. Li <thinker@branda.to>
parents: 3
diff changeset
124 cp_ccode_t code, int data_sz) {
1
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
125 int i, last = data_sz + CP_CMD_HEAD_SZ;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
126 int csum = 0;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
127
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
128 buf[0] = CP_MAGIC[0];
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
129 buf[1] = CP_MAGIC[1];
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
130 buf[2] = seq;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
131 buf[3] = data_sz + 1;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
132 buf[4] = code;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
133 for(i = CP_CMD_HEAD_SZ - 1; i < last; i++)
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
134 CSUM_ADD(csum, buf[i]);
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
135 CSUM_ADD(csum, 0);
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
136 buf[i] = csum;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
137
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
138 return data_sz + CP_CMD_OVERHEAD;
f7c60e525801 cptest and cp_ping.py to test cmd_proto.c.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
139 }