@@ -7,10 +7,54 @@ namespace fs
77class FS ;
88}
99
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+ */
1028struct Storage
1129{
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+ */
1238 static void begin ();
39+
40+ /* *
41+ * @brief Disengages filesystem and USB
42+ */
1343 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+ */
1451 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+ */
1559 static std::size_t size ();
1660};
0 commit comments