1 // SPDX-License-Identifier: GPL-2.0-only
3 * The NFC Controller Interface is the communication protocol between an
4 * NFC Controller (NFCC) and a Device Host (DH).
6 * Copyright (C) 2011 Texas Instruments, Inc.
8 * Written by Ilan Elias <ilane@ti.com>
11 * This file is based on lib.c, which was written
12 * by Maxim Krasnyansky.
15 #include <linux/module.h>
16 #include <linux/kernel.h>
17 #include <linux/types.h>
18 #include <linux/errno.h>
20 #include <net/nfc/nci.h>
21 #include <net/nfc/nci_core.h>
23 /* NCI status codes to Unix errno mapping */
24 int nci_to_errno(__u8 code)
30 case NCI_STATUS_REJECTED:
33 case NCI_STATUS_RF_FRAME_CORRUPTED:
36 case NCI_STATUS_NOT_INITIALIZED:
39 case NCI_STATUS_SYNTAX_ERROR:
40 case NCI_STATUS_SEMANTIC_ERROR:
41 case NCI_STATUS_INVALID_PARAM:
42 case NCI_STATUS_RF_PROTOCOL_ERROR:
43 case NCI_STATUS_NFCEE_PROTOCOL_ERROR:
46 case NCI_STATUS_UNKNOWN_GID:
47 case NCI_STATUS_UNKNOWN_OID:
50 case NCI_STATUS_MESSAGE_SIZE_EXCEEDED:
53 case NCI_STATUS_DISCOVERY_ALREADY_STARTED:
56 case NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED:
57 case NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED:
60 case NCI_STATUS_RF_TRANSMISSION_ERROR:
61 case NCI_STATUS_NFCEE_TRANSMISSION_ERROR:
64 case NCI_STATUS_RF_TIMEOUT_ERROR:
65 case NCI_STATUS_NFCEE_TIMEOUT_ERROR:
68 case NCI_STATUS_FAILED:
73 EXPORT_SYMBOL(nci_to_errno);