phFriNfc.h revision 80ee29b88ec489e2bbf6ae446692229d36755429
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: Thu Feb 11 18:45:30 2010 $ 24 * $Author: ing04880 $ 25 * $Revision: 1.19 $ 26 * $Aliases: NFC_FRI1.1_WK1007_R33_1 $ 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 62#ifdef DISABLE_FORMAT 63#define PH_FRINFC_FMT_DESFIRE_DISABLED 64#define PH_FRINFC_FMT_MIFAREUL_DISABLED 65#define PH_FRINFC_FMT_MIFARESTD_DISABLED 66#endif /* #ifdef DISABLE_FORMAT */ 67 68#define PH_FRINFC_FMT_TOPAZ_DISABLED 69 70/*! 71 * \name NFC FRI Main Header 72 * 73 * File: \ref phFriNfc.h 74 * 75 */ 76/*@{*/ 77 78#define PH_FRINFC_FILEREVISION "$Revision: 1.19 $" /**< \ingroup grp_file_attributes */ 79#define PH_FRINFC_FILEALIASES "$Aliases: NFC_FRI1.1_WK1007_R33_1 $" /**< \ingroup grp_file_attributes */ 80 81/*@}*/ 82 83 84/*! 85 * \ingroup grp_fri_nfc_common 86 * 87 * \brief \copydoc page_cb Completion Routine 88 * 89 * NFC-FRI components that work in an overlapped style need to provide a function that is compatible 90 * to this definition.\n\n 91 * It is \b mandatory to define such a routine for components that interact with other components up or 92 * down the stack. Moreover, such components shall provide a function within their API to enable the 93 * setting of the \b Completion \b Routine address and parameters. 94 * 95 * \par First Parameter: Context 96 * Set to the address of the called instance (component instance context structure). For instance, 97 * a component that needs to give control to a component up the stack needs to call the completion 98 * routine of the \b upper component. The value to assign to this parameter is the \b address of 99 * the context structure instance of the called component. Such a structure usually contains all 100 * variables, data or state information a component member needs for operation. The address of the 101 * upper instance must be known by the lower (completing) instance. The mechanism to ensure that this 102 * information is present involves the structure \ref phFriNfc_CplRt_t . See its documentation for 103 * further information. 104 * 105 * \par Second Parameter: Status Value 106 * The lower layer hands over the completion status via this parameter. The completion 107 * routine that has been called needs to process the status in a way that is comparable to what 108 * a regular function return value would require. 109 * 110 * \note The prototype of the component's \b Process(ing) functions has to be compatible to this 111 * function pointer declaration for components interacting with others. In other cases, where 112 * there is no interaction or asynchronous processing the definition of the \b Process(ing) 113 * function can be arbitrary, if present at all. 114 */ 115 116typedef void (*pphFriNfc_Cr_t)(void*, NFCSTATUS); 117 118 119/*! 120 * \ingroup grp_fri_nfc_common 121 * 122 * \brief Completion Routine structure 123 * 124 * This structure finds itself within each component that requires to report completion 125 * to an upper (calling) component.\n\n 126 * Depending on the actual implementation (static or dynamic completion information) the stack 127 * initialisation \b or the calling component needs to inform the initialised \b or called component 128 * about the completion path. This information is submitted via this structure. 129 * 130 */ 131typedef struct phFriNfc_CplRt 132{ 133 pphFriNfc_Cr_t CompletionRoutine; /*!< Address of the upper Layer's \b Process(ing) function to call upon completion. 134 * The stack initialiser (or depending on the implementation: the calling component) 135 * needs to set this member to the address of the function that needs to be within 136 * the completion path: A calling component would give its own processing function 137 * address to the lower layer. 138 */ 139 void *Context; /*!< Instance address (context) parameter. 140 * The stack initialiser (or depending on the implementation: the calling component) 141 * needs to set this member to the address of the component context structure instance 142 * within the completion path: A calling component would give its own instance address 143 * to the lower layer. 144 */ 145} phFriNfc_CplRt_t; 146 147 148#define NFCSTATUS_INVALID_DEVICE_REQUEST (0x10F5) 149 150 151#endif /* __PHFRINFC_H__ */ 152