ltp-ddt nand_ecc_tests
{
cat <<-EOF >&2
usage: ./${0##*/} [-n dev_node] [-r rules]
-n dev_node: optional; if not provided, choose one with the biggest size
-r rules: the rules used to inject error bits
-t test_type: optional; by default is positive test. you could pass 'negative'
-e test empty sectors
-h Help print this usage
EOF
exit 0
}
do_cmd dd if=/dev/urandom of="$testfile" bs=1 count=$pagesize
do_cmd nandwrite -p "$dev_node" "$testfile"
orig_nanddump_w_oob="$TMPDIR/testfile_nanddump_w_oob.original"
do_cmd nanddump -l "$pagesize" -o -f "$orig_nanddump_w_oob" "$dev_node" #-o --oob Dump OOB data
test_print_trc "Modifying nand dump file to prepare for ecc test"
corrupted_nanddump="$TMPDIR/testfile_nanddump.corrupted"
modify_nanddump_file "$orig_nanddump_w_oob" "$corrupted_nanddump" "$rules" #associate with rules
test_print_trc "Write the corrupted nanddump file back..."
do_cmd flash_erase -q "$dev_node" 0 0
do_cmd nandwrite -n -o "$dev_node" "$corrupted_nanddump" # -o, --oob Input contains oob data
hexdump_original_w_oob="$TMPDIR/original_w_oob"
hexdump_corrupted_w_oob="$TMPDIR/corrupted_w_oob"
do_cmd "hexdump -C $orig_nanddump_w_oob > "$hexdump_original_w_oob" "
do_cmd "hexdump -C $corrupted_nanddump > "$hexdump_corrupted_w_oob" "
test_print_trc "The below are the errors being injected in the nand page"
test_print_trc "diff "$hexdump_original_w_oob" "$hexdump_corrupted_w_oob" "
diff "$hexdump_original_w_oob" "$hexdump_corrupted_w_oob"
sleep 5
test_print_trc "Dumpping nand..."
corrected_nanddump="$TMPDIR/testfile_nanddump.corrected"
do_cmd "nanddump -l "$pagesize" -f "$corrected_nanddump" "$dev_node" " > $TMPDIR/nanddump_msg 2>&1
cat $TMPDIR/nanddump_msg
cat $TMPDIR/nanddump_msg |grep "uncorrectable bitflip(s)" && result=1 || result=0
echo "result is $result"
if [ $type = 'negative' ]; then
test_print_trc "The bit error(s) are not corrected as expected, checking if dut is ok..."
#check if dut is still stable
do_cmd "cat /proc/mtd"
do_cmd "time dd if=/dev/urandom of=$dev_node bs=1M count=10"
do_cmd flash_erase -q "$dev_node" 0 0
exit 0
else
test_print_trc "Nand dump from uncorrected page ..."
uncorrected_nanddump="$TMPDIR/testfile_nanddump.uncorrected"
do_cmd "nanddump -n -o -l "$pagesize" -f "$uncorrected_nanddump" "$dev_node" "
do_cmd "hexdump -C "$uncorrected_nanddump" "
do_cmd flash_erase -q "$dev_node" 0 0
die "Nand ECC Test failed. Not all errors are corrected"
fi
else
test_print_trc "Nand ECC Test Pass"
do_cmd flash_erase -q "$dev_node" 0 0
exit 0
fi
# Input
# $1: input file
# $2: rules like "<sector#>:byte_offset:mask"~"<oob>:byte_offset:mask"
# sector, byte_offset are decimal. 'mask' could be decimal or hex
# byte_offset starts from 0
# Output
# modified file
modify_nanddump_file()
{
inputfile=$1
outputfile=$2
rules=$3
local filesize=`get_filesize $1`
cp $inputfile $outputfile
ORIG_IFS=$IFS
IFS="~"
for rule in $rules
do
# rule is like "sector#:byte_offset:mask" or "oob:offset:mask"
sector=`echo "$rule" | cut -d":" -f1 | tr [:upper:] [:lower:]`
byte_offset=`echo "$rule" | cut -d":" -f2`
mask=`echo "$rule" | cut -d":" -f3`
if [ $sector = 'oob' ]; then
offset=$(( $pagesize + $byte_offset ))
if [ $offset -ge $filesize ]; then
die "Offset to $inputfile should not be bigger than the filesize"
fi
else
offset=$(( $sector * $sector_size + $byte_offset ))
if [ $offset -ge $pagesize ];then
die "Offset to $inputfile for non-oob data should not bigger than pagesize"
fi
fi
# get the original byte and modify it
orig_byte=`hexdump_onebyte $inputfile $offset`
mod_byte_dec=$(( 0x$orig_byte ^ $mask )) #xor mask
mod_byte=`echo "obase=16; $mod_byte_dec" |bc`
# write the modified byte to replace the original one
replace_onebyte $outputfile $offset $mod_byte
done
IFS=$ORIG_IFS
}
ltp-ddt nand_ecc_tests的更多相关文章
- LTP随笔——本地调用ltp之ltp4j
关于ltp本地调用的相关参考请见LTP的Git项目:https://github.com/HIT-SCIR 以下以/home/lion/Desktop路径为例下面教程中出现的具体路径以你实际配置的为准 ...
- ZH奶酪:自然语言处理工具LTP语言云调用方法
前言 LTP语言云平台 不支持离线调用: 支持分词.词性标注.命名实体识别.依存句法分析.语义角色标注: 不支持自定义词表,但是你可以先用其他支持自定义分词的工具(例如中科院的NLPIR)把文本进行分 ...
- Eclipse DDT
http://www.eclipse.org/downloads/ https://github.com/DDT-IDE/DDT/blob/latest/documentation/UserGuide ...
- ASP.NET中常用的几个李天平开源公共类LTP.Common,Maticsoft.DBUtility,LtpPageControl
ASP.NET中常用的几个开源公共类: LTP.Common.dll: 通用函数类库 源码下载Maticsoft.DBUtility.dll 数据访问类库组件 源码下载LtpPageC ...
- 很好的一篇讲LTP在编解码中的作用的文章
原文链接 LONG-TERM PREDICTION by: Adit Aviv Kfir Grichman introduction: The speech signal has been ...
- ASP.NET中常用的几个李天平开源公共类LTP.Common,Maticsoft.DBUtility,LtpPageControl (转)
ASP.NET中常用的几个开源公共类: LTP.Common.dll: 通用函数类库 源码下载Maticsoft.DBUtility.dll 数据访问类库组件 源码下载LtpPageC ...
- 编译哈工大语言技术平台云LTP(C++)源码及LTP4J(Java)源码
转自:编译哈工大语言技术平台云LTP(C++)源码及LTP4J(Java)源码 JDK:java version “1.8.0_31”Java(TM) SE Runtime Environment ( ...
- LTP学习
下载LTP源码和模型文件: https://github.com/linux-test-project/ltp 官方说明文档 http://ltp.readthedocs.org/zh_CN/late ...
- LTP 分词算法实践
参考链接: https://github.com/HIT-SCIR/ltp/blob/master/doc/install.rst http://www.xfyun.cn/index.php/serv ...
- ltp工具使用配置
ltp是一个比较全的自然语言处理工具,可以用它进行分词.词性标注.语法分析等任务. ---- 准备 下载 下载ltp和ltp4j,在cmake官网下载并安装相应版本的cmake,并且下载ant. 构建 ...
随机推荐
- Python实例教程
转自:http://codingdict.com/article/9026 Python 100例-01 题目: 输有1.2.3.4个数字,能组成多少个互不相同且无重复数字的三位数? Python 1 ...
- eclipse 报错:One or more constraints have not been satisfied.
接受 我有同样的问题.在我的maven项目中添加速度依赖关系后,我在标记选项卡中得到相同的错误.然后我注意到maven项目创建的web.xml文件具有servlet2.3模式.当我将其更改为servl ...
- MySql不区分大小写。
解决方案: 1:给相关字段添加上让其区分大小写. alter table 表名 modify column 字段名 varchar(100) binary character set utf8
- php面试专题---Mysql索引类型、介绍及优点
php面试专题---Mysql索引类型.介绍及优点 一.总结 一句话总结: 精品视频讲解里面的资料来源也是通过各种资料,比如博客.书等,只不过是基于讲解者的知识体系有整理的过程 1.B-Tree索引三 ...
- 点击" ./start_navicat"安装出现界面便面为乱码
环境:ubuntu16.4 下载Navicat:navicat112_mariadb_cs_x64.tar.gz 点击" ./start_navicat"安装出现界面便面为乱码 解 ...
- __I、 __O 、__IO是什么意思?怎么用?
出处:http://www.chuxue123.com/forum.php?mod=viewthread&tid=122&ctid=3 __I. __O .__IO是什么意思?这是ST ...
- 字符串模式匹配算法系列(二):KMP算法
算法背景: KMP算法是由Donald Knuth和Vaughan Pratt于1970年共同提出的,而James H.Morris也几乎同时间独立提出了这个算法.因此人们将其称作“克努特-莫里斯-普 ...
- VS代码自动补全功能
VS代码自动补全功能 新建工程后,依次打开 工具>>代码段管理器>>选择C++>>点击 添加(A)...按钮 ,设置你的代码块的目录 复制以下代码并存为note.s ...
- Vuejs中关于computed、methods、watch,mounted的区别
1.computed是在HTML DOM加载后马上执行的,如赋值: 2.methods则必须要有一定的触发条件才能执行,如点击事件: 3.watch呢?它用于观察Vue实例上的数据变动.对应一个对象, ...
- 【Python】Python实现Excel用例直接导入testlink-UI界面小工具
1.写在前面 testlink上传用例一种方法是excel转换为xml,然后再用xml上传,还有一种是调用api进行上传.最开始写了个转换工具,是将excel转换为xml,然后在testlink里上传 ...