/usr/include/android-19/libnfc-nxp/phLlcNfc_Frame.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 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | /*
* 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 phLlcNfc_Frame.h
* \brief To append and delete the I or S or U frames.
*
* Project: NFC-FRI-1.1
*
* $Date: Fri Apr 30 10:03:36 2010 $
* $Author: ing02260 $
* $Revision: 1.19 $
* $Aliases: NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $
*
*/
#ifndef PHLLCNFC_FRAME_H
#define PHLLCNFC_FRAME_H
/**
* \name LLC NFC frame creation and deletion
*
* File: \ref phLlcNfc_Frame.h
*
*/
/*@{*/
#define PHLLCNFCFRAME_FILEREVISION "$Revision: 1.19 $" /**< \ingroup grp_hal_nfc_llc */
#define PHLLCNFCFRAME_FILEALIASES "$Aliases: NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $" /**< \ingroup grp_hal_nfc_llc */
/*@}*/
/*************************** Includes *******************************/
/*********************** End of includes ****************************/
/** \defgroup grp_hal_nfc_llc_helper LLC helper functions
*
*
*
*/
/***************************** Macros *******************************/
/** Maximum buffer that LLC can send and receive */
#define PH_LLCNFC_MAX_BUFLEN_RECV_SEND (33)
/** Maximum buffer that LLC can send and receive */
#define PH_LLCNFC_MIN_BUFLEN_RECVD (1)
/** Modulo to calculate the N(S) and N(R), when it extends 7, because
N(S) and N(R) can have the value maximum up to 7 */
#define PH_LLCNFC_MOD_NS_NR (8)
/** When the entire LLC buffer is created or received, the header byte
will be the first byte (not the 0th byte which is the LLC length)
of the buffer */
#define PH_LLCNFC_HEADER_BYTE_IN_BUFFER (1)
/** Maximum windows size, which is obtained by sending or
receiving the U - frame */
#define PH_LLCNFC_U_FRAME_MAX_WIN_SIZE (4)
/** Minimum windows size, which is obtained by sending or
receiving the U - frame */
#define PH_LLCNFC_U_FRAME_MIN_WIN_SIZE (2)
/** Start position of the U frame */
#define PH_LLCNFC_U_FRAME_START_POS (0)
/** No of position to set the U frame */
#define PH_LLCNFC_U_FRAME_NO_OF_POS (5)
/** This mask is to find the frame type ( S or U) */
#define PH_LLCNFC_LLC_HEADER_MASK (0xE0)
/** This mask is to find the frame type (I, S or U) */
#define PH_LLCNFC_I_FRM_HEADER_MASK (0x80)
/** If S frame is received or to be sent, the maximum length that
can be sent or received is 4 */
#define PH_LLCNFC_MAX_S_FRAME_LEN (4)
/** If S frame is received, to know the command type like RR, RNR,
REJ or SREJ */
#define PH_LLCNFC_S_FRAME_TYPE_MASK (0x18)
/** Maximum value of N(S) or N(R) */
#define PH_LLCNFC_I_S_FRAME_MAX_NR (0x07)
/** If U frame is received or to be sent, the maximum length that
can be sent or received is 7 */
#define PH_LLCNFC_U_FRAME_LEN (7)
/** If S frame is received, to know the command type like RSET or UA */
#define PH_LLCNFC_U_FRAME_MODIFIER_MASK (0x1F)
/** Extra length to be append to the user buffer Length to create the
LLC buffer */
#define PH_LLCNFC_LEN_APPEND (0x04)
/** U frame header without modifier */
#define PH_LLCNFC_U_HEADER_INIT (0xE0)
/** I frame header without N(S) and N(R) */
#define PH_LLCNFC_I_HEADER_INIT (0x80)
/** S frame header without type and N(R) */
#define PH_LLCNFC_S_HEADER_INIT (0xC0)
/** N(S) start bit position */
#define PH_LLCNFC_NS_START_BIT_POS (0x03)
/** N(R) start bit position */
#define PH_LLCNFC_NR_START_BIT_POS (0x00)
/** Number of bits N(R) and N(S) */
#define PH_LLCNFC_NR_NS_NO_OF_BITS (0x03)
/** S frame type start bit position */
#define PH_LLCNFC_S_FRAME_TYPE_POS (0x03)
/** Number of bits (Type in S frame) */
#define PH_LLCNFC_SFRAME_TYPE_NOOFBITS (0x02)
/** SREJ command */
#define PH_LLCNFC_SREJ_BYTE_VALUE (0x00)
/** Number of CRC bytes in a LLC packet */
#define PH_LLCNFC_NUM_OF_CRC_BYTES (0x02)
/* This macro is used as the input for the function "phLlcNfc_H_IFrameList_Peek"
and "phLlcNfc_H_SendTimedOutIFrame" functions. This values means, take the starting
position as the reference */
#define DEFAULT_PACKET_INPUT (0xFFU)
#define MAX_NS_NR_VALUE (0x07U)
/************************ End of macros *****************************/
/********************** Callback functions **************************/
/******************* End of Callback functions **********************/
/********************* Structures and enums *************************/
/****************** End of structures and enums *********************/
/******************** Function declarations *************************/
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC helper functions \b Frame Init function
*
* \copydoc page_reg Gets the LLC main context and stores it.
*
* \param[in] psLlcCtxt Llc main structure information
*
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.
*
*/
void phLlcNfc_H_Frame_Init (
phLlcNfc_Context_t *psLlcCtxt
);
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC helper functions \b DeInit function
*
* \copydoc page_reg
*
* \param[in] psFrameInfo Frame structure information
*
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.
*
*/
void
phLlcNfc_H_Frame_DeInit (
phLlcNfc_Frame_t *psFrameInfo
);
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC helper functions \b List append function
*
* \copydoc page_reg Append the new I frame information at the beginning of the list
*
* \param[in/out] psList List inofrmation to know where shall the packet should be stored
* \param[in] packetInfo Llc packet information
*
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.
*
*/
NFCSTATUS
phLlcNfc_H_StoreIFrame (
phLlcNfc_StoreIFrame_t *psList,
phLlcNfc_LlcPacket_t sPacketInfo
);
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC helper functions <b>Create S frame</b> function
*
* \copydoc page_reg This function creates a S frame
*
* \param[in/out] pllcSFrmBuf Required buffer to create the S frame
*
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.
*
*/
void
phLlcNfc_H_Create_S_Frame(
uint8_t *pllcSFrmBuf
);
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC helper functions <b>Compute CRC</b> function
*
* \copydoc page_reg This function is used to compute CRC for the llc data
*
* \param[in] pData Llc data for which the CRC needs to be calculated
* \param[in] length Length is the value till the CRC needs to be
* calculated for the Llc data
* \param[in] pCrc1 1st CRC byte
* \param[in] pCrc2 2nd CRC byte
*
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.
*
*/
void
phLlcNfc_H_ComputeCrc(
uint8_t *pData,
uint8_t length,
uint8_t *pCrc1,
uint8_t *pCrc2
);
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC helper functions <b>Create U frame payload </b> function
*
* \copydoc page_reg This function is used to create a LLC packet with U frame
*
* \param[in/out] psLlcCtxt Llc main structure information
* \param[in/out] psLlcPacket Llc packet sent by the upper layer
* \param[in/out] pLlcPacketLength Length of the llc packet
* \param[in] cmdType U frame has RSET/UA commands
*
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.
*
*/
NFCSTATUS
phLlcNfc_H_CreateUFramePayload (
phLlcNfc_Context_t *psLlcCtxt,
phLlcNfc_LlcPacket_t *psLlcPacket,
uint8_t *pLlcPacketLength,
phLlcNfc_LlcCmd_t cmdType
);
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC helper functions <b>Create I frame payload </b> function
*
* \copydoc page_reg This function is used to create a LLC packet with I frame
*
* \param[in/out] psFrameInfo Information related to LLC frames are stored
* in this structure
* \param[in/out] psLlcPacket Llc packet sent by the upper layer
* \param[in] pLlcBuf User given buffer or the buffer which needs LLC framing
* \param[in] llcBufLength Length of the parameter "pLlcBuf"
*
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.
*
*/
NFCSTATUS
phLlcNfc_H_CreateIFramePayload (
phLlcNfc_Frame_t *psFrameInfo,
phLlcNfc_LlcPacket_t *psLlcPacket,
uint8_t *pLlcBuf,
uint8_t llcBufLength
);
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC helper functions <b>Process received frame </b> function
*
* \copydoc page_reg This function process the received data
*
* \param[in] pLlcCtxt Llc main context
*
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_FORMAT If any error in the frame
*/
NFCSTATUS
phLlcNfc_H_ProRecvFrame (
phLlcNfc_Context_t *psLlcCtxt
);
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC component <b>resend the I frame</b> function
*
* \copydoc page_reg This is a helper function which, sends back the timed out
* I frame to the PN544. This is due to the reason that ACK is not received
* from PN544 within the guard time-out value
*
* \param[in] psLlcCtxt Llc main structure information
* \param[in/out] psListInfo List of I frame information
* \param[in] ns_frame_no Frame number to send (to send the first stored
* frame send DEFAULT_PACKET_INPUT)
*
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.
*
*/
extern
NFCSTATUS
phLlcNfc_H_SendTimedOutIFrame (
phLlcNfc_Context_t *psLlcCtxt,
phLlcNfc_StoreIFrame_t *psListInfo,
uint8_t ns_frame_no
);
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC state machine functions \b Change state function
*
* \copydoc page_reg changes the state if possible else returns error
*
* \param[in, out] psLlcCtxt Llc main structure information
* \param[in] changeStateTo Next state to change
*
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.
*
*/
extern
NFCSTATUS
phLlcNfc_H_ChangeState(
phLlcNfc_Context_t *psLlcCtxt,
phLlcNfc_State_t changeStateTo
);
#ifdef CRC_ERROR_REJ
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC send reject command function
*
* \copydoc page_reg Sends reject command, when CRC error is recieved
*
* \param[in, out] psLlcCtxt Llc main structure information
*
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.
*
*/
extern
NFCSTATUS
phLlcNfc_H_SendRejectFrame(
phLlcNfc_Context_t *psLlcCtxt
);
#endif /* #ifdef CRC_ERROR_REJ */
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC Write wait call function
*
* \copydoc page_reg Write that has been ignored earlier will be called in this function
*
* \param[in, out] psLlcCtxt Llc main structure information
*
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_BUSY Write is pended, so wait till it completes.
* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.
*
*/
extern
NFCSTATUS
phLlcNfc_H_WriteWaitCall (
phLlcNfc_Context_t *psLlcCtxt
);
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC Send user frame function
*
* \copydoc page_reg Sends the stored user frame, that are not sent.
*
* \param[in, out] psLlcCtxt Llc main structure information
* \param[in] psListInfo Stored list of packets
*
* No return value
*
*/
NFCSTATUS
phLlcNfc_H_SendUserIFrame (
phLlcNfc_Context_t *psLlcCtxt,
phLlcNfc_StoreIFrame_t *psListInfo
);
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC Send rejected frame function
*
* \copydoc page_reg Sends the stored rejected frame from PN544.
*
* \param[in, out] psLlcCtxt Llc main structure information
* \param[in] psListInfo Stored list of packets
* \param[in] ns_rejected N(S) that was rejected
*
* No return value
*
*/
NFCSTATUS
phLlcNfc_H_SendRejectedIFrame (
phLlcNfc_Context_t *psLlcCtxt,
phLlcNfc_StoreIFrame_t *psListInfo,
uint8_t ns_rejected
);
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC component <b>Create S frame</b> function
*
* \copydoc page_reg This is a helper function which, creates the S frame
*
* \param[in/out] psFrameInfo Generic frame information
* \param[in/out] psLlcPacket Llc packet sent by the upper layer
* \param[in/out] cmdType Command type of S frame
*
* \retval NFCSTATUS_SUCCESS Operation successful.
* \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid.
*
*/
NFCSTATUS
phLlcNfc_H_CreateSFramePayload (
phLlcNfc_Frame_t *psFrameInfo,
phLlcNfc_LlcPacket_t *psLlcPacket,
phLlcNfc_LlcCmd_t cmdType
);
/**
* \ingroup grp_hal_nfc_llc_helper
*
* \brief LLC Send upper layer information function
*
* \copydoc page_reg Sends received information to the upper layer frame.
*
* \param[in, out] psLlcCtxt Llc main structure information
*
* No return value
*
*/
void
phLlcNfc_H_SendInfo(
phLlcNfc_Context_t *psLlcCtxt
);
/******************** Function declarations *************************/
#endif /* #ifndef PHLLCNFC_FRAME_H */
|