nvram.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Eistec AB
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
27 #ifndef NVRAM_H
28 #define NVRAM_H
29 
30 #include <stdint.h>
31 #include <stddef.h>
32 
33 #if MODULE_VFS
34 #include "vfs.h"
35 #endif
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /* Forward declaration in order to declare function pointers which take this
42  * type as a parameter within the struct. */
43 struct nvram;
44 
48 typedef struct nvram {
62  int (*read)(struct nvram *dev, uint8_t *dst, uint32_t src, size_t size);
63 
77  int (*write)(struct nvram *dev, const uint8_t *src, uint32_t dst, size_t size);
78 
80  size_t size;
81 
83  void *extra;
84 } nvram_t;
85 
86 #if MODULE_VFS
87 extern const vfs_file_ops_t nvram_vfs_ops;
88 #endif
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif /* NVRAM_H */
95 
nvram::size
size_t size
Device capacity.
Definition: nvram.h:80
nvram
Device descriptor for generic NVRAM devices.
Definition: nvram.h:48
nvram::read
int(* read)(struct nvram *dev, uint8_t *dst, uint32_t src, size_t size)
Pointer to device-specific read function.
Definition: nvram.h:62
nvram_t
struct nvram nvram_t
Device descriptor for generic NVRAM devices.
nvram::extra
void * extra
Device-specific parameters, if any.
Definition: nvram.h:83
nvram::write
int(* write)(struct nvram *dev, const uint8_t *src, uint32_t dst, size_t size)
Pointer to device-specific write function.
Definition: nvram.h:77
vfs_file_ops
Operations on open files.
Definition: vfs.h:328
vfs.h
VFS layer API declarations.