phFriNfc.h revision a6e012a748e70ab203655d4e1c0d0a77b6515fad
1/* 2 * Copyright (C) 2010 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 17/*! 18 * \file phFriNfc.h 19 * \brief NFC FRI Main Header. 20 * 21 * Project: NFC-FRI 22 * 23 * $Date: Mon Dec 13 14:14:13 2010 $ 24 * $Author: ing02260 $ 25 * $Revision: 1.20 $ 26 * $Aliases: $ 27 * 28 */ 29 30#ifndef PHFRINFC_H /* */ 31#define PHFRINFC_H /* */ 32#include <phNfcTypes.h> 33#include <phOsalNfc.h> 34 35#define PH_HAL4_ENABLE 36 37#ifdef PH_HAL4_ENABLE 38 #include <phNfcConfig.h> 39 #define LOCK_BITS_CHECK_ENABLE 40#endif 41 42#define FRINFC_READONLY_NDEF 43 44#ifdef DISABLE_MIFARE_MAPPING 45#define PH_FRINFC_MAP_MIFAREUL_DISABLED 46#define PH_FRINFC_MAP_MIFARESTD_DISABLED 47#define PH_FRINFC_MAP_DESFIRE_DISABLED 48#else 49#define PH_NDEF_MIFARE_ULC 50#endif 51 52#ifdef DISABLE_FELICA_MAPPING 53#define PH_FRINFC_MAP_FELICA_DISABLED 54#endif 55 56#ifdef DISABLE_JEWEL_MAPPING 57#define PH_FRINFC_MAP_TOPAZ_DISABLED 58#define PH_FRINFC_MAP_TOPAZ_DYNAMIC_DISABLED 59#endif 60 61#ifdef DISABLE_ISO15693_MAPPING 62#define PH_FRINFC_MAP_ISO15693_DISABLED 63#endif 64 65 66#ifdef DISABLE_FORMAT 67#define PH_FRINFC_FMT_DESFIRE_DISABLED 68#define PH_FRINFC_FMT_MIFAREUL_DISABLED 69#define PH_FRINFC_FMT_MIFARESTD_DISABLED 70#endif /* #ifdef DISABLE_FORMAT */ 71 72#define PH_FRINFC_FMT_TOPAZ_DISABLED 73 74/*! 75 * \name NFC FRI Main Header 76 * 77 * File: \ref phFriNfc.h 78 * 79 */ 80/*@{*/ 81 82#define PH_FRINFC_FILEREVISION "$Revision: 1.20 $" /**< \ingroup grp_file_attributes */ 83#define PH_FRINFC_FILEALIASES "$Aliases: $" /**< \ingroup grp_file_attributes */ 84 85/*@}*/ 86 87 88/*! 89 * \ingroup grp_fri_nfc_common 90 * 91 * \brief \copydoc page_cb Completion Routine 92 * 93 * NFC-FRI components that work in an overlapped style need to provide a function that is compatible 94 * to this definition.\n\n 95 * It is \b mandatory to define such a routine for components that interact with other components up or 96 * down the stack. Moreover, such components shall provide a function within their API to enable the 97 * setting of the \b Completion \b Routine address and parameters. 98 * 99 * \par First Parameter: Context 100 * Set to the address of the called instance (component instance context structure). For instance, 101 * a component that needs to give control to a component up the stack needs to call the completion 102 * routine of the \b upper component. The value to assign to this parameter is the \b address of 103 * the context structure instance of the called component. Such a structure usually contains all 104 * variables, data or state information a component member needs for operation. The address of the 105 * upper instance must be known by the lower (completing) instance. The mechanism to ensure that this 106 * information is present involves the structure \ref phFriNfc_CplRt_t . See its documentation for 107 * further information. 108 * 109 * \par Second Parameter: Status Value 110 * The lower layer hands over the completion status via this parameter. The completion 111 * routine that has been called needs to process the status in a way that is comparable to what 112 * a regular function return value would require. 113 * 114 * \note The prototype of the component's \b Process(ing) functions has to be compatible to this 115 * function pointer declaration for components interacting with others. In other cases, where 116 * there is no interaction or asynchronous processing the definition of the \b Process(ing) 117 * function can be arbitrary, if present at all. 118 */ 119 120typedef void (*pphFriNfc_Cr_t)(void*, NFCSTATUS); 121 122 123/*! 124 * \ingroup grp_fri_nfc_common 125 * 126 * \brief Completion Routine structure 127 * 128 * This structure finds itself within each component that requires to report completion 129 * to an upper (calling) component.\n\n 130 * Depending on the actual implementation (static or dynamic completion information) the stack 131 * initialisation \b or the calling component needs to inform the initialised \b or called component 132 * about the completion path. This information is submitted via this structure. 133 * 134 */ 135typedef struct phFriNfc_CplRt 136{ 137 pphFriNfc_Cr_t CompletionRoutine; /*!< Address of the upper Layer's \b Process(ing) function to call upon completion. 138 * The stack initialiser (or depending on the implementation: the calling component) 139 * needs to set this member to the address of the function that needs to be within 140 * the completion path: A calling component would give its own processing function 141 * address to the lower layer. 142 */ 143 void *Context; /*!< Instance address (context) parameter. 144 * The stack initialiser (or depending on the implementation: the calling component) 145 * needs to set this member to the address of the component context structure instance 146 * within the completion path: A calling component would give its own instance address 147 * to the lower layer. 148 */ 149} phFriNfc_CplRt_t; 150 151 152#define NFCSTATUS_INVALID_DEVICE_REQUEST (0x10F5) 153 154 155#endif /* __PHFRINFC_H__ */ 156