• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 NFCSTATUS phNxpNciHal_PrbsTestStart(phNxpNfc_PrbsType_t prbs_type,
122                                     phNxpNfc_PrbsHwType_t hw_prbs_type,
123                                     phNxpNfc_Tech_t tech,
124                                     phNxpNfc_Bitrate_t bitrate);
125 /*******************************************************************************
126  **
127  ** Function         phNxpNciHal_PrbsTestStop
128  **
129  ** Description      Test function stop RF generation for RF technology started
130  **                  by phNxpNciHal_PrbsTestStart.
131  **
132  ** Returns          NFCSTATUS_SUCCESS if operation successful,
133  **                  otherwise NFCSTATUS_FAILED.
134  **
135  ******************************************************************************/
136 
137 NFCSTATUS phNxpNciHal_PrbsTestStop();
138 
139 /*******************************************************************************
140 **
141 ** Function         phNxpNciHal_AntennaSelfTest
142 **
143 ** Description      Test function to validate the Antenna's discrete
144 **                  components connection.
145 **
146 ** Returns          NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED.
147 **
148 *******************************************************************************/
149 
150 NFCSTATUS phNxpNciHal_AntennaSelfTest(phAntenna_St_Resp_t* phAntenna_St_Resp);
151 
152 /*******************************************************************************
153 **
154 ** Function         phNxpNciHal_RfFieldTest
155 **
156 ** Description      Test function performs RF filed test.
157 **
158 ** Returns          NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED.
159 **
160 *******************************************************************************/
161 
162 NFCSTATUS phNxpNciHal_RfFieldTest(uint8_t on);
163 
164 /*******************************************************************************
165  **
166  ** Function         phNxpNciHal_DownloadPinTest
167  **
168  ** Description      Test function to validate the FW download pin connection.
169  **
170  ** Returns          NFCSTATUS_SUCCESS if successful,otherwise NFCSTATUS_FAILED.
171  **
172  ******************************************************************************/
173 
174 NFCSTATUS phNxpNciHal_DownloadPinTest(void);
175 
176 #endif /* _NXP_HW_SELF_TEST_H_ */
177 #endif /* _PHNXPNCIHAL_SELFTEST_H_ */
178