Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8c0dacd authored by Ilan Elias's avatar Ilan Elias Committed by John W. Linville
Browse files

NFC: Update names and structs to NCI spec 1.0 d18



Addition, deletion and modification of NCI constants.
Changes in NCI commands, responses and notifications structures.

Signed-off-by: default avatarIlan Elias <ilane@ti.com>
Acked-by: default avatarLauro Ramos Venancio <lauro.venancio@openbossa.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e999882a
Loading
Loading
Loading
Loading
+56 −25
Original line number Diff line number Diff line
@@ -36,24 +36,23 @@
/* 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
#define	NCI_STATUS_RF_FRAME_CORRUPTED				0x02
#define	NCI_STATUS_FAILED					0x03
#define	NCI_STATUS_NOT_INITIALIZED				0x04
#define	NCI_STATUS_SYNTAX_ERROR					0x05
#define	NCI_STATUS_SEMANTIC_ERROR				0x06
#define	NCI_STATUS_UNKNOWN_GID					0x07
#define	NCI_STATUS_UNKNOWN_OID					0x08
#define	NCI_STATUS_INVALID_PARAM				0x09
#define	NCI_STATUS_MESSAGE_SIZE_EXCEEDED			0x0a
/* Discovery Specific Status Codes */
#define	NCI_STATUS_DISCOVERY_ALREADY_STARTED			0xa0
#define	NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED		0xa1
#define	NCI_STATUS_DISCOVERY_TEAR_DOWN				0xa2
/* 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
@@ -73,6 +72,21 @@
#define NCI_NFC_A_ACTIVE_LISTEN_MODE				0x83
#define NCI_NFC_F_ACTIVE_LISTEN_MODE				0x85

/* NCI RF Technologies */
#define NCI_NFC_RF_TECHNOLOGY_A					0x00
#define NCI_NFC_RF_TECHNOLOGY_B					0x01
#define NCI_NFC_RF_TECHNOLOGY_F					0x02
#define NCI_NFC_RF_TECHNOLOGY_15693				0x03

/* NCI Bit Rates */
#define NCI_NFC_BIT_RATE_106					0x00
#define NCI_NFC_BIT_RATE_212					0x01
#define NCI_NFC_BIT_RATE_424					0x02
#define NCI_NFC_BIT_RATE_848					0x03
#define NCI_NFC_BIT_RATE_1696					0x04
#define NCI_NFC_BIT_RATE_3392					0x05
#define NCI_NFC_BIT_RATE_6784					0x06

/* NCI RF Protocols */
#define NCI_RF_PROTOCOL_UNKNOWN					0x00
#define NCI_RF_PROTOCOL_T1T					0x01
@@ -82,11 +96,18 @@
#define NCI_RF_PROTOCOL_NFC_DEP					0x05

/* NCI RF Interfaces */
#define NCI_RF_INTERFACE_RFU					0x00
#define NCI_RF_INTERFACE_NFCEE_DIRECT				0x00
#define	NCI_RF_INTERFACE_FRAME					0x01
#define	NCI_RF_INTERFACE_ISO_DEP				0x02
#define	NCI_RF_INTERFACE_NFC_DEP				0x03

/* NCI Reset types */
#define NCI_RESET_TYPE_KEEP_CONFIG				0x00
#define NCI_RESET_TYPE_RESET_CONFIG				0x01

/* NCI Static RF connection ID */
#define NCI_STATIC_RF_CONN_ID					0x00

/* NCI RF_DISCOVER_MAP_CMD modes */
#define NCI_DISC_MAP_MODE_POLL					0x01
#define NCI_DISC_MAP_MODE_LISTEN				0x02
@@ -98,8 +119,6 @@
#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
@@ -111,8 +130,7 @@
#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
#define	NCI_DEACTIVATE_TYPE_DISCOVERY				0x03

