Lines Matching refs:ndev

30 static void nci_core_reset_ntf_packet(struct nci_dev *ndev,
36 ndev->nci_ver = ntf->nci_ver;
40 ndev->manufact_id = ntf->manufact_id;
41 ndev->manufact_specific_info =
44 nci_req_complete(ndev, NCI_STATUS_OK);
47 static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev,
68 conn_info = nci_get_conn_info_by_conn_id(ndev,
78 if (!skb_queue_empty(&ndev->tx_q))
79 queue_work(ndev->tx_wq, &ndev->tx_work);
82 static void nci_core_generic_error_ntf_packet(struct nci_dev *ndev,
89 if (atomic_read(&ndev->state) == NCI_W4_HOST_SELECT) {
92 nci_req_complete(ndev, status);
96 static void nci_core_conn_intf_error_ntf_packet(struct nci_dev *ndev,
106 if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags))
107 nci_data_exchange_complete(ndev, NULL, ntf->conn_id, -EIO);
111 nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev,
139 nci_extract_rf_params_nfcb_passive_poll(struct nci_dev *ndev,
154 nci_extract_rf_params_nfcf_passive_poll(struct nci_dev *ndev,
171 nci_extract_rf_params_nfcv_passive_poll(struct nci_dev *ndev,
183 nci_extract_rf_params_nfcf_passive_listen(struct nci_dev *ndev,
195 static __u32 nci_get_prop_rf_protocol(struct nci_dev *ndev, __u8 rf_protocol)
197 if (ndev->ops->get_rfprotocol)
198 return ndev->ops->get_rfprotocol(ndev, rf_protocol);
202 static int nci_add_new_protocol(struct nci_dev *ndev,
230 protocol = nci_get_prop_rf_protocol(ndev, rf_protocol);
232 if (!(protocol & ndev->poll_prots)) {
287 static void nci_add_new_target(struct nci_dev *ndev,
293 for (i = 0; i < ndev->n_targets; i++) {
294 target = &ndev->targets[i];
297 nci_add_new_protocol(ndev, target, ntf->rf_protocol,
305 if (ndev->n_targets == NCI_MAX_DISCOVERED_TARGETS) {
310 target = &ndev->targets[ndev->n_targets];
312 rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol,
317 ndev->n_targets++;
320 ndev->n_targets);
324 void nci_clear_target_list(struct nci_dev *ndev)
326 memset(ndev->targets, 0,
329 ndev->n_targets = 0;
332 static void nci_rf_discover_ntf_packet(struct nci_dev *ndev,
353 data = nci_extract_rf_params_nfca_passive_poll(ndev,
358 data = nci_extract_rf_params_nfcb_passive_poll(ndev,
363 data = nci_extract_rf_params_nfcf_passive_poll(ndev,
368 data = nci_extract_rf_params_nfcv_passive_poll(ndev,
384 nci_add_new_target(ndev, &ntf);
387 atomic_set(&ndev->state, NCI_W4_ALL_DISCOVERIES);
389 atomic_set(&ndev->state, NCI_W4_HOST_SELECT);
390 nfc_targets_found(ndev->nfc_dev, ndev->targets,
391 ndev->n_targets);
395 static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev,
432 static int nci_extract_activation_params_nfc_dep(struct nci_dev *ndev,
469 static void nci_target_auto_activated(struct nci_dev *ndev,
475 target = &ndev->targets[ndev->n_targets];
477 rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol,
484 ndev->n_targets++;
487 target->logical_idx, ndev->n_targets);
489 nfc_targets_found(ndev->nfc_dev, ndev->targets, ndev->n_targets);
492 static int nci_store_general_bytes_nfc_dep(struct nci_dev *ndev,
495 ndev->remote_gb_len = 0;
503 ndev->remote_gb_len = min_t(__u8,
507 memcpy(ndev->remote_gb,
510 ndev->remote_gb_len);
515 ndev->remote_gb_len = min_t(__u8,
519 memcpy(ndev->remote_gb,
522 ndev->remote_gb_len);
534 static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,
572 data = nci_extract_rf_params_nfca_passive_poll(ndev,
577 data = nci_extract_rf_params_nfcb_passive_poll(ndev,
582 data = nci_extract_rf_params_nfcf_passive_poll(ndev,
587 data = nci_extract_rf_params_nfcv_passive_poll(ndev,
596 data = nci_extract_rf_params_nfcf_passive_listen(ndev,
623 err = nci_extract_activation_params_iso_dep(ndev,
628 err = nci_extract_activation_params_nfc_dep(ndev,
646 conn_info = ndev->rf_conn_info;
659 err = nci_store_general_bytes_nfc_dep(ndev, &ntf);
667 if (atomic_read(&ndev->state) == NCI_DISCOVERY) {
670 atomic_set(&ndev->state, NCI_POLL_ACTIVE);
672 nci_target_auto_activated(ndev, &ntf);
673 } else { /* ndev->state == NCI_W4_HOST_SELECT */
676 atomic_set(&ndev->state, NCI_POLL_ACTIVE);
677 nci_req_complete(ndev, err);
682 atomic_set(&ndev->state, NCI_LISTEN_ACTIVE);
685 err = nfc_tm_activated(ndev->nfc_dev,
688 ndev->remote_gb,
689 ndev->remote_gb_len);
696 static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev,
704 conn_info = ndev->rf_conn_info;
709 skb_queue_purge(&ndev->tx_q);
712 if (ndev->rx_data_reassembly) {
713 kfree_skb(ndev->rx_data_reassembly);
714 ndev->rx_data_reassembly = NULL;
718 if (test_bit(NCI_DATA_EXCHANGE, &ndev->flags))
719 nci_data_exchange_complete(ndev, NULL, NCI_STATIC_RF_CONN_ID,
724 nci_clear_target_list(ndev);
725 atomic_set(&ndev->state, NCI_IDLE);
729 atomic_set(&ndev->state, NCI_W4_HOST_SELECT);
732 nci_clear_target_list(ndev);
733 atomic_set(&ndev->state, NCI_DISCOVERY);
737 nci_req_complete(ndev, NCI_STATUS_OK);
740 static void nci_nfcee_discover_ntf_packet(struct nci_dev *ndev,
752 ndev->hci_dev->nfcee_id = nfcee_ntf->nfcee_id;
753 ndev->cur_params.id = nfcee_ntf->nfcee_id;
755 nci_req_complete(ndev, status);
758 void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb)
772 if (nci_prop_ntf_packet(ndev, ntf_opcode, skb) == -ENOTSUPP) {
782 nci_core_reset_ntf_packet(ndev, skb);
786 nci_core_conn_credits_ntf_packet(ndev, skb);
790 nci_core_generic_error_ntf_packet(ndev, skb);
794 nci_core_conn_intf_error_ntf_packet(ndev, skb);
798 nci_rf_discover_ntf_packet(ndev, skb);
802 nci_rf_intf_activated_ntf_packet(ndev, skb);
806 nci_rf_deactivate_ntf_packet(ndev, skb);
810 nci_nfcee_discover_ntf_packet(ndev, skb);
821 nci_core_ntf_packet(ndev, ntf_opcode, skb);