xref: /NextBSD/usr.sbin/nandsim/nandsim.8 (revision 84d351007654069f9643c8e4b4802a7f5f08ee42)
1.\" Copyright (c) 2010 Semihalf
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd August 10, 2010
28.Dt NANDSIM 8
29.Os
30.Sh NAME
31.Nm nandsim
32.Nd NAND simulator control program
33.Sh SYNOPSIS
34.Nm
35.Ic status
36.Aq ctrl_no | Fl -all  | Fl a
37.Op Fl v
38.Nm
39.Ic conf
40.Aq filename
41.Nm
42.Ic start
43.Aq ctrl_no
44.Nm
45.Ic mod
46.Aq ctrl_no:cs_no | Fl l Aq loglevel
47.Op Fl p Aq prog_time
48.Op Fl e Aq erase_time
49.Op Fl r Aq read_time
50.Op Fl E Aq error_ratio
51.Op Fl h
52.Nm
53.Ic stop
54.Aq ctrl_no
55.Nm
56.Ic error
57.Aq ctrl_no:cs_no
58.Aq page_num
59.Aq column
60.Aq length
61.Aq pattern
62.Nm
63.Ic bb
64.Aq ctrl_no:cs_no
65.Op blk_num,blk_num2,...
66.Op Fl U
67.Op Fl L
68.Nm
69.Ic freeze
70.Op ctrl_no
71.Nm
72.Ic log
73.Aq ctrl_no | Fl -all  | Fl a
74.Nm
75.Ic stats
76.Aq ctrl_no:cs_no
77.Aq page_num
78.Nm
79.Ic dump
80.Aq ctrl_no:cs_no
81.Aq filename
82.Nm
83.Ic restore
84.Aq ctrl_no:chip_no
85.Aq filename
86.Nm
87.Ic destroy
88.Aq ctrl_no[:cs_no] | Fl -all | Fl a
89.Nm
90.Ic help
91.Op Fl v
92.Sh COMMAND DESCRIPTION
93Controllers and chips are arranged into a simple hierarchy.
94There can be up to 4 controllers configured, each with 4 chip select (CS) lines.
95A given chip is connected to one of the chip selects.
96.Pp
97Controllers are specified as
98.Aq ctrl_no ;
99chip selects are specified as
100.Aq cs_no .
101.Bl -tag -width periphlist
102.It Ic status
103Gets controller(s) status. If
104.Fl a
105or
106.Fl -all
107flag is specified - command will print status of every controller
108currently available.
109Optional flag
110.Fl v
111causes printing complete information about the controller, and all
112chips attached to it.
113.It Ic conf
114Reads simulator configuration from a specified file (this includes
115the simulation "layout" i.e. controllers-chips assignments).
116Configuration changes for an already started simulation require a
117full stop-start cycle in order to take effect i.e.:
118.Bl -column
119.It nandsim stop ...
120.It nandsim destroy ...
121.Pp
122.It << edit config file >>
123.Pp
124.It nandsim conf ...
125.It nandsim start ...
126.El
127.It Ic mod
128Alters simulator parameters on-the-fly.
129If controller number and CS pair is not specified, the general
130simulator parameters (not specific to a controller or a chip) will be modified.
131Changing chip's parameters requires specifying both controller number and CS
132to which the given chip is connected.
133Parameters which can be altered:
134.Pp
135General simulator related:
136.Bl -tag -width flag
137.It Fl l Aq log_level
138change logging level to
139.Aq log_level
140.El
141.Pp
142Chip related:
143.Bl -tag -width flag
144.It Fl p Aq prog_time
145change prog time for specified chip to
146.Aq prog_time
147.It Fl e Aq erase_time
148change erase time for specified chip to
149.Aq erase_time
150.It Fl r Aq read_time
151change read time for specified chip to
152.Aq read_time
153.It Fl E Aq error_ratio
154change error ratio for specified chip to
155.Aq error_ratio .
156Error ratio is a number of errors per million read/write bytes.
157.El
158.Pp
159Additionally, flag
160.Fl h
161will list parameters which can be altered.
162.El
163.Bl -tag -width periphlist
164.It Ic bb
165Marks/unmarks a specified block as bad.
166To mark/unmark the bad condition an a block, the following parameters
167have to be supplied: controller number, CS number, and at least one
168block number.
169It is possible to specify multiple blocks, by separating blocks numbers
170with a comma.
171The following options can be used for the 'bb' command:
172.Bl -tag -width flag
173.It Fl U
174unmark the bad previously marked block as bad.
175.It Fl L
176list all blocks marked as bad on a given chip.
177.El
178.It Ic log
179Prints activity log of the specified controller to stdout; if
180controller number is not specified, logs for all available
181controllers are printed.
182.It Ic stats
183Print statistics of the selected controller, chip and page.
184Statistics includes read count, write count, raw read count, raw
185write count, ECC stats (succeeded corrections, failed correction).
186.It Ic dump
187Dumps a snaphot of a single chip (including data and bad blocks
188information, wearout level) into the file.
189.It Ic restore
190Restores chip state from a dump-file snapshot (produced previously
191with the 'dump' command).
192.It Ic start
193Starts a controller i.e. the simulation.
194.It Ic stop
195Stops an already started controller; if the controller number is not
196supplied, attempts to stop all currently working controllers.
197.It Ic destroy
198Removes existing active chip/controller and its configuration from
199memory and releases the resources.
200Specifying flag
201.Fl a
202or
203.Fl -all
204causes removal of every chip and controller.
205Controller must be stopped in order to be destroyed.
206.It Ic error
207Directly overwrites a certain number of bytes in the specified page
208at a given offset with a supplied pattern (which mimics the
209corruption of flash contents).
210.It Ic help
211Prints synopsis,
212.Fl v
213gives more verbose output.
214.It Ic freeze
215Stops simulation of given controller (simulates power-loss).
216All commands issues to any chip on this controller are ignored.
217.El
218.Sh SEE ALSO
219.Xr nand 4 ,
220.Xr nandsim 4 ,
221.Xr nandsim.conf 5
222.Sh HISTORY
223The
224.Nm
225utility first appeared in
226.Fx 10.0 .
227.Sh AUTHORS
228This utility was written by
229.An Lukasz Wojcik .
230