./runtest/ddt/i2c_readwrite
# @name I2C write read test on slave device
# @desc I2C write read test on slave device
# @notes There is a default slave device for each platform. Its address can be
# found in 'get_i2c_slave_addr'. If you pass slave device name, this
# script can return the addr for that slave device
# @requires i2c
I2C_S_FUNC_RW_SETGET source 'common.sh'; do_cmd i2c_setget.sh
I2C_M_FUNC_RW_SETGET_10TIMES source 'common.sh'; do_cmd i2c_setget.sh -l '10'
I2C_M_STRESS_RW_SETGET_100TIMES source 'common.sh'; do_cmd i2c_setget.sh -l '100'
I2C_S_FUNC_NEG_INVALID_ADDR source 'common.sh'; invalid_addr=`get_i2c_invalid_addr.sh` && i2cbus_num=`get_i2cbus_number.sh` && i2c_reg=`get_i2c_slave_regoffset.sh` && inverted_return="true"; do_cmd i2cget -y $i2cbus_num $invalid_addr $i2c_reg
注意:
do_cmd i2cget -y $i2cbus_num $invalid_addr $i2c_reg 执行的结果是false,因为invalid_addr get的是invalid address
当然,执行结果false是表示成功,所以要将return结果反向,即将inverted_return设置为true
do_cmd function的说明如下;
########### FUNCTIONS #####################
# Default value for inverted_return is "false" but can
# be overridden by individual scripts.
inverted_return="false"
do_cmd() { ......