Commit 72a2707a authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'nfc-convert-from-txt-to-rst'

Robert Schwebel says:

====================
here is v2 of the series converting the NFC documentation from txt to
rst. Thanks to Jonathan and Dave for the input.

Changes since (implicit) v1:

* replace code-block by more compact :: syntax

* really add the rst file to the index
====================
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
parents a5d66f81 4791d77a
...@@ -33,6 +33,7 @@ Contents: ...@@ -33,6 +33,7 @@ Contents:
scaling scaling
tls tls
tls-offload tls-offload
nfc
.. only:: subproject and html .. only:: subproject and html
......
===================
Linux NFC subsystem Linux NFC subsystem
=================== ===================
...@@ -8,7 +9,7 @@ This document covers the architecture overview, the device driver interface ...@@ -8,7 +9,7 @@ This document covers the architecture overview, the device driver interface
description and the userspace interface description. description and the userspace interface description.
Architecture overview Architecture overview
--------------------- =====================
The NFC subsystem is responsible for: The NFC subsystem is responsible for:
- NFC adapters management; - NFC adapters management;
...@@ -25,33 +26,34 @@ The control operations are available to userspace via generic netlink. ...@@ -25,33 +26,34 @@ The control operations are available to userspace via generic netlink.
The low-level data exchange interface is provided by the new socket family The low-level data exchange interface is provided by the new socket family
PF_NFC. The NFC_SOCKPROTO_RAW performs raw communication with NFC targets. PF_NFC. The NFC_SOCKPROTO_RAW performs raw communication with NFC targets.
.. code-block:: none
+--------------------------------------+
| USER SPACE | +--------------------------------------+
+--------------------------------------+ | USER SPACE |
^ ^ +--------------------------------------+
| low-level | control ^ ^
| data exchange | operations | low-level | control
| | | data exchange | operations
| v | |
| +-----------+ | v
| AF_NFC | netlink | | +-----------+
| socket +-----------+ | AF_NFC | netlink |
| raw ^ | socket +-----------+
| | | raw ^
v v | |
+---------+ +-----------+ v v
| rawsock | <--------> | core | +---------+ +-----------+
+---------+ +-----------+ | rawsock | <--------> | core |
^ +---------+ +-----------+
| ^
v |
+-----------+ v
| driver | +-----------+
+-----------+ | driver |
+-----------+
Device Driver Interface Device Driver Interface
----------------------- =======================
When registering on the NFC subsystem, the device driver must inform the core When registering on the NFC subsystem, the device driver must inform the core
of the set of supported NFC protocols and the set of ops callbacks. The ops of the set of supported NFC protocols and the set of ops callbacks. The ops
...@@ -64,7 +66,7 @@ callbacks that must be implemented are the following: ...@@ -64,7 +66,7 @@ callbacks that must be implemented are the following:
* data_exchange - send data and receive the response (transceive operation) * data_exchange - send data and receive the response (transceive operation)
Userspace interface Userspace interface
-------------------- ===================
The userspace interface is divided in control operations and low-level data The userspace interface is divided in control operations and low-level data
exchange operation. exchange operation.
...@@ -82,7 +84,7 @@ The operations are composed by commands and events, all listed below: ...@@ -82,7 +84,7 @@ The operations are composed by commands and events, all listed below:
* NFC_EVENT_DEVICE_ADDED - reports an NFC device addition * NFC_EVENT_DEVICE_ADDED - reports an NFC device addition
* NFC_EVENT_DEVICE_REMOVED - reports an NFC device removal * NFC_EVENT_DEVICE_REMOVED - reports an NFC device removal
* NFC_EVENT_TARGETS_FOUND - reports START_POLL results when 1 or more targets * NFC_EVENT_TARGETS_FOUND - reports START_POLL results when 1 or more targets
are found are found
The user must call START_POLL to poll for NFC targets, passing the desired NFC The user must call START_POLL to poll for NFC targets, passing the desired NFC
protocols through NFC_ATTR_PROTOCOLS attribute. The device remains in polling protocols through NFC_ATTR_PROTOCOLS attribute. The device remains in polling
...@@ -101,14 +103,14 @@ it's closed. ...@@ -101,14 +103,14 @@ it's closed.
LOW-LEVEL DATA EXCHANGE: LOW-LEVEL DATA EXCHANGE:
The userspace must use PF_NFC sockets to perform any data communication with The userspace must use PF_NFC sockets to perform any data communication with
targets. All NFC sockets use AF_NFC: targets. All NFC sockets use AF_NFC::
struct sockaddr_nfc { struct sockaddr_nfc {
sa_family_t sa_family; sa_family_t sa_family;
__u32 dev_idx; __u32 dev_idx;
__u32 target_idx; __u32 target_idx;
__u32 nfc_protocol; __u32 nfc_protocol;
}; };
To establish a connection with one target, the user must create an To establish a connection with one target, the user must create an
NFC_SOCKPROTO_RAW socket and call the 'connect' syscall with the sockaddr_nfc NFC_SOCKPROTO_RAW socket and call the 'connect' syscall with the sockaddr_nfc
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment