mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Fri Feb 16 16:09:33 2018 +0000
Revision:
181:57724642e740
Parent:
178:79309dc6340a
Child:
187:0387e8f68319
mbed-dev library. Release version 159.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1 /* mbed Microcontroller Library
<> 149:156823d33999 2 * Copyright (c) 2015 ARM Limited
<> 149:156823d33999 3 *
<> 149:156823d33999 4 * Licensed under the Apache License, Version 2.0 (the "License");
<> 149:156823d33999 5 * you may not use this file except in compliance with the License.
<> 149:156823d33999 6 * You may obtain a copy of the License at
<> 149:156823d33999 7 *
<> 149:156823d33999 8 * http://www.apache.org/licenses/LICENSE-2.0
<> 149:156823d33999 9 *
<> 149:156823d33999 10 * Unless required by applicable law or agreed to in writing, software
<> 149:156823d33999 11 * distributed under the License is distributed on an "AS IS" BASIS,
<> 149:156823d33999 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 149:156823d33999 13 * See the License for the specific language governing permissions and
<> 149:156823d33999 14 * limitations under the License.
<> 149:156823d33999 15 */
<> 149:156823d33999 16 #ifndef MBED_TRANSACTION_H
<> 149:156823d33999 17 #define MBED_TRANSACTION_H
<> 149:156823d33999 18
<> 149:156823d33999 19 #include "platform/platform.h"
<> 149:156823d33999 20 #include "platform/FunctionPointer.h"
<> 149:156823d33999 21
<> 149:156823d33999 22 namespace mbed {
<> 149:156823d33999 23 /** \addtogroup platform */
AnnaBridge 178:79309dc6340a 24 /** @{*/
AnnaBridge 178:79309dc6340a 25 /**
AnnaBridge 178:79309dc6340a 26 * \defgroup platform_Transaction Transaction class
AnnaBridge 178:79309dc6340a 27 * @{
AnnaBridge 178:79309dc6340a 28 */
<> 149:156823d33999 29
<> 149:156823d33999 30 /** Transaction structure
<> 149:156823d33999 31 */
<> 149:156823d33999 32 typedef struct {
<> 149:156823d33999 33 void *tx_buffer; /**< Tx buffer */
<> 149:156823d33999 34 size_t tx_length; /**< Length of Tx buffer*/
<> 149:156823d33999 35 void *rx_buffer; /**< Rx buffer */
<> 149:156823d33999 36 size_t rx_length; /**< Length of Rx buffer */
<> 149:156823d33999 37 uint32_t event; /**< Event for a transaction */
<> 149:156823d33999 38 event_callback_t callback; /**< User's callback */
<> 149:156823d33999 39 uint8_t width; /**< Buffer's word width (8, 16, 32, 64) */
<> 149:156823d33999 40 } transaction_t;
<> 149:156823d33999 41
<> 149:156823d33999 42 /** Transaction class defines a transaction.
<> 149:156823d33999 43 *
AnnaBridge 167:e84263d55307 44 * @note Synchronization level: Not protected
<> 149:156823d33999 45 */
<> 149:156823d33999 46 template<typename Class>
<> 149:156823d33999 47 class Transaction {
<> 149:156823d33999 48 public:
<> 149:156823d33999 49 Transaction(Class *tpointer, const transaction_t& transaction) : _obj(tpointer), _data(transaction) {
<> 149:156823d33999 50 }
<> 149:156823d33999 51
<> 149:156823d33999 52 Transaction() : _obj(), _data() {
<> 149:156823d33999 53 }
<> 149:156823d33999 54
<> 149:156823d33999 55 ~Transaction() {
<> 149:156823d33999 56 }
<> 149:156823d33999 57
<> 149:156823d33999 58 /** Get object's instance for the transaction
<> 149:156823d33999 59 *
<> 149:156823d33999 60 * @return The object which was stored
<> 149:156823d33999 61 */
<> 149:156823d33999 62 Class* get_object() {
<> 149:156823d33999 63 return _obj;
<> 149:156823d33999 64 }
<> 149:156823d33999 65
<> 149:156823d33999 66 /** Get the transaction
<> 149:156823d33999 67 *
<> 149:156823d33999 68 * @return The transaction which was stored
<> 149:156823d33999 69 */
<> 149:156823d33999 70 transaction_t* get_transaction() {
<> 149:156823d33999 71 return &_data;
<> 149:156823d33999 72 }
<> 149:156823d33999 73
<> 149:156823d33999 74 private:
<> 149:156823d33999 75 Class* _obj;
<> 149:156823d33999 76 transaction_t _data;
<> 149:156823d33999 77 };
AnnaBridge 178:79309dc6340a 78 /**@}*/
<> 149:156823d33999 79
AnnaBridge 178:79309dc6340a 80 /**@}*/
<> 149:156823d33999 81 }
<> 149:156823d33999 82
<> 149:156823d33999 83 #endif