/* * 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 phDal4Nfc.h * \brief Common DAL for the upper layer. * * Project: NFC-FRI-1.1 * * $Date: Tue Nov 10 13:56:45 2009 $ * $Author: ing07299 $ * $Revision: 1.38 $ * $Aliases: NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $ * */ #ifndef PHDAL4NFC_H #define PHDAL4NFC_H /** * \name DAl4 NFC * * File: \ref phDal4Nfc.h * */ /*@{*/ #define PH_DAL4NFC_FILEREVISION "$Revision: 1.38 $" /**< \ingroup grp_file_attributes */ #define PH_DAL4NFC_FILEALIASES "$Aliases: NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $" /**< \ingroup grp_file_attributes */ /*@}*/ /*************************** Includes *******************************/ /** \defgroup grp_nfc_dal DAL Component * * * */ #include /**< Basic type definitions */ #include /**< Generic Interface Layer Function Definitions */ #include /*********************** End of includes ****************************/ /***************************** Macros *******************************/ /**< Used for messaging by DAL as well as Upper Layers */ #define PH_DAL4NFC_MESSAGE_BASE PH_LIBNFC_DEFERREDCALL_MSG /************************ End of macros *****************************/ /********************* Structures and enums *************************/ /** * \ingroup grp_nfc_dal * * DAL context : This contains the information of the upper layer callback * and hardware reference. */ typedef struct phDal4Nfc_SContext { phNfcIF_sCallBack_t cb_if; /**1.Exports DAL interfaces and DAL layer context to upper layer. *Exported DAL interfaces are : *

.phDal4Nfc_Shutdown *

.phDal4Nfc_Write *

.phDal4Nfc_Read *

.phDal4Nfc_ReadWait *

.phDal4Nfc_ReadWaitCancel *

phDal4Nfc_Unregister *

.Registeres upper layer callbacks and upper layer context with DAL layer. *For details refer to \ref phNfcIF_sReference_t. *Registration details are valid unless upper layer calls \ref phDal4Nfc_Unregister() or \ref phDal4Nfc_Shutdown called. * \param[in,out] psRefer holds DAL exported interface references once registration * sucessful.This also contains transmit and receive buffer * references. * * \param[in] if_cb Contains upper layer callback reference details, which are used * by DAL layer during callback notification. * These callbacks gets registered with DAL layer. * * \param[out] psIFConf Currently this parameter not used.This parameter to be other than NULL. * * * \retval NFCSTATUS_SUCCESS Operation is successful. * \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid. * *\msc *ClientApp,UpperLayer,phDal4Nfc; *ClientApp=>phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"]; *ClientApp<phDal4Nfc [label="phDal4Nfc_Register()",URL="\ref phDal4Nfc_Register"]; *UpperLayer<phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"]; *ClientApp<phDal4Nfc [label="phDal4Nfc_Register()",URL="\ref phDal4Nfc_Register"]; *UpperLayer<phDal4Nfc [label="phDal4Nfc_Unregister()",URL="\ref phDal4Nfc_Unregister"]; *UpperLayer<
. Initialize parameters for HW Interface. *

. Initializing read and writer threads. *

. Initializing read and write task specific events and event specific configurations. *

. Initializing DAL layer specific details. * * \param[in] pContext DAL context provided by the upper layer. * The DAL context will be exported to the * upper layer via upper layer registration interface. * \param[in] pHwRef information of the hardware * * \retval NFCSTATUS_SUCCESS DAL initialization successful. * \retval NFCSTATUS_INVALID_DEVICE The device is not enumerated or the * Hardware Reference points to a device * which does not exist. Alternatively, * also already open devices produce this * error. * \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function * is invalid. * *\msc *ClientApp,UpperLayer,phDal4Nfc; *ClientApp=>phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"]; *ClientApp<phDal4Nfc [label="phDal4Nfc_Register()",URL="\ref phDal4Nfc_Register"]; *UpperLayer<phDal4Nfc [label="phDal4Nfc_Init()",URL="\ref phDal4Nfc_Init"]; *UpperLayer<
.Releases all the resources.( context,memory resources,read/write buffers). *

.closes COMxx port which is used during DAL session. *

