This file is indexed.

/usr/include/android-19/libnfc-nxp/phFriNfc_OvrHal.h is in android-headers-19 23-0ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
/*
 * 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  phFriNfc_OvrHal.h
 * \brief Overlapped HAL
 *
 * Project: NFC-FRI
 * Creator: Gerald Kersch
 *
 * $Date: Tue May 19 10:30:18 2009 $
 * Changed by: $Author: ing07336 $
 * $Revision: 1.13 $
 * $Aliases: NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $
 *
 */

#ifndef PHFRINFC_OVRHAL_H
#define PHFRINFC_OVRHAL_H

#include <phFriNfc.h>
#ifdef PH_HAL4_ENABLE
#include <phHal4Nfc.h>
#else
#include <phHalNfc.h>
#endif
#include <phNfcCompId.h>
#include <phNfcStatus.h>


/**
 *  \name Overlapped HAL
 *
 * File: \ref phFriNfc_OvrHal.h
 *
 */
/*@{*/
#define PH_FRINFC_OVRHAL_FILEREVISION "$Revision: 1.13 $" /** \ingroup grp_file_attributes */
#define PH_FRINFC_OVRHAL_FILEALIASES  "$Aliases: NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $"      /** \ingroup grp_file_attributes */
/*@}*/


/** \defgroup grp_fri_nfc_ovr_hal Overlapped HAL
 *
 *  This component encapsulates the HAL functions, suited for the NFC-FRI overlapped way of operation. The HAL itself
 *  is used as it is, wrapped by this component. The purpose of the wrapper is to de-couple a blocking I/O, as used by
 *  the HAL, from the overlapped I/O operation mode the FRI is using.
 *
 *  \par Device Based Functions
 *  NFC Device Based Functions are used to address the NFC device (local device) directly.
 *  These are all functions that use no Remote Device Information.
 *
 *  \par Connection Based Functions
 *  Connection Based Functions use the Remote Device Information to describe a connection
 *  to a certain Remote Device.
 *
 *  \par Component Instance Sharing
 *  FRI components accessing one NFC device share one instance of the Overlapped HAL. Therefore
 *  each calling FRI component must specify - together with the call - where to deliver the
 *  response of the overlapped operation.
 *
 *  \par Lowest Layer
 *  The Overlapped HAL represents the NFC Device, the lowest layer of the FRI components.
 *
 *  \par Completion Forced
 *  The \b HAL \b functions (and underlying functions) of this library must complete before a new call can
 *  be issued. No HAL operation must be pending.
 *
 */
/*@{*/

/**
 *  \name OVR HAL Constants
 */
/*@{*/
#define PH_FRINFC_OVRHAL_MAX_NUM_MOCKUP_PARAM           255    /**< Number of mockup indices that are are prepared. */
/* Harsha: changed from 48 to 128, to work with the Mifare 4k TCs */
#define PH_FRINFC_OVRHAL_MAX_NUM_MOCKUP_RDI             4     /**< Max. number of mockup RDIs. */
#define PH_FRINFC_OVRHAL_MAX_TEST_DELAY                 1000  /**< Max. test delay in OVR HAL. */
#define PH_FRINFC_OVRHAL_POLL_PAYLOAD_LEN               5     /**< Length of the POLL payload. */ /* @GK/5.6.06 */
/*@}*/
/*@}*/ /* defgroup... */

/** \defgroup grp_ovr_hal_cmd Overlapped HAL Command List
 *  \ingroup grp_fri_nfc_ovr_hal
 *  These are the command definitions for the Overlapped HAL. They are used internally by the
 *  implementation of the component.
 */
/*@{*/
#define PH_FRINFC_OVRHAL_NUL             (0)     /**< \brief We're in NO command */

#define PH_FRINFC_OVRHAL_ENU             (1)     /**< \brief Enumerate */
#define PH_FRINFC_OVRHAL_OPE             (2)     /**< \brief Open */
#define PH_FRINFC_OVRHAL_CLO             (3)     /**< \brief Close */
#define PH_FRINFC_OVRHAL_GDC             (4)     /**< \brief Get Dev Caps */
#define PH_FRINFC_OVRHAL_POL             (5)     /**< \brief Poll */
#define PH_FRINFC_OVRHAL_CON             (6)     /**< \brief Connect */
#define PH_FRINFC_OVRHAL_DIS             (7)     /**< \brief Disconnect */
#define PH_FRINFC_OVRHAL_TRX             (8)     /**< \brief Transceive */
#define PH_FRINFC_OVRHAL_STM             (9)     /**< \brief Start Target Mode */
#define PH_FRINFC_OVRHAL_SND             (10)     /**< \brief Send */
#define PH_FRINFC_OVRHAL_RCV             (11)    /**< \brief Receive */
#define PH_FRINFC_OVRHAL_IOC             (12)    /**< \brief IOCTL */

#define PH_FRINFC_OVRHAL_TST             (255)   /**< \brief OVR HAL test-related command */

