aboutsummaryrefslogtreecommitdiff
path: root/pn54x/inc/phNxpNciHal_SelfTest.h
blob: ee7c8d64df37053db60721a2e321d177d02fa37b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
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_ */