.Terminates Reader and writer tasks. * * \param[in] pContext DAL context is provided by the upper layer. * The DAL context earlier was given to the * upper layer through the * \ref \e phDal4Nfc_Register() function * \param[in] pHwRef hardware reference context. * * \retval NFCSTATUS_SUCCESS DAL shutdown successful * \retval NFCSTATUS_FAILED DAL shutdown failed(example.unable to * suspend thread, close HW Interface etc.) * \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function * is invalid. * *\msc *ClientApp,UpperLayer,phDal4Nfc; *ClientApp=>phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"]; *ClientApp<phDal4Nfc [label="phDal4Nfc_Register()",URL="\ref phDal4Nfc_Register"]; *UpperLayer<phDal4Nfc [label="phDal4Nfc_Init()",URL="\ref phDal4Nfc_Init"]; *UpperLayer<phDal4Nfc [label="phDal4Nfc_Shutdown()",URL="\ref phDal4Nfc_Shutdown"]; *ClientApp<phDal4Nfc [label="phDal4Nfc_Write()",URL="\ref phDal4Nfc_Write()"]; *UpperLayer<phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref phDal4Nfc_DeferredCall()"]; *ClientApp=>phDal4Nfc [label="phDal4Nfc_DeferredCb()",URL="\ref phDal4Nfc_DeferredCb()"]; *phDal4Nfc=>UpperLayer [label="send_complete",URL="\ref phDal4Nfc_DeferredCb()"]; *ClientApp<phDal4Nfc [label="phDal4Nfc_Write()",URL="\ref phDal4Nfc_Write()"]; *UpperLayer<phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref phDal4Nfc_DeferredCall()"]; *ClientApp=>phDal4Nfc [label="phDal4Nfc_DeferredCb()",URL="\ref phDal4Nfc_DeferredCb()"]; *phDal4Nfc=>UpperLayer [label="send_complete",URL="\ref phDal4Nfc_DeferredCb()"]; *ClientApp<phDal4Nfc [label="phDal4Nfc_Read()",URL="\ref phDal4Nfc_Read()"]; *UpperLayer<phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref phDal4Nfc_DeferredCall()"]; *ClientApp=>phDal4Nfc [label="phDal4Nfc_DeferredCb()",URL="\ref phDal4Nfc_DeferredCb()"]; *phDal4Nfc=>UpperLayer [label="receive_complete",URL="\ref phDal4Nfc_DeferredCb()"]; *ClientApp<phDal4Nfc [label="phDal4Nfc_Write()",URL="\ref phDal4Nfc_Write()"]; *UpperLayer<phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref phDal4Nfc_DeferredCall()"]; *ClientApp=>phDal4Nfc [label="phDal4Nfc_DeferredCb()",URL="\ref phDal4Nfc_DeferredCb()"]; *phDal4Nfc=>UpperLayer [label="send_complete",URL="\ref phDal4Nfc_DeferredCb()"]; *ClientApp<phDal4Nfc [label="phDal4Nfc_ReadWait()",URL="\ref phDal4Nfc_ReadWait()"]; *UpperLayer<phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref phDal4Nfc_DeferredCall()"]; *ClientApp=>phDal4Nfc [label="phDal4Nfc_DeferredCb()",URL="\ref phDal4Nfc_DeferredCb()"]; *phDal4Nfc=>UpperLayer [label="receive_complete",URL="\ref phDal4Nfc_DeferredCb()"]; *ClientApp<phDal4Nfc [label="phDal4Nfc_Write()",URL="\ref phDal4Nfc_Write()"]; *UpperLayer<phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref phDal4Nfc_DeferredCall()"]; *ClientApp=>phDal4Nfc [label="phDal4Nfc_DeferredCb()",URL="\ref Call phDal4Nfc_DeferredCb()"]; *phDal4Nfc=>UpperLayer [label="send_complete",URL="\ref phDal4Nfc_DeferredCb()"]; *ClientApp<phDal4Nfc [label="phDal4Nfc_ReadWait()",URL="\ref phDal4Nfc_ReadWait()"]; *UpperLayer<phDal4Nfc [label="phDal4Nfc_ReadWaitCancel()",URL="\ref phDal4Nfc_ReadWaitCancel()"]; **UpperLayer<phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"]; *ClientApp<phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"]; *ClientApp<phDal4Nfc [label="phDal4Nfc_Register()",URL="\ref phDal4Nfc_Register"]; *UpperLayer<phDal4Nfc [label="phDal4Nfc_Init()",URL="\ref phDal4Nfc_Init"]; *UpperLayer<phDal4Nfc [label="phDal4Nfc_Shutdown()",URL="\ref phDal4Nfc_Shutdown"]; *UpperLayer<phDal4Nfc [label="phDal4Nfc_ConfigRelease()",URL="\ref phDal4Nfc_ConfigRelease"]; *ClientApp<