Describes predefine macros for mbed online compiler (armcc)

Committer:
MACRUM
Date:
Thu Mar 16 21:58:09 2017 +0900
Revision:
6:40e873bbc5f7
Add licence header info

Who changed what in which revision?

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