0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __LOCAL_ST_NCI_H_
0009 #define __LOCAL_ST_NCI_H_
0010
0011 #include "ndlc.h"
0012
0013
0014 #define ST_NCI_RUNNING 1
0015
0016 #define ST_NCI_CORE_PROP 0x01
0017 #define ST_NCI_SET_NFC_MODE 0x02
0018
0019
0020
0021
0022
0023 #define ST_NCI_ESE_MAX_LENGTH 33
0024
0025 #define ST_NCI_DEVICE_MGNT_GATE 0x01
0026
0027 #define ST_NCI_VENDOR_OUI 0x0080E1
0028 #define ST_NCI_FACTORY_MODE 2
0029
0030 struct nci_mode_set_cmd {
0031 u8 cmd_type;
0032 u8 mode;
0033 } __packed;
0034
0035 struct nci_mode_set_rsp {
0036 u8 status;
0037 } __packed;
0038
0039 struct st_nci_se_status {
0040 bool is_ese_present;
0041 bool is_uicc_present;
0042 };
0043
0044 struct st_nci_se_info {
0045 struct st_nci_se_status *se_status;
0046 u8 atr[ST_NCI_ESE_MAX_LENGTH];
0047 struct completion req_completion;
0048
0049 struct timer_list bwi_timer;
0050 int wt_timeout;
0051 bool bwi_active;
0052
0053 struct timer_list se_active_timer;
0054 bool se_active;
0055
0056 bool xch_error;
0057
0058 se_io_cb_t cb;
0059 void *cb_context;
0060 };
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095 enum nfc_vendor_cmds {
0096 FACTORY_MODE,
0097 HCI_CLEAR_ALL_PIPES,
0098 HCI_DM_PUT_DATA,
0099 HCI_DM_UPDATE_AID,
0100 HCI_DM_GET_INFO,
0101 HCI_DM_GET_DATA,
0102 HCI_DM_DIRECT_LOAD,
0103 HCI_DM_RESET,
0104 HCI_GET_PARAM,
0105 HCI_DM_FIELD_GENERATOR,
0106 LOOPBACK,
0107 HCI_DM_FWUPD_START,
0108 HCI_DM_FWUPD_END,
0109 HCI_DM_VDC_MEASUREMENT_VALUE,
0110 HCI_DM_VDC_VALUE_COMPARISON,
0111 MANUFACTURER_SPECIFIC,
0112 };
0113
0114 struct st_nci_info {
0115 struct llt_ndlc *ndlc;
0116 unsigned long flags;
0117
0118 struct st_nci_se_info se_info;
0119 };
0120
0121 void st_nci_remove(struct nci_dev *ndev);
0122 int st_nci_probe(struct llt_ndlc *ndlc, int phy_headroom,
0123 int phy_tailroom, struct st_nci_se_status *se_status);
0124
0125 int st_nci_se_init(struct nci_dev *ndev, struct st_nci_se_status *se_status);
0126 void st_nci_se_deinit(struct nci_dev *ndev);
0127
0128 int st_nci_discover_se(struct nci_dev *ndev);
0129 int st_nci_enable_se(struct nci_dev *ndev, u32 se_idx);
0130 int st_nci_disable_se(struct nci_dev *ndev, u32 se_idx);
0131 int st_nci_se_io(struct nci_dev *ndev, u32 se_idx,
0132 u8 *apdu, size_t apdu_length,
0133 se_io_cb_t cb, void *cb_context);
0134 int st_nci_hci_load_session(struct nci_dev *ndev);
0135 void st_nci_hci_event_received(struct nci_dev *ndev, u8 pipe,
0136 u8 event, struct sk_buff *skb);
0137 void st_nci_hci_cmd_received(struct nci_dev *ndev, u8 pipe, u8 cmd,
0138 struct sk_buff *skb);
0139
0140 int st_nci_vendor_cmds_init(struct nci_dev *ndev);
0141
0142 #endif