@@ -7,10 +7,54 @@ namespace fs
7
7
class FS ;
8
8
}
9
9
10
+ /* *
11
+ * @brief Provides internal non-volatile as filesystem and USB mass storage device.
12
+ *
13
+ * This adapter has two modes:
14
+ * Either filesystem for internal use or USB mass storage device.
15
+ *
16
+ * Initializes a filesystem for internal use.
17
+ * Initializes a USB mass storage class service.
18
+ *
19
+ * Access to the filesystem is provided as smart pointer.
20
+ * Until the deleter of the smart pointer is (implicitly)
21
+ * called, the storage is locked for filesystem use.
22
+ *
23
+ * When the USB Mass Storage Class (USB MSC) is started
24
+ * (typically by connecting a host device) the storage will
25
+ * present the memory as mass storage device to the host device#
26
+ * as soon as the storage is not locked for filesystem use.
27
+ */
10
28
struct Storage
11
29
{
30
+ /* *
31
+ * @brief Initializes storage
32
+ *
33
+ * Initializes filesystem and USB MSC service.
34
+ *
35
+ * @post storage may be used afterwards
36
+ * @warning do not call again unless end() was called after before
37
+ */
12
38
static void begin ();
39
+
40
+ /* *
41
+ * @brief Disengages filesystem and USB
42
+ */
13
43
static void end ();
44
+
45
+ /* *
46
+ * @brief Get locking access to filesystem.
47
+ *
48
+ * @pre storage must be initialized first
49
+ * @return smart pointer, locking storage to filesystem until deleted
50
+ */
14
51
static std::shared_ptr<fs::FS> getFileSystem_locking ();
52
+
53
+ /* *
54
+ * @brief Gets the total size of memory.
55
+ *
56
+ * @pre storage must be initialized first
57
+ * @return size in bytes
58
+ */
15
59
static std::size_t size ();
16
60
};
0 commit comments