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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
/*
* Copyright (C) 2010 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.
*/
/*!
* \file phLibNfc_Internal.h
*
* Project: NFC-FRI 1.1
*
* $Workfile:: phLibNfc_Internal.h $
* $Modtime:: $
* $Author: ing07385 $
* $Revision: 1.26 $
*
*/
#ifndef PHLIBNFC_IN_H
#define PHLIBNFC_IN_H
#include <phNfcStatus.h>
#include <phNfcCompId.h>
#include <phNfcHalTypes.h>
#include <phNfcInterface.h>
#include <phNfcConfig.h>
#include <phDbgTrace.h>
#include <phHal4Nfc.h>
#include <phFriNfc_NdefMap.h>
#include <phFriNfc_OvrHal.h>
#include <phFriNfc_SmtCrdFmt.h>
#include <phFriNfc_Llcp.h>
#include <phFriNfc_LlcpTransport.h>
#include <phOsalNfc_Timer.h>
#include <phLibNfc_SE.h>
#include <phFriNfc_NdefReg.h>
#include <phLibNfc.h>
#include <phLibNfc_initiator.h>
#include <phLibNfc_ndef_raw.h>
#include <phNfcLlcpTypes.h>
/**Maximum number of Records.Presently set to a realistic value of 128
Configurable upto 1K*/
#define MAX_NO_OF_RECORDS 128U
#define CHK_NDEF_NOT_DONE 0x02U
typedef struct phLibNfc_status
{
unsigned RlsCb_status : 1;
unsigned DiscEnbl_status : 1;
unsigned Connect_status : 1;
unsigned TransProg_status : 1;
unsigned RelsProg_status : 1;
unsigned GenCb_pending_status : 1;
unsigned Shutdown_pending_status : 1;
unsigned Discovery_pending_status : 1;
}Status_t;
typedef enum phLibNfc_State{
eLibNfcHalStateShutdown = 0x00, /**< closed*/
eLibNfcHalInitInProgress,
eLibNfcHalInited,
eLibNfcHalShutdownInProgress,
eLibNfcHalStateInitandIdle,
eLibNfcHalStateConfigReady ,
eLibNfcHalStateConnect,
eLibNfcHalStateTransaction,
eLibNfcHalStatePresenceChk,
eLibNfcHalStateRelease,
eLibNfcHalStateInvalid
} phLibNfc_State_t;
typedef struct phLibNfc_Hal_CB_Info
{
/*Init call back & its context*/
pphLibNfc_RspCb_t pClientInitCb;
void *pClientInitCntx;
/*Shutdown call back & its context*/
pphLibNfc_RspCb_t pClientShutdownCb;
void *pClientShtdwnCntx;
/*Connect call back & its context*/
pphLibNfc_ConnectCallback_t pClientConnectCb;
void *pClientConCntx;
/*DisConnect call back & its context*/
pphLibNfc_DisconnectCallback_t pClientDisConnectCb;
void *pClientDConCntx;
/*Transceive Call back & it's context*/
pphLibNfc_TransceiveCallback_t pClientTransceiveCb;
void *pClientTranseCntx;
/*Check Ndef Call back & it's context*/
pphLibNfc_ChkNdefRspCb_t pClientCkNdefCb;
void *pClientCkNdefCntx;
/*Read Ndef Call back & it's context*/
pphLibNfc_RspCb_t pClientRdNdefCb;
void *pClientRdNdefCntx;
/*Write Ndef Call back & it's context*/
pphLibNfc_RspCb_t pClientWrNdefCb;
void *pClientWrNdefCntx;
/*Discover Call back & it's context*/
pphLibNfc_RspCb_t pClientDisConfigCb;
void *pClientDisCfgCntx;
/*Presence check Call back & it's context*/
pphLibNfc_RspCb_t pClientPresChkCb;
void *pClientPresChkCntx;
/*Register notification Call back & it's context*/
phLibNfc_NtfRegister_RspCb_t pClientNtfRegRespCB;
void *pClientNtfRegRespCntx;
/*Ndef Notification CB*/
pphLibNfc_Ndef_Search_RspCb_t pClientNdefNtfRespCb;
void *pClientNdefNtfRespCntx;
/*LLCP Check CB*/
pphLibNfc_ChkLlcpRspCb_t pClientLlcpCheckRespCb;
void *pClientLlcpCheckRespCntx;
/*LLCP Link CB*/
pphLibNfc_LlcpLinkStatusCb_t pClientLlcpLinkCb;
void *pClientLlcpLinkCntx;
}phLibNfc_Hal_CB_Info_t;
typedef struct phLibNfc_NdefInfo
{
bool_t NdefContinueRead;
uint32_t NdefActualSize,
AppWrLength;
phFriNfc_NdefMap_t *psNdefMap;
uint16_t NdefSendRecvLen;
uint16_t NdefDataCount;
phNfc_sData_t *psUpperNdefMsg;
uint32_t NdefReadTimerId,
NdefLength;
uint8_t is_ndef ;
phFriNfc_sNdefSmtCrdFmt_t *ndef_fmt ;
phLibNfc_Last_Call_t eLast_Call;
uint32_t Chk_Ndef_Timer_Id;
/*Format Ndef Call back & it's context*/
pphLibNfc_RspCb_t pClientNdefFmtCb;
void *pClientNdefFmtCntx;
phLibNfc_Ndef_SrchType_t *pNdef_NtfSrch_Type;
}phLibNfc_NdefInfo_t;
typedef struct phLibNfc_NdefRecInfo
{
phFriNfc_NdefReg_CbParam_t CbParam;
phFriNfc_NdefReg_t NdefReg;
uint8_t *NdefTypes_array[100];
phFriNfc_NdefRecord_t RecordsExtracted;
uint8_t ChunkedRecordsarray[MAX_NO_OF_RECORDS];
uint32_t NumberOfRecords;
uint8_t IsChunked[MAX_NO_OF_RECORDS];
uint32_t NumberOfRawRecords;
uint8_t *RawRecords[MAX_NO_OF_RECORDS];
phFriNfc_NdefReg_Cb_t *NdefCb;
phNfc_sData_t ndef_message;
}phLibNfc_NdefRecInfo_t;
typedef struct phLibNfc_LlcpInfo
{
/* Local parameters for LLC, given upon config
* and used upon detection.
*/
phLibNfc_Llcp_sLinkParameters_t sLocalParams;
/* LLCP compliance flag */
bool_t bIsLlcp;
/* Monitor structure for LLCP Transport */
phFriNfc_LlcpTransport_t sLlcpTransportContext;
/* Monitor structure for LLCP LLC */
phFriNfc_Llcp_t sLlcpContext;
/* LLC Rx buffer */
uint8_t pRxBuffer[1024];
/* LLC Tx buffer */
uint8_t pTxBuffer[1024];
} phLibNfc_LlcpInfo_t;
typedef struct phLibNfc_LibContext
{
phHal_sHwReference_t *psHwReference;
Status_t status;
phHal_sEmulationCfg_t sCardEmulCfg;
phLibNfc_SeCtxt_t sSeContext;
phNfc_sState_t LibNfcState;
phHal_sDevInputParam_t *psDevInputParam;
phLibNfc_NdefInfo_t ndef_cntx;
phLibNfc_NfcIpInfo_t sNfcIp_Context;
phFriNfc_OvrHal_t *psOverHalCtxt;
phLibNfc_Registry_Info_t RegNtfType;
uint8_t dev_cnt;
/*To re configure the discovery wheel*/
phLibNfc_sADD_Cfg_t sADDconfig;
uint32_t Connected_handle,
Discov_handle[MAX_REMOTE_DEVICES];
/* To store the previous connected handle in case of Multiple protocol tags */
uint32_t Prev_Connected_handle;
/*Call back function pointers */
phLibNfc_eDiscoveryConfigMode_t eLibNfcCfgMode;
phHal4Nfc_DiscoveryInfo_t *psDiscInfo;
phLibNfc_eReleaseType_t ReleaseType;
/**Transaction Related Info */
phLibNfc_sTransceiveInfo_t *psTransInfo;
phLibNfc_sTransceiveInfo_t *psBufferedAuth;
uint8_t LastTrancvSuccess;
phLibNfc_RemoteDevList_t psRemoteDevList[MAX_REMOTE_DEVICES];
/*To Call back function pointers & Client context*/
phLibNfc_Hal_CB_Info_t CBInfo;
/*Ndef RTD search Info*/
phLibNfc_NdefRecInfo_t phLib_NdefRecCntx;
/*LLCP Info*/
phLibNfc_LlcpInfo_t llcp_cntx;
/* Pointer to Lib context */
} phLibNfc_LibContext_t,*pphLibNfc_LibContext_t;
extern void phLibNfc_Pending_Shutdown(void);
extern pphLibNfc_LibContext_t gpphLibContext;
extern NFCSTATUS
phLibNfc_UpdateNextState(
pphLibNfc_LibContext_t psNfcHalCtxt,
phLibNfc_State_t next_state
);
extern void
phLibNfc_UpdateCurState(
NFCSTATUS status,
pphLibNfc_LibContext_t psNfcHalCtxt
);
extern void
phLibNfc_Reconnect_Mifare_Cb (
void *pContext,
phHal_sRemoteDevInformation_t *psRemoteDevInfo,
NFCSTATUS status);
#endif
|