drivers/nfc/st-nci/se.c
Source file repositories/reference/linux-study-clean/drivers/nfc/st-nci/se.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/nfc/st-nci/se.c- Extension
.c- Size
- 21615 bytes
- Lines
- 764
- Domain
- Driver Families
- Bucket
- drivers/nfc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/nfc.hlinux/delay.hnet/nfc/nci.hnet/nfc/nci_core.hst-nci.h
Detected Declarations
struct st_nci_pipe_infofunction st_nci_se_get_bwifunction st_nci_se_get_atrfunction st_nci_hci_load_sessionfunction st_nci_hci_admin_event_receivedfunction st_nci_hci_apdu_reader_event_receivedfunction st_nci_hci_connectivity_event_receivedfunction st_nci_hci_event_receivedfunction st_nci_hci_cmd_receivedfunction st_nci_control_sefunction st_nci_disable_sefunction st_nci_enable_sefunction st_nci_hci_network_initfunction st_nci_discover_sefunction st_nci_se_iofunction st_nci_se_wt_timeoutfunction st_nci_se_activation_timeoutfunction st_nci_se_initfunction st_nci_se_deinitexport st_nci_hci_load_sessionexport st_nci_hci_event_receivedexport st_nci_hci_cmd_receivedexport st_nci_disable_seexport st_nci_enable_seexport st_nci_discover_seexport st_nci_se_ioexport st_nci_se_initexport st_nci_se_deinit
Annotated Snippet
struct st_nci_pipe_info {
u8 pipe_state;
u8 src_host_id;
u8 src_gate_id;
u8 dst_host_id;
u8 dst_gate_id;
} __packed;
/* Hosts */
#define ST_NCI_HOST_CONTROLLER_ID 0x00
#define ST_NCI_TERMINAL_HOST_ID 0x01
#define ST_NCI_UICC_HOST_ID 0x02
#define ST_NCI_ESE_HOST_ID 0xc0
/* Gates */
#define ST_NCI_APDU_READER_GATE 0xf0
#define ST_NCI_CONNECTIVITY_GATE 0x41
/* Pipes */
#define ST_NCI_DEVICE_MGNT_PIPE 0x02
/* Connectivity pipe only */
#define ST_NCI_SE_COUNT_PIPE_UICC 0x01
/* Connectivity + APDU Reader pipe */
#define ST_NCI_SE_COUNT_PIPE_EMBEDDED 0x02
#define ST_NCI_SE_TO_HOT_PLUG 1000 /* msecs */
#define ST_NCI_SE_TO_PIPES 2000
#define ST_NCI_EVT_HOT_PLUG_IS_INHIBITED(x) (x->data[0] & 0x80)
#define NCI_HCI_APDU_PARAM_ATR 0x01
#define NCI_HCI_ADMIN_PARAM_SESSION_IDENTITY 0x01
#define NCI_HCI_ADMIN_PARAM_WHITELIST 0x03
#define NCI_HCI_ADMIN_PARAM_HOST_LIST 0x04
#define ST_NCI_EVT_SE_HARD_RESET 0x20
#define ST_NCI_EVT_TRANSMIT_DATA 0x10
#define ST_NCI_EVT_WTX_REQUEST 0x11
#define ST_NCI_EVT_SE_SOFT_RESET 0x11
#define ST_NCI_EVT_SE_END_OF_APDU_TRANSFER 0x21
#define ST_NCI_EVT_HOT_PLUG 0x03
#define ST_NCI_SE_MODE_OFF 0x00
#define ST_NCI_SE_MODE_ON 0x01
#define ST_NCI_EVT_CONNECTIVITY 0x10
#define ST_NCI_EVT_TRANSACTION 0x12
#define ST_NCI_DM_GETINFO 0x13
#define ST_NCI_DM_GETINFO_PIPE_LIST 0x02
#define ST_NCI_DM_GETINFO_PIPE_INFO 0x01
#define ST_NCI_DM_PIPE_CREATED 0x02
#define ST_NCI_DM_PIPE_OPEN 0x04
#define ST_NCI_DM_RF_ACTIVE 0x80
#define ST_NCI_DM_DISCONNECT 0x30
#define ST_NCI_DM_IS_PIPE_OPEN(p) \
((p & 0x0f) == (ST_NCI_DM_PIPE_CREATED | ST_NCI_DM_PIPE_OPEN))
#define ST_NCI_ATR_DEFAULT_BWI 0x04
/*
* WT = 2^BWI/10[s], convert into msecs and add a secure
* room by increasing by 2 this timeout
*/
#define ST_NCI_BWI_TO_TIMEOUT(x) ((1 << x) * 200)
#define ST_NCI_ATR_GET_Y_FROM_TD(x) (x >> 4)
/* If TA is present bit 0 is set */
#define ST_NCI_ATR_TA_PRESENT(x) (x & 0x01)
/* If TB is present bit 1 is set */
#define ST_NCI_ATR_TB_PRESENT(x) (x & 0x02)
#define ST_NCI_NUM_DEVICES 256
static DECLARE_BITMAP(dev_mask, ST_NCI_NUM_DEVICES);
/* Here are the mandatory pipe for st_nci */
static struct nci_hci_gate st_nci_gates[] = {
{NCI_HCI_ADMIN_GATE, NCI_HCI_ADMIN_PIPE,
ST_NCI_HOST_CONTROLLER_ID},
{NCI_HCI_LINK_MGMT_GATE, NCI_HCI_LINK_MGMT_PIPE,
ST_NCI_HOST_CONTROLLER_ID},
{ST_NCI_DEVICE_MGNT_GATE, ST_NCI_DEVICE_MGNT_PIPE,
ST_NCI_HOST_CONTROLLER_ID},
{NCI_HCI_IDENTITY_MGMT_GATE, NCI_HCI_INVALID_PIPE,
ST_NCI_HOST_CONTROLLER_ID},
Annotation
- Immediate include surface: `linux/module.h`, `linux/nfc.h`, `linux/delay.h`, `net/nfc/nci.h`, `net/nfc/nci_core.h`, `st-nci.h`.
- Detected declarations: `struct st_nci_pipe_info`, `function st_nci_se_get_bwi`, `function st_nci_se_get_atr`, `function st_nci_hci_load_session`, `function st_nci_hci_admin_event_received`, `function st_nci_hci_apdu_reader_event_received`, `function st_nci_hci_connectivity_event_received`, `function st_nci_hci_event_received`, `function st_nci_hci_cmd_received`, `function st_nci_control_se`.
- Atlas domain: Driver Families / drivers/nfc.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.