18 #define PADDR_EMPTY ((uint32_t)UINT32_MAX) 23 #define DEVICE_PAGE_SIZE (8192) 55 #ifndef DEVICE_NR_BUS_BITS 56 #define DEVICE_NR_BUS_BITS (3) 59 #ifndef DEVICE_NR_CHIPS_BITS 60 #define DEVICE_NR_CHIPS_BITS (3) 63 #ifndef DEVICE_NR_PAGES_BITS 64 #define DEVICE_NR_PAGES_BITS (7) 67 #ifndef DEVICE_NR_BLOCKS_BITS 68 #define DEVICE_NR_BLOCKS_BITS (19) 72 #pragma message("DEVICE_NR_BUS_BITS = " TOSTRING(DEVICE_NR_BUS_BITS)) 73 #pragma message("DEVICE_NR_CHIPS_BITS = " TOSTRING(DEVICE_NR_CHIPS_BITS)) 74 #pragma message("DEVICE_NR_PAGES_BITS = " TOSTRING(DEVICE_NR_PAGES_BITS)) 75 #pragma message("DEVICE_NR_BLOCKS_BITS = " TOSTRING(DEVICE_NR_BLOCKS_BITS)) 169 int (*d_submodule_exit)(
struct device *);
176 int (*open)(
struct device *,
const char *name,
int flags);
254 return nr_segments * nr_pages_per_segment * page_size;
flash board's page information
Definition: device.h:131
void * d_private
Definition: device.h:168
struct device_address::@3::@5 format
static size_t device_get_blocks_per_segment(struct device *dev)
Definition: device.h:203
device_end_req_fn end_rq
Definition: device.h:118
size_t sector
Definition: device.h:114
generic device address format
Definition: device.h:95
uint32_t page
Definition: device.h:100
int device_module_init(const uint64_t modnum, struct device **, uint64_t flags)
initialize the device module
Definition: device.c:104
struct device_page page
Definition: device.h:139
#define DEVICE_NR_CHIPS_BITS
Definition: device.h:60
size_t nr_chips
Definition: device.h:157
metadata of the device
Definition: device.h:163
uint32_t block
Definition: device.h:101
pthread_cond_t cond
Definition: device.h:123
flash board's block information
Definition: device.h:138
struct device_request * device_alloc_request(uint64_t flags)
dynamic allocate the device request
Definition: device.c:51
flash board's package(nand chip) information
Definition: device.h:146
size_t size
Definition: device.h:132
static size_t device_get_total_pages(struct device *dev)
get total the number of pages in a flash board
Definition: device.h:264
#define DEVICE_NR_BUS_BITS
device address information
Definition: device.h:56
#define DEVICE_NR_PAGES_BITS
Definition: device.h:64
size_t nr_pages
Definition: device.h:140
uint32_t bus
Definition: device.h:98
flash board's architecture information
Definition: device.h:154
uint32_t lpn
Definition: device.h:103
static size_t device_get_nr_segments(struct device *dev)
get the number of segments in a flash board
Definition: device.h:196
pthread_mutex_t mutex
Definition: device.h:122
operations for device
Definition: device.h:175
uint64_t * badseg_bitmap
Definition: device.h:167
const struct device_operations * d_op
Definition: device.h:165
size_t nr_bus
Definition: device.h:156
unsigned int flag
Definition: device.h:111
void device_free_request(struct device_request *)
free pre-allocated device_request resource
Definition: device.c:88
gint is_finish
Definition: device.h:120
size_t data_len
Definition: device.h:113
static size_t device_get_total_size(struct device *dev)
total size of a flash board
Definition: device.h:248
void * data
Definition: device.h:117
uint32_t chip
Definition: device.h:99
int device_module_exit(struct device *)
deallocate the device module
Definition: device.c:140
struct device * dev
Definition: ramdisk-test.c:10
void * rq_private
Definition: device.h:125
void(* device_end_req_fn)(struct device_request *)
I/O end request function.
Definition: device.h:87
size_t nr_blocks
Definition: device.h:148
struct device_info info
Definition: device.h:166
static size_t device_get_pages_per_segment(struct device *dev)
get the number of pages in a segment
Definition: device.h:216
static size_t device_get_page_size(struct device *dev)
get flash board's NAND page size
Definition: device.h:232
#define DEVICE_NR_BLOCKS_BITS
Definition: device.h:68
pthread_mutex_t mutex
Definition: device.h:164
request for device
Definition: device.h:110