Commit 93ebf1c4 authored by Daniel DeGrasse's avatar Daniel DeGrasse Committed by Fabio Baltieri
Browse files

doc: services: disk_access: add documentation for INIT/DEINIT IOCTLs



Add documentation for disk INIT/DEINIT IOCTLs to the disk access API.

Signed-off-by: default avatarDaniel DeGrasse <daniel.degrasse@nxp.com>
parent d18cbb60
Loading
Loading
Loading
Loading
+32 −6
Original line number Diff line number Diff line
@@ -8,6 +8,35 @@ Overview

The disk access API provides access to storage devices.

Initializing Disks
******************

Since many disk devices (such as SD cards) are hotpluggable, the disk access
API provides IOCTLs to initialize and de-initialize the disk. They are
as follows:

* :c:macro:`DISK_IOCTL_CTRL_INIT`: Initialize the disk. Must be called before
  additional I/O operations can be run on the disk device. Equivalent to
  calling the legacy function :c:func:`disk_access_init`.

* :c:macro:`DISK_IOCTL_CTRL_DEINIT`: De-initialize the disk. Once this IOCTL
  is issued, the :c:macro:`DISK_IOCTL_CTRL_INIT` must be issued before
  the disk can be used for addition I/O operations.

Init/deinit IOCTL calls are balanced, so a disk will not de-initialize until
an equal number of deinit IOCTLs have been issued as init IOCTLs.

It is also possible to force a disk de-initialization by passing a
pointer to a boolean set to ``true`` as a parameter to the
:c:macro:`DISK_IOCTL_CTRL_DEINIT` IOCTL. This is an unsafe operation which
each disk driver may handle differently, but it will always return
a value indicating success.

Note that de-initializing a disk is a low level operation- typically the
de-initialization and initialization calls should be left to the filesystem
implementation, and the user application should not need to manually
de-initialize the disk and can instead call :c:func:`fs_unmount`

SD Card support
***************

@@ -16,12 +45,9 @@ SD cards via SPI. These drivers use disk driver interface and a file system
can access the SD cards via disk access API.
Both standard and high-capacity SD cards are supported.

.. note:: The system does not support inserting or removing cards while the
   system is running. The cards must be present at boot and must not be
   removed. This may be fixed in future releases.

   FAT filesystems are not power safe so the filesystem may become
   corrupted if power is lost or if the card is removed.
.. note:: FAT filesystems are not power safe so the filesystem may become
   corrupted if power is lost or if the card is removed without unmounting
   the filesystem

SD Memory Card subsystem
========================