<NME> commands.c
<BEF> /*
 * HydraBus/HydraNFC
 *
 * Copyright (C) 2014 Bert Vermeulen <bert@biot.com>
 * Copyright (C) 2014-2017 Benjamin VERNOUX
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "tokenline.h"
#include "commands.h"

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"

/* Developer warning keep this list synchronized with same number of items and same items order as commands.h => enum */
const t_token_dict tl_dict[] = {
	{ /* Dummy entry */ },
	{ T_HELP, "help" },
	{ T_HISTORY, "history" },
	{ T_EXIT, "exit" },
	{ T_CLEAR, "clear" },
	{ T_DEBUG, "debug" },
	{ T_SHOW, "show" },
	{ T_SYSTEM, "system" },
	{ T_MEMORY, "memory" },
	{ T_THREADS, "threads" },
	{ T_SD, "sd" },
	{ T_MOUNT, "mount" },
	{ T_UMOUNT, "umount" },
	{ T_CD, "cd" },
	{ T_PWD, "pwd" },
	{ T_LS, "ls" },
	{ T_CAT, "cat" },
	{ T_HD, "hd" },
	{ T_ERASE, "erase" },
	{ T_REALLY, "really" },
	{ T_TESTPERF, "test-perf" },
	{ T_MODE, "mode" },
	{ T_SPI, "spi" },
	{ T_I2C, "i2c" },
	{ T_DEVICE, "device" },
	{ T_MASTER, "master" },
	{ T_SLAVE, "slave" },
	{ T_FREQUENCY, "frequency" },
	{ T_POLARITY, "polarity" },
	{ T_PHASE, "phase" },
	{ T_MSB_FIRST, "msb-first" },
	{ T_LSB_FIRST, "lsb-first" },
	{ T_PULL, "pull" },
	{ T_UP, "up" },
	{ T_DOWN, "down" },
	{ T_FLOATING, "floating" },
	{ T_ON, "on" },
	{ T_OFF, "off" },
	{ T_CS_ON, "cs-on" },
	{ T_CS_OFF, "cs-off" },
	{ T_PINS, "pins" },
	{ T_READ, "read" },
	{ T_WRITE, "write" },
	{ T_START, "start" },
	{ T_STOP, "stop" },
	{ T_UART, "uart" },
	{ T_SPEED, "speed" },
	{ T_PARITY, "parity" },
	{ T_NONE, "none" },
	{ T_EVEN, "even" },
	{ T_ODD, "odd" },
	{ T_STOP_BITS, "stop-bits" },
	{ T_ADC, "adc" },
	{ T_ADC1, "adc1" },
	{ T_TEMPSENSOR, "tempsensor" },
	{ T_VREFINT, "vrefint" },
	{ T_VBAT, "vbat" },
	{ T_SAMPLES, "samples" },
	{ T_PERIOD, "period" },
	{ T_CONTINUOUS, "continuous" },
	{ T_SCAN, "scan" },
#ifdef HYDRANFC
	{ T_NFC, "nfc" },
	{ T_TYPEA, "typea" },
	{ T_VICINITY, "vicinity" },
	{ T_EMUL_MIFARE, "emul-mifare" },
	{ T_EMUL_ISO14443A, "emul-3a" },
	{ T_REGISTERS, "registers" },
	{ T_READ_MF_ULTRALIGHT, "read-mf-ul" },
	{ T_EMUL_MF_ULTRALIGHT, "emul-mf-ul" },
	{ T_CLONE_MF_ULTRALIGHT, "clone-mf-ul" },
	{ T_TRACE_UART1, "trace-uart1" },
	{ T_FRAME_TIME, "frame-time" },
	{ T_PCAP, "pcap" },
	{ T_BIN, "bin" },
	{ T_DIRECT_MODE_0, "dm0" },
	{ T_DIRECT_MODE_1, "dm1" },
#endif
	{ T_SNIFF, "sniff" },
	{ T_GPIO, "gpio" },
	{ T_IN, "in" },
	{ T_OUT, "out" },
	{ T_OPEN_DRAIN, "open-drain" },
	{ T_TOKENLINE, "tokenline" },
	{ T_TIMING, "timing" },
	{ T_DEBUG_TEST_RX, "test-rx" },
	{ T_RM, "rm" },
	{ T_MKDIR, "mkdir" },
	{ T_LOGGING, "logging" },
	{ T_DAC, "dac" },
	{ T_DAC1, "dac1" },
	{ T_DAC2, "dac2" },
	{ T_RAW, "raw" },
	{ T_VOLT, "volt" },
	{ T_TRIANGLE, "triangle" },
	{ T_NOISE, "noise" },
	{ T_PWM, "pwm" },
	{ T_DUTY_CYCLE, "duty-cycle" },
	{ T_BRIDGE, "bridge" },
	{ T_SUMP, "sump" },
	{ T_JTAG, "jtag" },
	{ T_TCK, "tck" },
	{ T_TMS, "tms" },
	{ T_TDI, "tdi" },
	{ T_TDO, "tdo" },
	{ T_TRST, "trst" },
	{ T_QUERY, "query" },
	{ T_BRUTE, "brute" },
	{ T_BYPASS, "bypass" },
	{ T_IDCODE, "idcode" },
	{ T_OOCD, "openocd" },
	{ T_RNG, "random" },
	{ T_TWOWIRE, "2-wire" },
	{ T_CAN, "can" },
	{ T_ID, "id" },
	{ T_MASK, "mask" },
	{ T_FILTER, "filter" },
	{ T_LOW, "low" },
	{ T_HIGH, "high" },
	{ T_THREEWIRE, "3-wire" },
	{ T_SCRIPT, "script" },
	{ T_FILE, "filename" },
	{ T_ONEWIRE, "1-wire" },
	{ T_FLASH, "flash" },
	{ T_TRIGGER, "trigger" },
	{ T_SLCAN, "slcan" },
	{ T_TS1, "ts1" },
	{ T_TS2, "ts2" },
	{ T_SJW, "sjw" },
	{ T_WIEGAND, "wiegand" },
	{ T_LIN, "lin" },
	{ T_SMARTCARD, "smartcard" },
	{ T_ATR, "atr" },
	{ T_GUARDTIME, "guardtime" },
	{ T_PRESCALER, "prescaler" },
	{ T_CONVENTION, "convention" },
	{ T_DELAY, "delay" },
	{ T_MMC, "mmc" },
	/* Developer warning add new command(s) here */

	/* BP-compatible commands */
	{ T_LEFT_SQ, "[" },
	{ T_RIGHT_SQ, "]" },
	{ T_LEFT_CURLY, "{" },
	{ T_RIGHT_CURLY, "}" },
	{ T_SLASH, "/" },
	{ T_BACKSLASH, "\\" },
	{ T_MINUS, "-" },
	{ T_UNDERSCORE, "_" },
	{ T_EXCLAMATION, "!" },
	{ T_CARET, "^" },
	{ T_DOT, "." },
	{ T_AMPERSAND, "&" },
	{ T_PERCENT, "%" },
	{ T_TILDE, "~" },
	{ T_AUX_OFF, "a" },
	{ T_AUX_ON, "A" },
	{ T_AUX_READ, "@" },
	{ }
};

t_token tokens_on_off[] = {
	{ T_ON },
	{ T_OFF },
	{ }
};

t_token tokens_master_slave[] = {
	{ T_MASTER },
	{ T_SLAVE },
	{ }
};

t_token tokens_gpio_pull[] = {
	{
		T_UP,
		.help = "Pull up"
	},
	{
		T_DOWN,
		.help = "Pull down"
	},
	{
		T_FLOATING,
		.help = "Floating (default)"
	},
	{ }
};

t_token tokens_mode_show[] = {
	{
		T_PINS,
		.help = "Show pins used in this mode"
	},
	{ }
};

t_token tokens_mode_can_show[] = {
	{
		T_PINS,
		.help = "Show pins used in this mode"
	},
	{
		T_FILTER,
		.help = "Show CAN filter"
	},
	{ }
};

t_token tokens_mode_brute[] = {
	{
		T_BYPASS,
		.arg_type = T_ARG_UINT,
		.help = "Performs a BYPASS scan on n pins"
	},
	{
		T_IDCODE,
		.arg_type = T_ARG_UINT,
		.help = "Performs an IDCODE scan on n pins"
	},
	{ }
};

t_token tokens_mode_can_filter[] = {
	{
		T_ON,
		.help = "Enable filter"
	},
	{
		T_OFF,
		.help = "Disable filter"
	},
	{
		T_ID,
		.arg_type = T_ARG_UINT,
		.help = "Filter value"
	},
	{
		T_MASK,
		.arg_type = T_ARG_UINT,
		.help = "Filter mask"
	},
	{ }
};

t_token tokens_mode_adc_trigger[] = {
	{
		T_LOW,
		.arg_type = T_ARG_UINT,
		.help = "ADC trigger lower bound"
	},
	{
		T_HIGH,
		.arg_type = T_ARG_UINT,
		.help = "ADC trigger higher bound"
	},
	{
		T_DELAY,
		.arg_type = T_ARG_UINT,
		.help = "ADC trigger delay (uS)"
	},
	{
		T_START,
		.help = "Start trigger"
	},
	{ }
};

t_token tokens_mode_trigger[] = {
	{
		T_SHOW,
		.subtokens = tokens_mode_show,
		.help = "Show trigger parameters"
	},
	{
		T_FILTER,
		.arg_type = T_ARG_STRING,
		.help = "Trigger data"
	},
	{
		T_START,
		.help = "Arm the trigger"
	},
	{ }
};

#ifdef HYDRANFC

t_token tokens_mode_nfc_show[] = {
	{
		T_REGISTERS,
		.help = "Show NFC registers"
	},
	{ }
};

t_token tokens_mode_nfc_scan[] = {
	{
		T_PERIOD,
		.arg_type = T_ARG_UINT,
		.help = "Delay between scans (msec)"
	},
	{
		T_CONTINUOUS,
		.help = "Scan until interrupted"
	},
	{ }
};

t_token tokens_mode_nfc_emul_mf_ul[] = {
	{
		T_FILE,
		.arg_type = T_ARG_STRING,
		.help = "microSD filename"
	},
	{ }
};

t_token tokens_mode_nfc_sniff[] = {
	{
		T_TRACE_UART1,
		.help = "Output realtime sniff trace on UART1(PA9@8.4Mbauds 8N1)"
	},
	{
		T_BIN,
		.help = "Force binary sniff trace(UART1 only)"
	},
	{
		T_RAW,
		.help = "Enable binary raw sniff trace(ISO14443A/B)(UART1 only)"
	},
	{
		T_PARITY,
		.help = "Add parity bit information in binary sniff trace(UART1 only)"
	},
	{
		T_FRAME_TIME,
		.help = "Add start/end frame timestamp(in CPU cycles)"
	},
	{
		T_PCAP,
		.help = "Save output file in Wireshark PCAP format"
	},
	{ }
};

#define NFC_PARAMETERS \
	{\
		T_TYPEA,\
		.help = "TypeA (ISO14443A => MIFARE...)"\
	},\
	{\
		T_VICINITY,\
		.help = "Vicinity (ISO/IEC 15693)"\
	},\
	{\
		T_SCAN,\
		.subtokens = tokens_mode_nfc_scan,\
		.help = "Scan"\
	},\
	{\
		T_READ_MF_ULTRALIGHT,\
		.arg_type = T_ARG_STRING,\
		.help = "Read Mifare UltraLight write to microSD"\
	},\
	{\
		T_EMUL_MF_ULTRALIGHT,\
		.subtokens = tokens_mode_nfc_emul_mf_ul,\
		.help = "Emul Tag Mifare Ultralight (optional read from microSD)"\
	},\
	{\
		T_CLONE_MF_ULTRALIGHT,\
		.help = "Clone Mifare UltraLight"\
	},\
	{\
		T_SNIFF,\
		.subtokens = tokens_mode_nfc_sniff,\
		.help = "Sniff (default ISO14443A see options for more details)"\
	},\
	{\
		T_EMUL_MIFARE,\
		.arg_type = T_ARG_UINT,\
		.help = "Emul Tag Mifare UID (uid)"\
	},\
	{\
		T_EMUL_ISO14443A,\
		.help = "Emul Tag ISO14443A SDD UID"\
	},\
	{\
		T_DIRECT_MODE_0,\
		.help = "Enter Direct Mode 0 (IO6/PC2=subcarrier)"\
	},\
	{\
		T_DIRECT_MODE_1,\
		.help = "Enter Direct Mode 1 (IO5/PC4=CLK, IO6/PC2=Data)"\
	},

t_token tokens_sd[];
t_token tokens_mode_nfc[] = {
	{
		T_SD,
		.subtokens = tokens_sd,
		.help = "SD card management"
	},
	{
		T_SHOW,
		.subtokens = tokens_mode_nfc_show,
		.help = "Show NFC parameters"
	},
	NFC_PARAMETERS
	{
		T_EXIT,
		.help = "Exit NFC mode"
	},
	{ }
};

t_token tokens_nfc[] = {
	NFC_PARAMETERS
	{ }
};
#endif /* ifdef HYDRANFC */

t_token tokens_parity[] = {
	{ T_NONE },
	{ T_EVEN },
	{ T_ODD },
};

#define UART_PARAMETERS \
	{\
		T_DEVICE,\
		.arg_type = T_ARG_UINT,\
		.help = "UART device (1/2)"\
	},\
	{\
		T_SPEED,\
		.arg_type = T_ARG_UINT,\
		.help = "Bus bitrate"\
	},\
	{\
		T_PARITY,\
		.arg_type = T_ARG_TOKEN,\
		.subtokens = tokens_parity,\
		.help = "Parity (none/even/odd)"\
	},\
	{\
		T_STOP_BITS,\
		.arg_type = T_ARG_UINT,\
		.help = "Stop bits (1/2)"\
	},

t_token tokens_mode_uart[] = {
	{
		T_SHOW,
		.subtokens = tokens_mode_show,
		.help = "Show UART parameters"
	},
	{
		T_TRIGGER,
		.subtokens = tokens_mode_trigger,
		.help = "Setup UART trigger"
	},
	UART_PARAMETERS
	/* UART-specific commands */
	{
		T_READ,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>)"
	},
	{
		T_HD,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>) and print hexdump"
	},
	{
		T_WRITE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
};

#define SMARTCARD_PARAMETERS \
	{\
		T_DEVICE,\
		.arg_type = T_ARG_UINT,\
		.help = "SMARTCARD device (1/2)"\
	},\
	{\
		T_SPEED,\
		.arg_type = T_ARG_UINT,\
		.help = "Write string"
	},
	/* BP commands */
	{
		T_AMPERSAND,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 usec (repeat with :<num>)"
	},
	{
		T_PERCENT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 msec (repeat with :<num>)"
	},
	{
		T_TILDE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write a random byte (repeat with :<num>)"
	},
	{
		T_AUX_ON,
		.help = "Toggle AUX[0](PC4) high"
	},
	{
		T_AUX_OFF,
		.help = "Toggle AUX[0](PC4) low"
	},
	{
		T_AUX_READ,
		.help = "Read AUX[0](PC4)"
	},
	{
		T_BRIDGE,
		.help = "UART bridge mode"
	},
	{
		T_SCAN,
		.help = "Measure baudrate (PC6)"
	},
	{
		T_EXIT,
		.help = "Exit UART mode"
	},
	{ }
};