/** \ingroup grp_fri_nfc_ovr_hal
 *  \brief Post Message Function for Overlapped HAL
 *
 *  \copydoc page_reg
 *
 * This is required by the Overlapped HAL in order to call the blocking (original HAL) in another
 * thread. This function is required in addition to \ref pphFriNfc_OvrHalPresetParm to be
 * implemented in the integrating software.
 *
 * \par First Parameter: Context of the Integration
 *      Set to the value, the Integration has provided when initialising this component.
 */
typedef void (*pphFriNfc_OvrHalPostMsg_t)(void*);

/** \ingroup grp_fri_nfc_ovr_hal
 *  \brief Abort Function (to be defined/implemented by the Integration)
 *
 *  \copydoc page_reg
 *
 * This is required by the Overlapped HAL in order abort a pending Overlapped HAL operation. This funtion will be
 * internally called by the \ref phFriNfc_OvrHal_Abort function.
 *
 * \par First Parameter: Context of the Integration
 *      Set to the value, the Integration has provided when initialising this component.
 *
 * \par Return value:
 *      As defined by the integration
 */
typedef NFCSTATUS (*pphFriNfc_OvrHalAbort_t)(void*);


typedef void (*pphOvrHal_CB_t) (phHal_sRemoteDevInformation_t *RemoteDevHandle,
                                NFCSTATUS status,
                                phNfc_sData_t  *pRecvdata,
                                void *context);

/** \ingroup grp_fri_nfc_ovr_hal
 *  \brief Preset Function to prepare the parameters in the HAL
 *
 *  \copydoc page_reg
 *
 * This function (pointer) is called by the Overlapped HAL to prepare the function call parameters
 * in the HAL before posting the start message. As we have an asynchronously running FRI, but a
 * synchronous HAL, the calls need to be "decoupled". This means, the HAL needs to run under
 * a different time-base (or thread/task etc.). The consequence is that the data exchange between
 * FRI and HAL must be done as required by the integration/system itself. The declaration
 * of the function pointer allows for the integrating software to implement whatever functionality
 * is required to convey the data.
 *
 *
 * \par First Parameter
 *      Context of the Integration Set to the value, the Integration has provided when initialising
 *      this component.
 *
 * \par Second Parameter:
 *      \b HAL \b Command, as defined in the module \ref grp_ovr_hal_cmd.
 *
 * \par Third Parameter:
 *      \b Pointers to a specific structure containing the parameters of the HAL functions to be
 *      called.
 *
 * \par Forth parameter:
 *      Immediate Operation result (not the result of the HAL operation). Usually this is
 *      \ref NFCSTATUS_PENDING (for a successfully triggered HAL I/O or an error value that is
 *      returned by the HAL immediately, such as \ref NFCSTATUS_INVALID_PARAMETER.
 *
 * \par Return value:
 *      A boolean (\ref grp_special_conventions) value. The integration implementation must ensure
 *      that, if the function \b succeeds, the return value is \b TRUE, otherwise false.
 */
typedef uint8_t (*pphFriNfc_OvrHalPresetParm)(void*, uint16_t, void*, NFCSTATUS*);

/** \ingroup grp_fri_nfc_ovr_hal
 *  \brief Overlapped HAL Context
 *
 *  The Overlapped HAL structure. This structure contains the HAL "context" that
 *  is required by the FRI on a connection basis. Please note that the Overlapped HAL is
 *  a shared component, requiring a special completion notification mechanism.
 *  Read more in the description of this component.
 *
 */
typedef struct phFriNfc_OvrHal
{
    /** Currently active operation of the component. If no operation is pending, the content of this member is
     *  \ref PH_FRINFC_OVRHAL_NUL .  The component refuses a new call if the contenet is different, namely one
     *  of the other values defined in \ref grp_ovr_hal_cmd .
     */
    uint8_t                         Operation;

    /** The \b temporary pointer to the completion routine information. The HAL needs - for each call - to be told about the
     *  completion routine of the upper (calling) component. This major difference to other components is because
     *  some functions of the HAL are connection-based and some are not. Moreover it is because the HAL is shared
     *  among the FRI components. So, with a variety of potential callers it is required for each caller to instruct
     *  the HAL about the "delivery" address of the response for each individual call.
     */
    phFriNfc_CplRt_t                TemporaryCompletionInfo;
    phFriNfc_CplRt_t                TemporaryRcvCompletionInfo;
    phFriNfc_CplRt_t                TemporarySndCompletionInfo;

    /** Points to a function within the Integration that presets the parameters for the actual
     *  HAL call.
     */
    pphFriNfc_OvrHalPresetParm      Presetparameters;

    /** Posts a message to the actual HAL integration, starting a  NFC HAL I/O with the pre-set
     *  parameters.
     */
    pphFriNfc_OvrHalPostMsg_t       PostMsg;

    /** The context of the Integration (the SW around this component). This is needed to let
     *  the Overlapped HAL access the Integration's functionality to post a message to another
     *  thread.
     */
    void                           *IntegrationContext;

    /** Device reference returned during enumeration: This has to be filled in by the integrating software after
        a call to the HAL Enumerate function (not contained in the overlapped HAl API). */
    phHal_sHwReference_t           *psHwReference;

    /** This flag is set by the ABORT function. The OVR HAL then does no I/O to the real HAL
     *  or to the mockup any more but just completed with the ABORTED status.
     */
    uint8_t OperationAborted;

    /** Abort function to be implemented by the integration. This parameter can be (optionally) initialized
     *  via the call of \ref phFriNfc_OvrHal_Reset_Abort function.
     *  If it is not NULL, the function pointed by \ref will be internally called by the \ref phFriNfc_OvrHal_Abort function.
     */
    pphFriNfc_OvrHalAbort_t      AbortIntegrationFunction;

    /** Integration-defined Context passed as a parameter of the \ref AbortIntegrationFunction.
     */
    void*                        AbortIntegrationContext;
    
    void*                        OvrCompletion;

    phHal_sTransceiveInfo_t      TranceiveInfo;
    
    /** TODO
     */
    phNfc_sData_t                sReceiveData;

    /** TODO
     */
    phNfc_sData_t                sSendData;

    /** TODO
     */
    phHal4Nfc_TransactInfo_t     TransactInfo;

    uint16_t                     *pndef_recv_length;
} phFriNfc_OvrHal_t;

