./platform/fmsh-psoc-db
add sram
将nor部分移植过来
# @name NOR read write test using dd
# @desc Perform NOR eraseall first, then do read write and then compare
# @requires nor
# The partition number is specified in get_mtd_partition_number.sh
# erase_size as buffer size
NOR_S_FUNC_DD_RW_JFFS2_ERASESIZE_0001 source 'common.sh'; part=`get_mtd_partition_number.sh "nor"` || die "error getting mtd part number: $part"; size=`get_mtd_erase_size.sh "$part"` || die "error getting mtd erase size: $size"; blk_device_dd_readwrite_test.sh -f "jffs2" -b "$size" -c 10 -d "nor"
# partial mtd size as count
NOR_L_FUNC_DD_RW_JFFS2_BIGSIZE_0001 source 'common.sh'; part=`get_mtd_partition_number.sh "nor"` || die "error getting mtd part number: $part"; size=`get_mtd_size.sh "$part"` || die "error getting mtd size: $size"; size=$(( $size/MB )); do_cmd blk_device_dd_readwrite_test.sh -f "jffs2" -b "1M" -c "$size" -d "nor"
1.
->get_mtd_erase_size.sh
->get_mtd_biggest_part
->in mtd_common.sh find_part_type
before
find_part_type() {
PART=$1
MTD_DEV="mtdblock$PART"
if [[ -e /sys/class/mtd/mtd$PART/type ]]; then
TYPE=`cat /sys/class/mtd/mtd$PART/type`
if [[ $TYPE == 'nand' ]]; then
PART_TYPE='nand'
else
if [[ `ls /sys/class/mtd/mtd$PART/device/driver/ | grep 'flash'` ]]; then
PART_TYPE="nor"
elif [[ `ls /sys/class/mtd/mtd$PART/device/driver/ | grep 'qspi'` ]];then
PART_TYPE="qspi"
elif [[ `ls /sys/class/mtd/mtd$PART/device/driver/ | grep 'ospi'` ]];then
PART_TYPE="qspi"
elif [[ `ls /sys/class/mtd/mtd$PART/device/driver/ | grep 'spi'` ]];then
if [[ `cat /proc/mtd |grep -E "mtd$PART |mtd${PART}: "|grep -i qspi ` ]];then
PART_TYPE="qspi"
else
PART_TYPE="spi"
fi
else
die "/sys/class/mtd/mtd$PART/device/driver doesn't exist"
fi
fi
else
die "/sys/class/mtd/mtd$PART/type doesn't exist"
fi
echo $PART_TYPE
}
after
find_part_type() {
PART=$1
MTD_DEV="mtdblock$PART"
if [[ -e /sys/class/mtd/mtd$PART/type ]]; then
TYPE=`cat /sys/class/mtd/mtd$PART/type`
if [[ $TYPE == 'nand' ]]; then
PART_TYPE='nand'
else
if [[ `ls /sys/class/mtd/mtd$PART/device/driver/ | grep 'flash'` ]]; then
PART_TYPE="nor"
elif [[ `ls /sys/class/mtd/mtd$PART/device/driver/ | grep 'qspi'` ]];then
PART_TYPE="qspi"
elif [[ `ls /sys/class/mtd/mtd$PART/device/driver/ | grep 'ospi'` ]];then
PART_TYPE="qspi"
elif [[ `ls /sys/class/mtd/mtd$PART/device/driver/ | grep 'sram'` ]];then
PART_TYPE="sram"
elif [[ `ls /sys/class/mtd/mtd$PART/device/driver/ | grep 'spi'` ]];then
if [[ `cat /proc/mtd |grep -E "mtd$PART |mtd${PART}: "|grep -i qspi ` ]];then
PART_TYPE="qspi"
else
PART_TYPE="spi"
fi
else
die "/sys/class/mtd/mtd$PART/device/driver doesn't exist"
fi
fi
else
die "/sys/class/mtd/mtd$PART/type doesn't exist"
fi
echo $PART_TYPE
}
2.
->blk_device_dd_readwrite_test.sh
->get_blk_device_node.sh
->get_device_type_map.sh
before
if [ $DEVICE_TYPE = "nand" ] || [ $DEVICE_TYPE = "nor" ] || [ $DEVICE_TYPE = "spi" ] || [ $DEVICE_TYPE = "qspi" ] ; then
DEV_TYPE="mtd"
fi
after
if [ $DEVICE_TYPE = "nand" ] || [ $DEVICE_TYPE = "nor" ] || [ $DEVICE_TYPE = "spi" ] || [ $DEVICE_TYPE = "qspi" ] || [ $DEVICE_TYPE = "sram" ]; then
DEV_TYPE="mtd"
fi
3.
->blk_device_dd_readwrite_test.sh
->blk_device_prepare_format.sh
->blk_device_do_mount.sh
before
case $DEV_TYPE in
mtd)
fs_to_try="jffs2:ubifs"
;;
*)
fs_to_try="vfat:ext3:ext4:ext2"
;;
esac
after
case $DEV_TYPE in
mtd)
case $DEVICE_TYPE in
sram)
fs_to_try="ramfs"
;;
*)
fs_to_try="jffs2:ubifs"
;;
esac
;;
*)
fs_to_try="vfat:ext3:ext4:ext2"
;;
esac
4.
sram_perf_ramfs
before
#do_cmd blk_device_umount.sh -n "$DEV_NODE" -d "$DEVICE_TYPE" -f "$FS_TYPE"
do_cmd blk_device_umount.sh -m "$MNT_POINT"
do_cmd "echo 3 > /proc/sys/vm/drop_caches"
#do_cmd "mount -t $FS_TYPE -o $MNT_MODE $DEV_NODE $MNT_POINT"
do_cmd blk_device_do_mount.sh -n "$DEV_NODE" -f "$FS_TYPE" -d "$DEVICE_TYPE" -o "$MNT_MODE" -m "$MNT_POINT"
do_cmd filesystem_tests -read -file ${TEST_FILE} -buffer_size $BUFFER_SIZE -file_size $FILE_SIZE -performance
do_cmd "sync"
after
#do_cmd blk_device_umount.sh -n "$DEV_NODE" -d "$DEVICE_TYPE" -f "$FS_TYPE"
if [ $FS_TYPE != "ramfs" ];then
do_cmd blk_device_umount.sh -m "$MNT_POINT"
do_cmd "echo 3 > /proc/sys/vm/drop_caches"
#do_cmd "mount -t $FS_TYPE -o $MNT_MODE $DEV_NODE $MNT_POINT"
do_cmd blk_device_do_mount.sh -n "$DEV_NODE" -f "$FS_TYPE" -d "$DEVICE_TYPE" -o "$MNT_MODE" -m "$MNT_POINT"
fi
do_cmd filesystem_tests -read -file ${TEST_FILE} -buffer_size $BUFFER_SIZE -file_size $FILE_SIZE -performance
do_cmd "sync"
原因是ramfs umount之后内容都会消失,所以在测试过程中不能umount,加一层判断。