Lines Matching defs:ndev
30 static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev,
51 conn_info = nci_get_conn_info_by_conn_id(ndev,
61 if (!skb_queue_empty(&ndev->tx_q))
62 queue_work(ndev->tx_wq, &ndev->tx_work);
65 static void nci_core_generic_error_ntf_packet(struct nci_dev *ndev,
72 if (atomic_read(&ndev->state) == NCI_W4_HOST_SELECT) {
75 nci_req_complete(ndev, status);
79 static void nci_core_conn_intf_error_ntf_packet(struct nci_dev *ndev,
89 if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags))
90 nci_data_exchange_complete(ndev, NULL, ntf->conn_id, -EIO);
93 static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev,
120 static __u8 *nci_extract_rf_params_nfcb_passive_poll(struct nci_dev *ndev,
134 static __u8 *nci_extract_rf_params_nfcf_passive_poll(struct nci_dev *ndev,
150 static __u8 *nci_extract_rf_params_nfcv_passive_poll(struct nci_dev *ndev,
161 static __u8 *nci_extract_rf_params_nfcf_passive_listen(struct nci_dev *ndev,
173 static __u32 nci_get_prop_rf_protocol(struct nci_dev *ndev, __u8 rf_protocol)
175 if (ndev->ops->get_rfprotocol)
176 return ndev->ops->get_rfprotocol(ndev, rf_protocol);
180 static int nci_add_new_protocol(struct nci_dev *ndev,
208 protocol = nci_get_prop_rf_protocol(ndev, rf_protocol);
210 if (!(protocol & ndev->poll_prots)) {
265 static void nci_add_new_target(struct nci_dev *ndev,
271 for (i = 0; i < ndev->n_targets; i++) {
272 target = &ndev->targets[i];
275 nci_add_new_protocol(ndev, target, ntf->rf_protocol,
283 if (ndev->n_targets == NCI_MAX_DISCOVERED_TARGETS) {
288 target = &ndev->targets[ndev->n_targets];
290 rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol,
295 ndev->n_targets++;
298 ndev->n_targets);
302 void nci_clear_target_list(struct nci_dev *ndev)
304 memset(ndev->targets, 0,
307 ndev->n_targets = 0;
310 static void nci_rf_discover_ntf_packet(struct nci_dev *ndev,
331 data = nci_extract_rf_params_nfca_passive_poll(ndev,
336 data = nci_extract_rf_params_nfcb_passive_poll(ndev,
341 data = nci_extract_rf_params_nfcf_passive_poll(ndev,
346 data = nci_extract_rf_params_nfcv_passive_poll(ndev,
362 nci_add_new_target(ndev, &ntf);
365 atomic_set(&ndev->state, NCI_W4_ALL_DISCOVERIES);
367 atomic_set(&ndev->state, NCI_W4_HOST_SELECT);
368 nfc_targets_found(ndev->nfc_dev, ndev->targets,
369 ndev->n_targets);
373 static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev,
409 static int nci_extract_activation_params_nfc_dep(struct nci_dev *ndev,
445 static void nci_target_auto_activated(struct nci_dev *ndev,
451 target = &ndev->targets[ndev->n_targets];
453 rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol,
460 ndev->n_targets++;
463 target->logical_idx, ndev->n_targets);
465 nfc_targets_found(ndev->nfc_dev, ndev->targets, ndev->n_targets);
468 static int nci_store_general_bytes_nfc_dep(struct nci_dev *ndev,
471 ndev->remote_gb_len = 0;
479 ndev->remote_gb_len = min_t(__u8,
483 memcpy(ndev->remote_gb,
486 ndev->remote_gb_len);
491 ndev->remote_gb_len = min_t(__u8,
495 memcpy(ndev->remote_gb,
498 ndev->remote_gb_len);
510 static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,
548 data = nci_extract_rf_params_nfca_passive_poll(ndev,
553 data = nci_extract_rf_params_nfcb_passive_poll(ndev,
558 data = nci_extract_rf_params_nfcf_passive_poll(ndev,
563 data = nci_extract_rf_params_nfcv_passive_poll(ndev,
572 data = nci_extract_rf_params_nfcf_passive_listen(ndev,
599 err = nci_extract_activation_params_iso_dep(ndev,
604 err = nci_extract_activation_params_nfc_dep(ndev,
622 conn_info = ndev->rf_conn_info;
635 err = nci_store_general_bytes_nfc_dep(ndev, &ntf);
643 if (atomic_read(&ndev->state) == NCI_DISCOVERY) {
646 atomic_set(&ndev->state, NCI_POLL_ACTIVE);
648 nci_target_auto_activated(ndev, &ntf);
649 } else { /* ndev->state == NCI_W4_HOST_SELECT */
652 atomic_set(&ndev->state, NCI_POLL_ACTIVE);
653 nci_req_complete(ndev, err);
658 atomic_set(&ndev->state, NCI_LISTEN_ACTIVE);
661 err = nfc_tm_activated(ndev->nfc_dev,
664 ndev->remote_gb,
665 ndev->remote_gb_len);
672 static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev,
680 conn_info = ndev->rf_conn_info;
685 skb_queue_purge(&ndev->tx_q);
688 if (ndev->rx_data_reassembly) {
689 kfree_skb(ndev->rx_data_reassembly);
690 ndev->rx_data_reassembly = NULL;
694 if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags))
695 nci_data_exchange_complete(ndev, NULL, NCI_STATIC_RF_CONN_ID,
700 nci_clear_target_list(ndev);
701 atomic_set(&ndev->state, NCI_IDLE);
705 atomic_set(&ndev->state, NCI_W4_HOST_SELECT);
708 nci_clear_target_list(ndev);
709 atomic_set(&ndev->state, NCI_DISCOVERY);
713 nci_req_complete(ndev, NCI_STATUS_OK);
716 static void nci_nfcee_discover_ntf_packet(struct nci_dev *ndev,
730 ndev->hci_dev->nfcee_id = nfcee_ntf->nfcee_id;
731 ndev->cur_params.id = nfcee_ntf->nfcee_id;
733 nci_req_complete(ndev, status);
736 static void nci_nfcee_action_ntf_packet(struct nci_dev *ndev,
742 void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb)
756 if (nci_prop_ntf_packet(ndev, ntf_opcode, skb) == -ENOTSUPP) {
766 nci_core_conn_credits_ntf_packet(ndev, skb);
770 nci_core_generic_error_ntf_packet(ndev, skb);
774 nci_core_conn_intf_error_ntf_packet(ndev, skb);
778 nci_rf_discover_ntf_packet(ndev, skb);
782 nci_rf_intf_activated_ntf_packet(ndev, skb);
786 nci_rf_deactivate_ntf_packet(ndev, skb);
790 nci_nfcee_discover_ntf_packet(ndev, skb);
794 nci_nfcee_action_ntf_packet(ndev, skb);
802 nci_core_ntf_packet(ndev, ntf_opcode, skb);