DRIVE

This is the interface for accessing drives.

The drive is usually one of two types:

  • Serial Flash (mostly use command flash interface)
  • SD/MMC Flash memory

Terminology

  • Page: the size of a writeable chunk of memory
  • Sector: the size of an eraseable chunk of memory (commonly 4KB on serial NAND devices)

Multiple pages typically make up a sector. Pages are aligned to sector boundaries.

Details

define DRIVE_VERSION

define DRIVE_IOC_IDENT_CHAR

define I_DRIVE_GETVERSION

Gets the driver version.


define I_DRIVE_GETINFO

Gets the drive info (drive_info_t).


define I_DRIVE_SETATTR

Sets the drive attributes (See also: drive_attr_t).


define I_DRIVE_SETACTION

define I_DRIVE_ISBUSY

See if the drive is busy. This ioctl call will return greater than one if the device is busy and 0 if drive is not busy.


define I_DRIVE_TOTAL

enum @9
  • DRIVE_FLAG_PROTECT Enables driver write protection.
  • DRIVE_FLAG_UNPROTECT Disables driver write protection.
  • DRIVE_FLAG_ERASE_BLOCKS Erases blocks on the disk. A block consists of the smallest eraseable memory size (See also: driver_info_t and erase_block_size). The return value is the amount of memory actually erased. Some devices can only erase only block at a Time.
  • DRIVE_FLAG_ERASE_SECTORS
  • DRIVE_FLAG_ERASE_DEVICE Erases the drive.
  • DRIVE_FLAG_POWERDOWN Puts the drive in power down mode.
  • DRIVE_FLAG_POWERUP Powers up the driver (after power down).
  • DRIVE_FLAG_INIT Initializes the drive.
  • DRIVE_FLAG_RESET Issue a reset to the drive.

struct::drive_info_t

This is the data structure for accessing information about the device.

u32 o_flags

Attribute flags supported by this driver

u32 o_events

MCU Event flags supported by this driver

u16 addressable_size

Number of bytes per address location (typically 1 for small devices 512 for larger ones)

u16 write_block_size

Minimum write block size

u32 num_write_blocks

Number of write blocks (size is num_write_blocks*write_block_size)

u32 erase_block_size

Minimum eraseable block size

u32 erase_block_time

Time in microseconds to erase one block

u32 erase_device_time

Time in microseconds to erase the device

u32 bitrate

Max bitrate

u32 page_program_size

The maximum number of bytes that can be program as one page

u32 resd

struct::drive_attr_t

This is the data structure used with setting drive attributes.

u32 o_flags

Drive flags such as DRIVE_FLAG_INIT

u32 start

Start block (used with DRIVE_FLAG_ERASE_BLOCKS). This should be the address divided by drive_info_t->address_size.

u32 end

End block (used with DRIVE_FLAG_ERASE_BLOCKS). This should be the address divided by drive_info_t->address_size.

u32 resd

X

Thanks for Coming!

Subscribe to news and updates