Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
pn533.c File Reference
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/nfc.h>
#include <linux/netdevice.h>
#include <net/nfc/nfc.h>

Go to the source code of this file.

Data Structures

struct  pn533_fw_version
 
struct  pn533_config_max_retries
 
struct  pn533_config_timing
 
union  pn533_cmd_poll_initdata
 
struct  pn533_poll_modulations
 
struct  pn533_cmd_activate_param
 
struct  pn533_cmd_activate_response
 
struct  pn533_cmd_jump_dep
 
struct  pn533_cmd_jump_dep_response
 
struct  pn533_cmd_init_target
 
struct  pn533_cmd_init_target_response
 
struct  pn533
 
struct  pn533_cmd
 
struct  pn533_frame
 
struct  pn533_sync_cmd_response
 
struct  pn533_target_type_a
 
struct  pn533_target_felica
 
struct  pn533_target_jewel
 
struct  pn533_type_b_prot_info
 
struct  pn533_type_b_sens_res
 
struct  pn533_target_type_b
 
struct  pn533_poll_response
 
struct  pn533_data_exchange_arg
 

Macros

#define VERSION   "0.1"
 
#define PN533_VENDOR_ID   0x4CC
 
#define PN533_PRODUCT_ID   0x2533
 
#define SCM_VENDOR_ID   0x4E6
 
#define SCL3711_PRODUCT_ID   0x5591
 
#define SONY_VENDOR_ID   0x054c
 
#define PASORI_PRODUCT_ID   0x02e1
 
#define PN533_QUIRKS_TYPE_A   BIT(0)
 
#define PN533_QUIRKS_TYPE_F   BIT(1)
 
#define PN533_QUIRKS_DEP   BIT(2)
 
#define PN533_QUIRKS_RAW_EXCHANGE   BIT(3)
 
#define PN533_DEVICE_STD   0x1
 
#define PN533_DEVICE_PASORI   0x2
 
#define PN533_ALL_PROTOCOLS
 
#define PN533_NO_TYPE_B_PROTOCOLS
 
#define PN533_LISTEN_TIME   2
 
#define PN533_FRAME_TAIL_SIZE   2
 
#define PN533_FRAME_SIZE(f)
 
#define PN533_FRAME_ACK_SIZE   (sizeof(struct pn533_frame) + 1)
 
#define PN533_FRAME_CHECKSUM(f)   (f->data[f->datalen])
 
#define PN533_FRAME_POSTAMBLE(f)   (f->data[f->datalen + 1])
 
#define PN533_SOF   0x00FF
 
#define PN533_FRAME_IDENTIFIER(f)   (f->data[0])
 
#define PN533_DIR_OUT   0xD4
 
#define PN533_DIR_IN   0xD5
 
#define PN533_FRAME_CMD(f)   (f->data[1])
 
#define PN533_FRAME_CMD_PARAMS_PTR(f)   (&f->data[2])
 
#define PN533_FRAME_CMD_PARAMS_LEN(f)   (f->datalen - 2)
 
#define PN533_CMD_GET_FIRMWARE_VERSION   0x02
 
#define PN533_CMD_RF_CONFIGURATION   0x32
 
#define PN533_CMD_IN_DATA_EXCHANGE   0x40
 
#define PN533_CMD_IN_COMM_THRU   0x42
 
#define PN533_CMD_IN_LIST_PASSIVE_TARGET   0x4A
 
#define PN533_CMD_IN_ATR   0x50
 
#define PN533_CMD_IN_RELEASE   0x52
 
#define PN533_CMD_IN_JUMP_FOR_DEP   0x56
 
#define PN533_CMD_TG_INIT_AS_TARGET   0x8c
 
#define PN533_CMD_TG_GET_DATA   0x86
 
#define PN533_CMD_TG_SET_DATA   0x8e
 
#define PN533_CMD_RESPONSE(cmd)   (cmd + 1)
 
#define PN533_CMD_RET_MASK   0x3F
 
#define PN533_CMD_MI_MASK   0x40
 
#define PN533_CMD_RET_SUCCESS   0x00
 
#define PN533_STATUS_TARGET_RELEASED   0x29
 
#define PN533_CFGITEM_TIMING   0x02
 
#define PN533_CFGITEM_MAX_RETRIES   0x05
 
