summaryrefslogtreecommitdiff
path: root/docs/library/zephyr.DiskAccess.rst
diff options
context:
space:
mode:
authorJulia Hathaway <julia.hathaway@nxp.com>2021-08-02 17:08:00 -0500
committerDamien George <damien@micropython.org>2021-08-13 20:21:14 +1000
commit6ed69906257ee59d6533dc06ddfa02db5f4fbce3 (patch)
treea88d715fdf3589005adff2e5380c6948e1d11c97 /docs/library/zephyr.DiskAccess.rst
parent333e16521bc8af8a55f362c1bad2f21c4704d20b (diff)
docs/library/zephyr: Add libraries specific to the Zephyr port.
Includes documentation for Zephyr specific modules (zephyr and zsensor), classes (DiskAccess and FlashArea), and functions. Signed-off-by: Julia Hathaway <julia.hathaway@nxp.com>
Diffstat (limited to 'docs/library/zephyr.DiskAccess.rst')
-rw-r--r--docs/library/zephyr.DiskAccess.rst38
1 files changed, 38 insertions, 0 deletions
diff --git a/docs/library/zephyr.DiskAccess.rst b/docs/library/zephyr.DiskAccess.rst
new file mode 100644
index 000000000..d19d81a96
--- /dev/null
+++ b/docs/library/zephyr.DiskAccess.rst
@@ -0,0 +1,38 @@
+.. currentmodule:: zephyr
+.. _zephyr.DiskAccess:
+
+class DiskAccess -- access to disk storage
+==========================================
+
+Uses `Zephyr Disk Access API <https://docs.zephyrproject.org/latest/reference/storage/disk/access.html>`_.
+
+This class allows access to storage devices on the board, such as support for SD card controllers and
+interfacing with SD cards via SPI. Disk devices are automatically detected and initialized on boot using
+Zephyr devicetree data.
+
+The Zephyr disk access class enables the transfer of data between a disk device and an accessible memory buffer given a disk name,
+buffer, starting disk block, and number of sectors to read. MicroPython reads as many blocks as necessary to fill the buffer, so
+the number of sectors to read is found by dividing the buffer length by block size of the disk.
+
+Constructors
+------------
+
+.. class:: DiskAccess(disk_name)
+
+ Gets an object for accessing disk memory of the specific disk.
+ For accessing an SD card on the mimxrt1050_evk, ``disk_name`` would be ``SDHC``. See board documentation and
+ devicetree for usable disk names for your board (ex. RT boards use style USDHC#).
+
+Methods
+-------
+
+.. method:: DiskAccess.readblocks(block_num, buf)
+ DiskAccess.readblocks(block_num, buf, offset)
+.. method:: DiskAccess.writeblocks(block_num, buf)
+ DiskAccess.writeblocks(block_num, buf, offset)
+.. method:: DiskAccess.ioctl(cmd, arg)
+
+ These methods implement the simple and extended
+ :ref:`block protocol <block-device-interface>` defined by
+ :class:`uos.AbstractBlockDev`.
+