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