t_token tokens_uart[] = {
	UART_PARAMETERS
	{ }
};

#define SMARTCARD_PARAMETERS \
	{\
		T_SPEED,\
		.arg_type = T_ARG_UINT,\
		.help = "Bus bitrate"\
	},\
	{\
		T_PARITY,\
		.arg_type = T_ARG_TOKEN,\
		.subtokens = tokens_parity,\
		.help = "Parity (even/odd)"\
	},\
	{\
		T_POLARITY,\
		.arg_type = T_ARG_UINT, \
		.help = "Clock polarity (0/1)"\
	},\
	{\
		T_PHASE,\
		.arg_type = T_ARG_UINT, \
		.help = "Clock phase (0/1)"\
	},\
	{\
		T_STOP_BITS,\
		.arg_type = T_ARG_UINT,\
		.help = "Stop bits (0/1)"\
	},\
	{\
		T_GUARDTIME,\
		.arg_type = T_ARG_UINT,\
		.help = "Guardtime value"\
	},\
	{\
		T_PRESCALER,\
		.arg_type = T_ARG_UINT,\
		.help = "Prescaler value"\
	},\
	{\
		T_CONVENTION,\
		.arg_type = T_ARG_UINT,\
		.help = "Communication convention",\
		.help_full = "Set communication convention (0=normal, 1=inverse)"\
	},

t_token tokens_mode_smartcard[] = {
	{
		T_SHOW,
		.subtokens = tokens_mode_show,
		.help = "Show SMARTCARD parameters"
	},
	{
		T_TRIGGER,
		.subtokens = tokens_mode_trigger,
		.help = "Setup SMARTCARD trigger"
	},
	SMARTCARD_PARAMETERS
	/* SMARTCARD-specific commands */
	{
		T_READ,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>)"
	},
	{
		T_HD,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>) and print hexdump"
	},
	{
		T_WRITE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_ARG_UINT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_ARG_STRING,
		.help = "Write string"
	},
	{
		T_QUERY,
		.help = "Get OFF port value (card inserted)"
	},
	{
		T_ATR,
		.help = "Read card ATR"
	},
	/* BP commands */
	{
		T_LEFT_SQ,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Toggle RST pin high"
	},
	{
		T_RIGHT_SQ,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Toggle RST pin low"
	},
	{
		T_MINUS,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Toggle CMDVCC pin high"
	},
	{
		T_UNDERSCORE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Toggle CMDVCC pin low"
	},
	{
		T_AMPERSAND,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 usec (repeat with :<num>)"
	},
	{
		T_PERCENT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 msec (repeat with :<num>)"
	},
	{
		T_TILDE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write a random byte (repeat with :<num>)"
	},
	{
		T_AUX_ON,
		.help = "Toggle AUX[0](PC4) high"
	},
	{
		T_AUX_OFF,
		.help = "Toggle AUX[0](PC4) low"
	},
	{
		T_AUX_READ,
		.help = "Read AUX[0](PC4)"
	},
	{
		T_EXIT,
		.help = "Exit SMARTCARD mode"
	},
	{ }
};

t_token tokens_smartcard[] = {
	SMARTCARD_PARAMETERS
	{ }
};

#define LIN_PARAMETERS \
	{\
		T_DEVICE,\
		.arg_type = T_ARG_UINT,\
		.help = "LIN device (1/2)"\
	},\

t_token tokens_mode_lin[] = {
	{
		T_SHOW,
		.subtokens = tokens_mode_show,
		.help = "Show LIN parameters"
	},
	{
		T_TRIGGER,
		.subtokens = tokens_mode_trigger,
		.help = "Setup LIN trigger"
	},
	LIN_PARAMETERS
	/* LIN-specific commands */
	{
		T_READ,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>)"
	},
	{
		T_HD,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>) and print hexdump"
	},
	{
		T_WRITE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_ARG_UINT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_ARG_STRING,
		.help = "Write string"
	},
	/* BP commands */
	{
		T_LEFT_SQ,
		.help = "Send a LIN break"
	},
	{
		T_AMPERSAND,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 usec (repeat with :<num>)"
	},
	{
		T_PERCENT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 msec (repeat with :<num>)"
	},
	{
		T_TILDE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write a random byte (repeat with :<num>)"
	},
	{
		T_AUX_ON,
		.help = "Toggle AUX[0](PC4) high"
	},
	{
		T_AUX_OFF,
		.help = "Toggle AUX[0](PC4) low"
	},
	{
		T_AUX_READ,
		.help = "Read AUX[0](PC4)"
	},
	{
		T_EXIT,
		.help = "Exit LIN mode"
	},
	{ }
};

t_token tokens_lin[] = {
	LIN_PARAMETERS
	{ }
};

#define CAN_PARAMETERS \
	{\
		T_DEVICE,\
		.arg_type = T_ARG_UINT,\
		.help = "CAN device (1/2)"\
	},\
	{\
		T_SPEED,\
		.arg_type = T_ARG_UINT,\
		.help = "Bus bitrate"\
	},\
	{\
		T_TS1,\
		.arg_type = T_ARG_UINT,\
		.help = "Time segment 1 value (1-16)"\
	},\
	{\
		T_TS2,\
		.arg_type = T_ARG_UINT,\
		.help = "Time segment 2 value (1-8)"\
	},\
	{\
		T_SJW,\
		.arg_type = T_ARG_UINT,\
		.help = "Resynchronisation jump width (1-4)"\
	},

t_token tokens_mode_can[] = {
	{
		T_SHOW,
		.subtokens = tokens_mode_can_show,
		.help = "Show CAN parameters"
	},
	CAN_PARAMETERS
	/* CAN-specific commands */
	{
		T_READ,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read packet (repeat with :<num>)"
	},
	{
		T_CONTINUOUS,
		.help = "Read continuously"
	},
	{
		T_WRITE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write packet (repeat with :<num>)"
	},
	{
		T_ID,
		.arg_type = T_ARG_UINT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Change next frame ID"
	},
	{
		T_FILTER,
		.subtokens = tokens_mode_can_filter,
		.help = "Set input filter"
	},
	{
		T_ARG_UINT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write packets (repeat with :<num>)"
	},
	{
		T_ARG_STRING,
		.help = "Write string"
	},
	/* BP commands */
	{
		T_TILDE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write a random byte (repeat with :<num>)"
	},
	{
		T_AUX_ON,
		.help = "Toggle AUX[0](PC4) high"
	},
	{
		T_AUX_OFF,
		.help = "Toggle AUX[0](PC4) low"
	},
	{
		T_AUX_READ,
		.help = "Read AUX[0](PC4)"
	},
	{
		T_SLCAN,
		.help = "slcan (LAWICEL) mode"
	},
	{
		T_EXIT,
		.help = "Exit CAN mode"
	},
	{ }
};

t_token tokens_can[] = {
	CAN_PARAMETERS
	{ }
};

#define I2C_PARAMETERS \
	{\
		T_PULL,\
		.arg_type = T_ARG_TOKEN,\
		.subtokens = tokens_gpio_pull,\
		.help = "GPIO pull (up/down/floating)"\
	},\
	{\
		T_FREQUENCY,\
		.arg_type = T_ARG_FLOAT,\
		.help = "Bus frequency"\
	},

t_token tokens_mode_i2c[] = {
	{
		T_SHOW,
		.subtokens = tokens_mode_show,
		.help = "Show I2C parameters"
	},
	{
		T_TRIGGER,
		.subtokens = tokens_mode_trigger,
		.help = "Setup I2C trigger"
	},
	I2C_PARAMETERS
	/* I2C-specific commands */
	{
		T_SCAN,
		.help = "Scan for connected devices"
	},
	{
		T_SNIFF,
		.help = "Sniff I2C bus"
	},
	{
		T_START,
		.help = "Start"
	},
	{
		T_STOP,
		.help = "Stop"
	},
	{
		T_READ,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>)"
	},
	{
		T_HD,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>) and print hexdump"
	},
	{
		T_WRITE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_ARG_UINT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_ARG_STRING,
		.help = "Write string"
	},
	/* BP commands */
	{
		T_LEFT_SQ,
		.help = "Alias for \"start\""
	},
	{
		T_RIGHT_SQ,
		.help = "Alias for \"stop\""
	},
	{
		T_AMPERSAND,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 usec (repeat with :<num>)"
	},
	{
		T_PERCENT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 msec (repeat with :<num>)"
	},
	{
		T_TILDE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write a random byte (repeat with :<num>)"
	},
	{
		T_AUX_ON,
		.help = "Toggle AUX[0](PC4) high"
	},
	{
		T_AUX_OFF,
		.help = "Toggle AUX[0](PC4) low"
	},
	{
		T_AUX_READ,
		.help = "Read AUX[0](PC4)"
	},
	{
		T_EXIT,
		.help = "Exit I2C mode"
	},
	{ }
};

t_token tokens_i2c[] = {
	I2C_PARAMETERS
	{ }
};

#define SPI_PARAMETERS \
	{ T_DEVICE, \
		.arg_type = T_ARG_UINT, \
		.help = "SPI device (1/2)" }, \
	{ T_PULL, \
		.arg_type = T_ARG_TOKEN, \
		.subtokens = tokens_gpio_pull, \
		.help = "GPIO pull (up/down/floating)" }, \
	{ T_MODE, \
		.arg_type = T_ARG_TOKEN, \
		.subtokens = tokens_master_slave, \
			.help = "Mode (master/slave)" }, \
	{ T_FREQUENCY, \
		.arg_type = T_ARG_FLOAT, \
		.help = "Bus frequency" }, \
	{ T_POLARITY, \
		.arg_type = T_ARG_UINT, \
		.help = "Clock polarity (0/1)" }, \
	{ T_PHASE, \
		.arg_type = T_ARG_UINT, \
		.help = "Clock phase (0/1)" }, \
	{ T_MSB_FIRST, \
		.help = "Send/receive MSB first" }, \
	{ T_LSB_FIRST, \
		.help = "Send/receive LSB first" },

t_token tokens_mode_spi[] = {
	{
		T_SHOW,
		.subtokens = tokens_mode_show,
		.help = "Show SPI parameters"
	},
	{
		T_TRIGGER,
		.subtokens = tokens_mode_trigger,
		.help = "Setup SPI trigger"
	},
	SPI_PARAMETERS
	/* SPI-specific commands */
	{
		T_READ,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>)"
	},
	{
		T_HD,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>) and print hexdump"
	},
	{
		T_WRITE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_ARG_UINT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_ARG_STRING,
		.help = "Write string"
	},
	{
		T_CS_ON,
		.help = "Alias for \"chip-select on\""
	},
	{
		T_CS_OFF,
		.help = "Alias for \"chip-select off\""
	},
	/* BP commands */
	{
		T_LEFT_SQ,
		.help = "Alias for \"chip-select on\""
	},
	{
		T_RIGHT_SQ,
		.help = "Alias for \"chip-select off\""
	},
	{
		T_AMPERSAND,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 usec (repeat with :<num>)"
	},
	{
		T_PERCENT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 msec (repeat with :<num>)"
	},
	{
		T_TILDE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write a random byte (repeat with :<num>)"
	},
	{
		T_AUX_ON,
		.help = "Toggle AUX[0](PC4) high"
	},
	{
		T_AUX_OFF,
		.help = "Toggle AUX[0](PC4) low"
	},
	{
		T_AUX_READ,
		.help = "Read AUX[0](PC4)"
	},
	{
		T_EXIT,
		.help = "Exit SPI mode"
	},
	{ }
};

t_token tokens_spi[] = {
	SPI_PARAMETERS
	{ }
};

#define JTAG_PARAMETERS \
	{ T_PULL, \
		.arg_type = T_ARG_TOKEN, \
		.subtokens = tokens_gpio_pull, \
		.help = "GPIO pull (up/down/floating)" }, \
	{ T_MSB_FIRST, \
		.help = "Send/receive MSB first" }, \
	{ T_LSB_FIRST, \
		.help = "Send/receive LSB first" },

t_token tokens_mode_jtag[] = {
	{
		T_SHOW,
		.subtokens = tokens_mode_show,
		.help = "Show JTAG parameters"
	},
	JTAG_PARAMETERS
	/* JTAG-specific commands */
	{
		T_READ,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>)"
	},
	{
		T_WRITE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_FREQUENCY,
		.arg_type = T_ARG_FLOAT,
		.help = "Bus frequency"
	},
	{
		T_ARG_UINT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_ARG_STRING,
		.help = "Write string"
	},
	{
		T_TCK,
		.arg_type = T_ARG_UINT, \
		.help = "Set TCK pin number x for PBx"
	},
	{
		T_TMS,
		.arg_type = T_ARG_UINT, \
		.help = "Set TMS pin number x for PBx"
	},
	{
		T_TDI,
		.arg_type = T_ARG_UINT, \
		.help = "Set TDI pin number x for PBx"
	},
	{
		T_TDO,
		.arg_type = T_ARG_UINT, \
		.help = "Set TDO pin number x for PBx"
	},
	{
		T_TRST,
		.arg_type = T_ARG_UINT, \
		.help = "Set TRST pin number x for PBx"
	},
	{
		T_BRUTE,
		.subtokens = tokens_mode_brute,
		.help = "Bruteforce JTAG pins on x pins starting from PB0"
	},
	{
		T_BYPASS,
		.help = "Query number of devices in the JTAG chain using BYPASS mode"
	},
	{
		T_IDCODE,
		.help = "Scan for IDCODEs in the JTAG chain"
	},
	{
		T_OOCD,
		.help = "Get into OpenOCD mode"
	},
	/* BP commands */
	{
		T_CARET,
		.help = "Send one clock tick"
	},
	{
		T_SLASH,
		.help = "Toggle clock level high"
	},
	{
		T_BACKSLASH,
		.help = "Toggle clock level low"
	},
	{
		T_MINUS,
		.help = "Toggle TDI high"
	},
	{
		T_UNDERSCORE,
		.help = "Toggle TDI low"
	},
	{
		T_LEFT_SQ,
		.help = "Toggle TMS high"
	},
	{
		T_RIGHT_SQ,
		.help = "Toggle TMS low"
	},
	{
		T_EXCLAMATION,
		.help = "Read bit with clock"
	},
	{
		T_DOT,
		.help = "Read bit without clock"
	},
	{
		T_AMPERSAND,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 usec (repeat with :<num>)"
	},
	{
		T_PERCENT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 msec (repeat with :<num>)"
	},
	{
		T_TILDE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write a random byte (repeat with :<num>)"
	},
	{
		T_AUX_ON,
		.help = "Toggle AUX[0](PC4) high"
	},
	{
		T_AUX_OFF,
		.help = "Toggle AUX[0](PC4) low"
	},
	{
		T_AUX_READ,
		.help = "Read AUX[0](PC4)"
	},
	{
		T_EXIT,
		.help = "Exit JTAG mode"
	},
	{ }
};

t_token tokens_jtag[] = {
	JTAG_PARAMETERS
	{ }
};

#define ONEWIRE_PARAMETERS \
	{ T_PULL, \
		.arg_type = T_ARG_TOKEN, \
		.subtokens = tokens_gpio_pull, \
		.help = "GPIO pull (up/down/floating)" }, \
	{ T_MSB_FIRST, \
		.help = "Send/receive MSB first" }, \
	{ T_LSB_FIRST, \
		.help = "Send/receive LSB first" },