#define PN533_CFGITEM_PASORI   0x82
 
#define PN533_CONFIG_TIMING_102   0xb
 
#define PN533_CONFIG_TIMING_204   0xc
 
#define PN533_CONFIG_TIMING_409   0xd
 
#define PN533_CONFIG_TIMING_819   0xe
 
#define PN533_CONFIG_MAX_RETRIES_NO_RETRY   0x00
 
#define PN533_CONFIG_MAX_RETRIES_ENDLESS   0xFF
 
#define PN533_FELICA_OPC_SENSF_REQ   0
 
#define PN533_FELICA_OPC_SENSF_RES   1
 
#define PN533_FELICA_SENSF_SC_ALL   0xFFFF
 
#define PN533_FELICA_SENSF_RC_NO_SYSTEM_CODE   0
 
#define PN533_FELICA_SENSF_RC_SYSTEM_CODE   1
 
#define PN533_FELICA_SENSF_RC_ADVANCED_PROTOCOL   2
 
#define PN533_TYPE_B_AFI_ALL_FAMILIES   0
 
#define PN533_TYPE_B_POLL_METHOD_TIMESLOT   0
 
#define PN533_TYPE_B_POLL_METHOD_PROBABILISTIC   1
 
#define PN533_POLL_MOD_MAX   (__PN533_POLL_MOD_AFTER_LAST - 1)
 
#define PN533_INIT_TARGET_PASSIVE   0x1
 
#define PN533_INIT_TARGET_DEP   0x2
 
#define PN533_INIT_TARGET_RESP_FRAME_MASK   0x3
 
#define PN533_INIT_TARGET_RESP_ACTIVE   0x1
 
#define PN533_INIT_TARGET_RESP_DEP   0x4
 
#define PN533_TYPE_A_SENS_RES_NFCID1(x)   ((u8)((be16_to_cpu(x) & 0x00C0) >> 6))
 
#define PN533_TYPE_A_SENS_RES_SSD(x)   ((u8)((be16_to_cpu(x) & 0x001F) >> 0))
 
#define PN533_TYPE_A_SENS_RES_PLATCONF(x)   ((u8)((be16_to_cpu(x) & 0x0F00) >> 8))
 
#define PN533_TYPE_A_SENS_RES_SSD_JEWEL   0x00
 
#define PN533_TYPE_A_SENS_RES_PLATCONF_JEWEL   0x0C
 
#define PN533_TYPE_A_SEL_PROT(x)   (((x) & 0x60) >> 5)
 
#define PN533_TYPE_A_SEL_CASCADE(x)   (((x) & 0x04) >> 2)
 
#define PN533_TYPE_A_SEL_PROT_MIFARE   0
 
#define PN533_TYPE_A_SEL_PROT_ISO14443   1
 
#define PN533_TYPE_A_SEL_PROT_DEP   2
 
#define PN533_TYPE_A_SEL_PROT_ISO14443_DEP   3
 
#define PN533_FELICA_SENSF_NFCID2_DEP_B1   0x01
 
#define PN533_FELICA_SENSF_NFCID2_DEP_B2   0xFE
 
#define PN533_TYPE_B_PROT_FCSI(x)   (((x) & 0xF0) >> 4)
 
#define PN533_TYPE_B_PROT_TYPE(x)   (((x) & 0x0F) >> 0)
 
#define PN533_TYPE_B_PROT_TYPE_RFU_MASK   0x8
 
#define PN533_TYPE_B_OPC_SENSB_RES   0x50
 
#define PN533_CMD_DATAEXCH_HEAD_LEN   (sizeof(struct pn533_frame) + 3)
 
#define PN533_CMD_DATAEXCH_DATA_MAXLEN   262
 
#define ATR_REQ_GB_OFFSET   17
 
#define PASSIVE_DATA_LEN   5
 

Typedefs

typedef int(* pn533_cmd_complete_t )(struct pn533 *dev, void *arg, u8 *params, int params_len)
 

Enumerations

enum  {
  PN533_POLL_MOD_106KBPS_A, PN533_POLL_MOD_212KBPS_FELICA, PN533_POLL_MOD_424KBPS_FELICA, PN533_POLL_MOD_106KBPS_JEWEL,
  PN533_POLL_MOD_847KBPS_B, PN533_LISTEN_MOD, __PN533_POLL_MOD_AFTER_LAST
}
 

