test public
Dependencies: HttpServer_snapshot_mbed-os
USBHostMSD Class Reference
A class to communicate a USB flash disk. More...
#include <USBHostMSD.h>
Inherits IUSBEnumerator.
Public Member Functions | |
USBHostMSD () | |
Constructor. | |
bool | connected () |
Check if a MSD device is connected. | |
bool | connect () |
Try to connect to a MSD device. | |
virtual int | init () |
Initialize a block device. | |
virtual int | deinit () |
Deinitialize a block device. | |
virtual int | read (void *buffer, bd_addr_t addr, bd_size_t size) |
Read blocks from a block device. | |
virtual int | program (const void *buffer, bd_addr_t addr, bd_size_t size) |
Program blocks to a block device. | |
virtual int | erase (bd_addr_t addr, bd_size_t size) |
Erase blocks on a block device. | |
virtual bd_size_t | get_read_size () const |
Get the size of a readable block. | |
virtual bd_size_t | get_program_size () const |
Get the size of a programable block. | |
virtual bd_size_t | get_erase_size () const |
Get the size of a eraseable block. | |
virtual bd_size_t | size () const |
Get the total size of the underlying device. | |
virtual const char * | get_type () const |
Get the BlockDevice class type. | |
virtual void | debug (bool dbg) |
Enable or disable debugging. |
Detailed Description
A class to communicate a USB flash disk.
Definition at line 30 of file USBHostMSD.h.
Constructor & Destructor Documentation
USBHostMSD | ( | ) |
Member Function Documentation
bool connect | ( | ) |
Try to connect to a MSD device.
- Returns:
- true if connection was successful
Definition at line 77 of file USBHostMSD.cpp.
bool connected | ( | ) |
Check if a MSD device is connected.
- Returns:
- true if a MSD device is connected
Definition at line 72 of file USBHostMSD.cpp.
virtual void debug | ( | bool | dbg ) | [virtual] |
Enable or disable debugging.
- Parameters:
-
State of debugging
int deinit | ( | ) | [virtual] |
Deinitialize a block device.
- Returns:
- 0 on success or a negative error code on failure
Definition at line 437 of file USBHostMSD.cpp.
virtual int erase | ( | bd_addr_t | addr, |
bd_size_t | size | ||
) | [virtual] |
Erase blocks on a block device.
The state of an erased block is undefined until it has been programmed
- Parameters:
-
addr Address of block to begin erasing size Size to erase in bytes, must be a multiple of erase block size
- Returns:
- 0 on success, negative error code on failure
virtual bd_size_t get_erase_size | ( | ) | const [virtual] |
Get the size of a eraseable block.
- Returns:
- Size of a eraseable block in bytes
- Note:
- Must be a multiple of the program size
virtual bd_size_t get_program_size | ( | ) | const [virtual] |
Get the size of a programable block.
- Returns:
- Size of a programable block in bytes
- Note:
- Must be a multiple of the read size
virtual bd_size_t get_read_size | ( | ) | const [virtual] |
Get the size of a readable block.
- Returns:
- Size of a readable block in bytes
virtual const char* get_type | ( | ) | const [virtual] |
Get the BlockDevice class type.
- Returns:
- A string represent the BlockDevice class type.
int init | ( | ) | [virtual] |
Initialize a block device.
- Returns:
- 0 on success or a negative error code on failure
Definition at line 410 of file USBHostMSD.cpp.
int program | ( | const void * | buffer, |
bd_addr_t | addr, | ||
bd_size_t | size | ||
) | [virtual] |
Program blocks to a block device.
The blocks must have been erased prior to being programmed
- Parameters:
-
buffer Buffer of data to write to blocks addr Address of block to begin writing to size Size to write in bytes, must be a multiple of program block size
- Returns:
- 0 on success, negative error code on failure
Definition at line 441 of file USBHostMSD.cpp.
virtual int read | ( | void * | buffer, |
bd_addr_t | addr, | ||
bd_size_t | size | ||
) | [virtual] |
Read blocks from a block device.
- Parameters:
-
buffer Buffer to write blocks to addr Address of block to begin reading from size Size to read in bytes, must be a multiple of read block size
- Returns:
- 0 on success, negative error code on failure
virtual bd_size_t size | ( | ) | const [virtual] |
Get the total size of the underlying device.
- Returns:
- Size of the underlying device in bytes
Generated on Wed Jul 13 2022 05:33:38 by 1.7.2