4.104.114.95
Last change
on this file since e6a5f31a was
5a2b5b2,
checked in by Chris Johns <chrisj@…>, on 05/01/08 at 04:15:36
|
2008-05-01 Chris Johns <chrisj@…>
- libblock/include/rtems/nvdisk-sram.h,
libblock/include/rtems/nvdisk.h,
libblock/src/nvdisk-sram.c,
libblock/src/nvdisk.c: New. A Non-volatile memory disk drive.
- Makefile.am, preinstall.am, libblock/Makefile.am: Updated for
the NV disk driver.
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Line | |
---|
1 | /* |
---|
2 | * $Id$ |
---|
3 | * |
---|
4 | * RTEMS Project (http://www.rtems.org/) |
---|
5 | * |
---|
6 | * Copyright 2007 Chris Johns (chrisj@rtems.org) |
---|
7 | */ |
---|
8 | /** |
---|
9 | * Provide SRAM support for the NV Disk. |
---|
10 | */ |
---|
11 | |
---|
12 | #include <stdio.h> |
---|
13 | #include <errno.h> |
---|
14 | |
---|
15 | #include <rtems.h> |
---|
16 | |
---|
17 | #include <rtems/nvdisk-sram.h> |
---|
18 | |
---|
19 | #ifndef NVDISK_SRAM_ERROR_TRACE |
---|
20 | #define NVDISK_SRAM_ERROR_TRACE (0) |
---|
21 | #endif |
---|
22 | |
---|
23 | static int |
---|
24 | rtems_nvdisk_sram_read (uint32_t device, |
---|
25 | uint32_t flags, |
---|
26 | uint32_t base, |
---|
27 | uint32_t offset, |
---|
28 | void* buffer, |
---|
29 | uint32_t size) |
---|
30 | { |
---|
31 | memcpy (buffer, (char*) (base + offset), size); |
---|
32 | return 0; |
---|
33 | } |
---|
34 | |
---|
35 | static int |
---|
36 | rtems_nvdisk_sram_write (uint32_t device, |
---|
37 | uint32_t flags, |
---|
38 | uint32_t base, |
---|
39 | uint32_t offset, |
---|
40 | const void* buffer, |
---|
41 | uint32_t size) |
---|
42 | { |
---|
43 | memcpy ((char*) (base + offset), buffer, size); |
---|
44 | return 0; |
---|
45 | } |
---|
46 | |
---|
47 | static int |
---|
48 | rtems_nvdisk_sram_verify (uint32_t device, |
---|
49 | uint32_t flags, |
---|
50 | uint32_t base, |
---|
51 | uint32_t offset, |
---|
52 | const void* buffer, |
---|
53 | uint32_t size) |
---|
54 | { |
---|
55 | return memcmp ((char*) (base + offset), buffer, size) == 0 ? 0 : EIO; |
---|
56 | } |
---|
57 | |
---|
58 | |
---|
59 | const rtems_nvdisk_driver_handlers rtems_nvdisk_sram_handlers = |
---|
60 | { |
---|
61 | read: rtems_nvdisk_sram_read, |
---|
62 | write: rtems_nvdisk_sram_write, |
---|
63 | verify: rtems_nvdisk_sram_verify |
---|
64 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.