Functions

 MODULE_DEVICE_TABLE (usb, pn533_table)
 
 module_usb_driver (pn533_driver)
 
 MODULE_AUTHOR ("Lauro Ramos Venancio <[email protected]>,"" Aloisio Almeida Jr <[email protected]>")
 
 MODULE_DESCRIPTION ("PN533 usb driver ver "VERSION)
 
 MODULE_VERSION (VERSION)
 
 MODULE_LICENSE ("GPL")
 

Variables

struct pn533_config_max_retries __packed
 
struct pn533_poll_modulations poll_mod []
 

Macro Definition Documentation

#define ATR_REQ_GB_OFFSET   17

Definition at line 1307 of file pn533.c.

#define PASORI_PRODUCT_ID   0x02e1

Definition at line 42 of file pn533.c.

#define PASSIVE_DATA_LEN   5

Definition at line 1759 of file pn533.c.

#define PN533_ALL_PROTOCOLS
Value:
NFC_PROTO_FELICA_MASK | NFC_PROTO_ISO14443_MASK |\
NFC_PROTO_NFC_DEP_MASK |\
NFC_PROTO_ISO14443_B_MASK)

Definition at line 52 of file pn533.c.

#define PN533_CFGITEM_MAX_RETRIES   0x05

Definition at line 147 of file pn533.c.

#define PN533_CFGITEM_PASORI   0x82

Definition at line 148 of file pn533.c.

#define PN533_CFGITEM_TIMING   0x02

Definition at line 146 of file pn533.c.

#define PN533_CMD_DATAEXCH_DATA_MAXLEN   262

Definition at line 1244 of file pn533.c.

#define PN533_CMD_DATAEXCH_HEAD_LEN   (sizeof(struct pn533_frame) + 3)

Definition at line 1243 of file pn533.c.

#define PN533_CMD_GET_FIRMWARE_VERSION   0x02

Definition at line 107 of file pn533.c.

#define PN533_CMD_IN_ATR   0x50

Definition at line 112 of file pn533.c.

#define PN533_CMD_IN_COMM_THRU   0x42

Definition at line 110 of file pn533.c.

#define PN533_CMD_IN_DATA_EXCHANGE   0x40

Definition at line 109 of file pn533.c.

#define PN533_CMD_IN_JUMP_FOR_DEP   0x56

Definition at line 114 of file pn533.c.

#define PN533_CMD_IN_LIST_PASSIVE_TARGET   0x4A

Definition at line 111 of file pn533.c.

#define PN533_CMD_IN_RELEASE   0x52

Definition at line 113 of file pn533.c.

#define PN533_CMD_MI_MASK   0x40

Definition at line 124 of file pn533.c.

#define PN533_CMD_RESPONSE (   cmd)    (cmd + 1)

Definition at line 120 of file pn533.c.

#define PN533_CMD_RET_MASK   0x3F

Definition at line 123 of file pn533.c.

#define PN533_CMD_RET_SUCCESS   0x00

Definition at line 125 of file pn533.c.

#define PN533_CMD_RF_CONFIGURATION   0x32

Definition at line 108 of file pn533.c.

#define PN533_CMD_TG_GET_DATA   0x86

Definition at line 117 of file pn533.c.

#define PN533_CMD_TG_INIT_AS_TARGET   0x8c

Definition at line 116 of file pn533.c.

#define PN533_CMD_TG_SET_DATA   0x8e

Definition at line 118 of file pn533.c.

#define PN533_CONFIG_MAX_RETRIES_ENDLESS   0xFF

Definition at line 156 of file pn533.c.

#define PN533_CONFIG_MAX_RETRIES_NO_RETRY   0x00

Definition at line 155 of file pn533.c.

#define PN533_CONFIG_TIMING_102   0xb

Definition at line 150 of file pn533.c.

#define PN533_CONFIG_TIMING_204   0xc

Definition at line 151 of file pn533.c.

#define PN533_CONFIG_TIMING_409   0xd

Definition at line 152 of file pn533.c.

#define PN533_CONFIG_TIMING_819   0xe

Definition at line 153 of file pn533.c.

#define PN533_DEVICE_PASORI   0x2

