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 
9 #pragma once
10 
29 #include <stdint.h>
30 #include <stddef.h>
31 
32 #if MODULE_VFS
33 #include "vfs.h"
34 #endif
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /* Forward declaration in order to declare function pointers which take this
41  * type as a parameter within the struct. */
42 struct nvram;
43 
47 typedef struct nvram {
61  int (*read)(struct nvram *dev, uint8_t *dst, uint32_t src, size_t size);
62 
76  int (*write)(struct nvram *dev, const uint8_t *src, uint32_t dst, size_t size);
77 
79  size_t size;
80 
82  void *extra;
84 
85 #if MODULE_VFS
86 extern const vfs_file_ops_t nvram_vfs_ops;
87 #endif
88 
89 #ifdef __cplusplus
90 }
91 #endif
92 
struct nvram nvram_t
Device descriptor for generic NVRAM devices.
Device descriptor for generic NVRAM devices.
Definition: nvram.h:47
void * extra
Device-specific parameters, if any.
Definition: nvram.h:82
int(* write)(struct nvram *dev, const uint8_t *src, uint32_t dst, size_t size)
Pointer to device-specific write function.
Definition: nvram.h:76
size_t size
Device capacity.
Definition: nvram.h:79
int(* read)(struct nvram *dev, uint8_t *dst, uint32_t src, size_t size)
Pointer to device-specific read function.
Definition: nvram.h:61
Operations on open files.
Definition: vfs.h:447