summaryrefslogtreecommitdiffstats
path: root/src/phFriNfc.h
blob: 36774054f6be6df250f8daf3058610a89846b18b (plain)
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
/*
 * 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.h
 * \brief NFC FRI Main Header.
 *
 * Project: NFC-FRI
 *
 * $Date: Mon Dec 13 14:14:13 2010 $
 * $Author: ing02260 $
 * $Revision: 1.20 $
 * $Aliases:  $
 *
 */

#ifndef PHFRINFC_H /* */
#define PHFRINFC_H /* */
#include <phNfcTypes.h>
#include <phOsalNfc.h>

#define PH_HAL4_ENABLE

#ifdef PH_HAL4_ENABLE
    #include <phNfcConfig.h>
    #define LOCK_BITS_CHECK_ENABLE
#endif

#define FRINFC_READONLY_NDEF

#ifdef  DISABLE_MIFARE_MAPPING
#define PH_FRINFC_MAP_MIFAREUL_DISABLED
#define PH_FRINFC_MAP_MIFARESTD_DISABLED
#define PH_FRINFC_MAP_DESFIRE_DISABLED
#else
#define PH_NDEF_MIFARE_ULC
#endif

#ifdef DISABLE_FELICA_MAPPING
#define PH_FRINFC_MAP_FELICA_DISABLED
#endif

#ifdef DISABLE_JEWEL_MAPPING
#define PH_FRINFC_MAP_TOPAZ_DISABLED
#define PH_FRINFC_MAP_TOPAZ_DYNAMIC_DISABLED
#endif

#ifdef DISABLE_ISO15693_MAPPING
#define PH_FRINFC_MAP_ISO15693_DISABLED
#endif


#ifdef DISABLE_FORMAT
#define PH_FRINFC_FMT_DESFIRE_DISABLED
#define PH_FRINFC_FMT_MIFAREUL_DISABLED
#define PH_FRINFC_FMT_MIFARESTD_DISABLED
#define PH_FRINFC_FMT_ISO15693_DISABLED
#endif /* #ifdef DISABLE_FORMAT */

#define PH_FRINFC_FMT_TOPAZ_DISABLED

/*! 
 *  \name NFC FRI Main Header
 *
 * File: \ref phFriNfc.h
 *
 */
/*@{*/

#define PH_FRINFC_FILEREVISION "$Revision: 1.20 $"   /**< \ingroup grp_file_attributes */
#define PH_FRINFC_FILEALIASES  "$Aliases:  $"       /**< \ingroup grp_file_attributes */

/*@}*/


/*!
 *  \ingroup grp_fri_nfc_common
 *
 *  \brief \copydoc page_cb Completion Routine
 *
 * NFC-FRI components that work in an overlapped style need to provide a function that is compatible
 * to this definition.\n\n
 * It is \b mandatory to define such a routine for components that interact with other components up or
 * down the stack. Moreover, such components shall provide a function within their API to enable the
 * setting of the \b Completion \b Routine address and parameters.
 *
 * \par First Parameter: Context
 *      Set to the address of the called instance (component instance context structure). For instance,
 *      a component that needs to give control to a component up the stack needs to call the completion
 *      routine of the \b upper component. The value to assign to this parameter is the \b address of
 *      the context structure instance of the called component. Such a structure usually contains all
 *      variables, data or state information a component member needs for operation. The address of the
 *      upper instance must be known by the lower (completing) instance. The mechanism to ensure that this
 *      information is present involves the structure \ref phFriNfc_CplRt_t . See its documentation for
 *      further information.
 *
 * \par Second Parameter: Status Value
 *      The lower layer hands over the completion status via this parameter. The completion 
 *      routine that has been called needs to process the status in a way that is comparable to what
 *      a regular function return value would require.
 *
 * \note The prototype of the component's \b Process(ing) functions has to be compatible to this
 *       function pointer declaration for components interacting with others. In other cases, where
 *       there is no interaction or asynchronous processing the definition of the \b Process(ing)
 *       function can be arbitrary, if present at all.
 */

typedef void (*pphFriNfc_Cr_t)(void*, NFCSTATUS);


/*!
 * \ingroup grp_fri_nfc_common
 *
 * \brief Completion Routine structure
 *
 * This structure finds itself within each component that requires to report completion
 * to an upper (calling) component.\n\n
 * Depending on the actual implementation (static or dynamic completion information) the stack
 * initialisation \b or the calling component needs to inform the initialised \b or called component
 * about the completion path. This information is submitted via this structure.
 *
 */
typedef struct phFriNfc_CplRt
{
    pphFriNfc_Cr_t    CompletionRoutine; /*!< Address of the upper Layer's \b Process(ing) function to call upon completion.
                                          *   The stack initialiser (or depending on the implementation: the calling component) 
                                          *   needs to set this member to the address of the function that needs to be within
                                          *   the completion path: A calling component would give its own processing function 
                                          *   address to the lower layer.
                                          */
    void             *Context;           /*!< Instance address (context) parameter.
                                          *   The stack initialiser (or depending on the implementation: the calling component) 
                                          *   needs to set this member to the address of the component context structure instance
                                          *   within the completion path: A calling component would give its own instance address
                                          *   to the lower layer.
                                          */
} phFriNfc_CplRt_t;


#define NFCSTATUS_INVALID_DEVICE_REQUEST                        (0x10F5)


#endif /* __PHFRINFC_H__ */