Definition at line 50 of file pn533.c.

#define PN533_DEVICE_STD   0x1

Definition at line 49 of file pn533.c.

#define PN533_DIR_IN   0xD5

Definition at line 100 of file pn533.c.

#define PN533_DIR_OUT   0xD4

Definition at line 99 of file pn533.c.

#define PN533_FELICA_OPC_SENSF_REQ   0

Definition at line 173 of file pn533.c.

#define PN533_FELICA_OPC_SENSF_RES   1

Definition at line 174 of file pn533.c.

#define PN533_FELICA_SENSF_NFCID2_DEP_B1   0x01

Definition at line 921 of file pn533.c.

#define PN533_FELICA_SENSF_NFCID2_DEP_B2   0xFE

Definition at line 922 of file pn533.c.

#define PN533_FELICA_SENSF_RC_ADVANCED_PROTOCOL   2

Definition at line 179 of file pn533.c.

#define PN533_FELICA_SENSF_RC_NO_SYSTEM_CODE   0

Definition at line 177 of file pn533.c.

#define PN533_FELICA_SENSF_RC_SYSTEM_CODE   1

Definition at line 178 of file pn533.c.

#define PN533_FELICA_SENSF_SC_ALL   0xFFFF

Definition at line 176 of file pn533.c.

#define PN533_FRAME_ACK_SIZE   (sizeof(struct pn533_frame) + 1)

Definition at line 90 of file pn533.c.

#define PN533_FRAME_CHECKSUM (   f)    (f->data[f->datalen])

Definition at line 91 of file pn533.c.

#define PN533_FRAME_CMD (   f)    (f->data[1])

Definition at line 103 of file pn533.c.

#define PN533_FRAME_CMD_PARAMS_LEN (   f)    (f->datalen - 2)

Definition at line 105 of file pn533.c.

#define PN533_FRAME_CMD_PARAMS_PTR (   f)    (&f->data[2])

Definition at line 104 of file pn533.c.

#define PN533_FRAME_IDENTIFIER (   f)    (f->data[0])

Definition at line 98 of file pn533.c.

#define PN533_FRAME_POSTAMBLE (   f)    (f->data[f->datalen + 1])

Definition at line 92 of file pn533.c.

#define PN533_FRAME_SIZE (   f)
Value:
(sizeof(struct pn533_frame) + f->datalen + \

Definition at line 88 of file pn533.c.

#define PN533_FRAME_TAIL_SIZE   2

Definition at line 87 of file pn533.c.

#define PN533_INIT_TARGET_DEP   0x2

Definition at line 322 of file pn533.c.

#define PN533_INIT_TARGET_PASSIVE   0x1

Definition at line 321 of file pn533.c.

#define PN533_INIT_TARGET_RESP_ACTIVE   0x1

Definition at line 325 of file pn533.c.

#define PN533_INIT_TARGET_RESP_DEP   0x4

Definition at line 326 of file pn533.c.

#define PN533_INIT_TARGET_RESP_FRAME_MASK   0x3

Definition at line 324 of file pn533.c.

#define PN533_LISTEN_TIME   2

Definition at line 84 of file pn533.c.

#define PN533_NO_TYPE_B_PROTOCOLS
Value:
NFC_PROTO_MIFARE_MASK | \
NFC_PROTO_FELICA_MASK | \
NFC_PROTO_ISO14443_MASK | \
NFC_PROTO_NFC_DEP_MASK)

Definition at line 57 of file pn533.c.

#define PN533_POLL_MOD_MAX   (__PN533_POLL_MOD_AFTER_LAST - 1)

Definition at line 210 of file pn533.c.

#define PN533_PRODUCT_ID   0x2533

Definition at line 36 of file pn533.c.

#define PN533_QUIRKS_DEP   BIT(2)

Definition at line 46 of file pn533.c.

#define PN533_QUIRKS_RAW_EXCHANGE   BIT(3)

Definition at line 47 of file pn533.c.

#define PN533_QUIRKS_TYPE_A   BIT(0)

Definition at line 44 of file pn533.c.

#define PN533_QUIRKS_TYPE_F   BIT(1)

Definition at line 45 of file pn533.c.

#define PN533_SOF   0x00FF

Definition at line 95 of file pn533.c.

