Skip to content

Commit f82feec

Browse files
author
Cruz Monrreal
authored
Merge pull request #7822 from donatieng/nfc-impl
Add initial NFC support to Mbed OS
2 parents a849fa4 + f3c3abd commit f82feec

File tree

100 files changed

+14350
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+14350
-3
lines changed

TESTS/nfc/eeprom/main.cpp

Lines changed: 499 additions & 0 deletions
Large diffs are not rendered by default.

doxygen_options.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"EXPAND_AS_DEFINED": "",
1111
"SKIP_FUNCTION_MACROS": "NO",
1212
"STRIP_CODE_COMMENTS": "NO",
13-
"EXCLUDE_PATTERNS": "*/tools/* */targets/* */features/mbedtls/* */features/storage/* */features/unsupported/* */BUILD/* */rtos/TARGET_CORTEX/rtx*/* */cmsis/* */features/lwipstack/* */nanostack/sal-stack-nanostack/* */nanostack/coap-service/* */ble/generic/* */ble/pal/* */mbed-trace/* */mbed-coap/* */nanostack-libservice/* */mbed-client-randlib/* */nanostack/sal-stack-nanostack-eventloop/*"
13+
"EXCLUDE_PATTERNS": "*/tools/* */targets/* */features/mbedtls/* */features/storage/* */features/unsupported/* */BUILD/* */rtos/TARGET_CORTEX/rtx*/* */cmsis/* */features/lwipstack/* */nanostack/sal-stack-nanostack/* */nanostack/coap-service/* */ble/generic/* */ble/pal/* */mbed-trace/* */mbed-coap/* */nanostack-libservice/* */mbed-client-randlib/* */nanostack/sal-stack-nanostack-eventloop/* */features/nfc/stack/*"
1414
}

features/nfc/acore/acore/ac_buffer.h

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/*
2+
* Copyright (c) 2017, 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 ac_buffer.h
19+
* \copyright Copyright (c) ARM Ltd 2013
20+
* \author Donatien Garnier
21+
*/
22+
23+
/** \addtogroup ACore
24+
* @{
25+
* \name Buffer
26+
* @{
27+
*/
28+
29+
#ifndef ACORE_BUFFER_H_
30+
#define ACORE_BUFFER_H_
31+
32+
#ifdef __cplusplus
33+
extern "C" {
34+
#endif
35+
36+
#include "stdint.h"
37+
#include "stddef.h"
38+
#include "stdbool.h"
39+
40+
typedef struct __ac_buffer {
41+
const uint8_t *data;
42+
size_t size;
43+
struct __ac_buffer *pNext;
44+
} ac_buffer_t;
45+
46+
/** Initialize ac_buffer using underlying byte array, set ac_buffer's length to 0 (empty)
47+
* \param pBuf pointer to ac_buffer_t structure to initialize
48+
* \param data byte array to use
49+
* \param size size of byte array
50+
*/
51+
void ac_buffer_init(ac_buffer_t *pBuf, const uint8_t *data, size_t size);
52+
53+
/** Copy pBufIn to pBuf
54+
* \param pBuf pointer to ac_buffer_t structure to initialize
55+
* \param pBufIn the source buffer
56+
*/
57+
void ac_buffer_dup(ac_buffer_t *pBuf, const ac_buffer_t *pBufIn);
58+
59+
/** Get buffer's underlying byte array
60+
* \param pBuf pointer to ac_buffer_t structure
61+
* \return underlying array
62+
*/
63+
static inline const uint8_t *ac_buffer_data(const ac_buffer_t *pBuf)
64+
{
65+
return pBuf->data;
66+
}
67+
68+
/** Get buffer's size
69+
* \param pBuf pointer to ac_buffer_t structure
70+
* \return buffer's size
71+
*/
72+
static inline size_t ac_buffer_size(const ac_buffer_t *pBuf)
73+
{
74+
return pBuf->size;
75+
}
76+
77+
/** Get next buffer in chain
78+
* \param pBuf pointer to ac_buffer_t structure
79+
* \return pointer to next buffer
80+
*/
81+
static inline ac_buffer_t *ac_buffer_next(const ac_buffer_t *pBuf)
82+
{
83+
return pBuf->pNext;
84+
}
85+
86+
/** Set next buffer in chain
87+
* \param pBuf pointer to ac_buffer_t structure
88+
* \param pNextBuf pointer to next buffer (or NULL to break chain)
89+
*/
90+
static inline void ac_buffer_set_next(ac_buffer_t *pBuf, ac_buffer_t *pNextBuf)
91+
{
92+
pBuf->pNext = (ac_buffer_t *) pNextBuf;
93+
}
94+
95+
/** Append buffer to end of chain
96+
* \param pBuf pointer to ac_buffer_t structure
97+
* \param pAppBuf pointer to buffer to append to chain
98+
*/
99+
void ac_buffer_append(ac_buffer_t *pBuf, ac_buffer_t *pAppBuf);
100+
101+
/** Truncate pBuf to length bytes and save the remaining bytes in pEndBuf
102+
* \param pBuf The buffer to split (will be set to invalid state)
103+
* \param pStartBuf A new buffer at the head of the split
104+
* \param pEndBuf A new buffer at the tail of the split
105+
* \param length How long pStartBuf should be (if longer than pBuf, then pStartBuf will be pBuf)
106+
*/
107+
void ac_buffer_split(ac_buffer_t *pStartBuf, ac_buffer_t *pEndBuf, ac_buffer_t *pBuf, size_t length);
108+
109+
//Debug
110+
void ac_buffer_dump(ac_buffer_t *pBuf);
111+
112+
#ifdef __cplusplus
113+
}
114+
#endif
115+
116+
#endif /* ACORE_BUFFER_H_ */
117+
118+
/**
119+
* @}
120+
* @}
121+
* */

0 commit comments

Comments
 (0)