1 /* 2 * Copyright (C) 2012-2014 NXP Semiconductors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #ifndef _PHNXPNCIHAL_SELFTEST_H_ 17 #define _PHNXPNCIHAL_SELFTEST_H_ 18 19 #ifdef NXP_HW_SELF_TEST 20 21 #include <phNfcStatus.h> 22 #include <phNxpNciHal.h> 23 #include <phTmlNfc.h> 24 25 /* PRBS Generation type */ 26 typedef enum { 27 NFC_FW_PRBS, /* FW software would generate the PRBS */ 28 NFC_HW_PRBS /* Hardware would generate the PRBS */ 29 } phNxpNfc_PrbsType_t; 30 31 /* Different HW PRBS types */ 32 typedef enum { NFC_HW_PRBS9, NFC_HW_PRBS15 } phNxpNfc_PrbsHwType_t; 33 /* RF Technology */ 34 typedef enum { 35 NFC_RF_TECHNOLOGY_A, 36 NFC_RF_TECHNOLOGY_B, 37 NFC_RF_TECHNOLOGY_F, 38 } phNxpNfc_Tech_t; 39 40 /* Bit rates */ 41 typedef enum { 42 NFC_BIT_RATE_106, 43 NFC_BIT_RATE_212, 44 NFC_BIT_RATE_424, 45 NFC_BIT_RATE_848, 46 } phNxpNfc_Bitrate_t; 47 48 typedef struct phAntenna_St_Resp { 49 /* Txdo Raw Value*/ 50 uint16_t wTxdoRawValue; 51 uint16_t wTxdoMeasuredRangeMin; /*Txdo Measured Range Max */ 52 uint16_t wTxdoMeasuredRangeMax; /*Txdo Measured Range Min */ 53 uint16_t wTxdoMeasuredTolerance; /*Txdo Measured Range Tolerance */ 54 /* Agc Values */ 55 uint16_t wAgcValue; /*Agc Min Value*/ 56 uint16_t wAgcValueTolerance; /*Txdo Measured Range*/ 57 /* Agc value with NFCLD */ 58 uint16_t wAgcValuewithfixedNFCLD; /*Agc Value with Fixed NFCLD Max */ 59 uint16_t wAgcValuewithfixedNFCLDTolerance; /*Agc Value with Fixed NFCLD 60 Tolerance */ 61 /* Agc Differential Values With Open/Short RM */ 62 uint16_t wAgcDifferentialWithOpen1; /*Agc Differential With Open 1*/ 63 uint16_t wAgcDifferentialWithOpenTolerance1; /*Agc Differential With Open 64 Tolerance 1*/ 65 uint16_t wAgcDifferentialWithOpen2; /*Agc Differential With Open 2*/ 66 uint16_t wAgcDifferentialWithOpenTolerance2; /*Agc Differential With Open 67 Tolerance 2*/ 68 } phAntenna_St_Resp_t; /* Instance of Transaction structure */ 69 70 /******************************************************************************* 71 ** 72 ** Function phNxpNciHal_TestMode_open 73 ** 74 ** Description It opens the physical connection with NFCC (pn547) and 75 ** creates required client thread for operation. 76 ** 77 ** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED. 78 ** 79 ******************************************************************************/ 80 81 NFCSTATUS phNxpNciHal_TestMode_open(void); 82 83 /******************************************************************************* 84 ** 85 ** Function phNxpNciHal_TestMode_close 86 ** 87 ** Description This function close the NFCC interface and free all 88 ** resources. 89 ** 90 ** Returns None. 91 ** 92 ******************************************************************************/ 93 94 void phNxpNciHal_TestMode_close(void); 95 96 /******************************************************************************* 97 ** 98 ** Function phNxpNciHal_SwpTest 99 ** 100 ** Description Test function to validate the SWP line. SWP line number is 101 ** is sent as parameter to the API. 102 ** 103 ** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED. 104 ** 105 ******************************************************************************/ 106 107 NFCSTATUS phNxpNciHal_SwpTest(uint8_t swp_line); 108 109 /******************************************************************************* 110 ** 111 ** Function phNxpNciHal_PrbsTestStart 112 ** 113 ** Description Test function start RF generation for RF technology and bit 114 ** rate. RF technology and bit rate are sent as parameter to 115 ** the API. 116 ** 117 ** Returns NFCSTATUS_SUCCESS if RF generation successful, 118 ** otherwise NFCSTATUS_FAILED. 119 ** 120 ******************************************************************************/ 121 #if (NFC_NXP_CHIP_TYPE != PN547C2) 122 NFCSTATUS phNxpNciHal_PrbsTestStart(phNxpNfc_PrbsType_t prbs_type, 123 phNxpNfc_PrbsHwType_t hw_prbs_type, 124 phNxpNfc_Tech_t tech, 125 phNxpNfc_Bitrate_t bitrate); 126 #else 127 NFCSTATUS phNxpNciHal_PrbsTestStart(phNxpNfc_Tech_t tech, 128 phNxpNfc_Bitrate_t bitrate); 129 #endif 130 /******************************************************************************* 131 ** 132 ** Function phNxpNciHal_PrbsTestStop 133 ** 134 ** Description Test function stop RF generation for RF technology started 135 ** by phNxpNciHal_PrbsTestStart. 136 ** 137 ** Returns NFCSTATUS_SUCCESS if operation successful, 138 ** otherwise NFCSTATUS_FAILED. 139 ** 140 ******************************************************************************/ 141 142 NFCSTATUS phNxpNciHal_PrbsTestStop(); 143 144 /******************************************************************************* 145 ** 146 ** Function phNxpNciHal_AntennaSelfTest 147 ** 148 ** Description Test function to validate the Antenna's discrete 149 ** components connection. 150 ** 151 ** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED. 152 ** 153 *******************************************************************************/ 154 155 NFCSTATUS phNxpNciHal_AntennaSelfTest(phAntenna_St_Resp_t* phAntenna_St_Resp); 156 157 /******************************************************************************* 158 ** 159 ** Function phNxpNciHal_RfFieldTest 160 ** 161 ** Description Test function performs RF filed test. 162 ** 163 ** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED. 164 ** 165 *******************************************************************************/ 166 167 NFCSTATUS phNxpNciHal_RfFieldTest(uint8_t on); 168 169 /******************************************************************************* 170 ** 171 ** Function phNxpNciHal_DownloadPinTest 172 ** 173 ** Description Test function to validate the FW download pin connection. 174 ** 175 ** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED. 176 ** 177 ******************************************************************************/ 178 179 NFCSTATUS phNxpNciHal_DownloadPinTest(void); 180 181 #endif /* _NXP_HW_SELF_TEST_H_ */ 182 #endif /* _PHNXPNCIHAL_SELFTEST_H_ */ 183