#define PN533_STATUS_TARGET_RELEASED   0x29

Definition at line 128 of file pn533.c.

#define PN533_TYPE_A_SEL_CASCADE (   x)    (((x) & 0x04) >> 2)

Definition at line 842 of file pn533.c.

#define PN533_TYPE_A_SEL_PROT (   x)    (((x) & 0x60) >> 5)

Definition at line 841 of file pn533.c.

#define PN533_TYPE_A_SEL_PROT_DEP   2

Definition at line 846 of file pn533.c.

#define PN533_TYPE_A_SEL_PROT_ISO14443   1

Definition at line 845 of file pn533.c.

#define PN533_TYPE_A_SEL_PROT_ISO14443_DEP   3

Definition at line 847 of file pn533.c.

#define PN533_TYPE_A_SEL_PROT_MIFARE   0

Definition at line 844 of file pn533.c.

#define PN533_TYPE_A_SENS_RES_NFCID1 (   x)    ((u8)((be16_to_cpu(x) & 0x00C0) >> 6))

Definition at line 834 of file pn533.c.

#define PN533_TYPE_A_SENS_RES_PLATCONF (   x)    ((u8)((be16_to_cpu(x) & 0x0F00) >> 8))

Definition at line 836 of file pn533.c.

#define PN533_TYPE_A_SENS_RES_PLATCONF_JEWEL   0x0C

Definition at line 839 of file pn533.c.

#define PN533_TYPE_A_SENS_RES_SSD (   x)    ((u8)((be16_to_cpu(x) & 0x001F) >> 0))

Definition at line 835 of file pn533.c.

#define PN533_TYPE_A_SENS_RES_SSD_JEWEL   0x00

Definition at line 838 of file pn533.c.

#define PN533_TYPE_B_AFI_ALL_FAMILIES   0

Definition at line 182 of file pn533.c.

#define PN533_TYPE_B_OPC_SENSB_RES   0x50

Definition at line 1021 of file pn533.c.

#define PN533_TYPE_B_POLL_METHOD_PROBABILISTIC   1

Definition at line 184 of file pn533.c.

#define PN533_TYPE_B_POLL_METHOD_TIMESLOT   0

Definition at line 183 of file pn533.c.

#define PN533_TYPE_B_PROT_FCSI (   x)    (((x) & 0xF0) >> 4)

Definition at line 1010 of file pn533.c.

#define PN533_TYPE_B_PROT_TYPE (   x)    (((x) & 0x0F) >> 0)

Definition at line 1011 of file pn533.c.

#define PN533_TYPE_B_PROT_TYPE_RFU_MASK   0x8

Definition at line 1012 of file pn533.c.

#define PN533_VENDOR_ID   0x4CC

Definition at line 35 of file pn533.c.

#define SCL3711_PRODUCT_ID   0x5591

Definition at line 39 of file pn533.c.

#define SCM_VENDOR_ID   0x4E6

Definition at line 38 of file pn533.c.

#define SONY_VENDOR_ID   0x054c

Definition at line 41 of file pn533.c.

#define VERSION   "0.1"

Definition at line 33 of file pn533.c.

Typedef Documentation

typedef int(* pn533_cmd_complete_t)(struct pn533 *dev, void *arg, u8 *params, int params_len)

Definition at line 132 of file pn533.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
PN533_POLL_MOD_106KBPS_A 
PN533_POLL_MOD_212KBPS_FELICA 
PN533_POLL_MOD_424KBPS_FELICA 
PN533_POLL_MOD_106KBPS_JEWEL 
PN533_POLL_MOD_847KBPS_B 
PN533_LISTEN_MOD 
__PN533_POLL_MOD_AFTER_LAST 

Definition at line 200 of file pn533.c.

Function Documentation

MODULE_AUTHOR ( "Lauro Ramos Venancio <[email protected] ,
""Aloisio Almeida Jr< aloisio.almeida @openbossa.org >"   
)
MODULE_DESCRIPTION ( "PN533 usb driver ver VERSION)
MODULE_DEVICE_TABLE ( usb  ,
pn533_table   
)
MODULE_LICENSE ( "GPL"  )
module_usb_driver ( pn533_driver  )
MODULE_VERSION ( VERSION  )

Variable Documentation

Definition at line 221 of file pn533.c.