CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
usb_msc.h
Go to the documentation of this file.
1// USB Mass Storage (MSC) block-device glue.
2//
3// usb_badge owns the TinyUSB MSC class callbacks but stays free of any storage
4// dependency: a module (mod_msc) wires the LUN to the vfat wear-levelling
5// volume by installing this backend. With no backend installed the LUN reports
6// "not ready" and the host sees no usable medium.
7
8#pragma once
9
10#include <stdbool.h>
11#include <stdint.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
20typedef struct {
21 bool (*read)(uint32_t lba, uint32_t offset, void* buf, uint32_t len);
22 bool (*write)(uint32_t lba, uint32_t offset, const void* buf, uint32_t len);
23 uint64_t (*total_bytes)(void);
24 uint16_t (*block_size)(void);
25 void (*set_host_active)(bool active);
27
32void usb_msc_set_backend(const usb_msc_backend_t* backend);
33
34#ifdef __cplusplus
35}
36#endif
Block-device backend for the single USB Mass Storage LUN.
Definition usb_msc.h:20
uint64_t(* total_bytes)(void)
Definition usb_msc.h:23
uint16_t(* block_size)(void)
Definition usb_msc.h:24
void(* set_host_active)(bool active)
Definition usb_msc.h:25
bool(* read)(uint32_t lba, uint32_t offset, void *buf, uint32_t len)
Definition usb_msc.h:21
bool(* write)(uint32_t lba, uint32_t offset, const void *buf, uint32_t len)
Definition usb_msc.h:22
void usb_msc_set_backend(const usb_msc_backend_t *backend)
Installs or removes the MSC block backend.
Definition usb_msc.cpp:24