mirror of https://github.com/ARMmbed/mbed-os.git
I2CTester: upgrade checksum calculation
parent
3ef8d1bff6
commit
fb589319bf
|
|
@ -62,6 +62,14 @@ uint32_t I2CTester::get_receive_checksum()
|
|||
return to_slave_checksum;
|
||||
}
|
||||
|
||||
uint32_t I2CTester::get_send_checksum()
|
||||
{
|
||||
uint32_t from_slave_checksum = 0;
|
||||
MBED_ASSERT(sizeof(from_slave_checksum) == TESTER_I2C_FROM_SLAVE_CHECKSUM_SIZE);
|
||||
read(TESTER_I2C_FROM_SLAVE_CHECKSUM, (uint8_t *)&from_slave_checksum, sizeof(from_slave_checksum));
|
||||
return from_slave_checksum;
|
||||
}
|
||||
|
||||
uint8_t I2CTester::state_num()
|
||||
{
|
||||
uint8_t state_num = 0;
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@ public:
|
|||
uint16_t num_nacks();
|
||||
|
||||
/**
|
||||
* Read the number of transfers which have occurred, not including the device address byte
|
||||
* Read the number of transfers which have occurred
|
||||
*
|
||||
* @return The number of I2C transfers that have completed since
|
||||
* i2c was reset, not including the device address byte
|
||||
* i2c was reset, including the device address byte.
|
||||
*/
|
||||
uint16_t transfer_count();
|
||||
|
||||
|
|
@ -75,6 +75,13 @@ public:
|
|||
*/
|
||||
uint32_t get_receive_checksum();
|
||||
|
||||
/**
|
||||
* Read a checksum of data read from the tester
|
||||
*
|
||||
* @return The sum of all bytes read from the tester since reset
|
||||
*/
|
||||
uint32_t get_send_checksum();
|
||||
|
||||
/**
|
||||
* Get the I2C slave state number
|
||||
*
|
||||
|
|
@ -153,7 +160,7 @@ public:
|
|||
uint8_t get_next_from_slave();
|
||||
|
||||
/**
|
||||
* Read the number of writes which have occurred, not including the device address byte
|
||||
* Read the number of writes which have occurred
|
||||
*
|
||||
* @return The number of I2C writes that have completed since
|
||||
* i2c was reset, not including the device address byte
|
||||
|
|
@ -164,7 +171,7 @@ public:
|
|||
* Read the number of reads which have occurred
|
||||
*
|
||||
* @return The number of I2C reads that have completed since
|
||||
* i2c was reset
|
||||
* i2c was reset, not including the device address byte
|
||||
*/
|
||||
uint16_t num_reads();
|
||||
|
||||
|
|
|
|||
|
|
@ -192,3 +192,5 @@
|
|||
#define TESTER_I2C_NEXT_FROM_SLAVE (0x015 + 0x00105000)
|
||||
#define TESTER_I2C_NUM_WRITES (0x016 + 0x00105000)
|
||||
#define TESTER_I2C_NUM_READS (0x018 + 0x00105000)
|
||||
#define TESTER_I2C_FROM_SLAVE_CHECKSUM (0x01A + 0x00105000)
|
||||
#define TESTER_I2C_FROM_SLAVE_CHECKSUM_SIZE 4
|
||||
|
|
|
|||
Loading…
Reference in New Issue