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 { 28 NFC_FW_PRBS, /* FW software would generate the PRBS */ 29 NFC_HW_PRBS /* Hardware would generate the PRBS */ 30 } phNxpNfc_PrbsType_t; 31 32 /* Different HW PRBS types */ 33 typedef enum 34 { 35 NFC_HW_PRBS9, 36 NFC_HW_PRBS15 37 } phNxpNfc_PrbsHwType_t; 38 /* RF Technology */ 39 typedef enum 40 { 41 NFC_RF_TECHNOLOGY_A, 42 NFC_RF_TECHNOLOGY_B, 43 NFC_RF_TECHNOLOGY_F, 44 } phNxpNfc_Tech_t; 45 46 /* Bit rates */ 47 typedef enum 48 { 49 NFC_BIT_RATE_106, 50 NFC_BIT_RATE_212, 51 NFC_BIT_RATE_424, 52 NFC_BIT_RATE_848, 53 } phNxpNfc_Bitrate_t; 54 55 typedef struct phAntenna_St_Resp 56 { 57 /* Txdo Raw Value*/ 58 uint16_t wTxdoRawValue; 59 uint16_t wTxdoMeasuredRangeMin; /*Txdo Measured Range Max */ 60 uint16_t wTxdoMeasuredRangeMax; /*Txdo Measured Range Min */ 61 uint16_t wTxdoMeasuredTolerance; /*Txdo Measured Range Tolerance */ 62 /* Agc Values */ 63 uint16_t wAgcValue; /*Agc Min Value*/ 64 uint16_t wAgcValueTolerance; /*Txdo Measured Range*/ 65 /* Agc value with NFCLD */ 66 uint16_t wAgcValuewithfixedNFCLD; /*Agc Value with Fixed NFCLD Max */ 67 uint16_t wAgcValuewithfixedNFCLDTolerance; /*Agc Value with Fixed NFCLD Tolerance */ 68 /* Agc Differential Values With Open/Short RM */ 69 uint16_t wAgcDifferentialWithOpen1; /*Agc Differential With Open 1*/ 70 uint16_t wAgcDifferentialWithOpenTolerance1; /*Agc Differential With Open Tolerance 1*/ 71 uint16_t wAgcDifferentialWithOpen2; /*Agc Differential With Open 2*/ 72 uint16_t wAgcDifferentialWithOpenTolerance2; /*Agc Differential With Open Tolerance 2*/ 73 }phAntenna_St_Resp_t; /* Instance of Transaction structure */ 74 75 76 /******************************************************************************* 77 ** 78 ** Function phNxpNciHal_TestMode_open 79 ** 80 ** Description It opens the physical connection with NFCC (pn547) and 81 ** creates required client thread for operation. 82 ** 83 ** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED. 84 ** 85 *******************************************************************************/ 86 87 NFCSTATUS phNxpNciHal_TestMode_open (void); 88 89 /******************************************************************************* 90 ** 91 ** Function phNxpNciHal_TestMode_close 92 ** 93 ** Description This function close the NFCC interface and free all 94 ** resources. 95 ** 96 ** Returns None. 97 ** 98 *******************************************************************************/ 99 100 void phNxpNciHal_TestMode_close (void); 101 102 /******************************************************************************* 103 ** 104 ** Function phNxpNciHal_SwpTest 105 ** 106 ** Description Test function to validate the SWP line. SWP line number is 107 ** is sent as parameter to the API. 108 ** 109 ** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED. 110 ** 111 *******************************************************************************/ 112 113 NFCSTATUS phNxpNciHal_SwpTest (uint8_t swp_line); 114 115 /******************************************************************************* 116 ** 117 ** Function phNxpNciHal_PrbsTestStart 118 ** 119 ** Description Test function start RF generation for RF technology and bit 120 ** rate. RF technology and bit rate are sent as parameter to 121 ** the API. 122 ** 123 ** Returns NFCSTATUS_SUCCESS if RF generation successful, 124 ** otherwise NFCSTATUS_FAILED. 125 ** 126 *******************************************************************************/ 127 #if(NFC_NXP_CHIP_TYPE != PN547C2) 128 NFCSTATUS phNxpNciHal_PrbsTestStart (phNxpNfc_PrbsType_t prbs_type, phNxpNfc_PrbsHwType_t hw_prbs_type, 129 phNxpNfc_Tech_t tech, phNxpNfc_Bitrate_t bitrate); 130 #else 131 NFCSTATUS phNxpNciHal_PrbsTestStart (phNxpNfc_Tech_t tech, phNxpNfc_Bitrate_t bitrate); 132 #endif 133 /******************************************************************************* 134 ** 135 ** Function phNxpNciHal_PrbsTestStop 136 ** 137 ** Description Test function stop RF generation for RF technology started 138 ** by phNxpNciHal_PrbsTestStart. 139 ** 140 ** Returns NFCSTATUS_SUCCESS if operation successful, 141 ** otherwise NFCSTATUS_FAILED. 142 ** 143 *******************************************************************************/ 144 145 NFCSTATUS phNxpNciHal_PrbsTestStop (); 146 147 /******************************************************************************* 148 ** 149 ** Function phNxpNciHal_AntennaSelfTest 150 ** 151 ** Description Test function to validate the Antenna's discrete 152 ** components connection. 153 ** 154 ** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED. 155 ** 156 *******************************************************************************/ 157 158 NFCSTATUS phNxpNciHal_AntennaSelfTest(phAntenna_St_Resp_t * phAntenna_St_Resp ); 159 160 /******************************************************************************* 161 ** 162 ** Function phNxpNciHal_RfFieldTest 163 ** 164 ** Description Test function performs RF filed test. 165 ** 166 ** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED. 167 ** 168 *******************************************************************************/ 169 170 NFCSTATUS phNxpNciHal_RfFieldTest (uint8_t on); 171 172 /******************************************************************************* 173 ** 174 ** Function phNxpNciHal_DownloadPinTest 175 ** 176 ** Description Test function to validate the FW download pin connection. 177 ** 178 ** Returns NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED. 179 ** 180 *******************************************************************************/ 181 182 NFCSTATUS phNxpNciHal_DownloadPinTest (void); 183 184 #endif /* _NXP_HW_SELF_TEST_H_ */ 185 #endif /* _PHNXPNCIHAL_SELFTEST_H_ */ 186