t_token tokens_mode_onewire[] = {
	{
		T_SHOW,
		.subtokens = tokens_mode_show,
		.help = "Show 1-wire parameters"
	},
	{
		T_TRIGGER,
		.subtokens = tokens_mode_trigger,
		.help = "Setup 1-wire trigger"
	},
	ONEWIRE_PARAMETERS
	/* 1-wire-specific commands */
	{
		T_SCAN,
		.help = "Scan for connected devices"
	},
	{
		T_READ,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>)"
	},
	{
		T_HD,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>) and print hexdump"
	},
	{
		T_WRITE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_ARG_UINT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_ARG_STRING,
		.help = "Write string"
	},
	/* BP commands */
	{
		T_LEFT_SQ,
		.help = "Reset bus"
	},
	{
		T_MINUS,
		.help = "Toggle pin high"
	},
	{
		T_UNDERSCORE,
		.help = "Toggle pin low"
	},
	{
		T_DOT,
		.help = "Read bit"
	},
	{
		T_AMPERSAND,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 usec (repeat with :<num>)"
	},
	{
		T_PERCENT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 msec (repeat with :<num>)"
	},
	{
		T_TILDE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write a random byte (repeat with :<num>)"
	},
	{
		T_AUX_ON,
		.help = "Toggle AUX[0](PC4) high"
	},
	{
		T_AUX_OFF,
		.help = "Toggle AUX[0](PC4) low"
	},
	{
		T_AUX_READ,
		.help = "Read AUX[0](PC4)"
	},
	{
		T_EXIT,
		.help = "Exit 1-wire mode"
	},
	{ }
};

t_token tokens_onewire[] = {
	ONEWIRE_PARAMETERS
	{ }
};

#define TWOWIRE_PARAMETERS \
	{ T_PULL, \
		.arg_type = T_ARG_TOKEN, \
		.subtokens = tokens_gpio_pull, \
		.help = "GPIO pull (up/down/floating)" }, \
	{ T_MSB_FIRST, \
		.help = "Send/receive MSB first" }, \
	{ T_LSB_FIRST, \
		.help = "Send/receive LSB first" },

t_token tokens_mode_twowire[] = {
	{
		T_SHOW,
		.subtokens = tokens_mode_show,
		.help = "Show 2-wire parameters"
	},
	{
		T_TRIGGER,
		.subtokens = tokens_mode_trigger,
		.help = "Setup 2-wire trigger"
	},
	TWOWIRE_PARAMETERS
	/* 2-wire-specific commands */
	{
		T_READ,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>)"
	},
	{
		T_HD,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>) and print hexdump"
	},
	{
		T_WRITE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_FREQUENCY,
		.arg_type = T_ARG_FLOAT,
		.help = "Bus frequency"
	},
	{
		T_POLARITY,
		.arg_type = T_ARG_UINT,
		.help = "Clock polarity (0/1)"
	},
	{
		T_IDCODE,
		.help = "Read SWD IDCODE."
	},
	{
		T_BRUTE,
		.arg_type = T_ARG_UINT,
		.help = "Perform a SWD enumeration on pins"
	},
	{
		T_ARG_UINT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_ARG_STRING,
		.help = "Write string"
	},
	/* BP commands */
	{
		T_CARET,
		.help = "Send one clock tick"
	},
	{
		T_SLASH,
		.help = "Toggle clock level high"
	},
	{
		T_BACKSLASH,
		.help = "Toggle clock level low"
	},
	{
		T_MINUS,
		.help = "Toggle SDA high"
	},
	{
		T_UNDERSCORE,
		.help = "Toggle SDA low"
	},
	{
		T_EXCLAMATION,
		.help = "Read bit with clock"
	},
	{
		T_DOT,
		.help = "Read bit without clock"
	},
	{
		T_AMPERSAND,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 usec (repeat with :<num>)"
	},
	{
		T_PERCENT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 msec (repeat with :<num>)"
	},
	{
		T_TILDE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write a random byte (repeat with :<num>)"
	},
	{
		T_AUX_ON,
		.help = "Toggle AUX[0](PC4) high"
	},
	{
		T_AUX_OFF,
		.help = "Toggle AUX[0](PC4) low"
	},
	{
		T_AUX_READ,
		.help = "Read AUX[0](PC4)"
	},
	{
		T_EXIT,
		.help = "Exit 2-wire mode"
	},
	{ }
};

t_token tokens_twowire[] = {
	TWOWIRE_PARAMETERS
	{ }
};

#define THREEWIRE_PARAMETERS \
	{ T_PULL, \
		.arg_type = T_ARG_TOKEN, \
		.subtokens = tokens_gpio_pull, \
		.help = "GPIO pull (up/down/floating)" }, \
	{ T_MSB_FIRST, \
		.help = "Send/receive MSB first" }, \
	{ T_LSB_FIRST, \
		.help = "Send/receive LSB first" },

t_token tokens_mode_threewire[] = {
	{
		T_SHOW,
		.subtokens = tokens_mode_show,
		.help = "Show 3-wire parameters"
	},
	{
		T_TRIGGER,
		.subtokens = tokens_mode_trigger,
		.help = "Setup 3-wire trigger"
	},
	THREEWIRE_PARAMETERS
	/* 3-wire-specific commands */
	{
		T_READ,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>)"
	},
	{
		T_WRITE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_FREQUENCY,
		.arg_type = T_ARG_FLOAT,
		.help = "Bus frequency"
	},
	{
		T_POLARITY,
		.arg_type = T_ARG_UINT,
		.help = "Clock polarity (0/1)"
	},
	{
		T_ARG_UINT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_ARG_STRING,
		.help = "Write string"
	},
	/* BP commands */
	{
		T_CARET,
		.help = "Send one clock tick"
	},
	{
		T_SLASH,
		.help = "Toggle clock level high"
	},
	{
		T_BACKSLASH,
		.help = "Toggle clock level low"
	},
	{
		T_MINUS,
		.help = "Toggle SDO high"
	},
	{
		T_UNDERSCORE,
		.help = "Toggle SDO low"
	},
	{
		T_EXCLAMATION,
		.help = "Read bit with clock"
	},
	{
		T_DOT,
		.help = "Read bit without clock"
	},
	{
		T_AMPERSAND,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 usec (repeat with :<num>)"
	},
	{
		T_PERCENT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 msec (repeat with :<num>)"
	},
	{
		T_TILDE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write a random byte (repeat with :<num>)"
	},
	{
		T_AUX_ON,
		.help = "Toggle AUX[0](PC4) high"
	},
	{
		T_AUX_OFF,
		.help = "Toggle AUX[0](PC4) low"
	},
	{
		T_AUX_READ,
		.help = "Read AUX[0](PC4)"
	},
	{
		T_EXIT,
		.help = "Exit 3-wire mode"
	},
	{ }
};

t_token tokens_threewire[] = {
	THREEWIRE_PARAMETERS
	{ }
};

t_token tokens_mode_flash[] = {
	{
		T_SHOW,
		.subtokens = tokens_mode_show,
		.help = "Show flash parameters"
	},
	/* flash-specific commands */
	{
		T_ID,
		.help = "Displays the ID and status registers"
	},
	/* BP commands */
	{
		T_EXIT,
		.help = "Exit flash mode"
	},
	{ }
};

t_token tokens_flash[] = {
	{ }
};

t_token tokens_mode_mmc[] = {
	{
		T_SHOW,
		.subtokens = tokens_mode_show,
		.help = "Show mmc parameters"
	},
	/* mmc-specific commands */
	{
		T_PINS,
		.arg_type = T_ARG_UINT,
		.help = "Number of data pins (1 or 4)"
	},
	{
		T_ID,
		.help = "Displays the CID and CSD registers"
	},
	/* BP commands */
	{
		T_EXIT,
		.help = "Exit mmc mode"
	},
	{ }
};

t_token tokens_mmc[] = {
	{ }
};

t_token tokens_gpio_mode[] = {
	{
		T_IN,
		.help = "Configure GPIO as input"
	},
	{
		T_OUT,
		.help = "Configure GPIO as output"
	},
	{
		T_OPEN_DRAIN,
		.help = "Configure GPIO pin as open drain (default)"
	},
	{ }
};

t_token tokens_gpio[] = {
	{
		T_ARG_STRING,
		.help = "One or more GPIO pins (PA0-15, PB0-11, PC0-15, PA* ...)"
	},
	{
		T_MODE,
		.arg_type = T_ARG_TOKEN,
		.subtokens = tokens_gpio_mode,
		.help = "Mode (in/out/open-drain)"
	},
	{
		T_PULL,
		.arg_type = T_ARG_TOKEN,
		.subtokens = tokens_gpio_pull,
		.help = "GPIO pull (up/down/floating)"
	},
	{
		T_PERIOD,
		.arg_type = T_ARG_UINT,
		.help = "Delay between reads, in milliseconds"
	},
	{
		T_READ,
		.help = "Read GPIO values"
	},
	{
		T_CONTINUOUS,
		.help = "Read continuously"
	},
	{
		T_ON,
		.help = "Set GPIO pin"
	},
	{
		T_OFF,
		.help = "Clear GPIO pin"
	},
	{ }
};

#define WIEGAND_PARAMETERS \
	{ T_PULL, \
		.arg_type = T_ARG_TOKEN, \
		.subtokens = tokens_gpio_pull, \
		.help = "GPIO pull (up/down/floating)" },
t_token tokens_mode_wiegand[] = {
	{
		T_SHOW,
		.subtokens = tokens_mode_show,
		.help = "Show wiegand parameters"
	},
	WIEGAND_PARAMETERS
	/* wiegand-specific commands */
	{
		T_READ,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>)"
	},
	{
		T_HD,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Read byte (repeat with :<num>) and print hexdump"
	},
	{
		T_WRITE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_ARG_UINT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write byte (repeat with :<num>)"
	},
	{
		T_ARG_STRING,
		.help = "Write string"
	},
	/* BP commands */
	{
		T_MINUS,
		.help = "Write one bit (D1)"
	},
	{
		T_UNDERSCORE,
		.help = "Write one bit (D0)"
	},
	{
		T_AMPERSAND,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 usec (repeat with :<num>)"
	},
	{
		T_PERCENT,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Delay 1 msec (repeat with :<num>)"
	},
	{
		T_TILDE,
		.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,
		.help = "Write a random byte (repeat with :<num>)"
	},
	{
		T_AUX_ON,
		.help = "Toggle AUX[0](PC4) high"
	},
	{
		T_AUX_OFF,
		.help = "Toggle AUX[0](PC4) low"
	},
	{
		T_AUX_READ,
		.help = "Read AUX[0](PC4)"
	},
	{
		T_EXIT,
		.help = "Exit wiegand mode"
	},
	{ }
};

t_token tokens_wiegand[] = {
	WIEGAND_PARAMETERS
	{ }
};

t_token tokens_adc[] = {
	{
		T_ADC1,
		.help = "ADC1 (PA1)"
	},
	{
		T_TEMPSENSOR,
		.help = "Temperature sensor"
	},
	{
		T_VREFINT,
		.help = "Internal reference voltage"
	},
	{
		T_VBAT,
		.help = "VBAT voltage"
	},
	{
		T_PERIOD,
		.arg_type = T_ARG_UINT,
		.help = "Delay between samples (msec)"
	},
	{
		T_SAMPLES,
		.arg_type = T_ARG_UINT,
		.help = "Number of samples"
	},
	{
		T_TRIGGER,
		.subtokens = tokens_mode_adc_trigger,
		.help = "Set trigger bounds"
	},
	{
		T_CONTINUOUS,
		.help = "Read continuously"
	},
	{ }
};

t_token tokens_dac[] = {
	{
		T_HELP,
		.arg_type = T_ARG_HELP,
		.help = "DAC1, DAC2 (12bits DAC 0 to 4095/3.3V)"
	},
	{
		T_DAC1,
		.help = "DAC1 (PA4 used by ULED)"
	},
	{
		T_DAC2,
		.help = "DAC2 (PA5)"
	},
	{
		T_RAW,
		.arg_type = T_ARG_UINT,
		.help = "Raw value <0 to 4095>"
	},
	{
		T_VOLT,
		.arg_type = T_ARG_FLOAT,
		.help = "Volt <0 to 3.3v>"
	},
	{
		T_TRIANGLE,
		.help = "Triangle output (5Hz and amplitude 3.3V)"
	},
	{
		T_NOISE,
		.help = "Noise output (amplitude 3.3V)"
	},
	{
		T_EXIT,
		.help = "Exit DAC mode (reinit DAC1&2 pins to safe mode/in)"
	},
	{ }
};

t_token tokens_pwm[] = {
	{
		T_HELP,
		.arg_type = T_ARG_HELP,
		.help = "PWM1 (PB11)"
	},
	{
		T_FREQUENCY,
		.arg_type = T_ARG_UINT,
		.help = "PWM frequency <value 1Hz to 42MHz>"
	},
	{
		T_DUTY_CYCLE,
		.arg_type = T_ARG_UINT,
		.help = "Duty Cycle in % <value 0 to 100>"
	},
	{
		T_EXIT,
		.help = "Exit PWM mode (reinit PWM1 pin to safe mode/in)"
	},
	{ }
};

