2 * Copyright (C) 2010 NXP Semiconductors
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * \file phFriNfc_LlcpMac.h
20 * \brief NFC LLCP MAC Mappings For Different RF Technologies.
26 #ifndef PHFRINFC_LLCPMAC_H
27 #define PHFRINFC_LLCPMAC_H
31 #include <phNfcTypes.h>
32 #include <phNfcLlcpTypes.h>
33 #include <phNfcStatus.h>
36 #include <phFriNfc_OvrHal.h>
39 * \name LLCP MAC Mapping
41 * File: \ref phFriNfc_LlcpMac.h
46 /** \defgroup grp_fri_nfc_llcp_mac LLCP MAC Mapping Component
48 * This component implements the different MAC mapping for a Logical Link Control Protocol communication,
49 * as defined by the NFC Forum LLCP specifications.\n
50 * The MAC component handles the mapping for the different technologies supported by LLCP
51 *..This component provides an API to the upper layer with the following features:\n\n
52 * - Reset the MAC mapping component
53 * - \ref phFriNfc_LlcpMac_ChkLlcp
55 * - Check the LLCP Compliancy
56 * - \ref phFriNfc_LlcpMac_ChkLlcp
58 * - Activate the LLCP link
59 * - \ref phFriNfc_LlcpMac_Activate
61 * - Deactivate the LLCP link
62 * - \ref phFriNfc_LlcpMac_Deactivate
64 * - Register the MAC component Interface with a specific technologie (NFCIP/ISO14443)
65 * - \ref phFriNfc_LlcpMac_Register
67 * - Send packets through the LLCP link
68 * - \ref phFriNfc_LlcpMac_Send
70 * - Receive packets through the LLCP link
71 * - \ref phFriNfc_LlcpMac_Receive
76 * \ingroup grp_fri_nfc_llcp_mac
77 * \brief Declaration of a MAC type
79 struct phFriNfc_LlcpMac;
80 typedef struct phFriNfc_LlcpMac phFriNfc_LlcpMac_t;
83 * \ingroup grp_fri_nfc_llcp_mac
86 /*========== ENUMERATES ===========*/
88 /* Enum reperesents the different MAC mapping*/
89 typedef enum phFriNfc_LlcpMac_eType
91 phFriNfc_LlcpMac_eTypeNfcip,
92 phFriNfc_LlcpMac_eTypeIso14443
93 }phFriNfc_LlcpMac_eType_t;
95 /* Enum reperesents the different Peer type for a LLCP communication*/
96 typedef enum phFriNfc_LlcpMac_ePeerType
98 phFriNfc_LlcpMac_ePeerTypeInitiator,
99 phFriNfc_LlcpMac_ePeerTypeTarget
100 }phFriNfc_LlcpMac_ePeerType_t;
107 /*========== CALLBACKS ===========*/
109 typedef void (*phFriNfc_LlcpMac_Chk_CB_t) (void *pContext,
112 typedef void (*phFriNfc_LlcpMac_LinkStatus_CB_t) (void *pContext,
113 phFriNfc_LlcpMac_eLinkStatus_t eLinkStatus,
114 phNfc_sData_t *psData,
115 phFriNfc_LlcpMac_ePeerType_t PeerRemoteDevType);
117 typedef void (*phFriNfc_LlcpMac_Send_CB_t) (void *pContext,
121 typedef void (*phFriNfc_LlcpMac_Reveive_CB_t) (void *pContext,
123 phNfc_sData_t *psData);
126 /*========== FUNCTIONS TYPES ===========*/
128 typedef NFCSTATUS (*pphFriNfcLlpcMac_Chk_t) ( phFriNfc_LlcpMac_t *LlcpMac,
129 phFriNfc_LlcpMac_Chk_CB_t ChkLlcpMac_Cb,
132 typedef NFCSTATUS (*pphFriNfcLlpcMac_Activate_t) (phFriNfc_LlcpMac_t *LlcpMac);
134 typedef NFCSTATUS (*pphFriNfcLlpcMac_Deactivate_t) (phFriNfc_LlcpMac_t *LlcpMac);
136 typedef NFCSTATUS (*pphFriNfcLlpcMac_Send_t) (phFriNfc_LlcpMac_t *LlcpMac,
137 phNfc_sData_t *psData,
138 phFriNfc_LlcpMac_Send_CB_t LlcpMacSend_Cb,
141 typedef NFCSTATUS (*pphFriNfcLlpcMac_Receive_t) (phFriNfc_LlcpMac_t *LlcpMac,
142 phNfc_sData_t *psData,
143 phFriNfc_LlcpMac_Reveive_CB_t LlcpMacReceive_Cb,
146 /*========== STRUCTURES ===========*/
149 * \ingroup grp_fri_nfc_llcp_mac
150 * \brief Generic Interface structure with the Lower Layer
152 typedef struct phFriNfc_LlcpMac_Interface
154 pphFriNfcLlpcMac_Chk_t chk;
155 pphFriNfcLlpcMac_Activate_t activate;
156 pphFriNfcLlpcMac_Deactivate_t deactivate;
157 pphFriNfcLlpcMac_Send_t send;
158 pphFriNfcLlpcMac_Receive_t receive;
159 } phFriNfc_LlcpMac_Interface_t;
162 * \ingroup grp_fri_nfc_llcp_mac
163 * \brief Definition of the MAC type
165 struct phFriNfc_LlcpMac
167 phFriNfc_LlcpMac_eLinkStatus_t LinkState;
168 phHal_sRemoteDevInformation_t *psRemoteDevInfo;
169 phFriNfc_LlcpMac_LinkStatus_CB_t LinkStatus_Cb;
170 void *LinkStatus_Context;
171 phFriNfc_LlcpMac_Interface_t LlcpMacInterface;
172 phFriNfc_LlcpMac_ePeerType_t PeerRemoteDevType;
173 phFriNfc_LlcpMac_eType_t MacType;
175 /**<\internal Holds the completion routine informations of the Map Layer*/
176 phFriNfc_CplRt_t MacCompletionInfo;
178 phFriNfc_LlcpMac_Send_CB_t MacSend_Cb;
179 void *MacSend_Context;
180 phFriNfc_LlcpMac_Reveive_CB_t MacReceive_Cb;
181 void *MacReceive_Context;
182 phNfc_sData_t *psReceiveBuffer;
183 phNfc_sData_t *psSendBuffer;
184 phNfc_sData_t sConfigParam;
188 phHal_uCmdList_t Cmd;
189 phHal_sDepAdditionalInfo_t psDepAdditionalInfo;
194 ################################################################################
195 ********************** MAC Interface Function Prototype ***********************
196 ################################################################################
200 * \ingroup grp_fri_nfc_llcp_mac
203 NFCSTATUS phFriNfc_LlcpMac_Reset (phFriNfc_LlcpMac_t *LlcpMac,
205 phFriNfc_LlcpMac_LinkStatus_CB_t LinkStatus_Cb,
208 * \ingroup grp_fri_nfc_llcp_mac
211 NFCSTATUS phFriNfc_LlcpMac_ChkLlcp (phFriNfc_LlcpMac_t *LlcpMac,
212 phHal_sRemoteDevInformation_t *psRemoteDevInfo,
213 phFriNfc_LlcpMac_Chk_CB_t ChkLlcpMac_Cb,
217 * \ingroup grp_fri_nfc_llcp_mac
220 NFCSTATUS phFriNfc_LlcpMac_Activate (phFriNfc_LlcpMac_t *LlcpMac);
223 * \ingroup grp_fri_nfc_llcp_mac
226 NFCSTATUS phFriNfc_LlcpMac_Deactivate (phFriNfc_LlcpMac_t *LlcpMac);
229 * \ingroup grp_fri_nfc_llcp_mac
232 NFCSTATUS phFriNfc_LlcpMac_Send (phFriNfc_LlcpMac_t *LlcpMac,
233 phNfc_sData_t *psData,
234 phFriNfc_LlcpMac_Send_CB_t LlcpMacSend_Cb,
238 * \ingroup grp_fri_nfc_llcp_mac
241 NFCSTATUS phFriNfc_LlcpMac_Receive (phFriNfc_LlcpMac_t *LlcpMac,
242 phNfc_sData_t *psData,
243 phFriNfc_LlcpMac_Reveive_CB_t ReceiveLlcpMac_Cb,
246 #endif /* PHFRINFC_LLCPMAC_H */