drivers/nfc/port100.c

Source file repositories/reference/linux-study-clean/drivers/nfc/port100.c

File Facts

System
Linux kernel
Corpus path
drivers/nfc/port100.c
Extension
.c
Size
42878 bytes
Lines
1641
Domain
Driver Families
Bucket
drivers/nfc
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct port100_in_rf_setting {
	u8 in_send_set_number;
	u8 in_send_comm_type;
	u8 in_recv_set_number;
	u8 in_recv_comm_type;
} __packed;

#define PORT100_COMM_TYPE_IN_212F 0x01
#define PORT100_COMM_TYPE_IN_424F 0x02
#define PORT100_COMM_TYPE_IN_106A 0x03
#define PORT100_COMM_TYPE_IN_106B 0x07

static const struct port100_in_rf_setting in_rf_settings[] = {
	[NFC_DIGITAL_RF_TECH_212F] = {
		.in_send_set_number = 1,
		.in_send_comm_type  = PORT100_COMM_TYPE_IN_212F,
		.in_recv_set_number = 15,
		.in_recv_comm_type  = PORT100_COMM_TYPE_IN_212F,
	},
	[NFC_DIGITAL_RF_TECH_424F] = {
		.in_send_set_number = 1,
		.in_send_comm_type  = PORT100_COMM_TYPE_IN_424F,
		.in_recv_set_number = 15,
		.in_recv_comm_type  = PORT100_COMM_TYPE_IN_424F,
	},
	[NFC_DIGITAL_RF_TECH_106A] = {
		.in_send_set_number = 2,
		.in_send_comm_type  = PORT100_COMM_TYPE_IN_106A,
		.in_recv_set_number = 15,
		.in_recv_comm_type  = PORT100_COMM_TYPE_IN_106A,
	},
	[NFC_DIGITAL_RF_TECH_106B] = {
		.in_send_set_number = 3,
		.in_send_comm_type  = PORT100_COMM_TYPE_IN_106B,
		.in_recv_set_number = 15,
		.in_recv_comm_type  = PORT100_COMM_TYPE_IN_106B,
	},
	/* Ensures the array has NFC_DIGITAL_RF_TECH_LAST elements */
	[NFC_DIGITAL_RF_TECH_LAST] = { 0 },
};

/**
 * struct port100_tg_rf_setting - Setting sets structure for tg_set_rf command
 *
 * @tg_set_number: Represents the entry index in the port-100 RF Base Table.
 *                 This table contains multiple RF setting sets required for RF
 *                 communication. this field is used for both send and receive
 *                 settings.
 *
 * @tg_comm_type: Sets the communication type to be used to send and receive
 *                data.
 */
struct port100_tg_rf_setting {
	u8 tg_set_number;
	u8 tg_comm_type;
} __packed;

#define PORT100_COMM_TYPE_TG_106A 0x0B
#define PORT100_COMM_TYPE_TG_212F 0x0C
#define PORT100_COMM_TYPE_TG_424F 0x0D

static const struct port100_tg_rf_setting tg_rf_settings[] = {
	[NFC_DIGITAL_RF_TECH_106A] = {
		.tg_set_number = 8,
		.tg_comm_type = PORT100_COMM_TYPE_TG_106A,
	},
	[NFC_DIGITAL_RF_TECH_212F] = {
		.tg_set_number = 8,
		.tg_comm_type = PORT100_COMM_TYPE_TG_212F,
	},
	[NFC_DIGITAL_RF_TECH_424F] = {
		.tg_set_number = 8,
		.tg_comm_type = PORT100_COMM_TYPE_TG_424F,
	},
	/* Ensures the array has NFC_DIGITAL_RF_TECH_LAST elements */
	[NFC_DIGITAL_RF_TECH_LAST] = { 0 },

};

#define PORT100_IN_PROT_INITIAL_GUARD_TIME      0x00
#define PORT100_IN_PROT_ADD_CRC                 0x01
#define PORT100_IN_PROT_CHECK_CRC               0x02
#define PORT100_IN_PROT_MULTI_CARD              0x03
#define PORT100_IN_PROT_ADD_PARITY              0x04
#define PORT100_IN_PROT_CHECK_PARITY            0x05
#define PORT100_IN_PROT_BITWISE_AC_RECV_MODE    0x06
#define PORT100_IN_PROT_VALID_BIT_NUMBER        0x07
#define PORT100_IN_PROT_CRYPTO1                 0x08
#define PORT100_IN_PROT_ADD_SOF                 0x09
#define PORT100_IN_PROT_CHECK_SOF               0x0A

Annotation

Implementation Notes