t_token tokens_freq[] = {
	{
		T_HELP,
		T_SMARTCARD,
		.subtokens = tokens_smartcard,
		.help = "SMARTCARD mode",
		.help_full = "Configuration: smartcard [device (1/2)>\r\nInteraction: <read/write (value:repeat)>"
	},
	{
		T_DEBUG,
t_token tokens_really[] = {
	{ T_REALLY },
	{ }
};

t_token tokens_sd[] = {
	{
		T_SHOW,
		.help = "Show SD information"
	},
	{
		T_MOUNT,
		.help = "Mount SD card"
	},
	{
		T_UMOUNT,
		.help = "Unmount SD card"
	},
	{
		T_ERASE,
		.subtokens = tokens_really,
		.help = "Erase and reformat SD card"
	},
	{
		T_CD,
		.arg_type = T_ARG_STRING,
		.help = "Change SD card directory"
	},
	{
		T_PWD,
		.help = "Show current SD card directory"
	},
	{
		T_LS,
		.help = "List files on SD card"
	},
	{
		T_TESTPERF,
		.help = "Test SD card performance"
	},
	{
		T_CAT,
		.arg_type = T_ARG_STRING,
		.help = "Display (ASCII) file on SD card"
	},
	{
		T_HD,
		.arg_type = T_ARG_STRING,
		.help = "Hexdump file on SD card"
	},
	{
		T_RM,
		.arg_type = T_ARG_STRING,
		.help = "Remove file or directory"
	},
	{
		T_MKDIR,
		.arg_type = T_ARG_STRING,
		.help = "Create new directory"
	},
	{
		T_SCRIPT,
		.arg_type = T_ARG_STRING,
		.help = "Execute script from file"
	},
	{ }
};

t_token tokens_show[] = {
	{ T_SYSTEM },
	{ T_MEMORY },
	{ T_THREADS },
	{ T_SD },
	{ T_DEBUG },
	{ }
};

t_token tokens_debug[] = {
	{
		T_TOKENLINE,
		.help = "Tokenline dump for every command"
	},
	{
		T_TIMING,
		.help = "Mysterious timing function"
	},
	{
		T_DEBUG_TEST_RX,
		.help = "Test USB1 or 2 RX(read all data until UBTN+Key pressed)"
	},
	{
		T_ON,
		.help = "Enable"
	},
	{
		T_OFF,
		.help = "Disable"
	},
	{ }
};

t_token tokens_logging[] = {
	{
		T_SD,
		.arg_type = T_ARG_STRING,
		.help = "Log to file on SD card"
	},
	{
		T_ON,
		.help = "Start logging"
	},
	{
		T_OFF,
		.help = "Stop logging"
	},
	{ }
};

t_token tl_tokens[] = {
	{
		T_HELP,
		.arg_type = T_ARG_HELP,
		.help = "Available commands"
	},
	{
		T_HISTORY,
		.help = "Command history"
	},
	{
		T_CLEAR,
		.help = "Clear screen"
	},
	{
		T_SHOW,
		.subtokens = tokens_show,
		.help = "Show information"
	},
	{
		T_LOGGING,
		.subtokens = tokens_logging,
		.help = "Turn logging on or off"
	},
	{
		T_SD,
		.subtokens = tokens_sd,
		.help = "SD card management"
	},
	{
		T_ADC,
		.subtokens = tokens_adc,
		.help = "Read analog values",
		.help_full = "Usage: adc <adc1/tempsensor/vrefint/vbat> [period (nb ms)] [samples (nb sample)/continuous]"
	},
	{
		T_DAC,
		.subtokens = tokens_dac,
		.help = "Write analog values",
		.help_full = "Usage: dac <dac1/dac2> <raw (0 to 4095)/volt (0 to 3.3V)/triangle/noise> [exit]"
	},
	{
		T_PWM,
		.subtokens = tokens_pwm,
		.help = "Write PWM",
		.help_full = "Usage: pwm <frequency (1Hz to 42MHz)> [duty-cycle (0 to 100%)] [exit]"
	},
	{
		T_FREQUENCY,
		.subtokens = tokens_freq,
		.help = "Read frequency",
		.help_full = "Usage: frequency"
	},
	{
		T_GPIO,
		.subtokens = tokens_gpio,
		.help = "Get or set GPIO pins",
		.help_full = "Configuration: gpio <PA0-15, PB0-11, PC0-15, PA*> <mode (in/out/open-drain)> [pull (up/down/floating)]\r\nInteraction: gpio <PA0-15, PB0-11, PC0-15, PA*> [period (nb ms)] <read/continuous> or <on/off>"
	},
	{
		T_SPI,
		.subtokens = tokens_spi,
		.help = "SPI mode",
		.help_full = "Configuration: spi [device (1/2)] [pull (up/down/floating)] [mode (master/slave)] [frequency (value hz/khz/mhz)] [polarity 0/1] [phase 0/1] [msb-first/lsb-first]\r\nInteraction: [cs-on/cs-off] <read/write (value:repeat)> [exit]"
	},
	{
		T_I2C,
		.subtokens = tokens_i2c,
		.help = "I2C mode",
		.help_full = "Configuration: i2c [pull (up/down/floating)] [frequency (value hz/khz/mhz)]\r\nInteraction: [<start>] [<stop>] <read/write (value:repeat)>"
	},
	{
		T_ONEWIRE,
		.subtokens = tokens_onewire,
		.help = "1-wire mode"
	},
	{
		T_TWOWIRE,
		.subtokens = tokens_twowire,
		.help = "2-wire mode"
	},
	{
		T_THREEWIRE,
		.subtokens = tokens_threewire,
		.help = "3-wire mode"
	},
	{
		T_UART,
		.subtokens = tokens_uart,
		.help = "UART mode",
		.help_full = "Configuration: uart [device (1/2)] [speed (value in bauds)] [parity (none/even/odd)] [stop-bits (1/2)]\r\nInteraction: <read/write (value:repeat)>"
	},
#ifdef HYDRANFC
	{
		T_NFC,
		.subtokens = tokens_nfc,
		.help = "NFC mode"
	},
#endif
	{
		T_CAN,
		.subtokens = tokens_can,
		.help = "CAN mode"
	},
	{
		T_SUMP,
		.help = "SUMP mode"
	},
	{
		T_JTAG,
		.subtokens = tokens_jtag,
		.help = "JTAG mode"
	},
	{
		T_RNG,
		.help = "Random number"
	},
	{
		T_FLASH,
		.subtokens = tokens_flash,
		.help = "NAND flash mode"
	},
	{
		T_MMC,
		.subtokens = tokens_mmc,
		.help = "MMC/eMMC mode"
	},
	{
		T_WIEGAND,
		.subtokens = tokens_wiegand,
		.help = "Wiegand mode"
	},
	{
		T_LIN,
		.subtokens = tokens_lin,
		.help = "LIN mode",
		.help_full = "Configuration: lin [device (1/2)]\r\nInteraction: <read/write (value:repeat)>"
	},
	{
		T_SMARTCARD,
		.subtokens = tokens_smartcard,
		.help = "SMARTCARD mode",
		.help_full = "Configuration: smartcard\r\nInteraction: <read/write (value:repeat)>"
	},
	{
		T_DEBUG,
		.subtokens = tokens_debug,
		.help = "Debug mode"
	},
	{ }
};

#pragma GCC diagnostic pop


<MSG> Removed smartcard2

<DFF> @@ -509,11 +509,6 @@ t_token tokens_uart[] = {
 };
 
 #define SMARTCARD_PARAMETERS \
-	{\
-		T_DEVICE,\
-		.arg_type = T_ARG_UINT,\
-		.help = "SMARTCARD device (1/2)"\
-	},\
 	{\
 		T_SPEED,\
 		.arg_type = T_ARG_UINT,\
@@ -1961,7 +1956,7 @@ t_token tl_tokens[] = {
 		T_SMARTCARD,
 		.subtokens = tokens_smartcard,
 		.help = "SMARTCARD mode",
-		.help_full = "Configuration: smartcard [device (1/2)>\r\nInteraction: <read/write (value:repeat)>"
+		.help_full = "Configuration: smartcard\r\nInteraction: <read/write (value:repeat)>"
 	},
 	{
 		T_DEBUG,

{'commit': 'diff --git a/src/drv/stm32cube/bsp_smartcard.c b/src/drv/stm32cube/bsp_smartcard.c\nindex 5127b51..a39f4f1 100644\n--- a/src/drv/stm32cube/bsp_smartcard.c\n+++ b/src/drv/stm32cube/bsp_smartcard.c\n@@ -16,6 +16,7 @@ limitations under the License.\n #include "bsp_smartcard_conf.h"\n #include "stm32f405xx.h"\n #include "stm32f4xx_hal.h"\n+#include "bsp_gpio.h"\n \n /*\n Warning in order to use this driver all GPIOs peripherals shall be enabled.\n@@ -41,44 +42,25 @@ static volatile uint16_t dummy_read;\n */\n static void smartcard_gpio_hw_init(bsp_dev_smartcard_t dev_num)\n {\n+\t(void)dev_num;\n \tGPIO_InitTypeDef GPIO_InitStructure;\n \n-\tif(dev_num == BSP_DEV_SMARTCARD1) {\n-\t\t/* Enable the SMARTCARD peripheral */\n-\t\t__USART1_CLK_ENABLE();\n+\t/* Enable the SMARTCARD peripheral */\n+\t__USART1_CLK_ENABLE();\n \n-\t\tGPIO_InitStructure.Mode = GPIO_MODE_AF_OD;\n-\t\tGPIO_InitStructure.Pull  = GPIO_PULLUP;\n-\t\tGPIO_InitStructure.Speed = BSP_SMARTCARD1_GPIO_SPEED;\n+\tGPIO_InitStructure.Mode = GPIO_MODE_AF_OD;\n+\tGPIO_InitStructure.Pull  = GPIO_PULLUP;\n+\tGPIO_InitStructure.Speed = BSP_SMARTCARD1_GPIO_SPEED;\n \n-\t\t/* SMARTCARD1 TX pin configuration */\n-\t\tGPIO_InitStructure.Alternate = BSP_SMARTCARD1_AF;\n-\t\tGPIO_InitStructure.Pin = BSP_SMARTCARD1_TX_PIN;\n-\t\tHAL_GPIO_Init(BSP_SMARTCARD1_TX_PORT, &GPIO_InitStructure);\n-\n-\t\tGPIO_InitStructure.Mode = GPIO_MODE_AF_PP;\n-\t\t/* SMARTCARD1 RX pin configuration */\n-\t\tGPIO_InitStructure.Pin = BSP_SMARTCARD1_CLK_PIN;\n-\t\tHAL_GPIO_Init(BSP_SMARTCARD1_CLK_PORT, &GPIO_InitStructure);\n-\n-\t} else {\n-\t\t/* Enable the SMARTCARD peripheral */\n-\t\t__USART2_CLK_ENABLE();\n-\n-\t\tGPIO_InitStructure.Mode = GPIO_MODE_AF_OD;\n-\t\tGPIO_InitStructure.Pull  = GPIO_PULLUP;\n-\t\tGPIO_InitStructure.Speed = BSP_SMARTCARD2_GPIO_SPEED;\n-\n-\t\t/* SMARTCARD2 TX pin configuration */\n-\t\tGPIO_InitStructure.Alternate = BSP_SMARTCARD2_AF;\n-\t\tGPIO_InitStructure.Pin = BSP_SMARTCARD2_TX_PIN;\n-\t\tHAL_GPIO_Init(BSP_SMARTCARD2_TX_PORT, &GPIO_InitStructure);\n-\n-\t\t/* SMARTCARD2 RX pin configuration */\n-\t\tGPIO_InitStructure.Pin = BSP_SMARTCARD2_RX_PIN;\n-\t\tHAL_GPIO_Init(BSP_SMARTCARD2_RX_PORT, &GPIO_InitStructure);\n-\t}\n+\t/* SMARTCARD1 TX pin configuration */\n+\tGPIO_InitStructure.Alternate = BSP_SMARTCARD1_AF;\n+\tGPIO_InitStructure.Pin = BSP_SMARTCARD1_TX_PIN;\n+\tHAL_GPIO_Init(BSP_SMARTCARD1_TX_PORT, &GPIO_InitStructure);\n \n+\tGPIO_InitStructure.Mode = GPIO_MODE_AF_PP;\n+\t/* SMARTCARD1 RX pin configuration */\n+\tGPIO_InitStructure.Pin = BSP_SMARTCARD1_CLK_PIN;\n+\tHAL_GPIO_Init(BSP_SMARTCARD1_CLK_PORT, &GPIO_InitStructure);\n }\n \n /**\n@@ -92,23 +74,14 @@ static void smartcard_gpio_hw_init(bsp_dev_smartcard_t dev_num)\n */\n static void smartcard_gpio_hw_deinit(bsp_dev_smartcard_t dev_num)\n {\n-\tif(dev_num == BSP_DEV_SMARTCARD1) {\n-\t\t/* Reset peripherals */\n-\t\t__USART1_FORCE_RESET();\n-\t\t__USART1_RELEASE_RESET();\n-\n-\t\t/* Disable peripherals GPIO */\n-\t\tHAL_GPIO_DeInit(BSP_SMARTCARD1_TX_PORT, BSP_SMARTCARD1_TX_PIN);\n-\t\tHAL_GPIO_DeInit(BSP_SMARTCARD1_CLK_PORT, BSP_SMARTCARD1_CLK_PIN);\n-\t} else {\n-\t\t/* Reset peripherals */\n-\t\t__USART2_FORCE_RESET();\n-\t\t__USART2_RELEASE_RESET();\n-\n-\t\t/* Disable peripherals GPIO */\n-\t\tHAL_GPIO_DeInit(BSP_SMARTCARD2_TX_PORT, BSP_SMARTCARD2_TX_PIN);\n-\t\tHAL_GPIO_DeInit(BSP_SMARTCARD2_RX_PORT, BSP_SMARTCARD2_RX_PIN);\n-\t}\n+\t(void)dev_num;\n+\t/* Reset peripherals */\n+\t__USART1_FORCE_RESET();\n+\t__USART1_RELEASE_RESET();\n+\n+\t/* Disable peripherals GPIO */\n+\tHAL_GPIO_DeInit(BSP_SMARTCARD1_TX_PORT, BSP_SMARTCARD1_TX_PIN);\n+\tHAL_GPIO_DeInit(BSP_SMARTCARD1_CLK_PORT, BSP_SMARTCARD1_CLK_PIN);\n }\n \n /**\n@@ -142,11 +115,7 @@ bsp_status_t bsp_smartcard_init(bsp_dev_smartcard_t dev_num, mode_config_proto_t\n \n \t__HAL_SMARTCARD_RESET_HANDLE_STATE(hsmartcard);\n \n-\tif(dev_num == BSP_DEV_SMARTCARD1) {\n-\t\thsmartcard->Instance = BSP_SMARTCARD1;\n-\t} else { /* SMARTCARD2 */\n-\t\thsmartcard->Instance = BSP_SMARTCARD2;\n-\t}\n+\thsmartcard->Instance = BSP_SMARTCARD1;\n \thsmartcard->Init.BaudRate = mode_conf->config.smartcard.dev_speed;\n \n \tswitch(mode_conf->config.smartcard.dev_parity) {\ndiff --git a/src/drv/stm32cube/bsp_smartcard.h b/src/drv/stm32cube/bsp_smartcard.h\nindex 33eea05..eb3f81e 100644\n--- a/src/drv/stm32cube/bsp_smartcard.h\n+++ b/src/drv/stm32cube/bsp_smartcard.h\n@@ -20,8 +20,7 @@ limitations under the License.\n \n typedef enum {\n \tBSP_DEV_SMARTCARD1 = 0,\n-\tBSP_DEV_SMARTCARD2 = 1,\n-\tBSP_DEV_SMARTCARD_END = 2\n+\tBSP_DEV_SMARTCARD_END = 1\n } bsp_dev_smartcard_t;\n \n bsp_status_t bsp_smartcard_init(bsp_dev_smartcard_t dev_num, mode_config_proto_t* mode_conf);\ndiff --git a/src/drv/stm32cube/bsp_smartcard_conf.h b/src/drv/stm32cube/bsp_smartcard_conf.h\nindex 835edbf..0e61415 100644\n--- a/src/drv/stm32cube/bsp_smartcard_conf.h\n+++ b/src/drv/stm32cube/bsp_smartcard_conf.h\n@@ -16,26 +16,15 @@ limitations under the License.\n #ifndef _BSP_SMARTCARD_CONF_H_\n #define _BSP_SMARTCARD_CONF_H_\n \n-/* UART1 */\n+/* SMARTCARD1 */\n #define BSP_SMARTCARD1             USART1\n #define BSP_SMARTCARD1_GPIO_SPEED  GPIO_SPEED_FAST\n #define BSP_SMARTCARD1_AF          GPIO_AF7_USART1\n-/* UART1 TX */\n+/* SMARTCARD1 TX */\n #define BSP_SMARTCARD1_TX_PORT     GPIOA\n #define BSP_SMARTCARD1_TX_PIN      GPIO_PIN_9  /* PA.09 */\n-/* UART1 RX */\n-#define BSP_SMARTCARD1_CLK_PORT     GPIOA\n-#define BSP_SMARTCARD1_CLK_PIN      GPIO_PIN_8  /* PA.10 */\n-\n-/* UART2 */\n-#define BSP_SMARTCARD2              USART2\n-#define BSP_SMARTCARD2_GPIO_SPEED   GPIO_SPEED_FAST\n-#define BSP_SMARTCARD2_AF           GPIO_AF7_USART2\n-/* UART2 TX */\n-#define BSP_SMARTCARD2_TX_PORT     GPIOA\n-#define BSP_SMARTCARD2_TX_PIN      GPIO_PIN_2 /* PA.02 */\n-/* UART2 RX */\n-#define BSP_SMARTCARD2_RX_PORT     GPIOA\n-#define BSP_SMARTCARD2_RX_PIN      GPIO_PIN_3 /* PA.03 */\n+/* SMARTCARD1 CLK */\n+#define BSP_SMARTCARD1_CLK_PORT    GPIOA\n+#define BSP_SMARTCARD1_CLK_PIN     GPIO_PIN_8  /* PA.10 */\n \n #endif /* _BSP_SMARTCARD_CONF_H_ */\ndiff --git a/src/hydrabus/commands.c b/src/hydrabus/commands.c\nindex ab1bd81..8f603ea 100644\n--- a/src/hydrabus/commands.c\n+++ b/src/hydrabus/commands.c\n@@ -509,11 +509,6 @@ t_token tokens_uart[] = {\n };\n \n #define SMARTCARD_PARAMETERS \\\n-\t{\\\n-\t\tT_DEVICE,\\\n-\t\t.arg_type = T_ARG_UINT,\\\n-\t\t.help = "SMARTCARD device (1/2)"\\\n-\t},\\\n \t{\\\n \t\tT_SPEED,\\\n \t\t.arg_type = T_ARG_UINT,\\\n@@ -1961,7 +1956,7 @@ t_token tl_tokens[] = {\n \t\tT_SMARTCARD,\n \t\t.subtokens = tokens_smartcard,\n \t\t.help = "SMARTCARD mode",\n-\t\t.help_full = "Configuration: smartcard [device (1/2)>\\r\\nInteraction: <read/write (value:repeat)>"\n+\t\t.help_full = "Configuration: smartcard\\r\\nInteraction: <read/write (value:repeat)>"\n \t},\n \t{\n \t\tT_DEBUG,\n', 'commit_subject': 'Removed smartcard2', 'repo_name': 'hydrabus/hydrafw', 'committer': {'name': 'Baldanos', 'email': '8ebbe8906c34812f994f8f7527958feeabac7f13@balda.ch', 'time_sec': '1542921724', 'tz_offset': '60', 'date': {'seconds': '1542921724'}}, 'commit_tree': '14a44caa65d90b276a1b51ccf0fc815f7509a37b', 'commit_message': 'Removed smartcard2\n', 'language_name': 'Python', 'license': 'apache-2.0', 'hunks': '@@ -509,11 +509,6 @@ t_token tokens_uart[] = {\n };\n \n #define SMARTCARD_PARAMETERS \\\n-\t{\\\n-\t\tT_DEVICE,\\\n-\t\t.arg_type = T_ARG_UINT,\\\n-\t\t.help = "SMARTCARD device (1/2)"\\\n-\t},\\\n \t{\\\n \t\tT_SPEED,\\\n \t\t.arg_type = T_ARG_UINT,\\\n@@ -1961,7 +1956,7 @@ t_token tl_tokens[] = {\n \t\tT_SMARTCARD,\n \t\t.subtokens = tokens_smartcard,\n \t\t.help = "SMARTCARD mode",\n-\t\t.help_full = "Configuration: smartcard [device (1/2)>\\r\\nInteraction: <read/write (value:repeat)>"\n+\t\t.help_full = "Configuration: smartcard\\r\\nInteraction: <read/write (value:repeat)>"\n \t},\n \t{\n \t\tT_DEBUG,\n', 'addition_count': 1, 'deletion_count': 6, 'src_file': 'a/src/hydrabus/commands.c', 'tgt_file': 'b/src/hydrabus/commands.c', 'file_extension': '.c', 'before_file': '/*\n * HydraBus/HydraNFC\n *\n * Copyright (C) 2014 Bert Vermeulen <bert@biot.com>\n * Copyright (C) 2014-2017 Benjamin VERNOUX\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include "tokenline.h"\n#include "commands.h"\n\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored "-Wmissing-field-initializers"\n\n/* Developer warning keep this list synchronized with same number of items and same items order as commands.h => enum */\nconst t_token_dict tl_dict[] = {\n\t{ /* Dummy entry */ },\n\t{ T_HELP, "help" },\n\t{ T_HISTORY, "history" },\n\t{ T_EXIT, "exit" },\n\t{ T_CLEAR, "clear" },\n\t{ T_DEBUG, "debug" },\n\t{ T_SHOW, "show" },\n\t{ T_SYSTEM, "system" },\n\t{ T_MEMORY, "memory" },\n\t{ T_THREADS, "threads" },\n\t{ T_SD, "sd" },\n\t{ T_MOUNT, "mount" },\n\t{ T_UMOUNT, "umount" },\n\t{ T_CD, "cd" },\n\t{ T_PWD, "pwd" },\n\t{ T_LS, "ls" },\n\t{ T_CAT, "cat" },\n\t{ T_HD, "hd" },\n\t{ T_ERASE, "erase" },\n\t{ T_REALLY, "really" },\n\t{ T_TESTPERF, "test-perf" },\n\t{ T_MODE, "mode" },\n\t{ T_SPI, "spi" },\n\t{ T_I2C, "i2c" },\n\t{ T_DEVICE, "device" },\n\t{ T_MASTER, "master" },\n\t{ T_SLAVE, "slave" },\n\t{ T_FREQUENCY, "frequency" },\n\t{ T_POLARITY, "polarity" },\n\t{ T_PHASE, "phase" },\n\t{ T_MSB_FIRST, "msb-first" },\n\t{ T_LSB_FIRST, "lsb-first" },\n\t{ T_PULL, "pull" },\n\t{ T_UP, "up" },\n\t{ T_DOWN, "down" },\n\t{ T_FLOATING, "floating" },\n\t{ T_ON, "on" },\n\t{ T_OFF, "off" },\n\t{ T_CS_ON, "cs-on" },\n\t{ T_CS_OFF, "cs-off" },\n\t{ T_PINS, "pins" },\n\t{ T_READ, "read" },\n\t{ T_WRITE, "write" },\n\t{ T_START, "start" },\n\t{ T_STOP, "stop" },\n\t{ T_UART, "uart" },\n\t{ T_SPEED, "speed" },\n\t{ T_PARITY, "parity" },\n\t{ T_NONE, "none" },\n\t{ T_EVEN, "even" },\n\t{ T_ODD, "odd" },\n\t{ T_STOP_BITS, "stop-bits" },\n\t{ T_ADC, "adc" },\n\t{ T_ADC1, "adc1" },\n\t{ T_TEMPSENSOR, "tempsensor" },\n\t{ T_VREFINT, "vrefint" },\n\t{ T_VBAT, "vbat" },\n\t{ T_SAMPLES, "samples" },\n\t{ T_PERIOD, "period" },\n\t{ T_CONTINUOUS, "continuous" },\n\t{ T_SCAN, "scan" },\n#ifdef HYDRANFC\n\t{ T_NFC, "nfc" },\n\t{ T_TYPEA, "typea" },\n\t{ T_VICINITY, "vicinity" },\n\t{ T_EMUL_MIFARE, "emul-mifare" },\n\t{ T_EMUL_ISO14443A, "emul-3a" },\n\t{ T_REGISTERS, "registers" },\n\t{ T_READ_MF_ULTRALIGHT, "read-mf-ul" },\n\t{ T_EMUL_MF_ULTRALIGHT, "emul-mf-ul" },\n\t{ T_CLONE_MF_ULTRALIGHT, "clone-mf-ul" },\n\t{ T_TRACE_UART1, "trace-uart1" },\n\t{ T_FRAME_TIME, "frame-time" },\n\t{ T_PCAP, "pcap" },\n\t{ T_BIN, "bin" },\n\t{ T_DIRECT_MODE_0, "dm0" },\n\t{ T_DIRECT_MODE_1, "dm1" },\n#endif\n\t{ T_SNIFF, "sniff" },\n\t{ T_GPIO, "gpio" },\n\t{ T_IN, "in" },\n\t{ T_OUT, "out" },\n\t{ T_OPEN_DRAIN, "open-drain" },\n\t{ T_TOKENLINE, "tokenline" },\n\t{ T_TIMING, "timing" },\n\t{ T_DEBUG_TEST_RX, "test-rx" },\n\t{ T_RM, "rm" },\n\t{ T_MKDIR, "mkdir" },\n\t{ T_LOGGING, "logging" },\n\t{ T_DAC, "dac" },\n\t{ T_DAC1, "dac1" },\n\t{ T_DAC2, "dac2" },\n\t{ T_RAW, "raw" },\n\t{ T_VOLT, "volt" },\n\t{ T_TRIANGLE, "triangle" },\n\t{ T_NOISE, "noise" },\n\t{ T_PWM, "pwm" },\n\t{ T_DUTY_CYCLE, "duty-cycle" },\n\t{ T_BRIDGE, "bridge" },\n\t{ T_SUMP, "sump" },\n\t{ T_JTAG, "jtag" },\n\t{ T_TCK, "tck" },\n\t{ T_TMS, "tms" },\n\t{ T_TDI, "tdi" },\n\t{ T_TDO, "tdo" },\n\t{ T_TRST, "trst" },\n\t{ T_QUERY, "query" },\n\t{ T_BRUTE, "brute" },\n\t{ T_BYPASS, "bypass" },\n\t{ T_IDCODE, "idcode" },\n\t{ T_OOCD, "openocd" },\n\t{ T_RNG, "random" },\n\t{ T_TWOWIRE, "2-wire" },\n\t{ T_CAN, "can" },\n\t{ T_ID, "id" },\n\t{ T_MASK, "mask" },\n\t{ T_FILTER, "filter" },\n\t{ T_LOW, "low" },\n\t{ T_HIGH, "high" },\n\t{ T_THREEWIRE, "3-wire" },\n\t{ T_SCRIPT, "script" },\n\t{ T_FILE, "filename" },\n\t{ T_ONEWIRE, "1-wire" },\n\t{ T_FLASH, "flash" },\n\t{ T_TRIGGER, "trigger" },\n\t{ T_SLCAN, "slcan" },\n\t{ T_TS1, "ts1" },\n\t{ T_TS2, "ts2" },\n\t{ T_SJW, "sjw" },\n\t{ T_WIEGAND, "wiegand" },\n\t{ T_LIN, "lin" },\n\t{ T_SMARTCARD, "smartcard" },\n\t{ T_ATR, "atr" },\n\t{ T_GUARDTIME, "guardtime" },\n\t{ T_PRESCALER, "prescaler" },\n\t{ T_CONVENTION, "convention" },\n\t{ T_DELAY, "delay" },\n\t{ T_MMC, "mmc" },\n\t/* Developer warning add new command(s) here */\n\n\t/* BP-compatible commands */\n\t{ T_LEFT_SQ, "[" },\n\t{ T_RIGHT_SQ, "]" },\n\t{ T_LEFT_CURLY, "{" },\n\t{ T_RIGHT_CURLY, "}" },\n\t{ T_SLASH, "/" },\n\t{ T_BACKSLASH, "\\\\" },\n\t{ T_MINUS, "-" },\n\t{ T_UNDERSCORE, "_" },\n\t{ T_EXCLAMATION, "!" },\n\t{ T_CARET, "^" },\n\t{ T_DOT, "." },\n\t{ T_AMPERSAND, "&" },\n\t{ T_PERCENT, "%" },\n\t{ T_TILDE, "~" },\n\t{ T_AUX_OFF, "a" },\n\t{ T_AUX_ON, "A" },\n\t{ T_AUX_READ, "@" },\n\t{ }\n};\n\nt_token tokens_on_off[] = {\n\t{ T_ON },\n\t{ T_OFF },\n\t{ }\n};\n\nt_token tokens_master_slave[] = {\n\t{ T_MASTER },\n\t{ T_SLAVE },\n\t{ }\n};\n\nt_token tokens_gpio_pull[] = {\n\t{\n\t\tT_UP,\n\t\t.help = "Pull up"\n\t},\n\t{\n\t\tT_DOWN,\n\t\t.help = "Pull down"\n\t},\n\t{\n\t\tT_FLOATING,\n\t\t.help = "Floating (default)"\n\t},\n\t{ }\n};\n\nt_token tokens_mode_show[] = {\n\t{\n\t\tT_PINS,\n\t\t.help = "Show pins used in this mode"\n\t},\n\t{ }\n};\n\nt_token tokens_mode_can_show[] = {\n\t{\n\t\tT_PINS,\n\t\t.help = "Show pins used in this mode"\n\t},\n\t{\n\t\tT_FILTER,\n\t\t.help = "Show CAN filter"\n\t},\n\t{ }\n};\n\nt_token tokens_mode_brute[] = {\n\t{\n\t\tT_BYPASS,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "Performs a BYPASS scan on n pins"\n\t},\n\t{\n\t\tT_IDCODE,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "Performs an IDCODE scan on n pins"\n\t},\n\t{ }\n};\n\nt_token tokens_mode_can_filter[] = {\n\t{\n\t\tT_ON,\n\t\t.help = "Enable filter"\n\t},\n\t{\n\t\tT_OFF,\n\t\t.help = "Disable filter"\n\t},\n\t{\n\t\tT_ID,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "Filter value"\n\t},\n\t{\n\t\tT_MASK,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "Filter mask"\n\t},\n\t{ }\n};\n\nt_token tokens_mode_adc_trigger[] = {\n\t{\n\t\tT_LOW,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "ADC trigger lower bound"\n\t},\n\t{\n\t\tT_HIGH,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "ADC trigger higher bound"\n\t},\n\t{\n\t\tT_DELAY,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "ADC trigger delay (uS)"\n\t},\n\t{\n\t\tT_START,\n\t\t.help = "Start trigger"\n\t},\n\t{ }\n};\n\nt_token tokens_mode_trigger[] = {\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_mode_show,\n\t\t.help = "Show trigger parameters"\n\t},\n\t{\n\t\tT_FILTER,\n\t\t.arg_type = T_ARG_STRING,\n\t\t.help = "Trigger data"\n\t},\n\t{\n\t\tT_START,\n\t\t.help = "Arm the trigger"\n\t},\n\t{ }\n};\n\n#ifdef HYDRANFC\n\nt_token tokens_mode_nfc_show[] = {\n\t{\n\t\tT_REGISTERS,\n\t\t.help = "Show NFC registers"\n\t},\n\t{ }\n};\n\nt_token tokens_mode_nfc_scan[] = {\n\t{\n\t\tT_PERIOD,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "Delay between scans (msec)"\n\t},\n\t{\n\t\tT_CONTINUOUS,\n\t\t.help = "Scan until interrupted"\n\t},\n\t{ }\n};\n\nt_token tokens_mode_nfc_emul_mf_ul[] = {\n\t{\n\t\tT_FILE,\n\t\t.arg_type = T_ARG_STRING,\n\t\t.help = "microSD filename"\n\t},\n\t{ }\n};\n\nt_token tokens_mode_nfc_sniff[] = {\n\t{\n\t\tT_TRACE_UART1,\n\t\t.help = "Output realtime sniff trace on UART1(PA9@8.4Mbauds 8N1)"\n\t},\n\t{\n\t\tT_BIN,\n\t\t.help = "Force binary sniff trace(UART1 only)"\n\t},\n\t{\n\t\tT_RAW,\n\t\t.help = "Enable binary raw sniff trace(ISO14443A/B)(UART1 only)"\n\t},\n\t{\n\t\tT_PARITY,\n\t\t.help = "Add parity bit information in binary sniff trace(UART1 only)"\n\t},\n\t{\n\t\tT_FRAME_TIME,\n\t\t.help = "Add start/end frame timestamp(in CPU cycles)"\n\t},\n\t{\n\t\tT_PCAP,\n\t\t.help = "Save output file in Wireshark PCAP format"\n\t},\n\t{ }\n};\n\n#define NFC_PARAMETERS \\\n\t{\\\n\t\tT_TYPEA,\\\n\t\t.help = "TypeA (ISO14443A => MIFARE...)"\\\n\t},\\\n\t{\\\n\t\tT_VICINITY,\\\n\t\t.help = "Vicinity (ISO/IEC 15693)"\\\n\t},\\\n\t{\\\n\t\tT_SCAN,\\\n\t\t.subtokens = tokens_mode_nfc_scan,\\\n\t\t.help = "Scan"\\\n\t},\\\n\t{\\\n\t\tT_READ_MF_ULTRALIGHT,\\\n\t\t.arg_type = T_ARG_STRING,\\\n\t\t.help = "Read Mifare UltraLight write to microSD"\\\n\t},\\\n\t{\\\n\t\tT_EMUL_MF_ULTRALIGHT,\\\n\t\t.subtokens = tokens_mode_nfc_emul_mf_ul,\\\n\t\t.help = "Emul Tag Mifare Ultralight (optional read from microSD)"\\\n\t},\\\n\t{\\\n\t\tT_CLONE_MF_ULTRALIGHT,\\\n\t\t.help = "Clone Mifare UltraLight"\\\n\t},\\\n\t{\\\n\t\tT_SNIFF,\\\n\t\t.subtokens = tokens_mode_nfc_sniff,\\\n\t\t.help = "Sniff (default ISO14443A see options for more details)"\\\n\t},\\\n\t{\\\n\t\tT_EMUL_MIFARE,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "Emul Tag Mifare UID (uid)"\\\n\t},\\\n\t{\\\n\t\tT_EMUL_ISO14443A,\\\n\t\t.help = "Emul Tag ISO14443A SDD UID"\\\n\t},\\\n\t{\\\n\t\tT_DIRECT_MODE_0,\\\n\t\t.help = "Enter Direct Mode 0 (IO6/PC2=subcarrier)"\\\n\t},\\\n\t{\\\n\t\tT_DIRECT_MODE_1,\\\n\t\t.help = "Enter Direct Mode 1 (IO5/PC4=CLK, IO6/PC2=Data)"\\\n\t},\n\nt_token tokens_sd[];\nt_token tokens_mode_nfc[] = {\n\t{\n\t\tT_SD,\n\t\t.subtokens = tokens_sd,\n\t\t.help = "SD card management"\n\t},\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_mode_nfc_show,\n\t\t.help = "Show NFC parameters"\n\t},\n\tNFC_PARAMETERS\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit NFC mode"\n\t},\n\t{ }\n};\n\nt_token tokens_nfc[] = {\n\tNFC_PARAMETERS\n\t{ }\n};\n#endif /* ifdef HYDRANFC */\n\nt_token tokens_parity[] = {\n\t{ T_NONE },\n\t{ T_EVEN },\n\t{ T_ODD },\n};\n\n#define UART_PARAMETERS \\\n\t{\\\n\t\tT_DEVICE,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "UART device (1/2)"\\\n\t},\\\n\t{\\\n\t\tT_SPEED,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "Bus bitrate"\\\n\t},\\\n\t{\\\n\t\tT_PARITY,\\\n\t\t.arg_type = T_ARG_TOKEN,\\\n\t\t.subtokens = tokens_parity,\\\n\t\t.help = "Parity (none/even/odd)"\\\n\t},\\\n\t{\\\n\t\tT_STOP_BITS,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "Stop bits (1/2)"\\\n\t},\n\nt_token tokens_mode_uart[] = {\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_mode_show,\n\t\t.help = "Show UART parameters"\n\t},\n\t{\n\t\tT_TRIGGER,\n\t\t.subtokens = tokens_mode_trigger,\n\t\t.help = "Setup UART trigger"\n\t},\n\tUART_PARAMETERS\n\t/* UART-specific commands */\n\t{\n\t\tT_READ,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_HD,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>) and print hexdump"\n\t},\n\t{\n\t\tT_WRITE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n};\n\n#define SMARTCARD_PARAMETERS \\\n\t{\\\n\t\tT_DEVICE,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "SMARTCARD device (1/2)"\\\n\t},\\\n\t{\\\n\t\tT_SPEED,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "Write string"\n\t},\n\t/* BP commands */\n\t{\n\t\tT_AMPERSAND,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 usec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_PERCENT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 msec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_TILDE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write a random byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_AUX_ON,\n\t\t.help = "Toggle AUX[0](PC4) high"\n\t},\n\t{\n\t\tT_AUX_OFF,\n\t\t.help = "Toggle AUX[0](PC4) low"\n\t},\n\t{\n\t\tT_AUX_READ,\n\t\t.help = "Read AUX[0](PC4)"\n\t},\n\t{\n\t\tT_BRIDGE,\n\t\t.help = "UART bridge mode"\n\t},\n\t{\n\t\tT_SCAN,\n\t\t.help = "Measure baudrate (PC6)"\n\t},\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit UART mode"\n\t},\n\t{ }\n};\n\nt_token tokens_uart[] = {\n\tUART_PARAMETERS\n\t{ }\n};\n\n#define SMARTCARD_PARAMETERS \\\n\t{\\\n\t\tT_SPEED,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "Bus bitrate"\\\n\t},\\\n\t{\\\n\t\tT_PARITY,\\\n\t\t.arg_type = T_ARG_TOKEN,\\\n\t\t.subtokens = tokens_parity,\\\n\t\t.help = "Parity (even/odd)"\\\n\t},\\\n\t{\\\n\t\tT_POLARITY,\\\n\t\t.arg_type = T_ARG_UINT, \\\n\t\t.help = "Clock polarity (0/1)"\\\n\t},\\\n\t{\\\n\t\tT_PHASE,\\\n\t\t.arg_type = T_ARG_UINT, \\\n\t\t.help = "Clock phase (0/1)"\\\n\t},\\\n\t{\\\n\t\tT_STOP_BITS,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "Stop bits (0/1)"\\\n\t},\\\n\t{\\\n\t\tT_GUARDTIME,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "Guardtime value"\\\n\t},\\\n\t{\\\n\t\tT_PRESCALER,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "Prescaler value"\\\n\t},\\\n\t{\\\n\t\tT_CONVENTION,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "Communication convention",\\\n\t\t.help_full = "Set communication convention (0=normal, 1=inverse)"\\\n\t},\n\nt_token tokens_mode_smartcard[] = {\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_mode_show,\n\t\t.help = "Show SMARTCARD parameters"\n\t},\n\t{\n\t\tT_TRIGGER,\n\t\t.subtokens = tokens_mode_trigger,\n\t\t.help = "Setup SMARTCARD trigger"\n\t},\n\tSMARTCARD_PARAMETERS\n\t/* SMARTCARD-specific commands */\n\t{\n\t\tT_READ,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_HD,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>) and print hexdump"\n\t},\n\t{\n\t\tT_WRITE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_UINT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_STRING,\n\t\t.help = "Write string"\n\t},\n\t{\n\t\tT_QUERY,\n\t\t.help = "Get OFF port value (card inserted)"\n\t},\n\t{\n\t\tT_ATR,\n\t\t.help = "Read card ATR"\n\t},\n\t/* BP commands */\n\t{\n\t\tT_LEFT_SQ,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Toggle RST pin high"\n\t},\n\t{\n\t\tT_RIGHT_SQ,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Toggle RST pin low"\n\t},\n\t{\n\t\tT_MINUS,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Toggle CMDVCC pin high"\n\t},\n\t{\n\t\tT_UNDERSCORE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Toggle CMDVCC pin low"\n\t},\n\t{\n\t\tT_AMPERSAND,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 usec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_PERCENT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 msec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_TILDE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write a random byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_AUX_ON,\n\t\t.help = "Toggle AUX[0](PC4) high"\n\t},\n\t{\n\t\tT_AUX_OFF,\n\t\t.help = "Toggle AUX[0](PC4) low"\n\t},\n\t{\n\t\tT_AUX_READ,\n\t\t.help = "Read AUX[0](PC4)"\n\t},\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit SMARTCARD mode"\n\t},\n\t{ }\n};\n\nt_token tokens_smartcard[] = {\n\tSMARTCARD_PARAMETERS\n\t{ }\n};\n\n#define LIN_PARAMETERS \\\n\t{\\\n\t\tT_DEVICE,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "LIN device (1/2)"\\\n\t},\\\n\nt_token tokens_mode_lin[] = {\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_mode_show,\n\t\t.help = "Show LIN parameters"\n\t},\n\t{\n\t\tT_TRIGGER,\n\t\t.subtokens = tokens_mode_trigger,\n\t\t.help = "Setup LIN trigger"\n\t},\n\tLIN_PARAMETERS\n\t/* LIN-specific commands */\n\t{\n\t\tT_READ,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_HD,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>) and print hexdump"\n\t},\n\t{\n\t\tT_WRITE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_UINT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_STRING,\n\t\t.help = "Write string"\n\t},\n\t/* BP commands */\n\t{\n\t\tT_LEFT_SQ,\n\t\t.help = "Send a LIN break"\n\t},\n\t{\n\t\tT_AMPERSAND,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 usec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_PERCENT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 msec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_TILDE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write a random byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_AUX_ON,\n\t\t.help = "Toggle AUX[0](PC4) high"\n\t},\n\t{\n\t\tT_AUX_OFF,\n\t\t.help = "Toggle AUX[0](PC4) low"\n\t},\n\t{\n\t\tT_AUX_READ,\n\t\t.help = "Read AUX[0](PC4)"\n\t},\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit LIN mode"\n\t},\n\t{ }\n};\n\nt_token tokens_lin[] = {\n\tLIN_PARAMETERS\n\t{ }\n};\n\n#define CAN_PARAMETERS \\\n\t{\\\n\t\tT_DEVICE,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "CAN device (1/2)"\\\n\t},\\\n\t{\\\n\t\tT_SPEED,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "Bus bitrate"\\\n\t},\\\n\t{\\\n\t\tT_TS1,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "Time segment 1 value (1-16)"\\\n\t},\\\n\t{\\\n\t\tT_TS2,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "Time segment 2 value (1-8)"\\\n\t},\\\n\t{\\\n\t\tT_SJW,\\\n\t\t.arg_type = T_ARG_UINT,\\\n\t\t.help = "Resynchronisation jump width (1-4)"\\\n\t},\n\nt_token tokens_mode_can[] = {\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_mode_can_show,\n\t\t.help = "Show CAN parameters"\n\t},\n\tCAN_PARAMETERS\n\t/* CAN-specific commands */\n\t{\n\t\tT_READ,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read packet (repeat with :<num>)"\n\t},\n\t{\n\t\tT_CONTINUOUS,\n\t\t.help = "Read continuously"\n\t},\n\t{\n\t\tT_WRITE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write packet (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ID,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Change next frame ID"\n\t},\n\t{\n\t\tT_FILTER,\n\t\t.subtokens = tokens_mode_can_filter,\n\t\t.help = "Set input filter"\n\t},\n\t{\n\t\tT_ARG_UINT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write packets (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_STRING,\n\t\t.help = "Write string"\n\t},\n\t/* BP commands */\n\t{\n\t\tT_TILDE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write a random byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_AUX_ON,\n\t\t.help = "Toggle AUX[0](PC4) high"\n\t},\n\t{\n\t\tT_AUX_OFF,\n\t\t.help = "Toggle AUX[0](PC4) low"\n\t},\n\t{\n\t\tT_AUX_READ,\n\t\t.help = "Read AUX[0](PC4)"\n\t},\n\t{\n\t\tT_SLCAN,\n\t\t.help = "slcan (LAWICEL) mode"\n\t},\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit CAN mode"\n\t},\n\t{ }\n};\n\nt_token tokens_can[] = {\n\tCAN_PARAMETERS\n\t{ }\n};\n\n#define I2C_PARAMETERS \\\n\t{\\\n\t\tT_PULL,\\\n\t\t.arg_type = T_ARG_TOKEN,\\\n\t\t.subtokens = tokens_gpio_pull,\\\n\t\t.help = "GPIO pull (up/down/floating)"\\\n\t},\\\n\t{\\\n\t\tT_FREQUENCY,\\\n\t\t.arg_type = T_ARG_FLOAT,\\\n\t\t.help = "Bus frequency"\\\n\t},\n\nt_token tokens_mode_i2c[] = {\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_mode_show,\n\t\t.help = "Show I2C parameters"\n\t},\n\t{\n\t\tT_TRIGGER,\n\t\t.subtokens = tokens_mode_trigger,\n\t\t.help = "Setup I2C trigger"\n\t},\n\tI2C_PARAMETERS\n\t/* I2C-specific commands */\n\t{\n\t\tT_SCAN,\n\t\t.help = "Scan for connected devices"\n\t},\n\t{\n\t\tT_SNIFF,\n\t\t.help = "Sniff I2C bus"\n\t},\n\t{\n\t\tT_START,\n\t\t.help = "Start"\n\t},\n\t{\n\t\tT_STOP,\n\t\t.help = "Stop"\n\t},\n\t{\n\t\tT_READ,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_HD,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>) and print hexdump"\n\t},\n\t{\n\t\tT_WRITE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_UINT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_STRING,\n\t\t.help = "Write string"\n\t},\n\t/* BP commands */\n\t{\n\t\tT_LEFT_SQ,\n\t\t.help = "Alias for \\"start\\""\n\t},\n\t{\n\t\tT_RIGHT_SQ,\n\t\t.help = "Alias for \\"stop\\""\n\t},\n\t{\n\t\tT_AMPERSAND,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 usec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_PERCENT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 msec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_TILDE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write a random byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_AUX_ON,\n\t\t.help = "Toggle AUX[0](PC4) high"\n\t},\n\t{\n\t\tT_AUX_OFF,\n\t\t.help = "Toggle AUX[0](PC4) low"\n\t},\n\t{\n\t\tT_AUX_READ,\n\t\t.help = "Read AUX[0](PC4)"\n\t},\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit I2C mode"\n\t},\n\t{ }\n};\n\nt_token tokens_i2c[] = {\n\tI2C_PARAMETERS\n\t{ }\n};\n\n#define SPI_PARAMETERS \\\n\t{ T_DEVICE, \\\n\t\t.arg_type = T_ARG_UINT, \\\n\t\t.help = "SPI device (1/2)" }, \\\n\t{ T_PULL, \\\n\t\t.arg_type = T_ARG_TOKEN, \\\n\t\t.subtokens = tokens_gpio_pull, \\\n\t\t.help = "GPIO pull (up/down/floating)" }, \\\n\t{ T_MODE, \\\n\t\t.arg_type = T_ARG_TOKEN, \\\n\t\t.subtokens = tokens_master_slave, \\\n\t\t\t.help = "Mode (master/slave)" }, \\\n\t{ T_FREQUENCY, \\\n\t\t.arg_type = T_ARG_FLOAT, \\\n\t\t.help = "Bus frequency" }, \\\n\t{ T_POLARITY, \\\n\t\t.arg_type = T_ARG_UINT, \\\n\t\t.help = "Clock polarity (0/1)" }, \\\n\t{ T_PHASE, \\\n\t\t.arg_type = T_ARG_UINT, \\\n\t\t.help = "Clock phase (0/1)" }, \\\n\t{ T_MSB_FIRST, \\\n\t\t.help = "Send/receive MSB first" }, \\\n\t{ T_LSB_FIRST, \\\n\t\t.help = "Send/receive LSB first" },\n\nt_token tokens_mode_spi[] = {\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_mode_show,\n\t\t.help = "Show SPI parameters"\n\t},\n\t{\n\t\tT_TRIGGER,\n\t\t.subtokens = tokens_mode_trigger,\n\t\t.help = "Setup SPI trigger"\n\t},\n\tSPI_PARAMETERS\n\t/* SPI-specific commands */\n\t{\n\t\tT_READ,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_HD,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>) and print hexdump"\n\t},\n\t{\n\t\tT_WRITE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_UINT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_STRING,\n\t\t.help = "Write string"\n\t},\n\t{\n\t\tT_CS_ON,\n\t\t.help = "Alias for \\"chip-select on\\""\n\t},\n\t{\n\t\tT_CS_OFF,\n\t\t.help = "Alias for \\"chip-select off\\""\n\t},\n\t/* BP commands */\n\t{\n\t\tT_LEFT_SQ,\n\t\t.help = "Alias for \\"chip-select on\\""\n\t},\n\t{\n\t\tT_RIGHT_SQ,\n\t\t.help = "Alias for \\"chip-select off\\""\n\t},\n\t{\n\t\tT_AMPERSAND,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 usec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_PERCENT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 msec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_TILDE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write a random byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_AUX_ON,\n\t\t.help = "Toggle AUX[0](PC4) high"\n\t},\n\t{\n\t\tT_AUX_OFF,\n\t\t.help = "Toggle AUX[0](PC4) low"\n\t},\n\t{\n\t\tT_AUX_READ,\n\t\t.help = "Read AUX[0](PC4)"\n\t},\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit SPI mode"\n\t},\n\t{ }\n};\n\nt_token tokens_spi[] = {\n\tSPI_PARAMETERS\n\t{ }\n};\n\n#define JTAG_PARAMETERS \\\n\t{ T_PULL, \\\n\t\t.arg_type = T_ARG_TOKEN, \\\n\t\t.subtokens = tokens_gpio_pull, \\\n\t\t.help = "GPIO pull (up/down/floating)" }, \\\n\t{ T_MSB_FIRST, \\\n\t\t.help = "Send/receive MSB first" }, \\\n\t{ T_LSB_FIRST, \\\n\t\t.help = "Send/receive LSB first" },\n\nt_token tokens_mode_jtag[] = {\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_mode_show,\n\t\t.help = "Show JTAG parameters"\n\t},\n\tJTAG_PARAMETERS\n\t/* JTAG-specific commands */\n\t{\n\t\tT_READ,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_WRITE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_FREQUENCY,\n\t\t.arg_type = T_ARG_FLOAT,\n\t\t.help = "Bus frequency"\n\t},\n\t{\n\t\tT_ARG_UINT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_STRING,\n\t\t.help = "Write string"\n\t},\n\t{\n\t\tT_TCK,\n\t\t.arg_type = T_ARG_UINT, \\\n\t\t.help = "Set TCK pin number x for PBx"\n\t},\n\t{\n\t\tT_TMS,\n\t\t.arg_type = T_ARG_UINT, \\\n\t\t.help = "Set TMS pin number x for PBx"\n\t},\n\t{\n\t\tT_TDI,\n\t\t.arg_type = T_ARG_UINT, \\\n\t\t.help = "Set TDI pin number x for PBx"\n\t},\n\t{\n\t\tT_TDO,\n\t\t.arg_type = T_ARG_UINT, \\\n\t\t.help = "Set TDO pin number x for PBx"\n\t},\n\t{\n\t\tT_TRST,\n\t\t.arg_type = T_ARG_UINT, \\\n\t\t.help = "Set TRST pin number x for PBx"\n\t},\n\t{\n\t\tT_BRUTE,\n\t\t.subtokens = tokens_mode_brute,\n\t\t.help = "Bruteforce JTAG pins on x pins starting from PB0"\n\t},\n\t{\n\t\tT_BYPASS,\n\t\t.help = "Query number of devices in the JTAG chain using BYPASS mode"\n\t},\n\t{\n\t\tT_IDCODE,\n\t\t.help = "Scan for IDCODEs in the JTAG chain"\n\t},\n\t{\n\t\tT_OOCD,\n\t\t.help = "Get into OpenOCD mode"\n\t},\n\t/* BP commands */\n\t{\n\t\tT_CARET,\n\t\t.help = "Send one clock tick"\n\t},\n\t{\n\t\tT_SLASH,\n\t\t.help = "Toggle clock level high"\n\t},\n\t{\n\t\tT_BACKSLASH,\n\t\t.help = "Toggle clock level low"\n\t},\n\t{\n\t\tT_MINUS,\n\t\t.help = "Toggle TDI high"\n\t},\n\t{\n\t\tT_UNDERSCORE,\n\t\t.help = "Toggle TDI low"\n\t},\n\t{\n\t\tT_LEFT_SQ,\n\t\t.help = "Toggle TMS high"\n\t},\n\t{\n\t\tT_RIGHT_SQ,\n\t\t.help = "Toggle TMS low"\n\t},\n\t{\n\t\tT_EXCLAMATION,\n\t\t.help = "Read bit with clock"\n\t},\n\t{\n\t\tT_DOT,\n\t\t.help = "Read bit without clock"\n\t},\n\t{\n\t\tT_AMPERSAND,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 usec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_PERCENT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 msec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_TILDE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write a random byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_AUX_ON,\n\t\t.help = "Toggle AUX[0](PC4) high"\n\t},\n\t{\n\t\tT_AUX_OFF,\n\t\t.help = "Toggle AUX[0](PC4) low"\n\t},\n\t{\n\t\tT_AUX_READ,\n\t\t.help = "Read AUX[0](PC4)"\n\t},\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit JTAG mode"\n\t},\n\t{ }\n};\n\nt_token tokens_jtag[] = {\n\tJTAG_PARAMETERS\n\t{ }\n};\n\n#define ONEWIRE_PARAMETERS \\\n\t{ T_PULL, \\\n\t\t.arg_type = T_ARG_TOKEN, \\\n\t\t.subtokens = tokens_gpio_pull, \\\n\t\t.help = "GPIO pull (up/down/floating)" }, \\\n\t{ T_MSB_FIRST, \\\n\t\t.help = "Send/receive MSB first" }, \\\n\t{ T_LSB_FIRST, \\\n\t\t.help = "Send/receive LSB first" },\n\nt_token tokens_mode_onewire[] = {\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_mode_show,\n\t\t.help = "Show 1-wire parameters"\n\t},\n\t{\n\t\tT_TRIGGER,\n\t\t.subtokens = tokens_mode_trigger,\n\t\t.help = "Setup 1-wire trigger"\n\t},\n\tONEWIRE_PARAMETERS\n\t/* 1-wire-specific commands */\n\t{\n\t\tT_SCAN,\n\t\t.help = "Scan for connected devices"\n\t},\n\t{\n\t\tT_READ,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_HD,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>) and print hexdump"\n\t},\n\t{\n\t\tT_WRITE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_UINT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_STRING,\n\t\t.help = "Write string"\n\t},\n\t/* BP commands */\n\t{\n\t\tT_LEFT_SQ,\n\t\t.help = "Reset bus"\n\t},\n\t{\n\t\tT_MINUS,\n\t\t.help = "Toggle pin high"\n\t},\n\t{\n\t\tT_UNDERSCORE,\n\t\t.help = "Toggle pin low"\n\t},\n\t{\n\t\tT_DOT,\n\t\t.help = "Read bit"\n\t},\n\t{\n\t\tT_AMPERSAND,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 usec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_PERCENT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 msec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_TILDE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write a random byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_AUX_ON,\n\t\t.help = "Toggle AUX[0](PC4) high"\n\t},\n\t{\n\t\tT_AUX_OFF,\n\t\t.help = "Toggle AUX[0](PC4) low"\n\t},\n\t{\n\t\tT_AUX_READ,\n\t\t.help = "Read AUX[0](PC4)"\n\t},\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit 1-wire mode"\n\t},\n\t{ }\n};\n\nt_token tokens_onewire[] = {\n\tONEWIRE_PARAMETERS\n\t{ }\n};\n\n#define TWOWIRE_PARAMETERS \\\n\t{ T_PULL, \\\n\t\t.arg_type = T_ARG_TOKEN, \\\n\t\t.subtokens = tokens_gpio_pull, \\\n\t\t.help = "GPIO pull (up/down/floating)" }, \\\n\t{ T_MSB_FIRST, \\\n\t\t.help = "Send/receive MSB first" }, \\\n\t{ T_LSB_FIRST, \\\n\t\t.help = "Send/receive LSB first" },\n\nt_token tokens_mode_twowire[] = {\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_mode_show,\n\t\t.help = "Show 2-wire parameters"\n\t},\n\t{\n\t\tT_TRIGGER,\n\t\t.subtokens = tokens_mode_trigger,\n\t\t.help = "Setup 2-wire trigger"\n\t},\n\tTWOWIRE_PARAMETERS\n\t/* 2-wire-specific commands */\n\t{\n\t\tT_READ,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_HD,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>) and print hexdump"\n\t},\n\t{\n\t\tT_WRITE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_FREQUENCY,\n\t\t.arg_type = T_ARG_FLOAT,\n\t\t.help = "Bus frequency"\n\t},\n\t{\n\t\tT_POLARITY,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "Clock polarity (0/1)"\n\t},\n\t{\n\t\tT_IDCODE,\n\t\t.help = "Read SWD IDCODE."\n\t},\n\t{\n\t\tT_BRUTE,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "Perform a SWD enumeration on pins"\n\t},\n\t{\n\t\tT_ARG_UINT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_STRING,\n\t\t.help = "Write string"\n\t},\n\t/* BP commands */\n\t{\n\t\tT_CARET,\n\t\t.help = "Send one clock tick"\n\t},\n\t{\n\t\tT_SLASH,\n\t\t.help = "Toggle clock level high"\n\t},\n\t{\n\t\tT_BACKSLASH,\n\t\t.help = "Toggle clock level low"\n\t},\n\t{\n\t\tT_MINUS,\n\t\t.help = "Toggle SDA high"\n\t},\n\t{\n\t\tT_UNDERSCORE,\n\t\t.help = "Toggle SDA low"\n\t},\n\t{\n\t\tT_EXCLAMATION,\n\t\t.help = "Read bit with clock"\n\t},\n\t{\n\t\tT_DOT,\n\t\t.help = "Read bit without clock"\n\t},\n\t{\n\t\tT_AMPERSAND,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 usec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_PERCENT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 msec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_TILDE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write a random byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_AUX_ON,\n\t\t.help = "Toggle AUX[0](PC4) high"\n\t},\n\t{\n\t\tT_AUX_OFF,\n\t\t.help = "Toggle AUX[0](PC4) low"\n\t},\n\t{\n\t\tT_AUX_READ,\n\t\t.help = "Read AUX[0](PC4)"\n\t},\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit 2-wire mode"\n\t},\n\t{ }\n};\n\nt_token tokens_twowire[] = {\n\tTWOWIRE_PARAMETERS\n\t{ }\n};\n\n#define THREEWIRE_PARAMETERS \\\n\t{ T_PULL, \\\n\t\t.arg_type = T_ARG_TOKEN, \\\n\t\t.subtokens = tokens_gpio_pull, \\\n\t\t.help = "GPIO pull (up/down/floating)" }, \\\n\t{ T_MSB_FIRST, \\\n\t\t.help = "Send/receive MSB first" }, \\\n\t{ T_LSB_FIRST, \\\n\t\t.help = "Send/receive LSB first" },\n\nt_token tokens_mode_threewire[] = {\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_mode_show,\n\t\t.help = "Show 3-wire parameters"\n\t},\n\t{\n\t\tT_TRIGGER,\n\t\t.subtokens = tokens_mode_trigger,\n\t\t.help = "Setup 3-wire trigger"\n\t},\n\tTHREEWIRE_PARAMETERS\n\t/* 3-wire-specific commands */\n\t{\n\t\tT_READ,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_WRITE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_FREQUENCY,\n\t\t.arg_type = T_ARG_FLOAT,\n\t\t.help = "Bus frequency"\n\t},\n\t{\n\t\tT_POLARITY,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "Clock polarity (0/1)"\n\t},\n\t{\n\t\tT_ARG_UINT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_STRING,\n\t\t.help = "Write string"\n\t},\n\t/* BP commands */\n\t{\n\t\tT_CARET,\n\t\t.help = "Send one clock tick"\n\t},\n\t{\n\t\tT_SLASH,\n\t\t.help = "Toggle clock level high"\n\t},\n\t{\n\t\tT_BACKSLASH,\n\t\t.help = "Toggle clock level low"\n\t},\n\t{\n\t\tT_MINUS,\n\t\t.help = "Toggle SDO high"\n\t},\n\t{\n\t\tT_UNDERSCORE,\n\t\t.help = "Toggle SDO low"\n\t},\n\t{\n\t\tT_EXCLAMATION,\n\t\t.help = "Read bit with clock"\n\t},\n\t{\n\t\tT_DOT,\n\t\t.help = "Read bit without clock"\n\t},\n\t{\n\t\tT_AMPERSAND,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 usec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_PERCENT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 msec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_TILDE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write a random byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_AUX_ON,\n\t\t.help = "Toggle AUX[0](PC4) high"\n\t},\n\t{\n\t\tT_AUX_OFF,\n\t\t.help = "Toggle AUX[0](PC4) low"\n\t},\n\t{\n\t\tT_AUX_READ,\n\t\t.help = "Read AUX[0](PC4)"\n\t},\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit 3-wire mode"\n\t},\n\t{ }\n};\n\nt_token tokens_threewire[] = {\n\tTHREEWIRE_PARAMETERS\n\t{ }\n};\n\nt_token tokens_mode_flash[] = {\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_mode_show,\n\t\t.help = "Show flash parameters"\n\t},\n\t/* flash-specific commands */\n\t{\n\t\tT_ID,\n\t\t.help = "Displays the ID and status registers"\n\t},\n\t/* BP commands */\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit flash mode"\n\t},\n\t{ }\n};\n\nt_token tokens_flash[] = {\n\t{ }\n};\n\nt_token tokens_mode_mmc[] = {\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_mode_show,\n\t\t.help = "Show mmc parameters"\n\t},\n\t/* mmc-specific commands */\n\t{\n\t\tT_PINS,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "Number of data pins (1 or 4)"\n\t},\n\t{\n\t\tT_ID,\n\t\t.help = "Displays the CID and CSD registers"\n\t},\n\t/* BP commands */\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit mmc mode"\n\t},\n\t{ }\n};\n\nt_token tokens_mmc[] = {\n\t{ }\n};\n\nt_token tokens_gpio_mode[] = {\n\t{\n\t\tT_IN,\n\t\t.help = "Configure GPIO as input"\n\t},\n\t{\n\t\tT_OUT,\n\t\t.help = "Configure GPIO as output"\n\t},\n\t{\n\t\tT_OPEN_DRAIN,\n\t\t.help = "Configure GPIO pin as open drain (default)"\n\t},\n\t{ }\n};\n\nt_token tokens_gpio[] = {\n\t{\n\t\tT_ARG_STRING,\n\t\t.help = "One or more GPIO pins (PA0-15, PB0-11, PC0-15, PA* ...)"\n\t},\n\t{\n\t\tT_MODE,\n\t\t.arg_type = T_ARG_TOKEN,\n\t\t.subtokens = tokens_gpio_mode,\n\t\t.help = "Mode (in/out/open-drain)"\n\t},\n\t{\n\t\tT_PULL,\n\t\t.arg_type = T_ARG_TOKEN,\n\t\t.subtokens = tokens_gpio_pull,\n\t\t.help = "GPIO pull (up/down/floating)"\n\t},\n\t{\n\t\tT_PERIOD,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "Delay between reads, in milliseconds"\n\t},\n\t{\n\t\tT_READ,\n\t\t.help = "Read GPIO values"\n\t},\n\t{\n\t\tT_CONTINUOUS,\n\t\t.help = "Read continuously"\n\t},\n\t{\n\t\tT_ON,\n\t\t.help = "Set GPIO pin"\n\t},\n\t{\n\t\tT_OFF,\n\t\t.help = "Clear GPIO pin"\n\t},\n\t{ }\n};\n\n#define WIEGAND_PARAMETERS \\\n\t{ T_PULL, \\\n\t\t.arg_type = T_ARG_TOKEN, \\\n\t\t.subtokens = tokens_gpio_pull, \\\n\t\t.help = "GPIO pull (up/down/floating)" },\nt_token tokens_mode_wiegand[] = {\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_mode_show,\n\t\t.help = "Show wiegand parameters"\n\t},\n\tWIEGAND_PARAMETERS\n\t/* wiegand-specific commands */\n\t{\n\t\tT_READ,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_HD,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Read byte (repeat with :<num>) and print hexdump"\n\t},\n\t{\n\t\tT_WRITE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_UINT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_ARG_STRING,\n\t\t.help = "Write string"\n\t},\n\t/* BP commands */\n\t{\n\t\tT_MINUS,\n\t\t.help = "Write one bit (D1)"\n\t},\n\t{\n\t\tT_UNDERSCORE,\n\t\t.help = "Write one bit (D0)"\n\t},\n\t{\n\t\tT_AMPERSAND,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 usec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_PERCENT,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Delay 1 msec (repeat with :<num>)"\n\t},\n\t{\n\t\tT_TILDE,\n\t\t.flags = T_FLAG_SUFFIX_TOKEN_DELIM_INT,\n\t\t.help = "Write a random byte (repeat with :<num>)"\n\t},\n\t{\n\t\tT_AUX_ON,\n\t\t.help = "Toggle AUX[0](PC4) high"\n\t},\n\t{\n\t\tT_AUX_OFF,\n\t\t.help = "Toggle AUX[0](PC4) low"\n\t},\n\t{\n\t\tT_AUX_READ,\n\t\t.help = "Read AUX[0](PC4)"\n\t},\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit wiegand mode"\n\t},\n\t{ }\n};\n\nt_token tokens_wiegand[] = {\n\tWIEGAND_PARAMETERS\n\t{ }\n};\n\nt_token tokens_adc[] = {\n\t{\n\t\tT_ADC1,\n\t\t.help = "ADC1 (PA1)"\n\t},\n\t{\n\t\tT_TEMPSENSOR,\n\t\t.help = "Temperature sensor"\n\t},\n\t{\n\t\tT_VREFINT,\n\t\t.help = "Internal reference voltage"\n\t},\n\t{\n\t\tT_VBAT,\n\t\t.help = "VBAT voltage"\n\t},\n\t{\n\t\tT_PERIOD,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "Delay between samples (msec)"\n\t},\n\t{\n\t\tT_SAMPLES,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "Number of samples"\n\t},\n\t{\n\t\tT_TRIGGER,\n\t\t.subtokens = tokens_mode_adc_trigger,\n\t\t.help = "Set trigger bounds"\n\t},\n\t{\n\t\tT_CONTINUOUS,\n\t\t.help = "Read continuously"\n\t},\n\t{ }\n};\n\nt_token tokens_dac[] = {\n\t{\n\t\tT_HELP,\n\t\t.arg_type = T_ARG_HELP,\n\t\t.help = "DAC1, DAC2 (12bits DAC 0 to 4095/3.3V)"\n\t},\n\t{\n\t\tT_DAC1,\n\t\t.help = "DAC1 (PA4 used by ULED)"\n\t},\n\t{\n\t\tT_DAC2,\n\t\t.help = "DAC2 (PA5)"\n\t},\n\t{\n\t\tT_RAW,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "Raw value <0 to 4095>"\n\t},\n\t{\n\t\tT_VOLT,\n\t\t.arg_type = T_ARG_FLOAT,\n\t\t.help = "Volt <0 to 3.3v>"\n\t},\n\t{\n\t\tT_TRIANGLE,\n\t\t.help = "Triangle output (5Hz and amplitude 3.3V)"\n\t},\n\t{\n\t\tT_NOISE,\n\t\t.help = "Noise output (amplitude 3.3V)"\n\t},\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit DAC mode (reinit DAC1&2 pins to safe mode/in)"\n\t},\n\t{ }\n};\n\nt_token tokens_pwm[] = {\n\t{\n\t\tT_HELP,\n\t\t.arg_type = T_ARG_HELP,\n\t\t.help = "PWM1 (PB11)"\n\t},\n\t{\n\t\tT_FREQUENCY,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "PWM frequency <value 1Hz to 42MHz>"\n\t},\n\t{\n\t\tT_DUTY_CYCLE,\n\t\t.arg_type = T_ARG_UINT,\n\t\t.help = "Duty Cycle in % <value 0 to 100>"\n\t},\n\t{\n\t\tT_EXIT,\n\t\t.help = "Exit PWM mode (reinit PWM1 pin to safe mode/in)"\n\t},\n\t{ }\n};\n\nt_token tokens_freq[] = {\n\t{\n\t\tT_HELP,\n\t\tT_SMARTCARD,\n\t\t.subtokens = tokens_smartcard,\n\t\t.help = "SMARTCARD mode",\n\t\t.help_full = "Configuration: smartcard [device (1/2)>\\r\\nInteraction: <read/write (value:repeat)>"\n\t},\n\t{\n\t\tT_DEBUG,\nt_token tokens_really[] = {\n\t{ T_REALLY },\n\t{ }\n};\n\nt_token tokens_sd[] = {\n\t{\n\t\tT_SHOW,\n\t\t.help = "Show SD information"\n\t},\n\t{\n\t\tT_MOUNT,\n\t\t.help = "Mount SD card"\n\t},\n\t{\n\t\tT_UMOUNT,\n\t\t.help = "Unmount SD card"\n\t},\n\t{\n\t\tT_ERASE,\n\t\t.subtokens = tokens_really,\n\t\t.help = "Erase and reformat SD card"\n\t},\n\t{\n\t\tT_CD,\n\t\t.arg_type = T_ARG_STRING,\n\t\t.help = "Change SD card directory"\n\t},\n\t{\n\t\tT_PWD,\n\t\t.help = "Show current SD card directory"\n\t},\n\t{\n\t\tT_LS,\n\t\t.help = "List files on SD card"\n\t},\n\t{\n\t\tT_TESTPERF,\n\t\t.help = "Test SD card performance"\n\t},\n\t{\n\t\tT_CAT,\n\t\t.arg_type = T_ARG_STRING,\n\t\t.help = "Display (ASCII) file on SD card"\n\t},\n\t{\n\t\tT_HD,\n\t\t.arg_type = T_ARG_STRING,\n\t\t.help = "Hexdump file on SD card"\n\t},\n\t{\n\t\tT_RM,\n\t\t.arg_type = T_ARG_STRING,\n\t\t.help = "Remove file or directory"\n\t},\n\t{\n\t\tT_MKDIR,\n\t\t.arg_type = T_ARG_STRING,\n\t\t.help = "Create new directory"\n\t},\n\t{\n\t\tT_SCRIPT,\n\t\t.arg_type = T_ARG_STRING,\n\t\t.help = "Execute script from file"\n\t},\n\t{ }\n};\n\nt_token tokens_show[] = {\n\t{ T_SYSTEM },\n\t{ T_MEMORY },\n\t{ T_THREADS },\n\t{ T_SD },\n\t{ T_DEBUG },\n\t{ }\n};\n\nt_token tokens_debug[] = {\n\t{\n\t\tT_TOKENLINE,\n\t\t.help = "Tokenline dump for every command"\n\t},\n\t{\n\t\tT_TIMING,\n\t\t.help = "Mysterious timing function"\n\t},\n\t{\n\t\tT_DEBUG_TEST_RX,\n\t\t.help = "Test USB1 or 2 RX(read all data until UBTN+Key pressed)"\n\t},\n\t{\n\t\tT_ON,\n\t\t.help = "Enable"\n\t},\n\t{\n\t\tT_OFF,\n\t\t.help = "Disable"\n\t},\n\t{ }\n};\n\nt_token tokens_logging[] = {\n\t{\n\t\tT_SD,\n\t\t.arg_type = T_ARG_STRING,\n\t\t.help = "Log to file on SD card"\n\t},\n\t{\n\t\tT_ON,\n\t\t.help = "Start logging"\n\t},\n\t{\n\t\tT_OFF,\n\t\t.help = "Stop logging"\n\t},\n\t{ }\n};\n\nt_token tl_tokens[] = {\n\t{\n\t\tT_HELP,\n\t\t.arg_type = T_ARG_HELP,\n\t\t.help = "Available commands"\n\t},\n\t{\n\t\tT_HISTORY,\n\t\t.help = "Command history"\n\t},\n\t{\n\t\tT_CLEAR,\n\t\t.help = "Clear screen"\n\t},\n\t{\n\t\tT_SHOW,\n\t\t.subtokens = tokens_show,\n\t\t.help = "Show information"\n\t},\n\t{\n\t\tT_LOGGING,\n\t\t.subtokens = tokens_logging,\n\t\t.help = "Turn logging on or off"\n\t},\n\t{\n\t\tT_SD,\n\t\t.subtokens = tokens_sd,\n\t\t.help = "SD card management"\n\t},\n\t{\n\t\tT_ADC,\n\t\t.subtokens = tokens_adc,\n\t\t.help = "Read analog values",\n\t\t.help_full = "Usage: adc <adc1/tempsensor/vrefint/vbat> [period (nb ms)] [samples (nb sample)/continuous]"\n\t},\n\t{\n\t\tT_DAC,\n\t\t.subtokens = tokens_dac,\n\t\t.help = "Write analog values",\n\t\t.help_full = "Usage: dac <dac1/dac2> <raw (0 to 4095)/volt (0 to 3.3V)/triangle/noise> [exit]"\n\t},\n\t{\n\t\tT_PWM,\n\t\t.subtokens = tokens_pwm,\n\t\t.help = "Write PWM",\n\t\t.help_full = "Usage: pwm <frequency (1Hz to 42MHz)> [duty-cycle (0 to 100%)] [exit]"\n\t},\n\t{\n\t\tT_FREQUENCY,\n\t\t.subtokens = tokens_freq,\n\t\t.help = "Read frequency",\n\t\t.help_full = "Usage: frequency"\n\t},\n\t{\n\t\tT_GPIO,\n\t\t.subtokens = tokens_gpio,\n\t\t.help = "Get or set GPIO pins",\n\t\t.help_full = "Configuration: gpio <PA0-15, PB0-11, PC0-15, PA*> <mode (in/out/open-drain)> [pull (up/down/floating)]\\r\\nInteraction: gpio <PA0-15, PB0-11, PC0-15, PA*> [period (nb ms)] <read/continuous> or <on/off>"\n\t},\n\t{\n\t\tT_SPI,\n\t\t.subtokens = tokens_spi,\n\t\t.help = "SPI mode",\n\t\t.help_full = "Configuration: spi [device (1/2)] [pull (up/down/floating)] [mode (master/slave)] [frequency (value hz/khz/mhz)] [polarity 0/1] [phase 0/1] [msb-first/lsb-first]\\r\\nInteraction: [cs-on/cs-off] <read/write (value:repeat)> [exit]"\n\t},\n\t{\n\t\tT_I2C,\n\t\t.subtokens = tokens_i2c,\n\t\t.help = "I2C mode",\n\t\t.help_full = "Configuration: i2c [pull (up/down/floating)] [frequency (value hz/khz/mhz)]\\r\\nInteraction: [<start>] [<stop>] <read/write (value:repeat)>"\n\t},\n\t{\n\t\tT_ONEWIRE,\n\t\t.subtokens = tokens_onewire,\n\t\t.help = "1-wire mode"\n\t},\n\t{\n\t\tT_TWOWIRE,\n\t\t.subtokens = tokens_twowire,\n\t\t.help = "2-wire mode"\n\t},\n\t{\n\t\tT_THREEWIRE,\n\t\t.subtokens = tokens_threewire,\n\t\t.help = "3-wire mode"\n\t},\n\t{\n\t\tT_UART,\n\t\t.subtokens = tokens_uart,\n\t\t.help = "UART mode",\n\t\t.help_full = "Configuration: uart [device (1/2)] [speed (value in bauds)] [parity (none/even/odd)] [stop-bits (1/2)]\\r\\nInteraction: <read/write (value:repeat)>"\n\t},\n#ifdef HYDRANFC\n\t{\n\t\tT_NFC,\n\t\t.subtokens = tokens_nfc,\n\t\t.help = "NFC mode"\n\t},\n#endif\n\t{\n\t\tT_CAN,\n\t\t.subtokens = tokens_can,\n\t\t.help = "CAN mode"\n\t},\n\t{\n\t\tT_SUMP,\n\t\t.help = "SUMP mode"\n\t},\n\t{\n\t\tT_JTAG,\n\t\t.subtokens = tokens_jtag,\n\t\t.help = "JTAG mode"\n\t},\n\t{\n\t\tT_RNG,\n\t\t.help = "Random number"\n\t},\n\t{\n\t\tT_FLASH,\n\t\t.subtokens = tokens_flash,\n\t\t.help = "NAND flash mode"\n\t},\n\t{\n\t\tT_MMC,\n\t\t.subtokens = tokens_mmc,\n\t\t.help = "MMC/eMMC mode"\n\t},\n\t{\n\t\tT_WIEGAND,\n\t\t.subtokens = tokens_wiegand,\n\t\t.help = "Wiegand mode"\n\t},\n\t{\n\t\tT_LIN,\n\t\t.subtokens = tokens_lin,\n\t\t.help = "LIN mode",\n\t\t.help_full = "Configuration: lin [device (1/2)]\\r\\nInteraction: <read/write (value:repeat)>"\n\t},\n\t{\n\t\tT_SMARTCARD,\n\t\t.subtokens = tokens_smartcard,\n\t\t.help = "SMARTCARD mode",\n\t\t.help_full = "Configuration: smartcard\\r\\nInteraction: <read/write (value:repeat)>"\n\t},\n\t{\n\t\tT_DEBUG,\n\t\t.subtokens = tokens_debug,\n\t\t.help = "Debug mode"\n\t},\n\t{ }\n};\n\n#pragma GCC diagnostic pop\n\n', 'message': 'Removed smartcard2\n', 'author_name': 'Baldanos', 'lang': 'c'}