as3993 ST25RU3993 Firmware
appl_commands.h
Go to the documentation of this file.
1 /*
2  *****************************************************************************
3  * AS3993/ST25RU3993 Firmware tech@eleckits.com http://iot.eleckits.com *
4  * STMicroelectronics ST25RU3993 is an EPC Class 1 Gen 2 RFID reader IC *
5  * *
6  * IMPORTANT - PLEASE READ CAREFULLY BEFORE COPYING, INSTALLING OR USING *
7  * THE SOFTWARE. *
8  * *
9  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
10  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
11  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
12  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
13  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
14  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
15  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
16  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
17  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
18  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
19  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
20  *****************************************************************************
21  */
33 #ifndef __USB_COMMANDS_H__
34 #define __USB_COMMANDS_H__
35 
36 /*
37  ******************************************************************************
38  * INCLUDES
39  ******************************************************************************
40  */
41 #include "global.h"
42 
43 #define CALL_FKT_SIZE 32
44 
45 struct callFunction {
46  u16 min_tx_size;
47  u16 min_rx_size;
48  void (*const func)(void);
49 };
50 
51 /*
52  ******************************************************************************
53  * GLOBAL FUNCTIONS
54  ******************************************************************************
55  */
56 extern u8 commands( u8 protocol, u16 rxSize, const u8 * rxData, u16 * txSize, u8 * txData );
57 extern void initCommands(void);
58 extern u8 uartCommands(void);
59 extern u8 sendTagData( u8 * protocol, u16 * txSize, u8 * txData, u16 remainingSize );
60 extern int doCyclicInventory(void);
61 
62 extern u8 readRegister(u8 addr, u16 * txSize, u8 * txData);
63 extern u8 readRegisters(u16 * txSize, u8 * txData);
64 extern u8 writeRegister(u8 addr, u8 value, u16 * txSize, u8 * txData);
65 
66 
67 /* command functions table */
68 extern struct callFunction call_fkt_[CALL_FKT_SIZE];
69 
70 /*
71  ******************************************************************************
72  * DEFINES
73  ******************************************************************************
74  */
75 
76 /*USB COMMANDS (READER) */
78 #define CMD_READER_CONFIG 0
79 
80 #define CMD_ANTENNA_POWER 1
81 
82 #define CMD_CHANGE_FREQ 2
83 
84 #define CMD_GEN2_SETTINGS 3
85 
86 #define CMD_CONFIG_TX_RX 4
87 
88 #define CMD_INVENTORY_GEN2 5
89 
90 #define CMD_SELECT_TAG 6
91 
92 #define CMD_WRITE_TO_TAG 7
93 
94 #define CMD_READ_FROM_TAG 8
95 
96 #define CMD_LOCK_UNLOCK_TAG 9
97 
98 #define CMD_KILL_TAG 10
99 
100 #define CMD_START_STOP 12
101 
102 #define CMD_TUNER_TABLE 13
103 
104 #define CMD_AUTO_TUNER 14
105 
106 #define CMD_ANTENNA_TUNER 15
107 
108 #define CMD_INVENTORY_6B 17
109 
110 #define CMD_READ_FROM_TAG_6B 18
111 
112 #define CMD_WRITE_TO_TAG_6B 19
113 
114 #define CMD_GENERIC_CMD_ID 20
115 
116 #define CMD_RSSI_MEAS_CMD_ID 21
117 
118 #define CMD_CALL_PA_ID 22
119 
120 #define CMD_CALL_INV_PARAMS_ID 23
121 
122 /*Size */
123 #define CMD_READER_CONFIG_MIN_REPLY_SIZE 9
124 #define CMD_READER_CONFIG_REPLY_SIZE 10
125 
126 #define CMD_READER_CONFIG_RX_SIZE 2
127 
128 #define CMD_TUNER_TABLE_REPLY_SIZE 3
129 #define CMD_TUNER_TABLE_RX_SIZE 1
130 
131 #define CMD_AUTO_TUNER_REPLY_SIZE 0
132 #define CMD_AUTO_TUNER_RX_SIZE 1
133 
134 #if RADON
135 #define CMD_ANTENNA_TUNER_REPLY_SIZE 12
136 #else
137 #define CMD_ANTENNA_TUNER_REPLY_SIZE 6
138 #endif
139 #define CMD_ANTENNA_TUNER_RX_SIZE 6
140 
141 #define CMD_ANTENNA_POWER_REPLY_SIZE 1
142 #define CMD_ANTENNA_POWER_RX_SIZE 2
143 
144 #define CMD_WRITE_TO_TAG_REPLY_SIZE 2
145 #define CMD_WRITE_TO_TAG_RX_SIZE 9
146 
147 #define CMD_READ_FROM_TAG_REPLY_SIZE 2
148 #define CMD_READ_FROM_TAG_RX_SIZE 9
149 
150 #define CMD_INVENTORY_6B_REPLY_SIZE 0x0
151 #define CMD_INVENTORY_6B_RX_SIZE 0x0
152 
153 #define CMD_WRITE_TO_TAG_6B_REPLY_SIZE 0x01
154 #define CMD_WRITE_TO_TAG_6B_RX_SIZE 0x01
155 
156 #define CMD_GENERIC_CMD_REPLY_SIZE 0
157 #define CMD_GENERIC_CMD_RX_SIZE 0
158 
159 #define CMD_RSSI_MEAS_CMD_REPLY_SIZE 0
160 #define CMD_RSSI_MEAS_CMD_RX_SIZE 0
161 
162 #define CMD_READ_FROM_TAG_6B_REPLY_SIZE 0x08
163 #define CMD_READ_FROM_TAG_6B_RX_SIZE 0x08
164 
165 #define CMD_CHANGE_FREQ_REPLY_SIZE 0
166 #define CMD_CHANGE_FREQ_RX_SIZE 1
167 #define CMD_CHANGE_FREQ_RSSI_RX_SIZE 4
168 #define CMD_CHANGE_FREQ_REFL_RX_SIZE 5
169 #define CMD_CHANGE_FREQ_ADD_RX_SIZE 6
170 #define CMD_CHANGE_FREQ_SETHOP_RX_SIZE 8
171 #define CMD_CHANGE_FREQ_CONTMOD_RX_SIZE 18
172 
173 #define CMD_INVENTORY_GEN2_REPLY_SIZE 0
174 #define CMD_INVENTORY_GEN2_RX_SIZE 3
175 
176 #define CMD_LOCK_REPLY_SIZE 1
177 #define CMD_LOCK_RX_SIZE 7
178 
179 #define CMD_SELECT_REPLY_SIZE 0
180 #define CMD_SELECT_RX_SIZE 2
181 
182 #define CMD_KILL_TAG_REPLY_SIZE 1
183 #define CMD_KILL_TAG_RX_SIZE 6
184 
185 #define CMD_GEN2_SETTINGS_REPLY_SIZE 16
186 #define CMD_GEN2_SETTINGS_RX_SIZE 16
187 
188 #define CMD_CONFIG_TX_RX_REPLY_SIZE 4
189 #define CMD_CONFIG_TX_RX_RX_SIZE 4
190 
191 #define CMD_START_STOP_REPLY_SIZE 0
192 #define CMD_START_STOP_RX_SIZE 5
193 
194 #define CMD_ERROR_REPLY_SIZE 1
195 /*Protocol Bytes */
196 
197 /*Command Antenna Power */
198 #define ANT_POWER_OFF 0x00
199 #define ANT_POWER_ON 0xFF
200 
201 /* read/write registers */
202 #define WRITE_REG_REPLY_SIZE 1
203 #define WRITE_REG_RX_SIZE 2
204 
205 #define READ_REG_REPLY_SIZE 1
206 #define READ_REG_RX_SIZE 2
207 
208 #define READ_REGS_COMPLETE_REPLY_SIZE 48
209 #define READ_REGS_COMPLETE_RX_SIZE 2
210 
211 #define CMD_CONFIG_PA_REPLY_SIZE 1
212 #define CMD_CONFIG_PA_RX_SIZE 2
213 
214 
216 #define CMD_CALL_INV_PARAMS_ID 23
217 
218 #define CMD_INV_PARAMS_REPLY_SIZE 9
219 #define CMD_INV_PARAMS_RX_SIZE 12
220 
221 
222 
223 
224 #endif
225 
struct callFunction call_fkt_[CALL_FKT_SIZE]
int doCyclicInventory(void)
This file provides declarations for global helper functions.
u8 readRegister(u8 addr, u16 *txSize, u8 *txData)
u8 readRegisters(u16 *txSize, u8 *txData)
u8 commands(u8 protocol, u16 rxSize, const u8 *rxData, u16 *txSize, u8 *txData)
u8 sendTagData(u8 *protocol, u16 *txSize, u8 *txData, u16 remainingSize)
u8 writeRegister(u8 addr, u8 value, u16 *txSize, u8 *txData)