/* Message Type (MT) */
#define NCI_MT_DATA_PKT						0x00
@@ -169,6 +187,9 @@ struct nci_data_hdr {
/* -----  NCI Commands ---- */
/* ------------------------ */
#define NCI_OP_CORE_RESET_CMD		nci_opcode_pack(NCI_GID_CORE, 0x00)
struct nci_core_reset_cmd {
	__u8	reset_type;
} __packed;

#define NCI_OP_CORE_INIT_CMD		nci_opcode_pack(NCI_GID_CORE, 0x01)

@@ -218,6 +239,7 @@ struct nci_rf_deactivate_cmd {
struct nci_core_reset_rsp {
	__u8	status;
	__u8	nci_ver;
	__u8	config_status;
} __packed;

#define NCI_OP_CORE_INIT_RSP		nci_opcode_pack(NCI_GID_CORE, 0x01)
@@ -232,10 +254,12 @@ struct nci_core_init_rsp_1 {
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;
	__u8	max_ctrl_pkt_payload_len;
	__le16	max_size_for_large_params;
	__u8	max_data_pkt_payload_size;
	__u8	initial_num_credits;
	__u8	manufact_id;
	__le32	manufact_specific_info;
} __packed;

#define NCI_OP_CORE_SET_CONFIG_RSP	nci_opcode_pack(NCI_GID_CORE, 0x02)
@@ -275,7 +299,7 @@ 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)
#define NCI_OP_RF_INTF_ACTIVATED_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 */
@@ -289,17 +313,20 @@ struct activation_params_nfca_poll_iso_dep {
	__u8	rats_res[20];
};

struct nci_rf_activate_ntf {
	__u8	target_handle;
struct nci_rf_intf_activated_ntf {
	__u8	rf_discovery_id;
	__u8	rf_interface_type;
	__u8	rf_protocol;
	__u8	rf_tech_and_mode;
	__u8	activation_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	data_exch_rf_tech_and_mode;
	__u8	data_exch_tx_bit_rate;
	__u8	data_exch_rx_bit_rate;
	__u8	activation_params_len;

	union {
@@ -309,5 +336,9 @@ struct nci_rf_activate_ntf {
} __packed;

#define NCI_OP_RF_DEACTIVATE_NTF	nci_opcode_pack(NCI_GID_RF_MGMT, 0x06)
struct nci_rf_deactivate_ntf {
	__u8	type;
	__u8	reason;
} __packed;

#endif /* __NCI_H */
+6 −5
Original line number Diff line number Diff line
@@ -109,14 +109,15 @@ struct nci_dev {
				[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;
	__u8			max_ctrl_pkt_payload_len;
	__u16			max_size_for_large_params;
	__u8			max_data_pkt_payload_size;
	__u8			initial_num_credits;
	__u8			manufact_id;
	__u32			manufact_specific_info;

	/* 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 */
+5 −2
Original line number Diff line number Diff line
@@ -125,7 +125,10 @@ static inline int nci_request(struct nci_dev *ndev,

static void nci_reset_req(struct nci_dev *ndev, unsigned long opt)
{
	nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 0, NULL);
	struct nci_core_reset_cmd cmd;

	cmd.reset_type = NCI_RESET_TYPE_RESET_CONFIG;
	nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 1, &cmd);
}

static void nci_init_req(struct nci_dev *ndev, unsigned long opt)
@@ -469,7 +472,7 @@ static int nci_data_exchange(struct nfc_dev *nfc_dev, __u32 target_idx,
	ndev->data_exchange_cb = cb;
	ndev->data_exchange_cb_context = cb_context;

	rc = nci_send_data(ndev, ndev->conn_id, skb);
	rc = nci_send_data(ndev, NCI_STATIC_RF_CONN_ID, skb);
	if (rc)
		clear_bit(NCI_DATA_EXCHANGE, &ndev->flags);

+3 −2
Original line number Diff line number Diff line
@@ -95,7 +95,8 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev,
	__skb_queue_head_init(&frags_q);

	while (total_len) {
		frag_len = min_t(int, total_len, ndev->max_pkt_payload_size);
		frag_len =
			min_t(int, total_len, ndev->max_data_pkt_payload_size);

		skb_frag = nci_skb_alloc(ndev,
					(NCI_DATA_HDR_SIZE + frag_len),
@@ -151,7 +152,7 @@ int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb)
	nfc_dbg("entry, conn_id 0x%x, plen %d", conn_id, skb->len);

	/* check if the packet need to be fragmented */
	if (skb->len <= ndev->max_pkt_payload_size) {
	if (skb->len <= ndev->max_data_pkt_payload_size) {
		/* no need to fragment packet */
		nci_push_data_hdr(ndev, conn_id, skb, NCI_PBF_LAST);

+1 −7
Original line number Diff line number Diff line
@@ -42,12 +42,9 @@ int nci_to_errno(__u8 code)
	case NCI_STATUS_REJECTED:
		return -EBUSY;

	case NCI_STATUS_MESSAGE_CORRUPTED:
	case NCI_STATUS_RF_FRAME_CORRUPTED:
		return -EBADMSG;

	case NCI_STATUS_BUFFER_FULL:
		return -ENOBUFS;

	case NCI_STATUS_NOT_INITIALIZED:
		return -EHOSTDOWN;

@@ -80,9 +77,6 @@ int nci_to_errno(__u8 code)
	case NCI_STATUS_NFCEE_TIMEOUT_ERROR:
		return -ETIMEDOUT;

	case NCI_STATUS_RF_LINK_LOSS_ERROR:
		return -ENOLINK;

	case NCI_STATUS_MAX_ACTIVE_NFCEE_INTERFACES_REACHED:
		return -EDQUOT;

Loading