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