Mistake on this page?
Report an issue in GitHub or email us
isodep_target.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2018, ARM Limited, All Rights Reserved
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may
6  * 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, WITHOUT
13  * 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  * \file isodep_target.h
19  * \copyright Copyright (c) ARM Ltd 2015
20  * \author Donatien Garnier
21  */
22 
23 #ifndef ISODEP_TARGET_H_
24 #define ISODEP_TARGET_H_
25 
26 #include "stack/nfc_common.h"
28 #include "isodep.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
37  nfc_transceiver_t *pTransceiver;
38 
39  struct {
40  ac_ostream_t *pReqStream;
41  ac_istream_t *pResStream;
42 
43  nfc_tech_isodep_cb_t reqCb;
44  void *pReqUserData;
45 
46  nfc_tech_isodep_cb_t resCb;
47  void *pResUserData;
48 
49  ac_buffer_t res;
50  bool chaining;
51 
52  uint8_t blockNumber;
53 
54  enum {
55  ISO_DEP_TARGET_DEP_FRAME_IDLE,
56  ISO_DEP_TARGET_DEP_FRAME_WTX_RECEIVED,
57  ISO_DEP_TARGET_DEP_FRAME_WTX_SENT,
58  ISO_DEP_TARGET_DEP_FRAME_INFORMATION_RECEIVED,
59  ISO_DEP_TARGET_DEP_FRAME_INFORMATION_SENT,
60  ISO_DEP_TARGET_DEP_FRAME_NACK_RECEIVED,
61  ISO_DEP_TARGET_DEP_FRAME_NACK_DIFF_BLOCK_NUMBER_RECEIVED,
62  ISO_DEP_TARGET_DEP_FRAME_NACK_SENT,
63  ISO_DEP_TARGET_DEP_FRAME_ACK_RECEIVED,
64  ISO_DEP_TARGET_DEP_FRAME_ACK_SENT,
65  ISO_DEP_TARGET_DEP_FRAME_DESELECT_RECEIVED,
66  ISO_DEP_TARGET_DEP_FRAME_DESELECT_SENT,
67  } frameState;
68  } dep;
69  struct {
70  enum {
71  ISO_DEP_TARGET_COMMANDS_DISCONNECTED,
72 
73  ISO_DEP_TARGET_COMMANDS_CONNECTING,
74 
75  ISO_DEP_TARGET_COMMANDS_ATS_REQ_RECVD,
76  ISO_DEP_TARGET_COMMANDS_ATS_RES_SENT,
77 
78  ISO_DEP_TARGET_COMMANDS_DEP_REQ_RECVD,
79  ISO_DEP_TARGET_COMMANDS_DEP_RES_SENT,
80  } state;
81 
82  size_t inPayloadSize;
83 
84  ac_buffer_builder_t respBldr;
85  uint8_t respBuf[32];
86 
87  ac_buffer_t *pReq;
88  } commands;
89 
90  ac_buffer_t *pHist;
91 
92  nfc_tech_isodep_disconnected_cb disconnectedCb;
93  void *pUserData;
94 };
95 
96 //High-level Target functions
97 void nfc_tech_isodep_target_init(nfc_tech_isodep_target_t *pIsodepTarget, nfc_transceiver_t *pTransceiver,
98  ac_buffer_t *pHist, nfc_tech_isodep_disconnected_cb disconnectedCb, void *pUserData);
99 
100 nfc_err_t nfc_tech_isodep_target_connect(nfc_tech_isodep_target_t *pIsodepTarget);
101 void nfc_tech_isodep_target_disconnect(nfc_tech_isodep_target_t *pIsodepTarget);
102 
103 nfc_err_t nfc_tech_isodep_target_transmit(nfc_tech_isodep_target_t *pIsodepTarget, ac_istream_t *pStream, nfc_tech_isodep_cb_t cb, void *pUserData);
104 nfc_err_t nfc_tech_isodep_target_receive(nfc_tech_isodep_target_t *pIsodepTarget, ac_ostream_t *pStream, nfc_tech_isodep_cb_t cb, void *pUserData);
105 
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #endif /* ISODEP_TARGET_H_ */
int nfc_err_t
Type for NFC errors.
Definition: nfc_errors.h:59
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.