Home | History | Annotate | Download | only in src
      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 * =========================================================================== *
     19 *                                                                             *
     20 *                                                                             *
     21 * \file  phHciNfc_RFReaderA.h                                                 *
     22 * \brief HCI Reader A Management Routines.                                    *
     23 *                                                                             *
     24 *                                                                             *
     25 * Project: NFC-FRI-1.1                                                        *
     26 *                                                                             *
     27 * $Date: Fri Aug 14 17:01:27 2009 $                                           *
     28 * $Author: ing04880 $                                                         *
     29 * $Revision: 1.17 $                                                           *
     30 * $Aliases: NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,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 $                                          *
     31 *                                                                             *
     32 * =========================================================================== *
     33 */
     34 
     35 
     36 #ifndef PHHCINFC_RFREADERA_H
     37 #define PHHCINFC_RFREADERA_H
     38 
     39 /*@}*/
     40 
     41 
     42 /**
     43  *  \name HCI
     44  *
     45  * File: \ref phHciNfc_ReaderA.h
     46  *
     47  */
     48 /*@{*/
     49 #define PHHCINFC_RFREADERA_FILEREVISION "$Revision: 1.17 $" /**< \ingroup grp_file_attributes */
     50 #define PHHCINFC_RFREADERA_FILEALIASES  "$Aliases: NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,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 */
     51 /*@}*/
     52 
     53 /*
     54 ***************************** Header File Inclusion ****************************
     55 */
     56 
     57 #include <phHciNfc_Generic.h>
     58 
     59 /*
     60 ****************************** Macro Definitions *******************************
     61 */
     62 
     63 /* Commands exposed to the upper layer */
     64 #define NXP_WRA_CONTINUE_ACTIVATION         0x12U
     65 #define NXP_MIFARE_RAW                      0x20U
     66 #define NXP_MIFARE_CMD                      0x21U
     67 #define DATA_RATE_MAX_DEFAULT_VALUE         0x00U
     68 
     69 /* Enable the reader A */
     70 #define HCI_READER_A_ENABLE                 0x01U
     71 #define HCI_READER_A_INFO_SEQ               0x02U
     72 
     73 #define RDR_A_TIMEOUT_MIN                   0x00U
     74 #define RDR_A_TIMEOUT_MAX                   0x15U
     75 /*
     76 ******************** Enumeration and Structure Definition **********************
     77 */
     78 typedef enum phHciNfc_ReaderA_Seq{
     79     RDR_A_DATA_RATE_MAX,
     80     RDR_A_UID,
     81     RDR_A_SAK,
     82     RDR_A_ATQA,
     83     RDR_A_APP_DATA,
     84     RDR_A_FWI_SFGT,
     85     RDR_A_END_SEQUENCE,
     86     RDR_A_INVALID_SEQ
     87 } phHciNfc_ReaderA_Seq_t;
     88 
     89 /* Information structure for the polling loop Gate */
     90 typedef struct phHciNfc_ReaderA_Info{
     91     /* Current running Sequence of the reader A Management */
     92     phHciNfc_ReaderA_Seq_t          current_seq;
     93     /* Next running Sequence of the reader A Management */
     94     phHciNfc_ReaderA_Seq_t          next_seq;
     95     /* Pointer to the reader A pipe information */
     96     phHciNfc_Pipe_Info_t            *p_pipe_info;
     97     uint8_t                         pipe_id;
     98     /* Flag to say about the multiple targets */
     99     uint8_t                         multiple_tgts_found;
    100     /* Reader A information */
    101     phHal_sRemoteDevInformation_t   reader_a_info;
    102     /* Enable or disable reader gate */
    103     uint8_t                         enable_rdr_a_gate;
    104     /* UICC re-activation status */
    105     uint8_t                         uicc_activation;
    106 } phHciNfc_ReaderA_Info_t;
    107 
    108 /*
    109 *********************** Function Prototype Declaration *************************
    110 */
    111 
    112 /*!
    113  * \brief Allocates the resources of reader A management gate.
    114  *
    115  * This function Allocates the resources of the reader A management
    116  * gate Information Structure.
    117  *
    118  */
    119 extern
    120 NFCSTATUS
    121 phHciNfc_ReaderA_Init_Resources(
    122                                 phHciNfc_sContext_t     *psHciContext
    123                          );
    124 
    125 /**
    126 * \ingroup grp_hci_nfc
    127 *
    128 *   The phHciNfc_ReaderA_Get_PipeID function gives the pipe id of the reader A
    129 *   gate
    130 *
    131 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
    132 *                                       context Structure.
    133 *   \param[in]  pHwRef                  pHwRef is the Information of
    134 *                                       the Device Interface Link
    135 *
    136 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
    137 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    138 *                                       could not be interpreted properly.
    139 *
    140 */
    141 extern
    142 NFCSTATUS
    143 phHciNfc_ReaderA_Get_PipeID(
    144                             phHciNfc_sContext_t     *psHciContext,
    145                             uint8_t                 *ppipe_id
    146                             );
    147 
    148 /**
    149 * \ingroup grp_hci_nfc
    150 *
    151 *   The phHciNfc_ReaderA_Sequence function executes the sequence of operations, to
    152 *   get the UID, SAK, ATQA  etc.
    153 *
    154 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
    155 *                                       context Structure.
    156 *   \param[in]  pHwRef                  pHwRef is the Information of
    157 *                                       the Device Interface Link
    158 *
    159 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
    160 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    161 *                                       could not be interpreted properly.
    162 *
    163 */
    164 extern
    165 NFCSTATUS
    166 phHciNfc_ReaderA_Info_Sequence (
    167                        void             *psHciHandle,
    168                        void             *pHwRef
    169                        );
    170 
    171 
    172 /**
    173 * \ingroup grp_hci_nfc
    174 *
    175 *   The phHciNfc_ReaderA_App_Data function is to get the application data information.
    176 *
    177 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
    178 *                                       context Structure.
    179 *   \param[in]  pHwRef                  pHwRef is the Information of
    180 *                                       the Device Interface Link
    181 *
    182 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
    183 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    184 *                                       could not be interpreted properly.
    185 *
    186 */
    187 extern
    188 NFCSTATUS
    189 phHciNfc_ReaderA_App_Data (
    190                            void             *psHciHandle,
    191                            void             *pHwRef
    192                            );
    193 
    194 /**
    195 * \ingroup grp_hci_nfc
    196 *
    197 *   The phHciNfc_ReaderA_Fwi_Sfgt function is to get the frame waiting time
    198 *   information.
    199 *
    200 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
    201 *                                       context Structure.
    202 *   \param[in]  pHwRef                  pHwRef is the Information of
    203 *                                       the Device Interface Link
    204 *
    205 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
    206 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    207 *                                       could not be interpreted properly.
    208 *
    209 */
    210 extern
    211 NFCSTATUS
    212 phHciNfc_ReaderA_Fwi_Sfgt (
    213                            void             *psHciHandle,
    214                            void             *pHwRef
    215                            );
    216 
    217 /**
    218 * \ingroup grp_hci_nfc
    219 *
    220 *  The phHciNfc_ReaderA_Update_PipeInfo function updates the pipe_id of the reader A
    221 *  gate management Structure.
    222 *
    223 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
    224 *                                      context Structure.
    225 *  \param[in]  pipeID                  pipeID of the reader A gate
    226 *  \param[in]  pPipeInfo               Update the pipe Information of the reader
    227 *                                      A gate
    228 *
    229 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.
    230 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    231 *                                      could not be interpreted properly.
    232 *
    233 */
    234 
    235 extern
    236 NFCSTATUS
    237 phHciNfc_ReaderA_Update_PipeInfo(
    238                                   phHciNfc_sContext_t     *psHciContext,
    239                                   uint8_t                 pipeID,
    240                                   phHciNfc_Pipe_Info_t    *pPipeInfo
    241                                   );
    242 
    243 /**
    244 * \ingroup grp_hci_nfc
    245 *
    246 *   The phHciNfc_Send_ReaderA_Command function executes the command sent by the
    247 *   upper layer, depending on the commands defined.
    248 *
    249 *   \param[in]  psContext        psContext is the pointer to HCI Layer
    250 *                                context Structure.
    251 *   \param[in]  pHwRef           pHwRef is the Information of
    252 *                                the Device Interface Link
    253 *   \param[in]  pipe_id          pipeID of the reader A gate
    254 *   \param[in]  cmd              command that needs to be sent to the device
    255 *   \param[in]  length           information length sent by the caller
    256 *   \param[in]  params           information related to the command
    257 *
    258 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
    259 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    260 *                                       could not be interpreted properly.
    261 *
    262 */
    263 extern
    264 NFCSTATUS
    265 phHciNfc_Send_ReaderA_Command(
    266                               phHciNfc_sContext_t   *psContext,
    267                               void                  *pHwRef,
    268                               uint8_t               pipe_id,
    269                               uint8_t               cmd
    270                               );
    271 
    272 /**
    273 * \ingroup grp_hci_nfc
    274 *
    275 *   The phHciNfc_ReaderA_Auto_Activate function updates auto activate register
    276 *
    277 *   \param[in]  psContext        psContext is the pointer to HCI Layer
    278 *                                context Structure.
    279 *   \param[in]  pHwRef           pHwRef is the Information of
    280 *                                the Device Interface Link
    281 *   \param[in] activate_enable   to enable or disable auto activation
    282 *
    283 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
    284 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    285 *                                       could not be interpreted properly.
    286 *
    287 */
    288 extern
    289 NFCSTATUS
    290 phHciNfc_ReaderA_Auto_Activate(
    291                                void         *psContext,
    292                                void         *pHwRef,
    293                                uint8_t      activate_enable
    294                                );
    295 
    296 /**
    297 * \ingroup grp_hci_nfc
    298 *
    299 *   The phHciNfc_Send_ReaderA_Command function executes the command sent by the
    300 *   upper layer, depending on the commands defined.
    301 *
    302 *   \param[in]  psHciContext     psHciContext is the pointer to HCI Layer
    303 *                                context Structure.
    304 *   \param[in]  infotype         To enable the reader A gate
    305 *   \param[in]  rdr_a_info       reader A gate info
    306 *
    307 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
    308 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    309 *                                       could not be interpreted properly.
    310 *
    311 */
    312 extern
    313 NFCSTATUS
    314 phHciNfc_ReaderA_Update_Info(
    315                              phHciNfc_sContext_t        *psHciContext,
    316                              uint8_t                    infotype,
    317                              void                       *rdr_a_info
    318                              );
    319 
    320 /**
    321 * \ingroup grp_hci_nfc
    322 *
    323 *   The phHciNfc_ReaderA_Cont_Active function executes NXP_WRA_CONTINUE_ACTIVATION
    324 *   command to inform the CLF Controller after having received the event
    325 *   EVT_TARGET_DISCOVERED to continue activation in case activation has
    326 *   been stopped after successful SAK response. The response to this command, sent
    327 *   as soon as the activation is finished, indicates the result of the
    328 *   activation procedure
    329 *
    330 *   \param[in]  psHciContext     psHciContext is the pointer to HCI Layer
    331 *                                context Structure.
    332 *   \param[in]  pHwRef           pHwRef is the Information of
    333 *                                the Device Interface Link
    334 *   \param[in]  pipeID           pipeID of the reader A gate
    335 *
    336 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
    337 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    338 *                                       could not be interpreted properly.
    339 *
    340 */
    341 extern
    342 NFCSTATUS
    343 phHciNfc_ReaderA_Cont_Activate (
    344                               phHciNfc_sContext_t       *psHciContext,
    345                               void                      *pHwRef
    346                               );
    347 
    348 /**
    349 * \ingroup grp_hci_nfc
    350 *
    351 *  The phHciNfc_ReaderA_Set_DataRateMax function updates the data rate max value
    352 *
    353 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
    354 *                                      context Structure.
    355 *  \param[in]  pipeID                  pipeID of the reader A gate
    356 *  \param[in]  pPipeInfo               Update the pipe Information of the reader
    357 *                                      A gate
    358 *
    359 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.
    360 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    361 *                                      could not be interpreted properly.
    362 *
    363 */
    364 extern
    365 NFCSTATUS
    366 phHciNfc_ReaderA_Set_DataRateMax(
    367                                  void         *psContext,
    368                                  void         *pHwRef,
    369                                  uint8_t      data_rate_value
    370                                  );
    371 
    372 #endif /* #ifndef PHHCINFC_RFREADERA_H */
    373 
    374