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_Jewel.h                                                 *
     22 * \brief HCI Jewel Management Routines.                                    *
     23 *                                                                             *
     24 *                                                                             *
     25 * Project: NFC-FRI-1.1                                                        *
     26 *                                                                             *
     27 * $Date: Mon Mar 29 17:34:50 2010 $                                           *
     28 * $Author: ing04880 $                                                         *
     29 * $Revision: 1.3 $                                                            *
     30 * $Aliases: 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 #ifndef PHHCINFC_JEWEL_H
     36 #define PHHCINFC_JEWEL_H
     37 
     38 /*@}*/
     39 
     40 
     41 /**
     42 *  \name HCI
     43 *
     44 * File: \ref phHciNfc_Jewel.h
     45 *
     46 */
     47 /*@{*/
     48 #define PHHCINFC_JEWEL_FILEREVISION "$Revision: 1.3 $" /**< \ingroup grp_file_attributes */
     49 #define PHHCINFC_JEWEL_FILEALIASES  "$Aliases: 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 */
     50 /*@}*/
     51 
     52 /*
     53 ***************************** Header File Inclusion ****************************
     54 */
     55 
     56 #include <phHciNfc_Generic.h>
     57 
     58 /*
     59 ****************************** Macro Definitions *******************************
     60 */
     61 
     62 /* Commands exposed to the upper layer */
     63 
     64 /* Enable the Jewel */
     65 #define HCI_JEWEL_ENABLE                    0x01U
     66 #define HCI_JEWEL_INFO_SEQ                  0x02U
     67 
     68 /* Jewel read write commands */
     69 #define NXP_JEWEL_RAW                       0x23U
     70 
     71 /*
     72 ******************** Enumeration and Structure Definition **********************
     73 */
     74 typedef enum phHciNfc_Jewel_Seq{
     75     JEWEL_READID_SEQUENCE,
     76     JEWEL_END_SEQUENCE,
     77     JEWEL_INVALID_SEQ
     78 } phHciNfc_Jewel_Seq_t;
     79 
     80 /* Information structure for the Jewel Gate */
     81 typedef struct phHciNfc_Jewel_Info{
     82     /* Current running Sequence of the Jewel Management */
     83     phHciNfc_Jewel_Seq_t            current_seq;
     84     /* Next running Sequence of the Jewel Management */
     85     phHciNfc_Jewel_Seq_t            next_seq;
     86     /* Pointer to the Jewel pipe information */
     87     phHciNfc_Pipe_Info_t            *p_pipe_info;
     88     uint8_t                         pipe_id;
     89     /* Flag to say about the multiple targets */
     90     uint8_t                         multiple_tgts_found;
     91     /* Jewel information */
     92     phHal_sRemoteDevInformation_t   s_jewel_info;
     93     /* Enable or disable reader gate */
     94     uint8_t                         enable_jewel_gate;
     95     /* UICC re-activation status */
     96     uint8_t                         uicc_activation;
     97 } phHciNfc_Jewel_Info_t;
     98 
     99 /*
    100 *********************** Function Prototype Declaration *************************
    101 */
    102 
    103 /*!
    104 * \brief Allocates the resources of Jewel management gate.
    105 *
    106 * This function Allocates the resources of the Jewel management
    107 * gate Information Structure.
    108 *
    109 */
    110 extern
    111 NFCSTATUS
    112 phHciNfc_Jewel_Init_Resources(
    113                                 phHciNfc_sContext_t     *psHciContext
    114                                 );
    115 
    116 /**
    117 * \ingroup grp_hci_nfc
    118 *
    119 *   The phHciNfc_Jewel_Get_PipeID function gives the pipe id of the Jewel
    120 *   gate
    121 *
    122 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
    123 *                                       context Structure.
    124 *   \param[in]  pHwRef                  pHwRef is the Information of
    125 *                                       the Device Interface Link
    126 *
    127 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
    128 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    129 *                                       could not be interpreted properly.
    130 *
    131 */
    132 extern
    133 NFCSTATUS
    134 phHciNfc_Jewel_Get_PipeID(
    135                             phHciNfc_sContext_t     *psHciContext,
    136                             uint8_t                 *ppipe_id
    137                             );
    138 
    139 
    140 /**
    141 * \ingroup grp_hci_nfc
    142 *
    143 *  The phHciNfc_Jewel_Update_PipeInfo function updates the pipe_id of the Jewel
    144 *  gate management Structure.
    145 *
    146 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
    147 *                                      context Structure.
    148 *  \param[in]  pipeID                  pipeID of the Jewel gate
    149 *  \param[in]  pPipeInfo               Update the pipe Information of the reader
    150 *                                      A gate
    151 *
    152 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.
    153 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    154 *                                      could not be interpreted properly.
    155 *
    156 */
    157 
    158 extern
    159 NFCSTATUS
    160 phHciNfc_Jewel_Update_PipeInfo(
    161                                  phHciNfc_sContext_t     *psHciContext,
    162                                  uint8_t                 pipeID,
    163                                  phHciNfc_Pipe_Info_t    *pPipeInfo
    164                                  );
    165 
    166 /**
    167 * \ingroup grp_hci_nfc
    168 *
    169 *   The phHciNfc_Jewel_Update_Info function updated the jewel gate info.
    170 *
    171 *   \param[in]  psHciContext        psHciContext is the pointer to HCI Layer
    172 *                                   context Structure.
    173 *   \param[in]  infotype            To enable the jewel gate
    174 *   \param[in]  jewel_info          Jewel gate info
    175 *
    176 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
    177 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    178 *                                       could not be interpreted properly.
    179 */
    180 extern
    181 NFCSTATUS
    182 phHciNfc_Jewel_Update_Info(
    183                              phHciNfc_sContext_t        *psHciContext,
    184                              uint8_t                    infotype,
    185                              void                       *jewel_info
    186                              );
    187 
    188 /**
    189 * \ingroup grp_hci_nfc
    190 *
    191 *   The phHciNfc_Jewel_Info_Sequence function executes the sequence of operations, to
    192 *   get the ID.
    193 *
    194 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
    195 *                                       context Structure.
    196 *   \param[in]  pHwRef                  pHwRef is the Information of
    197 *                                       the Device Interface Link
    198 *
    199 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
    200 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    201 *                                       could not be interpreted properly.
    202 *
    203 */
    204 extern
    205 NFCSTATUS
    206 phHciNfc_Jewel_Info_Sequence (
    207                                 void             *psHciHandle,
    208                                 void             *pHwRef
    209                                 );
    210 
    211 /**
    212 * \ingroup grp_hci_nfc
    213 *
    214 *   The phHciNfc_Send_Jewel_Command function executes the command sent by the
    215 *   upper layer, depending on the commands defined.
    216 *
    217 *   \param[in]  psContext        psContext is the pointer to HCI Layer
    218 *                                context Structure.
    219 *   \param[in]  pHwRef           pHwRef is the Information of
    220 *                                the Device Interface Link
    221 *   \param[in]  pipe_id          pipeID of the jewel gate
    222 *   \param[in]  cmd              command that needs to be sent to the device
    223 *   \param[in]  length           information length sent by the caller
    224 *   \param[in]  params           information related to the command
    225 *
    226 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
    227 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    228 *                                       could not be interpreted properly.
    229 */
    230 extern
    231 NFCSTATUS
    232 phHciNfc_Send_Jewel_Command(
    233                              phHciNfc_sContext_t   *psContext,
    234                              void                  *pHwRef,
    235                              uint8_t               pipe_id,
    236                              uint8_t               cmd
    237                              );
    238 
    239 /**
    240 * \ingroup grp_hci_nfc
    241 *
    242 *   The phHciNfc_Jewel_GetRID function executes the command to read the ID
    243 *
    244 *   \param[in]  psHciContext     psHciContext is the pointer to HCI Layer
    245 *                                context Structure.
    246 *   \param[in]  pHwRef           pHwRef is the Information of
    247 *                                the Device Interface Link
    248 *
    249 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
    250 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
    251 *                                       could not be interpreted properly.
    252 */
    253 extern
    254 NFCSTATUS
    255 phHciNfc_Jewel_GetRID(
    256                 phHciNfc_sContext_t   *psHciContext,
    257                 void                  *pHwRef);
    258 
    259 #endif /* #ifndef PHHCINFC_JEWEL_H */
    260 
    261 
    262