xref: /netbsd-src/share/man/man9/flash.9 (revision 76c7fc5f6b13ed0b1508e6b313e88e59977ed78e)
1.\"	$NetBSD: flash.9,v 1.5 2014/03/18 18:20:40 riastradh Exp $
2.\"
3.\" Copyright (c) 2010 Department of Software Engineering,
4.\"		      University of Szeged, Hungary
5.\" Copyright (c) 2010 Adam Hoka <ahoka@NetBSD.org>
6.\" All rights reserved.
7.\"
8.\" This code is derived from software contributed to The NetBSD Foundation
9.\" by the Department of Software Engineering, University of Szeged, Hungary
10.\"
11.\" Redistribution and use in source and binary forms, with or without
12.\" modification, are permitted provided that the following conditions
13.\" are met:
14.\" 1. Redistributions of source code must retain the above copyright
15.\"    notice, this list of conditions and the following disclaimer.
16.\" 2. Redistributions in binary form must reproduce the above copyright
17.\"    notice, this list of conditions and the following disclaimer in the
18.\"    documentation and/or other materials provided with the distribution.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.Dd March 31, 2011
33.Dt FLASH 9
34.Os
35.Sh NAME
36.Nm flash
37.Nd subsystem for flash-like memory devices
38.Sh SYNOPSIS
39.In dev/flash/flash.h
40.Ft device_t
41.Fn flash_attach_mi "const struct flash_interface *fl" "device_t dev"
42.Sh DESCRIPTION
43Flash-like devices can register themselves to the
44.Nm
45layer with the
46.Fa flash_hw_if
47structure.
48This structure has function pointers and other fields.
49.Pp
50The attachment can be done by calling
51.Fn flash_attach_mi
52with this structure and the device's
53.Vt device_t
54as an argument.
55Return value is the flash layer device.
56The
57.Fa flash_interface
58structure is shown below.
59.Bd -literal
60struct flash_interface {
61	int (*erase) (device_t, struct flash_erase_instruction *);
62	int (*read) (device_t, off_t, size_t, size_t *, uint8_t *);
63	int (*write) (device_t, off_t, size_t, size_t *, const uint8_t *);
64	int (*block_markbad)(device_t, uint64_t);
65	int (*block_isbad)(device_t, uint64_t);
66	int (*sync) (device_t);
67
68	int (*submit)(device_t, struct buf *);
69
70	/* storage for partition info */
71	struct flash_partition partition;
72
73	/* total size of mtd */
74	flash_addr_t size;
75	uint32_t page_size;
76	uint32_t erasesize;
77	uint32_t writesize;
78	uint32_t minor;
79	uint8_t	type;
80};
81.Ed
82.Sh SEE ALSO
83.Xr flash 4 ,
84.Xr nand 9
85.Sh AUTHORS
86.An Adam Hoka Aq Mt ahoka@NetBSD.org
87