drivers/nfc/microread/microread.c
Source file repositories/reference/linux-study-clean/drivers/nfc/microread/microread.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/nfc/microread/microread.c- Extension
.c- Size
- 19496 bytes
- Lines
- 722
- 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/delay.hlinux/slab.hlinux/crc-ccitt.hlinux/nfc.hnet/nfc/nfc.hnet/nfc/hci.hmicroread.h
Detected Declarations
struct microread_infofunction microread_openfunction microread_closefunction microread_hci_readyfunction microread_xmitfunction microread_start_pollfunction microread_dep_link_upfunction microread_dep_link_downfunction microread_target_from_gatefunction microread_complete_target_discoveredfunction microread_im_transceive_cbfunction microread_im_transceivefunction microread_tm_sendfunction microread_target_discoveredfunction microread_event_receivedfunction microread_probefunction microread_removeexport microread_probeexport microread_remove
Annotated Snippet
struct microread_info {
const struct nfc_phy_ops *phy_ops;
void *phy_id;
struct nfc_hci_dev *hdev;
int async_cb_type;
data_exchange_cb_t async_cb;
void *async_cb_context;
};
static int microread_open(struct nfc_hci_dev *hdev)
{
struct microread_info *info = nfc_hci_get_clientdata(hdev);
return info->phy_ops->enable(info->phy_id);
}
static void microread_close(struct nfc_hci_dev *hdev)
{
struct microread_info *info = nfc_hci_get_clientdata(hdev);
info->phy_ops->disable(info->phy_id);
}
static int microread_hci_ready(struct nfc_hci_dev *hdev)
{
int r;
u8 param[4];
param[0] = 0x03;
r = nfc_hci_send_cmd(hdev, MICROREAD_GATE_ID_MREAD_ISO_A,
MICROREAD_CMD_MREAD_SUBSCRIBE, param, 1, NULL);
if (r)
return r;
r = nfc_hci_send_cmd(hdev, MICROREAD_GATE_ID_MREAD_ISO_A_3,
MICROREAD_CMD_MREAD_SUBSCRIBE, NULL, 0, NULL);
if (r)
return r;
param[0] = 0x00;
param[1] = 0x03;
param[2] = 0x00;
r = nfc_hci_send_cmd(hdev, MICROREAD_GATE_ID_MREAD_ISO_B,
MICROREAD_CMD_MREAD_SUBSCRIBE, param, 3, NULL);
if (r)
return r;
r = nfc_hci_send_cmd(hdev, MICROREAD_GATE_ID_MREAD_NFC_T1,
MICROREAD_CMD_MREAD_SUBSCRIBE, NULL, 0, NULL);
if (r)
return r;
param[0] = 0xFF;
param[1] = 0xFF;
param[2] = 0x00;
param[3] = 0x00;
r = nfc_hci_send_cmd(hdev, MICROREAD_GATE_ID_MREAD_NFC_T3,
MICROREAD_CMD_MREAD_SUBSCRIBE, param, 4, NULL);
return r;
}
static int microread_xmit(struct nfc_hci_dev *hdev, struct sk_buff *skb)
{
struct microread_info *info = nfc_hci_get_clientdata(hdev);
return info->phy_ops->write(info->phy_id, skb);
}
static int microread_start_poll(struct nfc_hci_dev *hdev,
u32 im_protocols, u32 tm_protocols)
{
int r;
u8 param[2];
u8 mode;
param[0] = 0x00;
param[1] = 0x00;
if (im_protocols & NFC_PROTO_ISO14443_MASK)
param[0] |= (1 << 2);
if (im_protocols & NFC_PROTO_ISO14443_B_MASK)
param[0] |= 1;
if (im_protocols & NFC_PROTO_MIFARE_MASK)
param[1] |= 1;
Annotation
- Immediate include surface: `linux/module.h`, `linux/delay.h`, `linux/slab.h`, `linux/crc-ccitt.h`, `linux/nfc.h`, `net/nfc/nfc.h`, `net/nfc/hci.h`, `microread.h`.
- Detected declarations: `struct microread_info`, `function microread_open`, `function microread_close`, `function microread_hci_ready`, `function microread_xmit`, `function microread_start_poll`, `function microread_dep_link_up`, `function microread_dep_link_down`, `function microread_target_from_gate`, `function microread_complete_target_discovered`.
- 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.