PebbleOS v4.47.0-1362-gd278268fe
Loading...
Searching...
No Matches
USB mass storage

Mass storage, Bulk-Only Transport with the SCSI transparent command set: the host reads and writes disks of the device as its own. More...

Data Structures

struct  pbl_usb_msc_lun
 A logical unit: a disk the host sees. More...
 

Macros

#define PBL_USB_MSC_LUN_DEFINE(_name, _disk, _read_only)
 Define a logical unit of the function.
 

Detailed Description

Mass storage, Bulk-Only Transport with the SCSI transparent command set: the host reads and writes disks of the device as its own.

The function has one interface and a bulk endpoint in each direction, numbered by the stack among the other functions'. Each disk is a logical unit the application defines with PBL_USB_MSC_LUN_DEFINE(), in the order of their names, removable media the host can eject. The disks are read and written on the system work queue, never from the controller's interrupt, through two buffers so that the bus moves one while the disk fills or empties the other.

const struct pbl_disk pbl_disk_ram
A disk in RAM, of CONFIG_DISK_RAM_SIZE KiB in 512-byte sectors, zeroed at boot.
#define PBL_USB_MSC_LUN_DEFINE(_name, _disk, _read_only)
Define a logical unit of the function.
Definition msc.h:62
int pbl_usbd_enable(void)
Connect the device to the bus, once: the controller first, if it is not up yet.

Data Structure Documentation

◆ pbl_usb_msc_lun

struct pbl_usb_msc_lun

A logical unit: a disk the host sees.

Data Fields
const struct pbl_disk * disk Disk.
bool read_only Whether the host may only read it, whatever the disk takes.

Macro Definition Documentation

◆ PBL_USB_MSC_LUN_DEFINE

#define PBL_USB_MSC_LUN_DEFINE (   _name,
  _disk,
  _read_only 
)
Value:
static struct pbl_usb_msc__lun_state pbl_usb_msc_lun_state_##_name; \
static const struct pbl_usb_msc_lun pbl_usb_msc_lun_##_name PBL_ITERABLE_SECTION( \
const struct pbl_usb_msc_lun, usb_msc_luns, #_name) = { \
.disk = (_disk), \
.read_only = (_read_only), \
.state = &pbl_usb_msc_lun_state_##_name, \
}
#define PBL_ITERABLE_SECTION(type, tag, key)
Add the object to an iterable section, a table gathered at link time from any file.
Definition section.h:144
bool read_only
Whether the host may only read it, whatever the disk takes.
Definition msc.h:47
const struct pbl_disk * disk
Disk.
Definition msc.h:45
A logical unit: a disk the host sees.
Definition msc.h:43

Define a logical unit of the function.

Up to 16 logical units are supported, numbered in the order of their names.

Parameters
_nameName of the logical unit.
_diskDisk.
_read_onlyWhether the host may only read it.