1235537Sgber#-
2235537Sgber# Copyright (C) 2009-2012 Semihalf
3235537Sgber# All rights reserved.
4235537Sgber#
5235537Sgber# Redistribution and use in source and binary forms, with or without
6235537Sgber# modification, are permitted provided that the following conditions
7235537Sgber# are met:
8235537Sgber# 1. Redistributions of source code must retain the above copyright
9235537Sgber#    notice, this list of conditions and the following disclaimer.
10235537Sgber# 2. Redistributions in binary form must reproduce the above copyright
11235537Sgber#    notice, this list of conditions and the following disclaimer in the
12235537Sgber#    documentation and/or other materials provided with the distribution.
13235537Sgber#
14235537Sgber# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15235537Sgber# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16235537Sgber# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17235537Sgber# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18235537Sgber# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19235537Sgber# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20235537Sgber# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21235537Sgber# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22235537Sgber# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23235537Sgber# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24235537Sgber# SUCH DAMAGE.
25235537Sgber#
26235537Sgber# $FreeBSD$
27235537Sgber
28235537Sgber#
29235537Sgber# Sample NANDsim configuration file.
30235537Sgber#
31235537Sgber
32235537Sgber#############################################################################
33235537Sgber#
34235537Sgber# [sim] General (common) simulator configuration section.
35235537Sgber#
36235537Sgber[sim]
37235537Sgber# log_level=0..255
38235537Sgberlog_level=11
39235537Sgber
40235537Sgber# log_output=[none, console, ram, file]
41235537Sgber#
42235537Sgber# When log_output=file is specified, each [ctrl] section must have a
43235537Sgber# corresponding 'log_filename' field provided, which specifies log file name
44235537Sgber# to be used.
45235537Sgberlog_output=none
46235537Sgber
47235537Sgber#############################################################################
48235537Sgber#
49235537Sgber# [ctrl] Controller configuration section.
50235537Sgber#
51235537Sgber# There can be a number of controllers defined for simulation, each has a
52235537Sgber# dedicated [ctrl] section. With a given controller there are associated
53235537Sgber# subordinate NAND chips, which are tied to chip select lines.
54235537Sgber#
55235537Sgber[ctrl]
56235537Sgber# The number of this controller.
57235537Sgber# ctrl_num=0..3
58235537Sgberctrl_num=0
59235537Sgber
60235537Sgber# The number of chip selects available at this controller.
61235537Sgber# num_cs=1..4
62235537Sgbernum_cs=1
63235537Sgber
64235537Sgber# ECC enable flag.
65235537Sgber# ecc=[on|off]
66235537Sgberecc=on
67235537Sgber
68235537Sgber# ECC layout. This is the list of byte offsets within OOB area, which comprise
69235537Sgber# the ECC contents set.
70235537Sgber#
71235537Sgber# ecc_layout=[byte1, byte2-byte3, ..byten]
72235537Sgberecc_layout=[0-53]
73235537Sgber
74235537Sgber# Absolute path to the log file for this controller.
75235537Sgber#log_filename=/var/log/nandsim-ctl0.log
76235537Sgber
77235537Sgber
78235537Sgber#############################################################################
79235537Sgber#
80235537Sgber# [chip] Chip configuration section.
81235537Sgber#
82235537Sgber# There can be a number of individual NAND chip devices defined for
83235537Sgber# simulation, and each has a dedicated [chip] section.
84235537Sgber#
85235537Sgber# A particular chip needs to be associated with its parent NAND controller by
86235537Sgber# specifying the following fields: controller number (chip_ctrl) and the chip
87235537Sgber# select line it is connected to (chip_cs). The chip can be connected to only
88235537Sgber# a single (and unique) controller:cs pair.
89235537Sgber#
90235537Sgber[chip]
91235537Sgber# The number of parent controller. This has to fit one of the controller
92235537Sgber# instance number (ctrl_num from [ctrl] section).
93235537Sgber# chip_ctrl=0..3
94235537Sgberchip_ctrl=0
95235537Sgber
96235537Sgber# Chip select line.
97235537Sgber# chip_cs=0..3
98235537Sgberchip_cs=0
99235537Sgber
100235537Sgber# ONFI device identifier.
101235537Sgber# device_id=0x00..0xff
102235537Sgberdevice_id=0xd3
103235537Sgber
104235537Sgber# ONFI manufacturer identifier.
105235537Sgber# manufacturer_id=0x00..0xff
106235537Sgbermanufacturer_id=0xec
107235537Sgber
108235537Sgber# Textual description of the chip.
109235537Sgber# model="model_name"
110235537Sgbermodel="k9xxg08uxM:1GiB 3,3V 8-bit"
111235537Sgber
112235537Sgber# Textual name of the chip manufacturer.
113235537Sgber# manufacturer="manufacturer name"
114235537Sgbermanufacturer="SAMSUNG"
115235537Sgber
116235537Sgber# page_size=[must be power of 2 and >= 512]  (in bytes)
117235537Sgberpage_size=2048
118235537Sgber# oob_size=[>0]
119235537Sgberoob_size=64
120235537Sgber# pages_per_block=n*32
121235537Sgberpages_per_block=64
122235537Sgber# blocks_per_lun=[>0]
123235537Sgberblocks_per_lun=4096
124235537Sgber# luns=1..N
125235537Sgberluns=1
126235537Sgber# column_addr_cycle=[1,2]
127235537Sgbercolumn_addr_cycle=2
128235537Sgber# row_addr_cycle=[1,2,3]
129235537Sgberrow_addr_cycle=3
130235537Sgber
131235537Sgber# program_time=  (in us)
132235537Sgberprogram_time=0
133235537Sgber# erase_time=    (in us)
134235537Sgbererase_time=0
135235537Sgber# read_time=     (in us)
136235537Sgberread_time=0
137235537Sgber# ccs_time=      (in us)
138235537Sgber#ccs_time=200
139235537Sgber
140235537Sgber# Simulate write-protect on the chip.
141235537Sgber# write_protect=[yes|no]
142235537Sgber#write_protect=no
143235537Sgber
144235537Sgber# Blocks wear-out threshold. Each block has a counter of program-erase cycles;
145235537Sgber# when this counter reaches 'wear_out' value a given block is treated as a bad
146235537Sgber# block (access will report error).
147235537Sgber#
148235537Sgber# Setting wear_out to 0 means that blocks will never wear out.
149235537Sgber#
150235537Sgber# wear_out=0..100000
151235537Sgberwear_out=50000
152235537Sgber
153235537Sgber# Errors per million read/write bytes. This simulates an accidental read/write
154235537Sgber# block error, which can happen in real devices with certain probability. Note
155235537Sgber# this isn't a bad block condition i.e. the block at which the read/write
156235537Sgber# operation is simulated to fail here remains usable, only the operation has
157235537Sgber# not succeeded (this is where ECC comes into play and is supposed to correct
158235537Sgber# such problems).
159235537Sgber#
160235537Sgber# error_ratio=0..1000000
161235537Sgber#error_ratio=50
162235537Sgber
163235537Sgber# Chip data bus width. All chips connected to the same controller must have
164235537Sgber# the same bus width.
165235537Sgber#
166235537Sgber# width=[8|16]
167235537Sgberwidth=8
168235537Sgber
169235537Sgber# Bad block map. NANDsim emulates bad block behavior upon accessing a block 
170235537Sgber# with number from the specified list.
171235537Sgber#
172235537Sgber# bad_block_map=[bad_block1, bad_block2-bad_block3, ..bad_blockn]
173235537Sgberbad_block_map=[100-200]
174235537Sgber
175