OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [doc/] [bsp_howto/] [nvmem.t] - Blame information for rev 1780

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
@c
2
@c  COPYRIGHT (c) 1988-2002.
3
@c  On-Line Applications Research Corporation (OAR).
4
@c  All rights reserved.
5
@c
6
@c  nvmem.t,v 1.5 2002/01/17 21:47:44 joel Exp
7
@c
8
 
9
@chapter Non-Volatile Memory Driver
10
 
11
The Non-Volatile driver is responsible for providing an
12
interface to various types of non-volatile memory.  These
13
types of memory include, but are not limited to, Flash, EEPROM,
14
and battery backed RAM.  The capabilities provided
15
by this class of device driver are:
16
 
17
@itemize @bullet
18
@item Initialize the Non-Volatile Memory Driver
19
@item Optional Disable Read and Write Handlers
20
@item Open a Particular Memory Partition
21
@item Close a Particular Memory Partition
22
@item Read from a Particular Memory Partition
23
@item Write to a Particular Memory Partition
24
@item Erase the Non-Volatile Memory Area
25
@end itemize
26
 
27
There is currently only one non-volatile device driver included in the
28
RTEMS source tree and it does not adhere to this device driver model.
29
The information provided in this chapter is based on drivers developed
30
by OAR Corporation personnel for applications using RTEMS.   It is
31
hoped that this driver model information can form the basis for a standard
32
non-volatile memory driver model that can be supported in future RTEMS
33
distribution.
34
 
35
@section Major and Minor Numbers
36
 
37
The @b{major} number of a device driver is its index in the
38
RTEMS Device Address Table.
39
 
40
A @b{minor} number is associated with each device instance
41
managed by a particular device driver.  An RTEMS minor number
42
is an @code{unsigned32} entity.  Convention calls
43
dividing the bits in the minor number down into categories
44
that specify an area of non-volatile memory and a partition
45
with that area.  This results in categories
46
like the following:
47
 
48
@itemize @bullet
49
 
50
@item @b{area} - indicates a block of non-volatile memory
51
@item @b{partition} - indicates a particular address range with an area
52
 
53
@end itemize
54
 
55
From the above, it should be clear that a single device driver
56
can support multiple types of non-volatile memory in a single system.
57
The minor number is used to distinguish the types of memory and
58
blocks of memory used for different purposes.
59
 
60
@section Non-Volatile Memory Driver Configuration
61
 
62
There is not a standard non-volatile driver configuration table but some
63
fields are common across different drivers.  The non-volatile memory driver
64
configuration table is typically an array of structures with each
65
structure containing the information for a particular area of
66
non-volatile memory.
67
The following is a list of the type of information normally required
68
to configure each area of non-volatile memory.
69
 
70
@table @b
71
@item memory_type
72
is the type of memory device in this area.  Choices are battery backed RAM,
73
EEPROM, Flash, or an optional user-supplied type.  If the user-supplied type
74
is configured, then the user is responsible for providing a set of
75
routines to program the memory.
76
 
77
@item memory
78
is the base address of this memory area.
79
 
80
@item attributes
81
is a pointer to a memory type specific attribute block.  Some of
82
the fields commonly contained in this memory type specific attribute
83
structure area:
84
 
85
@table @b
86
@item use_protection_algorithm
87
is set to TRUE to indicate that the protection (i.e. locking) algorithm
88
should be used for this area of non-volatile memory.  A particular
89
type of non-volatile memory may not have a protection algorithm.
90
 
91
@item access
92
is an enumerated type to indicate the organization of the memory
93
devices in this memory area.  The following is a list of the
94
access types supported by the current driver implementation:
95
 
96
@itemize @bullet
97
@item simple unsigned8
98
@item simple unsigned16
99
@item simple unsigned32
100
@item simple unsigned64
101
@item single unsigned8 at offset 0 in an unsigned16
102
@item single unsigned8 at offset 1 in an unsigned16
103
@item single unsigned8 at offset 0 in an unsigned32
104
@item single unsigned8 at offset 1 in an unsigned32
105
@item single unsigned8 at offset 2 in an unsigned32
106
@item single unsigned8 at offset 3 in an unsigned32
107
@end itemize
108
 
