Flash Translation Layer  1.0
flash.h
Go to the documentation of this file.
1 
8 #ifndef FLASH_H
9 #define FLASH_H
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 #include <stdlib.h>
16 #include <stdint.h>
17 #include <pthread.h>
18 
22 enum { FLASH_DEFAULT_FLAG = 0 ,
23 };
24 
25 struct flash_device;
26 struct flash_operations;
27 
31 struct flash_device {
32  const struct flash_operations *f_op;
33  void *f_private;
34  int (*f_submodule_exit)(struct flash_device *);
35 };
36 
46  int (*open)(struct flash_device *, const char *name,
47  int flags);
48  ssize_t (*write)(struct flash_device *, void *buffer, size_t count,
49  off_t offset);
50  ssize_t (*read)(struct flash_device *, void *buffer, size_t count,
51  off_t offset);
52  int (*ioctl)(struct flash_device *, unsigned int request,
53  ...);
54  int (*close)(struct flash_device *);
55 };
56 
57 int flash_module_init(struct flash_device **, uint64_t flags);
58 int flash_module_exit(struct flash_device *);
59 
60 #ifdef __cplusplus
61 }
62 #endif
63 
64 #endif
void * f_private
Definition: flash.h:33
int flash_module_init(struct flash_device **, uint64_t flags)
initialize the flash module
Definition: flash.c:26
Definition: flash.h:22
int(* f_submodule_exit)(struct flash_device *)
Definition: flash.h:34
int flash_module_exit(struct flash_device *)
free resources in the flash module
Definition: flash.c:59
generic interface for communicate with the flash
Definition: flash.h:45
contain the flash device information
Definition: flash.h:31
const struct flash_operations * f_op
Definition: flash.h:32