• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 2018 NXP Semiconductors
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 #ifndef ANDROID_HARDWARE_HAL_NXPESE_V1_0_H
19 #define ANDROID_HARDWARE_HAL_NXPESE_V1_0_H
20 
21 #define ESE_NXPNFC_HARDWARE_MODULE_ID "ese_nxp.pn54x"
22 #define MAX_IOCTL_TRANSCEIVE_CMD_LEN 256
23 #define MAX_IOCTL_TRANSCEIVE_RESP_LEN 256
24 #define MAX_ATR_INFO_LEN 128
25 enum {
26   HAL_ESE_IOCTL_P61_IDLE_MODE = 0,
27   HAL_ESE_IOCTL_P61_WIRED_MODE,
28   HAL_ESE_IOCTL_P61_PWR_MODE,
29   HAL_ESE_IOCTL_P61_DISABLE_MODE,
30   HAL_ESE_IOCTL_P61_ENABLE_MODE,
31   HAL_ESE_IOCTL_SET_BOOT_MODE,
32   HAL_ESE_IOCTL_GET_CONFIG_INFO,
33   HAL_ESE_IOCTL_CHECK_FLASH_REQ,
34   HAL_ESE_IOCTL_FW_DWNLD,
35   HAL_ESE_IOCTL_FW_MW_VER_CHECK,
36   HAL_ESE_IOCTL_DISABLE_HAL_LOG,
37   HAL_ESE_IOCTL_NXP_TRANSCEIVE,
38   HAL_ESE_IOCTL_P61_GET_ACCESS,
39   HAL_ESE_IOCTL_P61_REL_ACCESS,
40   HAL_ESE_IOCTL_ESE_CHIP_RST,
41   HAL_ESE_IOCTL_REL_SVDD_WAIT,
42   HAL_ESE_IOCTL_SET_JCP_DWNLD_ENABLE,
43   HAL_ESE_IOCTL_SET_JCP_DWNLD_DISABLE,
44   HAL_ESE_IOCTL_SET_ESE_SERVICE_PID,
45   HAL_ESE_IOCTL_REL_DWP_WAIT,
46   HAL_ESE_IOCTL_GET_FEATURE_LIST,
47   HAL_ESE_IOCTL_RF_STATUS_UPDATE
48 };
49 
50 enum {
51   HAL_NFC_IOCTL_P61_IDLE_MODE = 0,
52   HAL_NFC_IOCTL_P61_WIRED_MODE,
53   HAL_NFC_IOCTL_P61_PWR_MODE,
54   HAL_NFC_IOCTL_P61_DISABLE_MODE,
55   HAL_NFC_IOCTL_P61_ENABLE_MODE,
56   HAL_NFC_IOCTL_SET_BOOT_MODE,
57   HAL_NFC_IOCTL_GET_CONFIG_INFO,
58   HAL_NFC_IOCTL_CHECK_FLASH_REQ,
59   HAL_NFC_IOCTL_FW_DWNLD,
60   HAL_NFC_IOCTL_FW_MW_VER_CHECK,
61   HAL_NFC_IOCTL_DISABLE_HAL_LOG,
62   HAL_NFC_IOCTL_NCI_TRANSCEIVE,
63   HAL_NFC_IOCTL_P61_GET_ACCESS,
64   HAL_NFC_IOCTL_P61_REL_ACCESS,
65   HAL_NFC_IOCTL_ESE_CHIP_RST,
66   HAL_NFC_IOCTL_REL_SVDD_WAIT,
67   HAL_NFC_IOCTL_SET_JCP_DWNLD_ENABLE,
68   HAL_NFC_IOCTL_SET_JCP_DWNLD_DISABLE,
69   HAL_NFC_IOCTL_SET_NFC_SERVICE_PID,
70   HAL_NFC_IOCTL_REL_DWP_WAIT,
71   HAL_NFC_IOCTL_GET_FEATURE_LIST,
72   HAL_NFC_IOCTL_SPI_DWP_SYNC, /*21*/
73   HAL_NFC_IOCTL_RF_STATUS_UPDATE,
74   HAL_NFC_SET_SPM_PWR,
75   HAL_NFC_SET_POWER_SCHEME,
76   HAL_NFC_GET_SPM_STATUS,
77   HAL_NFC_GET_ESE_ACCESS,
78   HAL_NFC_SET_DWNLD_STATUS,
79   HAL_NFC_INHIBIT_PWR_CNTRL
80 };
81 /*
82  * Data structures provided below are used of Hal Ioctl calls
83  */
84 /*
85  * ese_nxp_ExtnCmd_t shall contain data for commands used for transceive command
86  * in ioctl
87  */
88 typedef struct {
89   uint16_t cmd_len;
90   uint8_t p_cmd[MAX_IOCTL_TRANSCEIVE_CMD_LEN];
91 } ese_nxp_ExtnCmd_t;
92 
93 /*
94  * ese_nxp_ExtnRsp_t shall contain response for command sent in transceive
95  * command
96  */
97 typedef struct {
98   uint16_t rsp_len;
99   uint8_t p_rsp[MAX_IOCTL_TRANSCEIVE_RESP_LEN];
100 } ese_nxp_ExtnRsp_t;
101 /*
102  * InputData_t :ioctl has multiple subcommands
103  * Each command has corresponding input data which needs to be populated in this
104  */
105 typedef union {
106   uint16_t bootMode;
107   uint8_t halType;
108   ese_nxp_ExtnCmd_t nxpCmd;
109   uint32_t timeoutMilliSec;
110   long eseServicePid;
111 } eseInputData_t;
112 /*
113  * ese_nxp_ExtnInputData_t :Apart from InputData_t, there are context data
114  * which is required during callback from stub to proxy.
115  * To avoid additional copy of data while propagating from libese to Adaptation
116  * and Esestub to nxphal, common structure is used. As a sideeffect, context
117  * data is exposed to libese (Not encapsulated).
118  */
119 typedef struct {
120   /*context to be used/updated only by users of proxy & stub of Ese.hal
121    * i.e, EseAdaptation & hardware/interface/Ese.
122    */
123   void* context;
124   eseInputData_t data;
125   uint8_t data_source;
126   long level;
127 } ese_nxp_ExtnInputData_t;
128 
129 /*
130  * outputData_t :ioctl has multiple commands/responses
131  * This contains the output types for each ioctl.
132  */
133 typedef union {
134   uint32_t status;
135   ese_nxp_ExtnRsp_t nxpRsp;
136   uint8_t nxpNciAtrInfo[MAX_ATR_INFO_LEN];
137   uint32_t p61CurrentState;
138   uint16_t fwUpdateInf;
139   uint16_t fwDwnldStatus;
140   uint16_t fwMwVerStatus;
141   uint8_t chipType;
142 } eseOutputData_t;
143 
144 /*
145  * ese_nxp_ExtnOutputData_t :Apart from outputData_t, there are other
146  * information which is required during callback from stub to proxy. For ex
147  * (context, result of the operation , type of ioctl which was completed). To
148  * avoid additional copy of data while propagating from libese to Adaptation and
149  * Esestub to nxphal, common structure is used. As a sideeffect, these data is
150  * exposed(Not encapsulated).
151  */
152 typedef struct {
153   /*ioctlType, result & context to be used/updated only by users of
154    * proxy & stub of Ese.hal.
155    * i.e, EseAdaptation & hardware/interface/Ese
156    * These fields shall not be used by libese or halimplementation*/
157   uint64_t ioctlType;
158   uint32_t result;
159   void* context;
160   eseOutputData_t data;
161 } ese_nxp_ExtnOutputData_t;
162 
163 /*
164  * ese_nxp_IoctlInOutData_t :data structure for input & output
165  * to be sent for ioctl command. input is populated by client/proxy side
166  * output is provided from server/stub to client/proxy
167  */
168 typedef struct {
169   ese_nxp_ExtnInputData_t inp;
170   ese_nxp_ExtnOutputData_t out;
171 } ese_nxp_IoctlInOutData_t;
172 
173 #endif  // ANDROID_HARDWARE_HAL_NXPESE_V1_0_H
174