109
@item depth
110
is the depth of the progamming FIFO on this particular chip.  Some
111
chips, particularly EEPROMs, have the same programming algorithm but
112
vary in the depth of the amount of data that can be programmed in a single
113
block.
114
 
115
@end table
116
 
117
@item number_of_partitions
118
is the number of logical partitions within this area.
119
 
120
@item Partitions
121
is the address of the table that contains an entry to describe each
122
partition in this area.  Fields within each element of this
123
table are defined as follows:
124
 
125
@table @b
126
 
127
@item offset
128
is the offset of this partition from the base address of this area.
129
 
130
@item length
131
is the length of this partition.
132
 
133
@end table
134
@end table
135
 
136
By dividing an area of memory into multiple partitions, it is possible
137
to easily divide the non-volatile memory for different purposes.
138
 
139
@section Initialize the Non-Volatile Memory Driver
140
 
141
At system initialization, the non-volatile memory driver's
142
initialization entry point will be invoked.  As part of
143
initialization, the driver will perform
144
whatever initializatin is required on each non-volatile memory area.
145
 
146
The discrete I/O driver may register device names for memory
147
partitions of particular interest to the system.  Normally this
148
will be restricted to the device "/dev/nv_memory" to indicate
149
the entire device driver.
150
 
151
@section Disable Read and Write Handlers
152
 
153
Depending on the target's non-volatile memory configuration, it may be
154
possible to write to a status register and make the memory area completely
155
inaccessible.  This is target dependent and beyond the standard capabilities
156
of any memory type.  The user has the optional capability to provide
157
handlers to disable and enable access to a partiticular memory area.
158
 
159
@section Open a Particular Memory Partition
160
 
161
This is the driver open call.  Usually this call does nothing other than
162
validate the minor number.
163
 
164
With some drivers, it may be necessary to allocate memory when a particular
165
device is opened.  If that is the case, then this is often the place
166
to do this operation.
167
 
168
@section Close a Particular Memory Partition
169
 
170
This is the driver close call.  Usually this call does nothing.
171
 
172
With some drivers, it may be necessary to allocate memory when a particular
173
device is opened.  If that is the case, then this is the place
174
where that memory should be deallocated.
175
 
176
@section Read from a Particular Memory Partition
177
 
178
This corresponds to the driver read call.  After validating the minor
179
number and arguments, this call enables reads from the specified
180
memory area by invoking the user supplied "enable reads handler"
181
and then reads the indicated memory area.  When
182
invoked the @code{argument_block} is actually a pointer to the following
183
structure type:
184
 
185
@example
186
@group
187
typedef struct @{
188
  rtems_unsigned32   offset;
189
  void              *buffer;
190
  rtems_unsigned32   length;
191
  rtems_unsigned32   status;
192
@}   Non_volatile_memory_Driver_arguments;
193
@end group
194
@end example
195
 
196
The driver reads @code{length} bytes starting at @code{offset} into
197
the partition and places them at @code{buffer}.  The result is returned
198
in @code{status}.
199
 
200
After the read operation is complete, the user supplied "disable reads handler"
201
is invoked to protect the memory area again.
202
 
203
@section Write to a Particular Memory Partition
204
 
205
This corresponds to the driver write call.   After validating the minor
206
number and arguments, this call enables writes to the specified
207
memory area by invoking the "enable writes handler", then unprotecting
208
the memory area, and finally actually writing to the indicated memory
209
area.  When invoked the @code{argument_block} is actually a pointer to
210
the following structure type:
211
 
212
@example
213
@group
214
typedef struct @{
215
  rtems_unsigned32   offset;
216
  void              *buffer;
217
  rtems_unsigned32   length;
218
  rtems_unsigned32   status;
219
@}   Non_volatile_memory_Driver_arguments;
220
@end group
221
@end example
222
 
223
The driver writes @code{length} bytes from @code{buffer} and
224
writes them to the non-volatile memory starting at @code{offset} into
225
the partition.  The result is returned in @code{status}.
226
 
227
After the write operation is complete, the "disable writes handler"
228
is invoked to protect the memory area again.
229
 
230
@section Erase the Non-Volatile Memory Area
231
 
232
This is one of the IOCTL functions supported by the I/O control
233
device driver entry point.  When this IOCTL function is invoked,
234
the specified area of non-volatile memory is erased.
235
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.