/**
 * \ingroup grp_fri_nfc_ovr_hal
 *
 * \brief Transceive Data to/from a Remote Device
 *
 * \copydoc page_ovr
 *
 * \param[in]      OvrHal               Component Context.
 * \param[in]      CompletionInfo       \copydoc phFriNfc_OvrHal_t::TemporaryCompletionInfo
 * \param[in,out]  RemoteDevInfo        Remote Device Information.
 * \param[in]      Cmd                  Command to perform.
 * \param[out]     DepAdditionalInfo    Protocol Information.
 * \param[in]      SendBuf              Pointer to the data to send.
 * \param[in]      SendLength           Length, in bytes, of the Send Buffer.
 * \param[out]     RecvBuf              Pointer to the buffer that receives the data.
 * \param[in,out]  RecvLength           Length, in bytes, of the received data.
 *
 * \retval NFCSTATUS_PENDING                The operation is pending.
 * \retval NFCSTATUS_INVALID_DEVICE_REQUEST \copydoc phFriNfc_OvrHal_t::Operation
 * \retval NFCSTATUS_SUCCESS                Success.
 * \retval NFCSTATUS_INVALID_PARAMETER      One or more of the supplied parameters could not be
 *                                          properly interpreted.
 * \retval NFCSTATUS_INVALID_DEVICE         The device has not been opened or has been disconnected
 *                                          meanwhile.
 * \retval NFCSTATUS_CMD_ABORTED            The caller/driver has aborted the request.
 * \retval NFCSTATUS_BUFFER_TOO_SMALL       The buffer provided by the caller is too small.
 * \retval NFCSTATUS_RF_TIMEOUT             No data has been received within the TIMEOUT period.
 *
 * \note Please refer to HAL Transceive for a detailed description of the
 *       underlying function and the propagated parameters.
 *
 */

NFCSTATUS phFriNfc_OvrHal_Transceive(phFriNfc_OvrHal_t              *OvrHal,
                                     phFriNfc_CplRt_t               *CompletionInfo,
                                     phHal_sRemoteDevInformation_t  *RemoteDevInfo,
                                     phHal_uCmdList_t                Cmd,
                                     phHal_sDepAdditionalInfo_t     *DepAdditionalInfo,
                                     uint8_t                        *SendBuf,
                                     uint16_t                        SendLength,
                                     uint8_t                        *RecvBuf,
                                     uint16_t                       *RecvLength);

/**
 * \ingroup grp_fri_nfc_ovr_hal
 *
 * \brief TODO
 *
 */
NFCSTATUS phFriNfc_OvrHal_Receive(phFriNfc_OvrHal_t              *OvrHal,
                                  phFriNfc_CplRt_t               *CompletionInfo,
                                  phHal_sRemoteDevInformation_t  *RemoteDevInfo,
                                  uint8_t                        *RecvBuf,
                                  uint16_t                       *RecvLength);

/**
 * \ingroup grp_fri_nfc_ovr_hal
 *
 * \brief TODO
 *
 */
NFCSTATUS phFriNfc_OvrHal_Send(phFriNfc_OvrHal_t              *OvrHal,
                               phFriNfc_CplRt_t               *CompletionInfo,
                               phHal_sRemoteDevInformation_t  *RemoteDevInfo,
                               uint8_t                        *SendBuf,
                               uint16_t                       SendLength);


NFCSTATUS phFriNfc_OvrHal_Reconnect(phFriNfc_OvrHal_t              *OvrHal,
                                    phFriNfc_CplRt_t               *CompletionInfo,
                                    phHal_sRemoteDevInformation_t  *RemoteDevInfo);


NFCSTATUS phFriNfc_OvrHal_Connect(phFriNfc_OvrHal_t              *OvrHal,
                                  phFriNfc_CplRt_t               *CompletionInfo,
                                  phHal_sRemoteDevInformation_t  *RemoteDevInfo,
                                  phHal_sDevInputParam_t         *DevInputParam);

#endif