4.104.114.95
Last change
on this file since 4f971343 was
48c5660,
checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/01/08 at 07:21:18
|
2008-09-01 Ralf Corsépius <ralf.corsepius@…>
- libblock/src/nvdisk-sram.c: Add missing HAVE_CONFIG_H.
|
-
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 | #if HAVE_CONFIG_H |
---|
13 | #include "config.h" |
---|
14 | #endif |
---|
15 | |
---|
16 | #include <stdio.h> |
---|
17 | #include <errno.h> |
---|
18 | |
---|
19 | #include <rtems.h> |
---|
20 | |
---|
21 | #include <rtems/nvdisk-sram.h> |
---|
22 | |
---|
23 | #ifndef NVDISK_SRAM_ERROR_TRACE |
---|
24 | #define NVDISK_SRAM_ERROR_TRACE (0) |
---|
25 | #endif |
---|
26 | |
---|
27 | static int |
---|
28 | rtems_nvdisk_sram_read (uint32_t device, |
---|
29 | uint32_t flags, |
---|
30 | uint32_t base, |
---|
31 | uint32_t offset, |
---|
32 | void* buffer, |
---|
33 | uint32_t size) |
---|
34 | { |
---|
35 | memcpy (buffer, (char*) (base + offset), size); |
---|
36 | return 0; |
---|
37 | } |
---|
38 | |
---|
39 | static int |
---|
40 | rtems_nvdisk_sram_write (uint32_t device, |
---|
41 | uint32_t flags, |
---|
42 | uint32_t base, |
---|
43 | uint32_t offset, |
---|
44 | const void* buffer, |
---|
45 | uint32_t size) |
---|
46 | { |
---|
47 | memcpy ((char*) (base + offset), buffer, size); |
---|
48 | return 0; |
---|
49 | } |
---|
50 | |
---|
51 | static int |
---|
52 | rtems_nvdisk_sram_verify (uint32_t device, |
---|
53 | uint32_t flags, |
---|
54 | uint32_t base, |
---|
55 | uint32_t offset, |
---|
56 | const void* buffer, |
---|
57 | uint32_t size) |
---|
58 | { |
---|
59 | return memcmp ((char*) (base + offset), buffer, size) == 0 ? 0 : EIO; |
---|
60 | } |
---|
61 | |
---|
62 | |
---|
63 | const rtems_nvdisk_driver_handlers rtems_nvdisk_sram_handlers = |
---|
64 | { |
---|
65 | read: rtems_nvdisk_sram_read, |
---|
66 | write: rtems_nvdisk_sram_write, |
---|
67 | verify: rtems_nvdisk_sram_verify |
---|
68 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.