WIZlib Library API  ver 1.0
WIZlib Library API User Menual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cmdrun.h
Go to the documentation of this file.
1 
12 #ifndef _CMDRUN_H
13 #define _CMDRUN_H
14 
15 #include "common/common.h"
16 
17 
18 #define RET_DONE 2
19 #define RET_OK_DUMP 3
20 #define RET_ASYNC 4
21 #define RET_RECV 5
22 
23 #define RET_UNSPECIFIED -2
24 #define RET_WRONG_OP -3
25 #define RET_WRONG_SIGN -4
26 #define RET_WRONG_ARG -5
27 #define RET_RANGE_OUT -6
28 #define RET_DISABLED -7
29 #define RET_NOT_ALLOWED -8
30 #define RET_BUSY -9
31 #define RET_TIMEOUT -10
32 #define RET_NO_SOCK -20
33 #define RET_SOCK_CLS -21
34 #define RET_USING_PORT -22
35 #define RET_NOT_CONN -23
36 #define RET_WRONG_ADDR -24
37 #define RET_NO_DATA -25
38 #define RET_NO_FREEMEM -30
39 
40 #define ERRVAL_UNSPECIFIED '0' // under 10
41 #define ERRVAL_WRONG_OP '1'
42 #define ERRVAL_WRONG_SIGN '2'
43 #define ERRVAL_WRONG_ARG '3'
44 #define ERRVAL_RANGE_OUT '4'
45 #define ERRVAL_DISABLED '5'
46 #define ERRVAL_NOT_ALLOWED '6'
47 #define ERRVAL_BUSY '7'
48 #define ERRVAL_TIMEOUT '8'
49 #define ERRVAL_NO_SOCK '0' // under 20
50 #define ERRVAL_SOCK_CLS '1'
51 #define ERRVAL_USING_PORT '2'
52 #define ERRVAL_NOT_CONN '3'
53 #define ERRVAL_WRONG_ADDR '4'
54 #define ERRVAL_NO_DATA '5'
55 #define ERRVAL_NO_FREEMEM '0' // under 30
56 
57 #define ATC_SOCK_NUM_START 1
58 #define ATC_SOCK_NUM_END TOTAL_SOCK_NUM-1
59 #define ATC_SOCK_NUM_TOTAL ATC_SOCK_NUM_END - ATC_SOCK_NUM_START + 1
60 #define ATC_SOCK_AO 1 // Array Offset
61 #define WORK_BUF_SIZE 2048
62 #define EVENT_QUEUE_SIZE 20
63 #define ATC_VERSION "1.0"
64 
65 #define OP_SIZE 8
66 #define LONG_ARG_SIZE 36
67 #define SHORT_ARG_SIZE 20
68 #define ARG_1_SIZE LONG_ARG_SIZE
69 #define ARG_2_SIZE LONG_ARG_SIZE
70 #define ARG_3_SIZE SHORT_ARG_SIZE
71 #define ARG_4_SIZE SHORT_ARG_SIZE
72 #define ARG_5_SIZE SHORT_ARG_SIZE
73 #define ARG_6_SIZE SHORT_ARG_SIZE
74 
75 #define POLL_MODE_NONE 0x0
76 #define POLL_MODE_SEMI 0x1
77 #define POLL_MODE_FULL 0x2
78 
79 
80 typedef struct atct_t {
81  int8 sign;
82  int8 op[OP_SIZE];
83  int8 arg1[ARG_1_SIZE]; // could be SSID
84  int8 arg2[ARG_2_SIZE];
85  int8 arg3[ARG_3_SIZE];
86  int8 arg4[ARG_4_SIZE];
87  int8 arg5[ARG_5_SIZE];
88  int8 arg6[ARG_6_SIZE];
89 } atct;
90 
91 struct atc_info {
92  wiz_NetInfo net;
93  atct tcmd;
94  int8 sendsock;
95  uint8 sendip[4];
96  uint16 sendport;
97  int8 sendbuf[WORK_BUF_SIZE+1];
98  int8 recvbuf[WORK_BUF_SIZE+1];
99  uint16 worklen;
100  uint16 sendlen;
101  uint16 recvlen;
102  int8 echo;
103  int8 mode; // Reserved
104  int8 poll;
105  int8 country; // Reserved
106 };
107 
108 extern struct atc_info atci;
109 
110 #define CRITICAL_ERR(fmt) \
111  do{printf("### ERROR ### %s(%d): "fmt"\r\n", __FUNCTION__, __LINE__); while(1);}while(0)
112 #define CRITICAL_ERRA(fmt, ...) \
113  do{printf("### ERROR ### %s(%d): "fmt"\r\n", __FUNCTION__, __LINE__, __VA_ARGS__); while(1);}while(0)
114 
115 extern void cmd_resp(int8 retval, int8 idval);
116 extern void cmd_resp_dump(int8 idval, int8 *dump);
117 
118 void atc_async_cb(uint8 id, uint8 item, int32 ret);
119 void act_nset_q(int8 num);
120 void act_nset_a(int8 mode, uint8 *ip, uint8 *sn, uint8 *gw, uint8 *dns1, uint8 *dns2);
121 void act_nstat(int8 num);
122 void act_nmac_q(void);
123 void act_nmac_a(uint8 *mac);
124 void act_nopen_q(void);
125 void act_nopen_a(int8 type, uint16 sport, uint8 *dip, uint16 dport);
126 void act_ncls(uint8 sock);
127 int8 act_nsend_chk(uint8 sock, uint16 *len, uint8 *dip, uint16 *dport);
128 void act_nsend(uint8 sock, int8 *buf, uint16 len, uint8 *dip, uint16 *dport);
129 void act_nrecv(int8 sock, uint16 maxlen);
130 void act_nsock(int8 sock);
131 //void act_nopt(void);
132 #if 0
133 void act_wset(void);
134 void act_wstat(void);
135 void act_wscan(void);
136 void act_wjoin(void);
137 void act_wleave(void);
138 void act_wsec(void);
139 void act_wwps(void);
140 #endif
141 void act_mset_q(int8 num);
142 void act_mset_a(int8 echo, int8 mode, int8 poll, int8 country);
143 void act_mstat(void);
144 void act_mevt_q(void);
145 void act_mevt_a(int8 id);
146 //void act_musart(void);
147 //void act_mspi(void);
148 //void act_mprof(void);
149 //void act_fdhcpd(void);
150 //void act_fdns(void);
151 //void act_fping(void);
152 //void act_fgpio(void);
153 //void act_eset(void);
154 //void act_estat(void);
155 
156 
157 #endif //_CMDRUN_H
158 
159 
160