summaryrefslogtreecommitdiff
path: root/pn54x/inc
diff options
context:
space:
mode:
authorArian <arian.kulmer@web.de>2019-09-30 11:10:42 +0200
committerArian <arian.kulmer@web.de>2019-10-25 22:17:12 +0200
commit9224c881cf3f8575194823a6c779c0d65c42258a (patch)
treeac8a018ff4fdea5a589ca7ee3d88cd88d0d460ba /pn54x/inc
parentfbdbc276d9f25e67e49a7ca03002b838cc9c8548 (diff)
shinano-common: pn54x: Import from lineage-15.1
* https://github.com/LineageOS/android_system_nfc/tree/lineage-15.1/halimpl/pn54x/common * support for pn54x has been dropped in lineage-16.0 and above Change-Id: I19f2c3a6e3066bf9aaaaf4ddcd7d7ad867de0ed8
Diffstat (limited to 'pn54x/inc')
-rw-r--r--pn54x/inc/phNxpNciHal_Adaptation.h40
-rw-r--r--pn54x/inc/phNxpNciHal_Api.h36
-rw-r--r--pn54x/inc/phNxpNciHal_SelfTest.h182
3 files changed, 258 insertions, 0 deletions
diff --git a/pn54x/inc/phNxpNciHal_Adaptation.h b/pn54x/inc/phNxpNciHal_Adaptation.h
new file mode 100644
index 0000000..b4d5566
--- /dev/null
+++ b/pn54x/inc/phNxpNciHal_Adaptation.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2012-2014 NXP Semiconductors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _PHNXPNCIHAL_ADAPTATION_H_
+#define _PHNXPNCIHAL_ADAPTATION_H_
+
+#include <hardware/hardware.h>
+#include <hardware/nfc.h>
+
+typedef struct {
+ struct nfc_nci_device nci_device;
+
+ /* Local definitions */
+} pn547_dev_t;
+
+/* NXP HAL functions */
+
+int phNxpNciHal_open(nfc_stack_callback_t* p_cback,
+ nfc_stack_data_callback_t* p_data_cback);
+int phNxpNciHal_write(uint16_t data_len, const uint8_t* p_data);
+int phNxpNciHal_core_initialized(uint8_t* p_core_init_rsp_params);
+int phNxpNciHal_pre_discover(void);
+int phNxpNciHal_close(void);
+int phNxpNciHal_control_granted(void);
+int phNxpNciHal_power_cycle(void);
+
+#endif /* _PHNXPNCIHAL_ADAPTATION_H_ */
diff --git a/pn54x/inc/phNxpNciHal_Api.h b/pn54x/inc/phNxpNciHal_Api.h
new file mode 100644
index 0000000..e1e0649
--- /dev/null
+++ b/pn54x/inc/phNxpNciHal_Api.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2012-2014 NXP Semiconductors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _PHNXPNCIHAL_API_H_
+#define _PHNXPNCIHAL_API_H_
+
+#include <phNfcStatus.h>
+#include <phNxpNciHal.h>
+#include <phTmlNfc.h>
+
+/*******************************************************************************
+ **
+ ** Function phNxpNciHal_get_version
+ **
+ ** Description Function to get the HW, FW and SW versions.
+ **
+ ** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED.
+ **
+ ******************************************************************************/
+
+NFCSTATUS phNxpNciHal_get_version(uint32_t* hw_ver, uint32_t* fw_ver,
+ uint32_t* sw_ver);
+
+#endif /* _PHNXPNCIHAL_API_H_ */
diff --git a/pn54x/inc/phNxpNciHal_SelfTest.h b/pn54x/inc/phNxpNciHal_SelfTest.h
new file mode 100644
index 0000000..ee7c8d6
--- /dev/null
+++ b/pn54x/inc/phNxpNciHal_SelfTest.h
@@ -0,0 +1,182 @@
+/*
+ * Copyright (C) 2012-2014 NXP Semiconductors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef _PHNXPNCIHAL_SELFTEST_H_
+#define _PHNXPNCIHAL_SELFTEST_H_
+
+#ifdef NXP_HW_SELF_TEST
+
+#include <phNfcStatus.h>
+#include <phNxpNciHal.h>
+#include <phTmlNfc.h>
+
+/* PRBS Generation type */
+typedef enum {
+ NFC_FW_PRBS, /* FW software would generate the PRBS */
+ NFC_HW_PRBS /* Hardware would generate the PRBS */
+} phNxpNfc_PrbsType_t;
+
+/* Different HW PRBS types */
+typedef enum { NFC_HW_PRBS9, NFC_HW_PRBS15 } phNxpNfc_PrbsHwType_t;
+/* RF Technology */
+typedef enum {
+ NFC_RF_TECHNOLOGY_A,
+ NFC_RF_TECHNOLOGY_B,
+ NFC_RF_TECHNOLOGY_F,
+} phNxpNfc_Tech_t;
+
+/* Bit rates */
+typedef enum {
+ NFC_BIT_RATE_106,
+ NFC_BIT_RATE_212,
+ NFC_BIT_RATE_424,
+ NFC_BIT_RATE_848,
+} phNxpNfc_Bitrate_t;
+
+typedef struct phAntenna_St_Resp {
+ /* Txdo Raw Value*/
+ uint16_t wTxdoRawValue;
+ uint16_t wTxdoMeasuredRangeMin; /*Txdo Measured Range Max */
+ uint16_t wTxdoMeasuredRangeMax; /*Txdo Measured Range Min */
+ uint16_t wTxdoMeasuredTolerance; /*Txdo Measured Range Tolerance */
+ /* Agc Values */
+ uint16_t wAgcValue; /*Agc Min Value*/
+ uint16_t wAgcValueTolerance; /*Txdo Measured Range*/
+ /* Agc value with NFCLD */
+ uint16_t wAgcValuewithfixedNFCLD; /*Agc Value with Fixed NFCLD Max */
+ uint16_t wAgcValuewithfixedNFCLDTolerance; /*Agc Value with Fixed NFCLD
+ Tolerance */
+ /* Agc Differential Values With Open/Short RM */
+ uint16_t wAgcDifferentialWithOpen1; /*Agc Differential With Open 1*/
+ uint16_t wAgcDifferentialWithOpenTolerance1; /*Agc Differential With Open
+ Tolerance 1*/
+ uint16_t wAgcDifferentialWithOpen2; /*Agc Differential With Open 2*/
+ uint16_t wAgcDifferentialWithOpenTolerance2; /*Agc Differential With Open
+ Tolerance 2*/
+} phAntenna_St_Resp_t; /* Instance of Transaction structure */
+
+/*******************************************************************************
+ **
+ ** Function phNxpNciHal_TestMode_open
+ **
+ ** Description It opens the physical connection with NFCC (pn547) and
+ ** creates required client thread for operation.
+ **
+ ** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED.
+ **
+ ******************************************************************************/
+
+NFCSTATUS phNxpNciHal_TestMode_open(void);
+
+/*******************************************************************************
+ **
+ ** Function phNxpNciHal_TestMode_close
+ **
+ ** Description This function close the NFCC interface and free all
+ ** resources.
+ **
+ ** Returns None.
+ **
+ ******************************************************************************/
+
+void phNxpNciHal_TestMode_close(void);
+
+/*******************************************************************************
+ **
+ ** Function phNxpNciHal_SwpTest
+ **
+ ** Description Test function to validate the SWP line. SWP line number is
+ ** is sent as parameter to the API.
+ **
+ ** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED.
+ **
+ ******************************************************************************/
+
+NFCSTATUS phNxpNciHal_SwpTest(uint8_t swp_line);
+
+/*******************************************************************************
+ **
+ ** Function phNxpNciHal_PrbsTestStart
+ **
+ ** Description Test function start RF generation for RF technology and bit
+ ** rate. RF technology and bit rate are sent as parameter to
+ ** the API.
+ **
+ ** Returns NFCSTATUS_SUCCESS if RF generation successful,
+ ** otherwise NFCSTATUS_FAILED.
+ **
+ ******************************************************************************/
+#if (NFC_NXP_CHIP_TYPE != PN547C2)
+NFCSTATUS phNxpNciHal_PrbsTestStart(phNxpNfc_PrbsType_t prbs_type,
+ phNxpNfc_PrbsHwType_t hw_prbs_type,
+ phNxpNfc_Tech_t tech,
+ phNxpNfc_Bitrate_t bitrate);
+#else
+NFCSTATUS phNxpNciHal_PrbsTestStart(phNxpNfc_Tech_t tech,
+ phNxpNfc_Bitrate_t bitrate);
+#endif
+/*******************************************************************************
+ **
+ ** Function phNxpNciHal_PrbsTestStop
+ **
+ ** Description Test function stop RF generation for RF technology started
+ ** by phNxpNciHal_PrbsTestStart.
+ **
+ ** Returns NFCSTATUS_SUCCESS if operation successful,
+ ** otherwise NFCSTATUS_FAILED.
+ **
+ ******************************************************************************/
+
+NFCSTATUS phNxpNciHal_PrbsTestStop();
+
+/*******************************************************************************
+**
+** Function phNxpNciHal_AntennaSelfTest
+**
+** Description Test function to validate the Antenna's discrete
+** components connection.
+**
+** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED.
+**
+*******************************************************************************/
+
+NFCSTATUS phNxpNciHal_AntennaSelfTest(phAntenna_St_Resp_t* phAntenna_St_Resp);
+
+/*******************************************************************************
+**
+** Function phNxpNciHal_RfFieldTest
+**
+** Description Test function performs RF filed test.
+**
+** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED.
+**
+*******************************************************************************/
+
+NFCSTATUS phNxpNciHal_RfFieldTest(uint8_t on);
+
+/*******************************************************************************
+ **
+ ** Function phNxpNciHal_DownloadPinTest
+ **
+ ** Description Test function to validate the FW download pin connection.
+ **
+ ** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED.
+ **
+ ******************************************************************************/
+
+NFCSTATUS phNxpNciHal_DownloadPinTest(void);
+
+#endif /* _NXP_HW_SELF_TEST_H_ */
+#endif /* _PHNXPNCIHAL_SELFTEST_H_ */