Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
9ebfbc0
Re-introduce a shared pointer class in mbed OS
Aug 14, 2018
f45642c
Make shared pointer thread safe and clean-up class and doc
Aug 17, 2018
2608478
Cleanup shared pointer implementation and add reset() methods
Aug 17, 2018
ac79b00
Cleanup description
Aug 17, 2018
154e90a
Adding initial API
Aug 3, 2018
47a4842
Added nfc_tag_type() and fixed some const qualifiers
Aug 3, 2018
34516e8
Move nfc_tag_type_t to NFCDefinitions.h
Aug 3, 2018
76771f3
Remove redundant boolean parameters in NDEF Capable
Aug 3, 2018
439391f
NFCTarget should not inherit from NFCEndpoint
Aug 3, 2018
727d580
Missing end of comment
Aug 3, 2018
e0bc73e
Add has_started_session() in NFC EEPROM driver delegate
Aug 3, 2018
a5d4c4e
Simplify NFCNDEFCapable.h
Aug 7, 2018
0f1a03d
Finish renaming NFCRemoteEndpoint.h
Aug 7, 2018
5e01d77
Add get_supported_rf_protocols() method to driver
Aug 7, 2018
897998c
Add doc to NFCController
Aug 7, 2018
48eaf0f
Amend NFCControllerDriver API and add documentation
Aug 7, 2018
a712892
Add doc for NFCTarget
Aug 7, 2018
08155ee
Add doc for NFCEEPROMDriver and amend API slightly
Aug 7, 2018
66ddb50
Add doc for NFCRemoteEndpoint
Aug 7, 2018
b17ce42
Add doc and amend API of NFCNDEFCapable
Aug 7, 2018
762cd4e
Add documemtation for ISO7816App
Aug 8, 2018
2ddfb92
Add doc for NFCRemoteInitiator
Aug 8, 2018
5980ff6
Fix NFCEEPROM's destructor
Aug 8, 2018
2e17dfd
Update API/doc for NFCNDEFCapable
Aug 9, 2018
0f985e3
Add doc/update API for NFCTarget
Aug 9, 2018
b50862b
Update doc/API for Type4RemoteInitiator
Aug 9, 2018
da15c6a
Add NFC Stack
Aug 13, 2018
498aee0
Add basis for NFC Controller implementation
Aug 14, 2018
7869164
Use SharedPtr class for detected endpoints
Aug 14, 2018
57e0c26
Implement NFCNDEFCapable
Aug 14, 2018
0db057a
Type 4 Target and dependencies implementation
Aug 15, 2018
5c74617
Implement PN512 SPI transport driver
Aug 16, 2018
b36302f
Add PN512 Driver implementation
Aug 16, 2018
bbc1974
Add scheduler implementation to NFC Controller class
Aug 16, 2018
183e46c
Update NFC EEPROM Driver and add implementation
Aug 16, 2018
ab577d3
Update NFC EEPROM Driver + Delegate API names
Aug 16, 2018
aa913b3
Writing implementation in NFC EEPROM
Aug 16, 2018
2f65363
Erase & Read implementations in NFCEEPROM
Aug 17, 2018
7330e46
Fix API signatures
Aug 17, 2018
f829abe
Fix virtualness of NFCControllerDriver::Delegate method
Aug 17, 2018
842e313
Missing inheritance in NFCController
Aug 17, 2018
30164c2
Missing =0 in NFCEEPROMDriver
Aug 17, 2018
6dcd259
Some missing virtual qualifiers
Aug 17, 2018
4aea07a
Missing change in NFCRemoteInitiator
Aug 17, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions features/nfc/acore/acore/buffer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/*
* Copyright (c) 2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* \file buffer.h
* \copyright Copyright (c) ARM Ltd 2013
* \author Donatien Garnier
*/

/** \addtogroup ACore
* @{
* \name Buffer
* @{
*/

#ifndef ACORE_BUFFER_H_
#define ACORE_BUFFER_H_

#ifdef __cplusplus
extern "C" {
#endif

#include "stdint.h"
#include "stddef.h"
#include "stdbool.h"

typedef struct __ac_buffer
{
const uint8_t* data;
size_t size;
struct __ac_buffer* pNext;
} ac_buffer_t;

/** Initialize ac_buffer using underlying byte array, set ac_buffer's length to 0 (empty)
* \param pBuf pointer to ac_buffer_t structure to initialize
* \param data byte array to use
* \param size size of byte array
*/
void ac_buffer_init(ac_buffer_t* pBuf, const uint8_t* data, size_t size);

/** Copy pBufIn to pBuf
* \param pBuf pointer to ac_buffer_t structure to initialize
* \param pBufIn the source buffer
*/
void ac_buffer_dup(ac_buffer_t* pBuf, const ac_buffer_t* pBufIn);

/** Get buffer's underlying byte array
* \param pBuf pointer to ac_buffer_t structure
* \return underlying array
*/
static inline const uint8_t* ac_buffer_data(const ac_buffer_t* pBuf)
{
return pBuf->data;
}

/** Get buffer's size
* \param pBuf pointer to ac_buffer_t structure
* \return buffer's size
*/
static inline size_t ac_buffer_size(const ac_buffer_t* pBuf)
{
return pBuf->size;
}

/** Get next buffer in chain
* \param pBuf pointer to ac_buffer_t structure
* \return pointer to next buffer
*/
static inline ac_buffer_t* ac_buffer_next(const ac_buffer_t* pBuf)
{
return pBuf->pNext;
}

/** Set next buffer in chain
* \param pBuf pointer to ac_buffer_t structure
* \param pNextBuf pointer to next buffer (or NULL to break chain)
*/
static inline void ac_buffer_set_next(ac_buffer_t* pBuf, ac_buffer_t* pNextBuf)
{
pBuf->pNext = (ac_buffer_t*) pNextBuf;
}

/** Append buffer to end of chain
* \param pBuf pointer to ac_buffer_t structure
* \param pAppBuf pointer to buffer to append to chain
*/
void ac_buffer_append(ac_buffer_t* pBuf, ac_buffer_t* pAppBuf);

/** Truncate pBuf to length bytes and save the remaining bytes in pEndBuf
* \param pBuf The buffer to split (will be set to invalid state)
* \param pStartBuf A new buffer at the head of the split
* \param pEndBuf A new buffer at the tail of the split
* \param length How long pStartBuf should be (if longer than pBuf, then pStartBuf will be pBuf)
*/
void ac_buffer_split(ac_buffer_t* pStartBuf, ac_buffer_t* pEndBuf, ac_buffer_t* pBuf, size_t length);

//Debug
void ac_buffer_dump(ac_buffer_t* pBuf);

#ifdef __cplusplus
}
#endif

#endif /* ACORE_BUFFER_H_ */

/**
* @}
* @}
* */
Loading