Dataflow Runtime API
3.1.1.0
|
An I2C master transaction can contain up to MAX_NR_OF_DATAOPERATIONS read/write operations. More...
#include <Imt.Base.Dff.ActiveParts.AM3354/I2C/I2CMasterTransactionProtocol.h>
Public Member Functions | |
I2CMasterTransactionProtocol (const uint8_t slaveAddress=INVALID_7BIT_ADDRESS, const uint32_t transactionId=imt::base::dff::runtime::RuntimeIdGenerator::UNDEFINED_ID) | |
Default constructor. More... | |
I2CMasterTransactionProtocol (imt::base::core::serialization::Deserializer &deserializer) | |
Constructor from deserializer. More... | |
I2CMasterTransactionProtocol (const I2CMasterTransactionProtocol &other) | |
Copy constructor. More... | |
virtual | ~I2CMasterTransactionProtocol (void) |
Destructor. More... | |
I2CMasterTransactionProtocol & | operator= (const I2CMasterTransactionProtocol &other) |
Assignment operator. More... | |
virtual void | deserialize (imt::base::core::serialization::Deserializer &deserializer) |
virtual void | serialize (imt::base::core::serialization::Serializer &serializer) const |
void | addWriteOperation (const uint8_t dataToWrite) |
Add a write operation to this transaction. More... | |
void | addReadOperation (void) |
Add a read operation to this transaction. More... | |
uint8_t | getOperationData (const uint8_t position) const |
Get the data of the operation at the given position. More... | |
uint8_t | getSlaveAddress (void) const |
Get the 7-Bit address of I2C slave for this master transaction. More... | |
uint32_t | getTransactionId (void) const |
Get the transaction id which is used to identify the transaction (similar to a tracking number in mail-order). More... | |
uint8_t | getNumberOfDataOperations (void) const |
Returns the number of data operation associated to this transaction. More... | |
uint8_t | getNumberOfRemainingBytesWithSameDirection (const uint8_t startPosition) const |
Returns the number of remaining bytes with the same direction from the given position (read and write operations can be mixed which will generated a repeated start). More... | |
uint16_t | getWriteTransactionFlags (void) const |
Get the bit flag for each data operation. More... | |
bool | isWriteOperation (const uint8_t position) const |
Returns true if the data operation at the given position is a write operation. More... | |
Public Member Functions inherited from imt::base::core::serialization::SerializableIfc | |
virtual | ~SerializableIfc (void) |
Destructor. More... | |
Static Public Attributes | |
static const uint8_t | MAX_NR_OF_DATAOPERATIONS = 16U |
Maximum number of data operations. More... | |
static const uint8_t | INVALID_7BIT_ADDRESS = 0x80U |
Invalid 7-bit address. More... | |
Protected Member Functions | |
void | setReadOperationData (const uint8_t position, const uint8_t readData) |
Set the read data of a read operation at the passed position. More... | |
Friends | |
class | I2CIrqHandlerAP |
An I2C master transaction can contain up to MAX_NR_OF_DATAOPERATIONS read/write operations.
|
explicit |
Default constructor.
slaveAddress | Address of the I2C slave (valid range = 0x00...0x7F). |
transactionId | Identifier of the transaction (use RuntimeIdGenerator to generate unique id's). |
|
explicit |
Constructor from deserializer.
imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::I2CMasterTransactionProtocol | ( | const I2CMasterTransactionProtocol & | other | ) |
Copy constructor.
|
virtual |
Destructor.
void imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::addReadOperation | ( | void | ) |
Add a read operation to this transaction.
If maximum of operations are already added the operation will be ignored.
void imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::addWriteOperation | ( | const uint8_t | dataToWrite | ) |
Add a write operation to this transaction.
If maximum of operations are already added the operation will be ignored.
dataToWrite | Data to write. |
|
virtual |
Implements imt::base::core::serialization::SerializableIfc.
uint8_t imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::getNumberOfDataOperations | ( | void | ) | const |
Returns the number of data operation associated to this transaction.
uint8_t imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::getNumberOfRemainingBytesWithSameDirection | ( | const uint8_t | startPosition | ) | const |
Returns the number of remaining bytes with the same direction from the given position (read and write operations can be mixed which will generated a repeated start).
startPosition | Start position. |
uint8_t imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::getOperationData | ( | const uint8_t | position | ) | const |
Get the data of the operation at the given position.
If an invalid position is passed 0 will be returned.
position | Position of the operation within the transaction. |
uint8_t imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::getSlaveAddress | ( | void | ) | const |
Get the 7-Bit address of I2C slave for this master transaction.
uint32_t imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::getTransactionId | ( | void | ) | const |
Get the transaction id which is used to identify the transaction (similar to a tracking number in mail-order).
uint16_t imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::getWriteTransactionFlags | ( | void | ) | const |
Get the bit flag for each data operation.
The bit value of the bit position indicates a write(bit value ==1) or read operation (bit value = 0). The bits are only valid for the associated number of data operations for this transaction. Example: bit0 is 1 -> First operation is a write operation, getOperationData(0) returns the data to write. bit0 is 0 -> First operation is a read operation, getOperationData(1) returns the read data.
bool imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::isWriteOperation | ( | const uint8_t | position | ) | const |
Returns true if the data operation at the given position is a write operation.
If position is out of range, the return value is always false.
position | Valid range from 0 .. (MAX_NR_OF_DATAOPERATIONS-1). |
I2CMasterTransactionProtocol& imt::base::dff::activeparts::am3354::I2CMasterTransactionProtocol::operator= | ( | const I2CMasterTransactionProtocol & | other | ) |
Assignment operator.
|
virtual |
Implements imt::base::core::serialization::SerializableIfc.
|
protected |
Set the read data of a read operation at the passed position.
If an invalid position is passed or the position indicates no read operation the date will be ignored. Remark: getWriteTransactionFlags() must indicate a read operation on this position else the data will not be set.
|
friend |
|
static |
Invalid 7-bit address.
|
static |
Maximum number of data operations.