Lines Matching refs:LlcpMac
35 static NFCSTATUS phFriNfc_LlcpMac_Nfcip_Send(phFriNfc_LlcpMac_t *LlcpMac,
41 static void phFriNfc_LlcpMac_Nfcip_TriggerRecvCb(phFriNfc_LlcpMac_t *LlcpMac,
47 if (LlcpMac->MacReceive_Cb != NULL)
50 pfReceiveCB = LlcpMac->MacReceive_Cb;
51 pReceiveContext = LlcpMac->MacReceive_Context;
54 LlcpMac->MacReceive_Cb = NULL;
55 LlcpMac->MacReceive_Context = NULL;
58 pfReceiveCB(pReceiveContext, status, LlcpMac->psReceiveBuffer);
62 static void phFriNfc_LlcpMac_Nfcip_TriggerSendCb(phFriNfc_LlcpMac_t *LlcpMac,
68 if (LlcpMac->MacSend_Cb != NULL)
71 pfSendCB = LlcpMac->MacSend_Cb;
72 pSendContext = LlcpMac->MacSend_Context;
75 LlcpMac->MacSend_Cb = NULL;
76 LlcpMac->MacSend_Context = NULL;
83 static NFCSTATUS phFriNfc_LlcpMac_Nfcip_Chk(phFriNfc_LlcpMac_t *LlcpMac,
90 if(NULL == LlcpMac || NULL == ChkLlcpMac_Cb || NULL == pContext)
96 status = (NFCSTATUS)memcmp(Llcp_Magic_Number,LlcpMac->psRemoteDevInfo->RemoteDevInfo.NfcIP_Info.ATRInfo,3);
99 LlcpMac->sConfigParam.buffer = &LlcpMac->psRemoteDevInfo->RemoteDevInfo.NfcIP_Info.ATRInfo[3] ;
100 LlcpMac->sConfigParam.length = (LlcpMac->psRemoteDevInfo->RemoteDevInfo.NfcIP_Info.ATRInfo_Length - 3);
113 static NFCSTATUS phFriNfc_LlcpMac_Nfcip_Activate (phFriNfc_LlcpMac_t *LlcpMac)
117 if(LlcpMac == NULL)
123 LlcpMac->LinkState = phFriNfc_LlcpMac_eLinkActivated;
124 LlcpMac->LinkStatus_Cb(LlcpMac->LinkStatus_Context,
125 LlcpMac->LinkState,
126 &LlcpMac->sConfigParam,
127 LlcpMac->PeerRemoteDevType);
133 static NFCSTATUS phFriNfc_LlcpMac_Nfcip_Deactivate (phFriNfc_LlcpMac_t *LlcpMac)
137 if(NULL == LlcpMac)
144 LlcpMac->LinkState = phFriNfc_LlcpMac_eLinkDeactivated;
146 if (LlcpMac->SendPending)
149 LlcpMac->SendPending = FALSE;
150 phFriNfc_LlcpMac_Nfcip_TriggerSendCb(LlcpMac, NFCSTATUS_FAILED);
153 if (LlcpMac->RecvPending)
156 LlcpMac->RecvPending = FALSE;
157 phFriNfc_LlcpMac_Nfcip_TriggerRecvCb(LlcpMac, NFCSTATUS_FAILED);
160 LlcpMac->LinkStatus_Cb(LlcpMac->LinkStatus_Context,
161 LlcpMac->LinkState,
163 LlcpMac->PeerRemoteDevType);
172 phFriNfc_LlcpMac_t *LlcpMac = (phFriNfc_LlcpMac_t *)pContext;
184 LlcpMac->SendPending = FALSE;
185 LlcpMac->RecvPending = FALSE;
187 phFriNfc_LlcpMac_Nfcip_TriggerSendCb(LlcpMac, Status);
194 phFriNfc_LlcpMac_t *LlcpMac = (phFriNfc_LlcpMac_t *)pContext;
211 pfSendCB = LlcpMac->MacSend_Cb;
212 pSendContext = LlcpMac->MacSend_Context;
215 LlcpMac->MacSend_Cb = NULL;
216 LlcpMac->MacSend_Context = NULL;
219 LlcpMac->SendPending = FALSE;
220 LlcpMac->RecvPending = FALSE;
225 phFriNfc_LlcpMac_Nfcip_TriggerRecvCb(LlcpMac, Status);
231 if ((LlcpMac->SendPending) && (NULL != pfSendCB))
241 if(LlcpMac->SendPending)
243 Status = phFriNfc_LlcpMac_Nfcip_Send(LlcpMac,LlcpMac->psSendBuffer,LlcpMac->MacSend_Cb,LlcpMac->MacSend_Context);
251 phFriNfc_LlcpMac_t *LlcpMac = (phFriNfc_LlcpMac_t *)pContext;
263 LlcpMac->SendPending = FALSE;
264 LlcpMac->RecvPending = FALSE;
267 phFriNfc_LlcpMac_Nfcip_TriggerSendCb(LlcpMac, Status);
268 phFriNfc_LlcpMac_Nfcip_TriggerRecvCb(LlcpMac, Status);
271 static NFCSTATUS phFriNfc_LlcpMac_Nfcip_Send(phFriNfc_LlcpMac_t *LlcpMac,
278 if(NULL == LlcpMac || NULL == psData || NULL == LlcpMacSend_Cb || NULL == pContext)
282 else if(LlcpMac->MacSend_Cb != NULL && LlcpMac->PeerRemoteDevType == phFriNfc_LlcpMac_ePeerTypeInitiator)
290 LlcpMac->MacSend_Cb = LlcpMacSend_Cb;
291 LlcpMac->MacSend_Context = pContext;
293 switch(LlcpMac->PeerRemoteDevType)
297 if(LlcpMac->RecvPending)
300 LlcpMac->MacCompletionInfo.CompletionRoutine = phFriNfc_LlcpMac_Nfcip_Transceive_Cb;
301 LlcpMac->MacCompletionInfo.Context = LlcpMac;
304 LlcpMac->Cmd.NfcIP1Cmd = phHal_eNfcIP1_Raw;
307 LlcpMac->psDepAdditionalInfo.DepFlags.MetaChaining = 0;
308 LlcpMac->psDepAdditionalInfo.DepFlags.NADPresent = 0;
309 LlcpMac->SendPending = TRUE;
311 status = phFriNfc_OvrHal_Transceive(LlcpMac->LowerDevice,
312 &LlcpMac->MacCompletionInfo,
313 LlcpMac->psRemoteDevInfo,
314 LlcpMac->Cmd,
315 &LlcpMac->psDepAdditionalInfo,
318 LlcpMac->psReceiveBuffer->buffer,
319 (uint16_t*)&LlcpMac->psReceiveBuffer->length);
323 LlcpMac->SendPending = TRUE;
324 LlcpMac->psSendBuffer = psData;
330 if(!LlcpMac->RecvPending)
332 LlcpMac->SendPending = TRUE;
333 LlcpMac->psSendBuffer = psData;
339 LlcpMac->MacCompletionInfo.CompletionRoutine = phFriNfc_LlcpMac_Nfcip_Send_Cb;
340 LlcpMac->MacCompletionInfo.Context = LlcpMac;
341 status = phFriNfc_OvrHal_Send(LlcpMac->LowerDevice,
342 &LlcpMac->MacCompletionInfo,
343 LlcpMac->psRemoteDevInfo,
357 static NFCSTATUS phFriNfc_LlcpMac_Nfcip_Receive(phFriNfc_LlcpMac_t *LlcpMac,
363 if(NULL == LlcpMac || NULL==psData || NULL == LlcpMacReceive_Cb || NULL == pContext)
367 else if(LlcpMac->MacReceive_Cb != NULL)
375 LlcpMac->MacReceive_Cb = LlcpMacReceive_Cb;
376 LlcpMac->MacReceive_Context = pContext;
379 LlcpMac->psReceiveBuffer= psData;
381 switch(LlcpMac->PeerRemoteDevType)
385 if(LlcpMac->SendPending)
388 LlcpMac->MacCompletionInfo.CompletionRoutine = phFriNfc_LlcpMac_Nfcip_Transceive_Cb;
389 LlcpMac->MacCompletionInfo.Context = LlcpMac;
391 LlcpMac->Cmd.NfcIP1Cmd = phHal_eNfcIP1_Raw;
393 LlcpMac->psDepAdditionalInfo.DepFlags.MetaChaining = 0;
394 LlcpMac->psDepAdditionalInfo.DepFlags.NADPresent = 0;
395 LlcpMac->RecvPending = TRUE;
397 status = phFriNfc_OvrHal_Transceive(LlcpMac->LowerDevice,
398 &LlcpMac->MacCompletionInfo,
399 LlcpMac->psRemoteDevInfo,
400 LlcpMac->Cmd,
401 &LlcpMac->psDepAdditionalInfo,
402 LlcpMac->psSendBuffer->buffer,
403 (uint16_t)LlcpMac->psSendBuffer->length,
409 LlcpMac->RecvPending = TRUE;
416 LlcpMac->MacCompletionInfo.CompletionRoutine = phFriNfc_LlcpMac_Nfcip_Receive_Cb;
418 LlcpMac->MacCompletionInfo.Context = LlcpMac;
419 LlcpMac->RecvPending = TRUE;
421 status = phFriNfc_OvrHal_Receive(LlcpMac->LowerDevice,
422 &LlcpMac->MacCompletionInfo,
423 LlcpMac->psRemoteDevInfo,
424 LlcpMac->psReceiveBuffer->buffer,
425 (uint16_t*)&LlcpMac->psReceiveBuffer->length);
437 NFCSTATUS phFriNfc_LlcpMac_Nfcip_Register (phFriNfc_LlcpMac_t *LlcpMac)
441 if(NULL != LlcpMac)
443 LlcpMac->LlcpMacInterface.chk = phFriNfc_LlcpMac_Nfcip_Chk;
444 LlcpMac->LlcpMacInterface.activate = phFriNfc_LlcpMac_Nfcip_Activate;
445 LlcpMac->LlcpMacInterface.deactivate = phFriNfc_LlcpMac_Nfcip_Deactivate;
446 LlcpMac->LlcpMacInterface.send = phFriNfc_LlcpMac_Nfcip_Send;
447 LlcpMac->LlcpMacInterface.receive = phFriNfc_LlcpMac_Nfcip_Receive;