2 * Copyright (C) 2012 Intel Corporation. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
21 #include <net/nfc/hci.h>
23 struct gate_pipe_map
{
29 u8 header
; /* type -cmd,evt,rsp- + instruction */
34 u8 header
; /* cbit+pipe */
35 struct hcp_message message
;
38 struct hcp_exec_waiter
{
39 wait_queue_head_t
*wq
;
42 struct sk_buff
*result_skb
;
46 struct list_head msg_l
;
47 struct sk_buff_head msg_frags
;
49 data_exchange_cb_t cb
;
51 unsigned long completion_delay
;
54 struct hci_create_pipe_params
{
60 struct hci_create_pipe_resp
{
68 #define NFC_HCI_FRAGMENT 0x7f
70 #define HCP_HEADER(type, instr) ((((type) & 0x03) << 6) | ((instr) & 0x3f))
71 #define HCP_MSG_GET_TYPE(header) ((header & 0xc0) >> 6)
72 #define HCP_MSG_GET_CMD(header) (header & 0x3f)
74 int nfc_hci_hcp_message_tx(struct nfc_hci_dev
*hdev
, u8 pipe
,
75 u8 type
, u8 instruction
,
76 const u8
*payload
, size_t payload_len
,
77 data_exchange_cb_t cb
, void *cb_context
,
78 unsigned long completion_delay
);
80 u8
nfc_hci_pipe2gate(struct nfc_hci_dev
*hdev
, u8 pipe
);
82 void nfc_hci_hcp_message_rx(struct nfc_hci_dev
*hdev
, u8 pipe
, u8 type
,
83 u8 instruction
, struct sk_buff
*skb
);
86 #define NFC_HCI_HCP_PACKET_HEADER_LEN 1
87 #define NFC_HCI_HCP_MESSAGE_HEADER_LEN 1
88 #define NFC_HCI_HCP_HEADER_LEN 2
91 #define NFC_HCI_HCP_COMMAND 0x00
92 #define NFC_HCI_HCP_EVENT 0x01
93 #define NFC_HCI_HCP_RESPONSE 0x02
95 /* Generic commands */
96 #define NFC_HCI_ANY_SET_PARAMETER 0x01
97 #define NFC_HCI_ANY_GET_PARAMETER 0x02
98 #define NFC_HCI_ANY_OPEN_PIPE 0x03
99 #define NFC_HCI_ANY_CLOSE_PIPE 0x04
101 /* Reader RF commands */
102 #define NFC_HCI_WR_XCHG_DATA 0x10
105 #define NFC_HCI_ADM_CREATE_PIPE 0x10
106 #define NFC_HCI_ADM_DELETE_PIPE 0x11
107 #define NFC_HCI_ADM_NOTIFY_PIPE_CREATED 0x12
108 #define NFC_HCI_ADM_NOTIFY_PIPE_DELETED 0x13
109 #define NFC_HCI_ADM_CLEAR_ALL_PIPE 0x14
110 #define NFC_HCI_ADM_NOTIFY_ALL_PIPE_CLEARED 0x15
112 /* Generic responses */
113 #define NFC_HCI_ANY_OK 0x00
114 #define NFC_HCI_ANY_E_NOT_CONNECTED 0x01
115 #define NFC_HCI_ANY_E_CMD_PAR_UNKNOWN 0x02
116 #define NFC_HCI_ANY_E_NOK 0x03
117 #define NFC_HCI_ANY_E_PIPES_FULL 0x04
118 #define NFC_HCI_ANY_E_REG_PAR_UNKNOWN 0x05
119 #define NFC_HCI_ANY_E_PIPE_NOT_OPENED 0x06
120 #define NFC_HCI_ANY_E_CMD_NOT_SUPPORTED 0x07
121 #define NFC_HCI_ANY_E_INHIBITED 0x08
122 #define NFC_HCI_ANY_E_TIMEOUT 0x09
123 #define NFC_HCI_ANY_E_REG_ACCESS_DENIED 0x0a
124 #define NFC_HCI_ANY_E_PIPE_ACCESS_DENIED 0x0b
126 #endif /* __LOCAL_HCI_H */