iso15693: Add support for Type 5 tag reads

Add Type 5 tag read support.  The first time the read routine is called,
it will issue an ISO/IEC 15693 'Get System Information' command to get
the tag's block size and number of blocks.

The block size is required since read and write commands are block
oriented and the code needs to know how much data to read/write each time.
It is saved in the tag structure for use in future I/O operations.

The number of blocks is only required when formatting a tag but since it
comes as a part of the 'Get System Information' response anyway, its saved
in the tag structure as well.

The 'Get System Information' command is only issued the very first time a
tag is read.

Once the block size and number of blocks is known, the NDEF Capabilities
Container (CC) is read (the CC is referred to as the "META" area in the
code). The CC starts on the very first byte of the tag's user memory and
is 4 bytes long.  An 8-byte CC is currently being considered by the NFC-V
committee but it has not been accepted at this time.

After the CC is read and sanity checked, the complete NDEF data area is
read and stored.  The NDEF data area is assumed to begin at the beginning
of the next block after the CC.  This may change once the Type 5 tag
specification is finalized.

Currently, all reads are done using the ISO/IEC 15693 'Read Single Block'
command regardless of whether the tag supports the 'Read Multiple Block'
command.  Someday, that can be added as an optimization.

If either the 'Read Single Block' or 'Get System Information' commands are
not supported by the tag, neard reads will fail and no other tag operations
will work--the tag is basically dead as far as neard is concerned.
1 file changed