Support Isochronous transfer additionally
Dependents: USBHostC270_example_GR-PEACH USBHostDac_example USBHostDac_Audio_in_out
Fork of USBHost_custom by
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 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 66 of file USBHostMSD.cpp.
| bool connected | ( | ) |
Check if a MSD device is connected.
- Returns:
- true if a MSD device is connected
Definition at line 61 of file USBHostMSD.cpp.
| void debug | ( | bool | dbg ) | [virtual] |
Enable or disable debugging.
- Parameters:
-
State of debugging
Definition at line 437 of file USBHostMSD.cpp.
| int deinit | ( | ) | [virtual] |
Deinitialize a block device.
- Returns:
- 0 on success or a negative error code on failure
Definition at line 345 of file USBHostMSD.cpp.
| 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
Definition at line 408 of file USBHostMSD.cpp.
| 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
Definition at line 423 of file USBHostMSD.cpp.
| 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
Definition at line 418 of file USBHostMSD.cpp.
| bd_size_t get_read_size | ( | ) | const [virtual] |
Get the size of a readable block.
- Returns:
- Size of a readable block in bytes
Definition at line 413 of file USBHostMSD.cpp.
| int init | ( | ) | [virtual] |
Initialize a block device.
- Returns:
- 0 on success or a negative error code on failure
Definition at line 318 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 349 of file USBHostMSD.cpp.
| 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
Definition at line 379 of file USBHostMSD.cpp.
| bd_size_t size | ( | ) | const [virtual] |
Get the total size of the underlying device.
- Returns:
- Size of the underlying device in bytes
Definition at line 428 of file USBHostMSD.cpp.
Generated on Tue Jul 12 2022 18:09:27 by
1.7.2
