63#define _base_block_device_methods                                          \ 
   64  _base_object_methods                                                      \ 
   66  bool (*is_inserted)(void *instance);                                      \ 
   68  bool (*is_protected)(void *instance);                                     \ 
   70  bool (*connect)(void *instance);                                          \ 
   72  bool (*disconnect)(void *instance);                                       \ 
   74  bool (*read)(void *instance, uint32_t startblk,                           \ 
   75                 uint8_t *buffer, uint32_t n);                              \ 
   77  bool (*write)(void *instance, uint32_t startblk,                          \ 
   78                  const uint8_t *buffer, uint32_t n);                       \ 
   80  bool (*sync)(void *instance);                                             \ 
   82  bool (*get_info)(void *instance, BlockDeviceInfo *bdip); 
 
   87#define _base_block_device_data                                             \ 
 
  125#define blkGetDriverState(ip) ((ip)->state) 
  139#define blkIsTransferring(ip) ((((ip)->state) == BLK_CONNECTING) ||         \ 
  140                               (((ip)->state) == BLK_DISCONNECTING) ||      \ 
  141                               (((ip)->state) == BLK_READING) ||            \ 
  142                               (((ip)->state) == BLK_WRITING)) 
 
  159#define blkIsInserted(ip) ((ip)->vmt->is_inserted(ip)) 
  172#define blkIsWriteProtected(ip) ((ip)->vmt->is_protected(ip)) 
  188#define blkConnect(ip) ((ip)->vmt->connect(ip)) 
  202#define blkDisconnect(ip) ((ip)->vmt->disconnect(ip)) 
  218#define blkRead(ip, startblk, buf, n)                                       \ 
  219  ((ip)->vmt->read(ip, startblk, buf, n)) 
 
  235#define blkWrite(ip, startblk, buf, n)                                      \ 
  236  ((ip)->vmt->write(ip, startblk, buf, n)) 
 
  249#define blkSync(ip) ((ip)->vmt->sync(ip)) 
  263#define blkGetInfo(ip, bdip) ((ip)->vmt->get_info(ip, bdip)) 
blkstate_t
Driver state machine possible states.
 
#define _base_block_device_methods
BaseBlockDevice specific methods.
 
#define _base_block_device_data
BaseBlockDevice specific data.
 
const struct BaseBlockDeviceVMT * vmt
Virtual Methods Table.
 
BaseBlockDevice virtual methods table.
 
uint32_t blk_num
Total number of blocks.
 
uint32_t blk_size
Block size in bytes.