• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
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 #ifndef ESE_HW_NXP_PN80T_COMMON_H_
18 #define ESE_HW_NXP_PN80T_COMMON_H_ 1
19 
20 #include "../../libese-teq1/include/ese/teq1.h"
21 #include "../../libese/include/ese/ese.h"
22 #include "../../libese/include/ese/log.h"
23 #include "platform.h"
24 
25 /* Card state is _required_ to be at the front of eSE pad. */
26 struct NxpState {
27   void *handle;
28 };
29 
30 /* pad[0] is reserved for T=1. Lazily go to the middle. */
31 #define NXP_PN80T_STATE(ese)                                                   \
32   ((struct NxpState *)(&ese->pad[ESE_INTERFACE_STATE_PAD / 2]))
33 
34 void nxp_pn80t_close(struct EseInterface *ese);
35 uint32_t nxp_pn80t_transceive(struct EseInterface *ese,
36                               const struct EseSgBuffer *tx_buf, uint32_t tx_len,
37                               struct EseSgBuffer *rx_buf, uint32_t rx_len);
38 int nxp_pn80t_poll(struct EseInterface *ese, uint8_t poll_for, float timeout,
39                    int complete);
40 int nxp_pn80t_reset(struct EseInterface *ese);
41 int nxp_pn80t_open(struct EseInterface *ese, void *board);
42 
43 enum NxpPn80tError {
44   kNxpPn80tError = kTeq1ErrorMax,
45   kNxpPn80tErrorPlatformInit,
46   kNxpPn80tErrorPollRead,
47   kNxpPn80tErrorResetToggle,
48   kNxpPn80tErrorTransmit,
49   kNxpPn80tErrorTransmitSize,
50   kNxpPn80tErrorReceive,
51   kNxpPn80tErrorReceiveSize,
52   kNxpPn80tErrorMax,  /* sizeof(kNxpPn80tErrorMessages) */
53 };
54 
55 extern const char *kNxpPn80tErrorMessages[];
56 #endif  /* ESE_HW_NXP_PN80T_COMMON_H_ */
57