as3993 ST25RU3993 Firmware
|
#include "global.h"
Go to the source code of this file.
Macros | |
#define | CMD_READER_CONFIG 0 |
#define | CMD_ANTENNA_POWER 1 |
#define | CMD_CHANGE_FREQ 2 |
#define | CMD_GEN2_SETTINGS 3 |
#define | CMD_CONFIG_TX_RX 4 |
#define | CMD_INVENTORY_GEN2 5 |
#define | CMD_SELECT_TAG 6 |
#define | CMD_WRITE_TO_TAG 7 |
#define | CMD_READ_FROM_TAG 8 |
#define | CMD_LOCK_UNLOCK_TAG 9 |
#define | CMD_KILL_TAG 10 |
#define | CMD_START_STOP 12 |
#define | CMD_TUNER_TABLE 13 |
#define | CMD_AUTO_TUNER 14 |
#define | CMD_ANTENNA_TUNER 15 |
#define | CMD_INVENTORY_6B 17 |
#define | CMD_READ_FROM_TAG_6B 18 |
#define | CMD_WRITE_TO_TAG_6B 19 |
#define | CMD_GENERIC_CMD_ID 20 |
#define | CMD_RSSI_MEAS_CMD_ID 21 |
#define | CMD_CALL_PA_ID 22 |
#define | CMD_CALL_INV_PARAMS_ID 23 |
#define | CMD_CALL_INV_PARAMS_ID 23 |
Functions | |
u8 | commands (u8 protocol, u16 rxSize, const u8 *rxData, u16 *txSize, u8 *txData) |
u8 | sendTagData (u8 *protocol, u16 *txSize, u8 *txData, u16 remainingSize) |
int | doCyclicInventory (void) |
u8 | readRegister (u8 addr, u16 *txSize, u8 *txData) |
u8 | readRegisters (u16 *txSize, u8 *txData) |
u8 | writeRegister (u8 addr, u8 value, u16 *txSize, u8 *txData) |
Variables | |
struct callFunction | call_fkt_ [CALL_FKT_SIZE] |
This file is the include file for the appl_commands.c file.
This file contains defines for handling appl commands, eg: The defines for the index of command functions in call_ftk_() and expected rx and tx data sizes.
Definition in file appl_commands.h.
#define CMD_ANTENNA_POWER 1 |
appl command ID for callAntennaPower()
Definition at line 80 of file appl_commands.h.
#define CMD_ANTENNA_TUNER 15 |
appl command ID for callAntennaTuner()
Definition at line 106 of file appl_commands.h.
#define CMD_AUTO_TUNER 14 |
appl command ID for callAutoTuner()
Definition at line 104 of file appl_commands.h.
#define CMD_CALL_INV_PARAMS_ID 23 |
appl command ID for callInventoryParams()
Definition at line 216 of file appl_commands.h.
#define CMD_CALL_INV_PARAMS_ID 23 |
appl command ID for callInventoryParams()
Definition at line 216 of file appl_commands.h.
#define CMD_CALL_PA_ID 22 |
appl command ID for callConfigPA()
Definition at line 118 of file appl_commands.h.
#define CMD_CHANGE_FREQ 2 |
appl command ID for callChangeFreq()
Definition at line 82 of file appl_commands.h.
#define CMD_CONFIG_TX_RX 4 |
appl command ID for callConfigTxRx()
Definition at line 86 of file appl_commands.h.
#define CMD_GEN2_SETTINGS 3 |
appl command ID for callConfigGen2()
Definition at line 84 of file appl_commands.h.
#define CMD_GENERIC_CMD_ID 20 |
appl command ID for callGenericCMD()
Definition at line 114 of file appl_commands.h.
#define CMD_INVENTORY_6B 17 |
appl command ID for callInventory6B()
Definition at line 108 of file appl_commands.h.
#define CMD_INVENTORY_GEN2 5 |
appl command ID for callInventoryGen2()
Definition at line 88 of file appl_commands.h.
#define CMD_KILL_TAG 10 |
appl command ID for callKillTag()
Definition at line 98 of file appl_commands.h.
#define CMD_LOCK_UNLOCK_TAG 9 |
appl command ID for callLockUnlockTag()
Definition at line 96 of file appl_commands.h.
#define CMD_READ_FROM_TAG 8 |
appl command ID for callReadFromTag()
Definition at line 94 of file appl_commands.h.
#define CMD_READ_FROM_TAG_6B 18 |
appl command ID for callReadFromTag6B()
Definition at line 110 of file appl_commands.h.
#define CMD_READER_CONFIG 0 |
appl command ID for callReaderConfig()
Definition at line 78 of file appl_commands.h.
#define CMD_RSSI_MEAS_CMD_ID 21 |
appl command ID for callRSSIMeasureCMD()
Definition at line 116 of file appl_commands.h.
#define CMD_SELECT_TAG 6 |
appl command ID for callSelectTag()
Definition at line 90 of file appl_commands.h.
#define CMD_START_STOP 12 |
appl command ID for callStartStop()
Definition at line 100 of file appl_commands.h.
#define CMD_TUNER_TABLE 13 |
appl command ID for callTunerTable()
Definition at line 102 of file appl_commands.h.
#define CMD_WRITE_TO_TAG 7 |
appl command ID for callWriteToTag()
Definition at line 92 of file appl_commands.h.
#define CMD_WRITE_TO_TAG_6B 19 |
appl command ID for callWriteToTag6B()
Definition at line 112 of file appl_commands.h.
u8 commands | ( | u8 | protocol, |
u16 | rxSize, | ||
const u8 * | rxData, | ||
u16 * | txSize, | ||
u8 * | txData | ||
) |
Process various generic commands.
protocol | : forward from applProcessCmd() |
rxData | : forward from applProcessCmd() |
rxSize | : forward from applProcessCmd() |
txData | : forward from applProcessCmd() |
txSize | : forward from applProcessCmd() |
The following description gives an overview of the ams stream protocol and how the data of stream packets is forwarded to the commands() function. The protocol can be executed over USB or UART. Only the header bytes between USB and UART are different.
For a detailed description of the ams stream protocol have a look in ams_stream.h
A simple USB stream packet (not splitted, only 1 protocol in packet) is shown in the following table, which maps the transmitted data to the function parameters of commands().
Byte | 0 | 1 | 2 | 3 | 4..5 | 6..7 | 8..8+txprot-1 |
---|---|---|---|---|---|---|---|
Content | TID | payload | reserved | protocol | txprot | rxprot | data |
Parameter | protocol | rxSize | txSize | rxData[0..rxSize-1] |
where
The response will look like this:
Byte | 0 | 1 | 2 | 3 | 4 | 5 | 6..7 | 8..8+txprot-1 |
---|---|---|---|---|---|---|---|---|
Content | TID | payload | stream status | protocol | reserved | prot status | txprot | data |
Parameter | protocol | status | txSize | txData[0..txSize-1] |
where
Request from host (Reader Suite):
Byte | 0 | 1 | 2 | 3 | 4..5 | 6..7 | 8 |
---|---|---|---|---|---|---|---|
Content | TID | payload | reserved | protocol | txprot | rxprot | data |
Value | 0x0F | 0x07 | 0x00 | 0x01 | 0x0002 | 0x0001 | 0xFF |
where:
The reader answer with this report:
Byte | 0 | 1 | 2 | 3 | 4 | 5 | 6..7 | 8 |
---|---|---|---|---|---|---|---|---|
Content | TID | payload | stream status | protocol | reserved | prot status | txprot | data |
Value | 0xF0 | 0x06 | 0x00 | 0x01 | 0x00 | 0x00 | 0x0001 | 0x00 |
A simple UART stream packet is shown in the following table, which maps the transmitted data to the function parameters of commands().
Byte | 0 | 1 | 2..3 | 4 | 5..6 | 7..8 | 9..9+txprot-1 |
---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | txprot | rxprot | data |
Parameter | protocol | rxSize | txSize | rxData[0..rxSize-1] |
where
The response will look like this:
Byte | 0 | 1 | 2..3 | 4 | 5 | 6 | 7..8 | 9..9+txprot-1 |
---|---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | reserved | prot status | txprot | data |
Parameter | protocol | status | txSize | txData[0..txSize-1] |
where
UART Settings:
Request from host (Reader Suite):
Byte | 0 | 1 | 2..3 | 4 | 5..6 | 7..8 | 9..12 |
---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | txprot | rxprot | data |
Parameter | 0x20 | 0x00 | 0x00 09 | 0x04 | 0x00 04 | 0x00 04 | 0x00 00 01 01 |
where:
The reader answer with this report:
Byte | 0 | 1 | 2..3 | 4 | 5 | 6 | 7..8 | 9..12 |
---|---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | reserved | prot status | txprot | data |
Parameter | 0x01 | 0x00 | 0x00 09 | 0x04 | 0x00 | 0x00 | 0x00 04 | 0x00 0B 00 01 |
Request from host (Reader Suite):
Byte | 0 | 1 | 2..3 | 4 | 5..6 | 7..8 | 9..12 |
---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | txprot | rxprot | data |
Parameter | 0x07 | 0x00 | 0x00 08 | 0x85 | 0x00 03 | 0x00 00 | 0x00 01 06 |
where:
The reader answer with this report:
Byte | 0 | 1 | 2..3 | 4 | 5 | 6 | 7..8 | 9..12 |
---|---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | reserved | prot status | txprot | data |
Parameter | 0x76 | 0x00 | 0x00 14 | 0x05 | 0x00 | 0x00 | 0x00 0F | 00 00 01 8f ff ac 3c 0d 06 10 00 ba ba 77 77 |
Request from host (Reader Suite):
Byte | 0 | 1 | 2..3 | 4 | 5..6 | 7..8 | 9..17 |
---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | txprot | rxprot | data |
Parameter | 0x3E | 0x00 | 0x00 0e | 0x08 | 0x00 09 | 0x00 09 | 0x00 00 00 00 00 00 00 00 00 |
where:
The reader answer with this report:
Byte | 0 | 1 | 2..3 | 4 | 5 | 6 | 7..8 | 9..16 |
---|---|---|---|---|---|---|---|---|
Content | TID | Status | payload | protocol | reserved | prot status | txprot | data |
Parameter | 0xE7 | 0x00 | 0x00 0D | 0x08 | 0x00 | 0x00 | 0x00 08 | 00 00 00 00 55 55 55 55 |
Functions which handle the commands from the host are located in appl_commands.c
The documentation of the various appl command functions will only discuss the data received/sent back to host and will not include the header information for every transmitted packet.
For more details on the ams stream protocol have a look into ams_stream.h
Definition at line 3324 of file appl_commands.c.
int doCyclicInventory | ( | void | ) |
This function is called periodically from main() loop. If a cyclic inventory has been started callInventoryGen2Internal() is called.
Definition at line 3036 of file appl_commands.c.
u8 readRegister | ( | u8 | addr, |
u16 * | txSize, | ||
u8 * | txData | ||
) |
reads one AS3993 register at address and puts the value into the reply to the host.
see cmdReadReg() for reply structure.
addr | register address |
txSize | expected tx size |
txData | buffer for reply |
Definition at line 1125 of file appl_commands.c.
u8 readRegisters | ( | u16 * | txSize, |
u8 * | txData | ||
) |
reads all AS3993 registers and puts the values into the reply to the host.
see cmdReadReg() for reply structure.
txSize | expected tx size |
txData | buffer for reply |
Definition at line 1395 of file appl_commands.c.
u8 sendTagData | ( | u8 * | protocol, |
u16 * | txSize, | ||
u8 * | txData, | ||
u16 | remainingSize | ||
) |
This function sends the tag data received in the last inventory round to the host. The payload description is here: callInventoryGen2()
protocol | Protocol byte for the stream packet |
txData | Buffer to use for tx data |
txSize | Number of bytes which have been copied into the buffer. |
remainingSize | Number of available bytes in the tx buffer. |
number of bytes | content |
---|---|
1 | cyclic |
1 | tags_left |
1 | tags_in_reply |
1 | AGC and status (reg 0x2A) |
1 | RSSI_value (reg 0x2B) |
3 | base_freq |
1 | epclen+pclen |
2 | pc |
sum : 10 |
Definition at line 3390 of file appl_commands.c.
u8 writeRegister | ( | u8 | addr, |
u8 | value, | ||
u16 * | txSize, | ||
u8 * | txData | ||
) |
writes to AS3993 register at address addr the value and prepares tx answer to host.
see cmdWriteReg() for reply structure.
addr | register address |
value | the value to write |
txSize | expected tx size |
txData | buffer for reply |
Definition at line 1097 of file appl_commands.c.
struct callFunction call_fkt_[CALL_FKT_SIZE] |
Table of function pointers. The offset in the table matches the command identifier. When a command is received the corresponding function will be called via this table.
Definition at line 67 of file appl_commands_table.c.