Mistake on this page?
Report an issue in GitHub or email us
nfc_transport.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-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 nfc_transport.h
19  * \copyright Copyright (c) ARM Ltd 2013-2018
20  * \author Donatien Garnier
21  */
22 
23 /** \addtogroup Implementation
24  * @{
25  * \name Transport
26  * @{
27  */
28 
29 #ifndef NFC_TRANSPORT_H_
30 #define NFC_TRANSPORT_H_
31 
32 #include "stack/nfc_common.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 
39 /** Function called to write a register's value
40  * \param address address of the register to write to
41  * \param outBuf buffer to write
42  * \param outLen buffer's length
43  * \param pUser parameter passed to the nfc_transport_init function
44  */
45 typedef void (*nfc_transport_write_fn_t)(uint8_t address, const uint8_t *outBuf, size_t outLen, void *pUser);
46 
47 /** Function called to read a register's value
48  * \param address address to read packet from
49  * \param outBuf buffer to read
50  * \param outLen buffer's length
51  * \param pUser parameter passed to the nfc_transport_init function
52  */
53 typedef void (*nfc_transport_read_fn_t)(uint8_t address, uint8_t *inBuf, size_t inLen, void *pUser);
54 
55 typedef struct __transport {
58  void *pUser;
60 
61 void nfc_transport_init(nfc_transport_t *pTransport, nfc_transport_write_fn_t write, nfc_transport_read_fn_t read, void *pUser);
62 
63 static inline void nfc_transport_write(nfc_transport_t *pTransport, uint8_t address, const uint8_t *outBuf, size_t outLen)
64 {
65  pTransport->write(address, outBuf, outLen, pTransport->pUser);
66 }
67 
68 static inline void nfc_transport_read(nfc_transport_t *pTransport, uint8_t address, uint8_t *inBuf, size_t inLen)
69 {
70  pTransport->read(address, inBuf, inLen, pTransport->pUser);
71 }
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif /* NFC_TRANSPORT_H_ */
78 
79 
80 /**
81  * @}
82  * @}
83  * */
84 
void(* nfc_transport_read_fn_t)(uint8_t address, uint8_t *inBuf, size_t inLen, void *pUser)
Function called to read a register's value.
Definition: nfc_transport.h:53
void(* nfc_transport_write_fn_t)(uint8_t address, const uint8_t *outBuf, size_t outLen, void *pUser)
Function called to write a register's value.
Definition: nfc_transport.h:45
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.