mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 22:23:14 -04:00
Merge branch 'master' of git://git.infradead.org/users/linville/wireless-next into for-davem
Conflicts: drivers/net/wireless/iwlwifi/iwl-pci.c drivers/net/wireless/wl12xx/main.c
This commit is contained in:
commit
8e00f5fbb4
186 changed files with 8572 additions and 4414 deletions
|
|
@ -716,6 +716,16 @@ struct hci_rp_read_bd_addr {
|
|||
bdaddr_t bdaddr;
|
||||
} __packed;
|
||||
|
||||
#define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c
|
||||
struct hci_cp_write_page_scan_activity {
|
||||
__le16 interval;
|
||||
__le16 window;
|
||||
} __packed;
|
||||
|
||||
#define HCI_OP_WRITE_PAGE_SCAN_TYPE 0x0c47
|
||||
#define PAGE_SCAN_TYPE_STANDARD 0x00
|
||||
#define PAGE_SCAN_TYPE_INTERLACED 0x01
|
||||
|
||||
#define HCI_OP_LE_SET_EVENT_MASK 0x2001
|
||||
struct hci_cp_le_set_event_mask {
|
||||
__u8 mask[8];
|
||||
|
|
|
|||
|
|
@ -195,8 +195,6 @@ struct hci_dev {
|
|||
|
||||
__u16 init_last_cmd;
|
||||
|
||||
struct crypto_blkcipher *tfm;
|
||||
|
||||
struct inquiry_cache inq_cache;
|
||||
struct hci_conn_hash conn_hash;
|
||||
struct list_head blacklist;
|
||||
|
|
@ -348,6 +346,7 @@ enum {
|
|||
HCI_CONN_RSWITCH_PEND,
|
||||
HCI_CONN_MODE_CHANGE_PEND,
|
||||
HCI_CONN_SCO_SETUP_PEND,
|
||||
HCI_CONN_LE_SMP_PEND,
|
||||
};
|
||||
|
||||
static inline void hci_conn_hash_init(struct hci_dev *hdev)
|
||||
|
|
@ -395,6 +394,22 @@ static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
|
|||
}
|
||||
}
|
||||
|
||||
static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type)
|
||||
{
|
||||
struct hci_conn_hash *h = &hdev->conn_hash;
|
||||
switch (type) {
|
||||
case ACL_LINK:
|
||||
return h->acl_num;
|
||||
case LE_LINK:
|
||||
return h->le_num;
|
||||
case SCO_LINK:
|
||||
case ESCO_LINK:
|
||||
return h->sco_num;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
|
||||
__u16 handle)
|
||||
{
|
||||
|
|
@ -475,7 +490,7 @@ static inline void hci_conn_put(struct hci_conn *conn)
|
|||
{
|
||||
if (atomic_dec_and_test(&conn->refcnt)) {
|
||||
unsigned long timeo;
|
||||
if (conn->type == ACL_LINK) {
|
||||
if (conn->type == ACL_LINK || conn->type == LE_LINK) {
|
||||
del_timer(&conn->idle_timer);
|
||||
if (conn->state == BT_CONNECTED) {
|
||||
timeo = msecs_to_jiffies(conn->disc_timeout);
|
||||
|
|
@ -838,7 +853,7 @@ int mgmt_powered(u16 index, u8 powered);
|
|||
int mgmt_discoverable(u16 index, u8 discoverable);
|
||||
int mgmt_connectable(u16 index, u8 connectable);
|
||||
int mgmt_new_key(u16 index, struct link_key *key, u8 persistent);
|
||||
int mgmt_connected(u16 index, bdaddr_t *bdaddr);
|
||||
int mgmt_connected(u16 index, bdaddr_t *bdaddr, u8 link_type);
|
||||
int mgmt_disconnected(u16 index, bdaddr_t *bdaddr);
|
||||
int mgmt_disconnect_failed(u16 index);
|
||||
int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status);
|
||||
|
|
@ -858,6 +873,8 @@ int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 *dev_class, s8 rssi,
|
|||
u8 *eir);
|
||||
int mgmt_remote_name(u16 index, bdaddr_t *bdaddr, u8 *name);
|
||||
int mgmt_discovering(u16 index, u8 discovering);
|
||||
int mgmt_device_blocked(u16 index, bdaddr_t *bdaddr);
|
||||
int mgmt_device_unblocked(u16 index, bdaddr_t *bdaddr);
|
||||
|
||||
/* HCI info for socket */
|
||||
#define hci_pi(sk) ((struct hci_pinfo *) sk)
|
||||
|
|
|
|||
|
|
@ -409,14 +409,8 @@ struct l2cap_conn {
|
|||
|
||||
__u8 disc_reason;
|
||||
|
||||
__u8 preq[7]; /* SMP Pairing Request */
|
||||
__u8 prsp[7]; /* SMP Pairing Response */
|
||||
__u8 prnd[16]; /* SMP Pairing Random */
|
||||
__u8 pcnf[16]; /* SMP Pairing Confirm */
|
||||
__u8 tk[16]; /* SMP Temporary Key */
|
||||
__u8 smp_key_size;
|
||||
|
||||
struct timer_list security_timer;
|
||||
struct smp_chan *smp_chan;
|
||||
|
||||
struct list_head chan_l;
|
||||
rwlock_t chan_lock;
|
||||
|
|
|
|||
|
|
@ -211,6 +211,11 @@ struct mgmt_cp_unblock_device {
|
|||
bdaddr_t bdaddr;
|
||||
} __packed;
|
||||
|
||||
#define MGMT_OP_SET_FAST_CONNECTABLE 0x001F
|
||||
struct mgmt_cp_set_fast_connectable {
|
||||
__u8 enable;
|
||||
} __packed;
|
||||
|
||||
#define MGMT_EV_CMD_COMPLETE 0x0001
|
||||
struct mgmt_ev_cmd_complete {
|
||||
__le16 opcode;
|
||||
|
|
@ -249,6 +254,7 @@ struct mgmt_ev_new_key {
|
|||
#define MGMT_EV_CONNECTED 0x000B
|
||||
struct mgmt_ev_connected {
|
||||
bdaddr_t bdaddr;
|
||||
__u8 link_type;
|
||||
} __packed;
|
||||
|
||||
#define MGMT_EV_DISCONNECTED 0x000C
|
||||
|
|
@ -301,3 +307,13 @@ struct mgmt_ev_remote_name {
|
|||
} __packed;
|
||||
|
||||
#define MGMT_EV_DISCOVERING 0x0014
|
||||
|
||||
#define MGMT_EV_DEVICE_BLOCKED 0x0015
|
||||
struct mgmt_ev_device_blocked {
|
||||
bdaddr_t bdaddr;
|
||||
} __packed;
|
||||
|
||||
#define MGMT_EV_DEVICE_UNBLOCKED 0x0016
|
||||
struct mgmt_ev_device_unblocked {
|
||||
bdaddr_t bdaddr;
|
||||
} __packed;
|
||||
|
|
|
|||
|
|
@ -115,9 +115,26 @@ struct smp_cmd_security_req {
|
|||
#define SMP_MIN_ENC_KEY_SIZE 7
|
||||
#define SMP_MAX_ENC_KEY_SIZE 16
|
||||
|
||||
struct smp_chan {
|
||||
struct l2cap_conn *conn;
|
||||
u8 preq[7]; /* SMP Pairing Request */
|
||||
u8 prsp[7]; /* SMP Pairing Response */
|
||||
u8 prnd[16]; /* SMP Pairing Random (local) */
|
||||
u8 rrnd[16]; /* SMP Pairing Random (remote) */
|
||||
u8 pcnf[16]; /* SMP Pairing Confirm */
|
||||
u8 tk[16]; /* SMP Temporary Key */
|
||||
u8 smp_key_size;
|
||||
struct crypto_blkcipher *tfm;
|
||||
struct work_struct confirm;
|
||||
struct work_struct random;
|
||||
|
||||
};
|
||||
|
||||
/* SMP Commands */
|
||||
int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level);
|
||||
int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb);
|
||||
int smp_distribute_keys(struct l2cap_conn *conn, __u8 force);
|
||||
|
||||
void smp_chan_destroy(struct l2cap_conn *conn);
|
||||
|
||||
#endif /* __SMP_H */
|
||||
|
|
|
|||
|
|
@ -860,6 +860,7 @@ struct cfg80211_ssid {
|
|||
* @wiphy: the wiphy this was for
|
||||
* @dev: the interface
|
||||
* @aborted: (internal) scan request was notified as aborted
|
||||
* @no_cck: used to send probe requests at non CCK rate in 2GHz band
|
||||
*/
|
||||
struct cfg80211_scan_request {
|
||||
struct cfg80211_ssid *ssids;
|
||||
|
|
@ -874,6 +875,7 @@ struct cfg80211_scan_request {
|
|||
struct wiphy *wiphy;
|
||||
struct net_device *dev;
|
||||
bool aborted;
|
||||
bool no_cck;
|
||||
|
||||
/* keep last */
|
||||
struct ieee80211_channel *channels[0];
|
||||
|
|
@ -1484,7 +1486,7 @@ struct cfg80211_ops {
|
|||
int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
|
||||
struct bss_parameters *params);
|
||||
|
||||
int (*set_txq_params)(struct wiphy *wiphy,
|
||||
int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
|
||||
struct ieee80211_txq_params *params);
|
||||
|
||||
int (*set_channel)(struct wiphy *wiphy, struct net_device *dev,
|
||||
|
|
@ -1560,7 +1562,8 @@ struct cfg80211_ops {
|
|||
struct ieee80211_channel *chan, bool offchan,
|
||||
enum nl80211_channel_type channel_type,
|
||||
bool channel_type_valid, unsigned int wait,
|
||||
const u8 *buf, size_t len, u64 *cookie);
|
||||
const u8 *buf, size_t len, bool no_cck,
|
||||
u64 *cookie);
|
||||
int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
|
||||
struct net_device *dev,
|
||||
u64 cookie);
|
||||
|
|
@ -2461,6 +2464,24 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb);
|
|||
*/
|
||||
const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
|
||||
|
||||
/**
|
||||
* cfg80211_find_vendor_ie - find vendor specific information element in data
|
||||
*
|
||||
* @oui: vendor OUI
|
||||
* @oui_type: vendor-specific OUI type
|
||||
* @ies: data consisting of IEs
|
||||
* @len: length of data
|
||||
*
|
||||
* This function will return %NULL if the vendor specific element ID
|
||||
* could not be found or if the element is invalid (claims to be
|
||||
* longer than the given data), or a pointer to the first byte
|
||||
* of the requested element, that is the byte containing the
|
||||
* element ID. There are no checks on the element length
|
||||
* other than having to fit into the given data.
|
||||
*/
|
||||
const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
|
||||
const u8 *ies, int len);
|
||||
|
||||
/**
|
||||
* DOC: Regulatory enforcement infrastructure
|
||||
*
|
||||
|
|
@ -3121,6 +3142,17 @@ void cfg80211_cqm_pktloss_notify(struct net_device *dev,
|
|||
void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
|
||||
const u8 *replay_ctr, gfp_t gfp);
|
||||
|
||||
/**
|
||||
* cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
|
||||
* @dev: network device
|
||||
* @index: candidate index (the smaller the index, the higher the priority)
|
||||
* @bssid: BSSID of AP
|
||||
* @preauth: Whether AP advertises support for RSN pre-authentication
|
||||
* @gfp: allocation flags
|
||||
*/
|
||||
void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
|
||||
const u8 *bssid, bool preauth, gfp_t gfp);
|
||||
|
||||
/* Logging, debugging and troubleshooting/diagnostic helpers. */
|
||||
|
||||
/* wiphy_printk helpers, similar to dev_printk */
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ enum ieee80211_bss_change {
|
|||
BSS_CHANGED_ERP_CTS_PROT = 1<<1,
|
||||
BSS_CHANGED_ERP_PREAMBLE = 1<<2,
|
||||
BSS_CHANGED_ERP_SLOT = 1<<3,
|
||||
BSS_CHANGED_HT = 1<<4,
|
||||
BSS_CHANGED_HT = 1<<4,
|
||||
BSS_CHANGED_BASIC_RATES = 1<<5,
|
||||
BSS_CHANGED_BEACON_INT = 1<<6,
|
||||
BSS_CHANGED_BSSID = 1<<7,
|
||||
|
|
@ -363,6 +363,9 @@ struct ieee80211_bss_conf {
|
|||
* @IEEE80211_TX_INTFL_TKIP_MIC_FAILURE: Marks this packet to be used for TKIP
|
||||
* testing. It will be sent out with incorrect Michael MIC key to allow
|
||||
* TKIP countermeasures to be tested.
|
||||
* @IEEE80211_TX_CTL_NO_CCK_RATE: This frame will be sent at non CCK rate.
|
||||
* This flag is actually used for management frame especially for P2P
|
||||
* frames not being sent at CCK rate in 2GHz band.
|
||||
*
|
||||
* Note: If you have to add new flags to the enumeration, then don't
|
||||
* forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary.
|
||||
|
|
@ -393,6 +396,7 @@ enum mac80211_tx_control_flags {
|
|||
IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24),
|
||||
IEEE80211_TX_CTL_TX_OFFCHAN = BIT(25),
|
||||
IEEE80211_TX_INTFL_TKIP_MIC_FAILURE = BIT(26),
|
||||
IEEE80211_TX_CTL_NO_CCK_RATE = BIT(27),
|
||||
};
|
||||
|
||||
#define IEEE80211_TX_CTL_STBC_SHIFT 23
|
||||
|
|
@ -2000,9 +2004,10 @@ struct ieee80211_ops {
|
|||
enum sta_notify_cmd, struct ieee80211_sta *sta);
|
||||
int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
|
||||
const struct ieee80211_tx_queue_params *params);
|
||||
u64 (*get_tsf)(struct ieee80211_hw *hw);
|
||||
void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf);
|
||||
void (*reset_tsf)(struct ieee80211_hw *hw);
|
||||
u64 (*get_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
|
||||
void (*set_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
u64 tsf);
|
||||
void (*reset_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
|
||||
int (*tx_last_beacon)(struct ieee80211_hw *hw);
|
||||
int (*ampdu_action)(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
|
|
|
|||
313
include/net/nfc/nci.h
Normal file
313
include/net/nfc/nci.h
Normal file
|
|
@ -0,0 +1,313 @@
|
|||
/*
|
||||
* The NFC Controller Interface is the communication protocol between an
|
||||
* NFC Controller (NFCC) and a Device Host (DH).
|
||||
*
|
||||
* Copyright (C) 2011 Texas Instruments, Inc.
|
||||
*
|
||||
* Written by Ilan Elias <ilane@ti.com>
|
||||
*
|
||||
* Acknowledgements:
|
||||
* This file is based on hci.h, which was written
|
||||
* by Maxim Krasnyansky.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NCI_H
|
||||
#define __NCI_H
|
||||
|
||||
/* NCI constants */
|
||||
#define NCI_MAX_NUM_MAPPING_CONFIGS 10
|
||||
#define NCI_MAX_NUM_RF_CONFIGS 10
|
||||
#define NCI_MAX_NUM_CONN 10
|
||||
|
||||
/* NCI Status Codes */
|
||||
#define NCI_STATUS_OK 0x00
|
||||
#define NCI_STATUS_REJECTED 0x01
|
||||
#define NCI_STATUS_MESSAGE_CORRUPTED 0x02
|
||||
#define NCI_STATUS_BUFFER_FULL 0x03
|
||||
#define NCI_STATUS_FAILED 0x04
|
||||
#define NCI_STATUS_NOT_INITIALIZED 0x05
|
||||
#define NCI_STATUS_SYNTAX_ERROR 0x06
|
||||
#define NCI_STATUS_SEMANTIC_ERROR 0x07
|
||||
#define NCI_STATUS_UNKNOWN_GID 0x08
|
||||
#define NCI_STATUS_UNKNOWN_OID 0x09
|
||||
#define NCI_STATUS_INVALID_PARAM 0x0a
|
||||
#define NCI_STATUS_MESSAGE_SIZE_EXCEEDED 0x0b
|
||||
/* Discovery Specific Status Codes */
|
||||
#define NCI_STATUS_DISCOVERY_ALREADY_STARTED 0xa0
|
||||
#define NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED 0xa1
|
||||
/* RF Interface Specific Status Codes */
|
||||
#define NCI_STATUS_RF_TRANSMISSION_ERROR 0xb0
|
||||
#define NCI_STATUS_RF_PROTOCOL_ERROR 0xb1
|
||||
#define NCI_STATUS_RF_TIMEOUT_ERROR 0xb2
|
||||
#define NCI_STATUS_RF_LINK_LOSS_ERROR 0xb3
|
||||
/* NFCEE Interface Specific Status Codes */
|
||||
#define NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED 0xc0
|
||||
#define NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED 0xc1
|
||||
#define NCI_STATUS_NFCEE_TRANSMISSION_ERROR 0xc2
|
||||
#define NCI_STATUS_NFCEE_PROTOCOL_ERROR 0xc3
|
||||
#define NCI_STATUS_NFCEE_TIMEOUT_ERROR 0xc4
|
||||
|
||||
/* NCI RF Technology and Mode */
|
||||
#define NCI_NFC_A_PASSIVE_POLL_MODE 0x00
|
||||
#define NCI_NFC_B_PASSIVE_POLL_MODE 0x01
|
||||
#define NCI_NFC_F_PASSIVE_POLL_MODE 0x02
|
||||
#define NCI_NFC_A_ACTIVE_POLL_MODE 0x03
|
||||
#define NCI_NFC_F_ACTIVE_POLL_MODE 0x05
|
||||
#define NCI_NFC_A_PASSIVE_LISTEN_MODE 0x80
|
||||
#define NCI_NFC_B_PASSIVE_LISTEN_MODE 0x81
|
||||
#define NCI_NFC_F_PASSIVE_LISTEN_MODE 0x82
|
||||
#define NCI_NFC_A_ACTIVE_LISTEN_MODE 0x83
|
||||
#define NCI_NFC_F_ACTIVE_LISTEN_MODE 0x85
|
||||
|
||||
/* NCI RF Protocols */
|
||||
#define NCI_RF_PROTOCOL_UNKNOWN 0x00
|
||||
#define NCI_RF_PROTOCOL_T1T 0x01
|
||||
#define NCI_RF_PROTOCOL_T2T 0x02
|
||||
#define NCI_RF_PROTOCOL_T3T 0x03
|
||||
#define NCI_RF_PROTOCOL_ISO_DEP 0x04
|
||||
#define NCI_RF_PROTOCOL_NFC_DEP 0x05
|
||||
|
||||
/* NCI RF Interfaces */
|
||||
#define NCI_RF_INTERFACE_RFU 0x00
|
||||
#define NCI_RF_INTERFACE_FRAME 0x01
|
||||
#define NCI_RF_INTERFACE_ISO_DEP 0x02
|
||||
#define NCI_RF_INTERFACE_NFC_DEP 0x03
|
||||
|
||||
/* NCI RF_DISCOVER_MAP_CMD modes */
|
||||
#define NCI_DISC_MAP_MODE_POLL 0x01
|
||||
#define NCI_DISC_MAP_MODE_LISTEN 0x02
|
||||
#define NCI_DISC_MAP_MODE_BOTH 0x03
|
||||
|
||||
/* NCI Discovery Types */
|
||||
#define NCI_DISCOVERY_TYPE_POLL_A_PASSIVE 0x00
|
||||
#define NCI_DISCOVERY_TYPE_POLL_B_PASSIVE 0x01
|
||||
#define NCI_DISCOVERY_TYPE_POLL_F_PASSIVE 0x02
|
||||
#define NCI_DISCOVERY_TYPE_POLL_A_ACTIVE 0x03
|
||||
#define NCI_DISCOVERY_TYPE_POLL_F_ACTIVE 0x05
|
||||
#define NCI_DISCOVERY_TYPE_WAKEUP_A_PASSIVE 0x06
|
||||
#define NCI_DISCOVERY_TYPE_WAKEUP_B_PASSIVE 0x07
|
||||
#define NCI_DISCOVERY_TYPE_WAKEUP_A_ACTIVE 0x09
|
||||
#define NCI_DISCOVERY_TYPE_LISTEN_A_PASSIVE 0x80
|
||||
#define NCI_DISCOVERY_TYPE_LISTEN_B_PASSIVE 0x81
|
||||
#define NCI_DISCOVERY_TYPE_LISTEN_F_PASSIVE 0x82
|
||||
#define NCI_DISCOVERY_TYPE_LISTEN_A_ACTIVE 0x83
|
||||
#define NCI_DISCOVERY_TYPE_LISTEN_F_ACTIVE 0x85
|
||||
|
||||
/* NCI Deactivation Type */
|
||||
#define NCI_DEACTIVATE_TYPE_IDLE_MODE 0x00
|
||||
#define NCI_DEACTIVATE_TYPE_SLEEP_MODE 0x01
|
||||
#define NCI_DEACTIVATE_TYPE_SLEEP_AF_MODE 0x02
|
||||
#define NCI_DEACTIVATE_TYPE_RF_LINK_LOSS 0x03
|
||||
#define NCI_DEACTIVATE_TYPE_DISCOVERY_ERROR 0x04
|
||||
|
||||
/* Message Type (MT) */
|
||||
#define NCI_MT_DATA_PKT 0x00
|
||||
#define NCI_MT_CMD_PKT 0x01
|
||||
#define NCI_MT_RSP_PKT 0x02
|
||||
#define NCI_MT_NTF_PKT 0x03
|
||||
|
||||
#define nci_mt(hdr) (((hdr)[0]>>5)&0x07)
|
||||
#define nci_mt_set(hdr, mt) ((hdr)[0] |= (__u8)(((mt)&0x07)<<5))
|
||||
|
||||
/* Packet Boundary Flag (PBF) */
|
||||
#define NCI_PBF_LAST 0x00
|
||||
#define NCI_PBF_CONT 0x01
|
||||
|
||||
#define nci_pbf(hdr) (__u8)(((hdr)[0]>>4)&0x01)
|
||||
#define nci_pbf_set(hdr, pbf) ((hdr)[0] |= (__u8)(((pbf)&0x01)<<4))
|
||||
|
||||
/* Control Opcode manipulation */
|
||||
#define nci_opcode_pack(gid, oid) (__u16)((((__u16)((gid)&0x0f))<<8)|\
|
||||
((__u16)((oid)&0x3f)))
|
||||
#define nci_opcode(hdr) nci_opcode_pack(hdr[0], hdr[1])
|
||||
#define nci_opcode_gid(op) (__u8)(((op)&0x0f00)>>8)
|
||||
#define nci_opcode_oid(op) (__u8)((op)&0x003f)
|
||||
|
||||
/* Payload Length */
|
||||
#define nci_plen(hdr) (__u8)((hdr)[2])
|
||||
|
||||
/* Connection ID */
|
||||
#define nci_conn_id(hdr) (__u8)(((hdr)[0])&0x0f)
|
||||
|
||||
/* GID values */
|
||||
#define NCI_GID_CORE 0x0
|
||||
#define NCI_GID_RF_MGMT 0x1
|
||||
#define NCI_GID_NFCEE_MGMT 0x2
|
||||
#define NCI_GID_PROPRIETARY 0xf
|
||||
|
||||
/* ---- NCI Packet structures ---- */
|
||||
#define NCI_CTRL_HDR_SIZE 3
|
||||
#define NCI_DATA_HDR_SIZE 3
|
||||
|
||||
struct nci_ctrl_hdr {
|
||||
__u8 gid; /* MT & PBF & GID */
|
||||
__u8 oid;
|
||||
__u8 plen;
|
||||
} __packed;
|
||||
|
||||
struct nci_data_hdr {
|
||||
__u8 conn_id; /* MT & PBF & ConnID */
|
||||
__u8 rfu;
|
||||
__u8 plen;
|
||||
} __packed;
|
||||
|
||||
/* ------------------------ */
|
||||
/* ----- NCI Commands ---- */
|
||||
/* ------------------------ */
|
||||
#define NCI_OP_CORE_RESET_CMD nci_opcode_pack(NCI_GID_CORE, 0x00)
|
||||
|
||||
#define NCI_OP_CORE_INIT_CMD nci_opcode_pack(NCI_GID_CORE, 0x01)
|
||||
|
||||
#define NCI_OP_CORE_SET_CONFIG_CMD nci_opcode_pack(NCI_GID_CORE, 0x02)
|
||||
|
||||
#define NCI_OP_CORE_CONN_CREATE_CMD nci_opcode_pack(NCI_GID_CORE, 0x04)
|
||||
struct nci_core_conn_create_cmd {
|
||||
__u8 target_handle;
|
||||
__u8 num_target_specific_params;
|
||||
} __packed;
|
||||
|
||||
#define NCI_OP_CORE_CONN_CLOSE_CMD nci_opcode_pack(NCI_GID_CORE, 0x06)
|
||||
|
||||
#define NCI_OP_RF_DISCOVER_MAP_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
|
||||
struct disc_map_config {
|
||||
__u8 rf_protocol;
|
||||
__u8 mode;
|
||||
__u8 rf_interface_type;
|
||||
} __packed;
|
||||
|
||||
struct nci_rf_disc_map_cmd {
|
||||
__u8 num_mapping_configs;
|
||||
struct disc_map_config mapping_configs
|
||||
[NCI_MAX_NUM_MAPPING_CONFIGS];
|
||||
} __packed;
|
||||
|
||||
#define NCI_OP_RF_DISCOVER_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
|
||||
struct disc_config {
|
||||
__u8 type;
|
||||
__u8 frequency;
|
||||
} __packed;
|
||||
|
||||
struct nci_rf_disc_cmd {
|
||||
__u8 num_disc_configs;
|
||||
struct disc_config disc_configs[NCI_MAX_NUM_RF_CONFIGS];
|
||||
} __packed;
|
||||
|
||||
#define NCI_OP_RF_DEACTIVATE_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
|
||||
struct nci_rf_deactivate_cmd {
|
||||
__u8 type;
|
||||
} __packed;
|
||||
|
||||
/* ----------------------- */
|
||||
/* ---- NCI Responses ---- */
|
||||
/* ----------------------- */
|
||||
#define NCI_OP_CORE_RESET_RSP nci_opcode_pack(NCI_GID_CORE, 0x00)
|
||||
struct nci_core_reset_rsp {
|
||||
__u8 status;
|
||||
__u8 nci_ver;
|
||||
} __packed;
|
||||
|
||||
#define NCI_OP_CORE_INIT_RSP nci_opcode_pack(NCI_GID_CORE, 0x01)
|
||||
struct nci_core_init_rsp_1 {
|
||||
__u8 status;
|
||||
__le32 nfcc_features;
|
||||
__u8 num_supported_rf_interfaces;
|
||||
__u8 supported_rf_interfaces[0]; /* variable size array */
|
||||
/* continuted in nci_core_init_rsp_2 */
|
||||
} __packed;
|
||||
|
||||
struct nci_core_init_rsp_2 {
|
||||
__u8 max_logical_connections;
|
||||
__le16 max_routing_table_size;
|
||||
__u8 max_control_packet_payload_length;
|
||||
__le16 rf_sending_buffer_size;
|
||||
__le16 rf_receiving_buffer_size;
|
||||
__le16 manufacturer_id;
|
||||
} __packed;
|
||||
|
||||
#define NCI_OP_CORE_SET_CONFIG_RSP nci_opcode_pack(NCI_GID_CORE, 0x02)
|
||||
|
||||
#define NCI_OP_CORE_CONN_CREATE_RSP nci_opcode_pack(NCI_GID_CORE, 0x04)
|
||||
struct nci_core_conn_create_rsp {
|
||||
__u8 status;
|
||||
__u8 max_pkt_payload_size;
|
||||
__u8 initial_num_credits;
|
||||
__u8 conn_id;
|
||||
} __packed;
|
||||
|
||||
#define NCI_OP_CORE_CONN_CLOSE_RSP nci_opcode_pack(NCI_GID_CORE, 0x06)
|
||||
|
||||
#define NCI_OP_RF_DISCOVER_MAP_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
|
||||
|
||||
#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
|
||||
|
||||
#define NCI_OP_RF_DEACTIVATE_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
|
||||
|
||||
/* --------------------------- */
|
||||
/* ---- NCI Notifications ---- */
|
||||
/* --------------------------- */
|
||||
#define NCI_OP_CORE_CONN_CREDITS_NTF nci_opcode_pack(NCI_GID_CORE, 0x07)
|
||||
struct conn_credit_entry {
|
||||
__u8 conn_id;
|
||||
__u8 credits;
|
||||
} __packed;
|
||||
|
||||
struct nci_core_conn_credit_ntf {
|
||||
__u8 num_entries;
|
||||
struct conn_credit_entry conn_entries[NCI_MAX_NUM_CONN];
|
||||
} __packed;
|
||||
|
||||
#define NCI_OP_RF_FIELD_INFO_NTF nci_opcode_pack(NCI_GID_CORE, 0x08)
|
||||
struct nci_rf_field_info_ntf {
|
||||
__u8 rf_field_status;
|
||||
} __packed;
|
||||
|
||||
#define NCI_OP_RF_ACTIVATE_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x05)
|
||||
struct rf_tech_specific_params_nfca_poll {
|
||||
__u16 sens_res;
|
||||
__u8 nfcid1_len; /* 0, 4, 7, or 10 Bytes */
|
||||
__u8 nfcid1[10];
|
||||
__u8 sel_res_len; /* 0 or 1 Bytes */
|
||||
__u8 sel_res;
|
||||
} __packed;
|
||||
|
||||
struct activation_params_nfca_poll_iso_dep {
|
||||
__u8 rats_res_len;
|
||||
__u8 rats_res[20];
|
||||
};
|
||||
|
||||
struct nci_rf_activate_ntf {
|
||||
__u8 target_handle;
|
||||
__u8 rf_protocol;
|
||||
__u8 rf_tech_and_mode;
|
||||
__u8 rf_tech_specific_params_len;
|
||||
|
||||
union {
|
||||
struct rf_tech_specific_params_nfca_poll nfca_poll;
|
||||
} rf_tech_specific_params;
|
||||
|
||||
__u8 rf_interface_type;
|
||||
__u8 activation_params_len;
|
||||
|
||||
union {
|
||||
struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep;
|
||||
} activation_params;
|
||||
|
||||
} __packed;
|
||||
|
||||
#define NCI_OP_RF_DEACTIVATE_NTF nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
|
||||
|
||||
#endif /* __NCI_H */
|
||||
184
include/net/nfc/nci_core.h
Normal file
184
include/net/nfc/nci_core.h
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
* The NFC Controller Interface is the communication protocol between an
|
||||
* NFC Controller (NFCC) and a Device Host (DH).
|
||||
*
|
||||
* Copyright (C) 2011 Texas Instruments, Inc.
|
||||
*
|
||||
* Written by Ilan Elias <ilane@ti.com>
|
||||
*
|
||||
* Acknowledgements:
|
||||
* This file is based on hci_core.h, which was written
|
||||
* by Maxim Krasnyansky.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NCI_CORE_H
|
||||
#define __NCI_CORE_H
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
#include <net/nfc/nfc.h>
|
||||
#include <net/nfc/nci.h>
|
||||
|
||||
/* NCI device state */
|
||||
enum {
|
||||
NCI_INIT,
|
||||
NCI_UP,
|
||||
NCI_DISCOVERY,
|
||||
NCI_POLL_ACTIVE,
|
||||
NCI_DATA_EXCHANGE,
|
||||
};
|
||||
|
||||
/* NCI timeouts */
|
||||
#define NCI_RESET_TIMEOUT 5000
|
||||
#define NCI_INIT_TIMEOUT 5000
|
||||
#define NCI_RF_DISC_TIMEOUT 5000
|
||||
#define NCI_RF_DEACTIVATE_TIMEOUT 5000
|
||||
#define NCI_CMD_TIMEOUT 5000
|
||||
|
||||
struct nci_dev;
|
||||
|
||||
struct nci_ops {
|
||||
int (*open)(struct nci_dev *ndev);
|
||||
int (*close)(struct nci_dev *ndev);
|
||||
int (*send)(struct sk_buff *skb);
|
||||
};
|
||||
|
||||
#define NCI_MAX_SUPPORTED_RF_INTERFACES 4
|
||||
|
||||
/* NCI Core structures */
|
||||
struct nci_dev {
|
||||
struct nfc_dev *nfc_dev;
|
||||
struct nci_ops *ops;
|
||||
|
||||
int tx_headroom;
|
||||
int tx_tailroom;
|
||||
|
||||
unsigned long flags;
|
||||
|
||||
atomic_t cmd_cnt;
|
||||
atomic_t credits_cnt;
|
||||
|
||||
struct timer_list cmd_timer;
|
||||
|
||||
struct workqueue_struct *cmd_wq;
|
||||
struct work_struct cmd_work;
|
||||
|
||||
struct workqueue_struct *rx_wq;
|
||||
struct work_struct rx_work;
|
||||
|
||||
struct workqueue_struct *tx_wq;
|
||||
struct work_struct tx_work;
|
||||
|
||||
struct sk_buff_head cmd_q;
|
||||
struct sk_buff_head rx_q;
|
||||
struct sk_buff_head tx_q;
|
||||
|
||||
struct mutex req_lock;
|
||||
struct completion req_completion;
|
||||
__u32 req_status;
|
||||
__u32 req_result;
|
||||
|
||||
void *driver_data;
|
||||
|
||||
__u32 poll_prots;
|
||||
__u32 target_available_prots;
|
||||
__u32 target_active_prot;
|
||||
|
||||
/* received during NCI_OP_CORE_RESET_RSP */
|
||||
__u8 nci_ver;
|
||||
|
||||
/* received during NCI_OP_CORE_INIT_RSP */
|
||||
__u32 nfcc_features;
|
||||
__u8 num_supported_rf_interfaces;
|
||||
__u8 supported_rf_interfaces
|
||||
[NCI_MAX_SUPPORTED_RF_INTERFACES];
|
||||
__u8 max_logical_connections;
|
||||
__u16 max_routing_table_size;
|
||||
__u8 max_control_packet_payload_length;
|
||||
__u16 rf_sending_buffer_size;
|
||||
__u16 rf_receiving_buffer_size;
|
||||
__u16 manufacturer_id;
|
||||
|
||||
/* received during NCI_OP_CORE_CONN_CREATE_RSP for static conn 0 */
|
||||
__u8 max_pkt_payload_size;
|
||||
__u8 initial_num_credits;
|
||||
__u8 conn_id;
|
||||
|
||||
/* stored during nci_data_exchange */
|
||||
data_exchange_cb_t data_exchange_cb;
|
||||
void *data_exchange_cb_context;
|
||||
struct sk_buff *rx_data_reassembly;
|
||||
};
|
||||
|
||||
/* ----- NCI Devices ----- */
|
||||
struct nci_dev *nci_allocate_device(struct nci_ops *ops,
|
||||
__u32 supported_protocols,
|
||||
int tx_headroom,
|
||||
int tx_tailroom);
|
||||
void nci_free_device(struct nci_dev *ndev);
|
||||
int nci_register_device(struct nci_dev *ndev);
|
||||
void nci_unregister_device(struct nci_dev *ndev);
|
||||
int nci_recv_frame(struct sk_buff *skb);
|
||||
|
||||
static inline struct sk_buff *nci_skb_alloc(struct nci_dev *ndev,
|
||||
unsigned int len,
|
||||
gfp_t how)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
|
||||
skb = alloc_skb(len + ndev->tx_headroom + ndev->tx_tailroom, how);
|
||||
if (skb)
|
||||
skb_reserve(skb, ndev->tx_headroom);
|
||||
|
||||
return skb;
|
||||
}
|
||||
|
||||
static inline void nci_set_parent_dev(struct nci_dev *ndev, struct device *dev)
|
||||
{
|
||||
nfc_set_parent_dev(ndev->nfc_dev, dev);
|
||||
}
|
||||
|
||||
static inline void nci_set_drvdata(struct nci_dev *ndev, void *data)
|
||||
{
|
||||
ndev->driver_data = data;
|
||||
}
|
||||
|
||||
static inline void *nci_get_drvdata(struct nci_dev *ndev)
|
||||
{
|
||||
return ndev->driver_data;
|
||||
}
|
||||
|
||||
void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb);
|
||||
void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb);
|
||||
void nci_rx_data_packet(struct nci_dev *ndev, struct sk_buff *skb);
|
||||
int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload);
|
||||
int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb);
|
||||
void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb,
|
||||
int err);
|
||||
|
||||
/* ----- NCI requests ----- */
|
||||
#define NCI_REQ_DONE 0
|
||||
#define NCI_REQ_PEND 1
|
||||
#define NCI_REQ_CANCELED 2
|
||||
|
||||
void nci_req_complete(struct nci_dev *ndev, int result);
|
||||
|
||||
/* ----- NCI status code ----- */
|
||||
int nci_to_errno(__u8 code);
|
||||
|
||||
#endif /* __NCI_CORE_H */
|
||||
|
|
@ -48,6 +48,8 @@ typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb,
|
|||
int err);
|
||||
|
||||
struct nfc_ops {
|
||||
int (*dev_up)(struct nfc_dev *dev);
|
||||
int (*dev_down)(struct nfc_dev *dev);
|
||||
int (*start_poll)(struct nfc_dev *dev, u32 protocols);
|
||||
void (*stop_poll)(struct nfc_dev *dev);
|
||||
int (*activate_target)(struct nfc_dev *dev, u32 target_idx,
|
||||
|
|
@ -78,7 +80,9 @@ struct nfc_dev {
|
|||
int targets_generation;
|
||||
spinlock_t targets_lock;
|
||||
struct device dev;
|
||||
bool dev_up;
|
||||
bool polling;
|
||||
bool remote_activated;
|
||||
struct nfc_genl_data genl_data;
|
||||
u32 supported_protocols;
|
||||
|
||||
Loading…
Reference in a new issue