1.. _sdhc_api:
2
3
4Secure Digital High Capacity (SDHC)
5###################################
6
7The SDHC api offers a generic interface for interacting with an SD host
8controller device. It is used by the SD subsystem, and is not intended to be
9directly used by the application
10
11Basic Operation
12***************
13
14SD Host Controller
15==================
16
17An SD host controller is a device capable of sending SD commands to an attached
18SD card. These commands can be sent using the native SD protocol, or over SPI.
19Some SD host controllers are also capable of communicating with MMC devices.
20The SDHC api is designed to provide a generic way to send commands to and
21interact with attached SD devices.
22
23Requests
24========
25
26The core of the SDHC api is the :c:func:`sdhc_request` api. Requests contain a
27:c:struct:`sdhc_command` command structure, and an optional
28:c:struct:`sdhc_data` data structure. The caller may check the return code,
29or the ``response`` field of the SD command structure to determine if the
30SDHC request succeeded. The data structure allows the caller to specify a
31number of blocks to transfer, and a buffer location to read or write them from.
32Whether the provided buffer is used for sending or reading data depends on the
33command opcode provided.
34
35Host Controller I/O
36===================
37
38The :c:func:`sdhc_set_io` api allows the user to change I/O settings of the SD
39host controller, such as clock frequency, I/O voltage, and card power. Not all
40controllers will support applying all I/O settings. For example, SPI mode
41controllers typically cannot toggle power to the SD card.
42
43Related configuration options:
44
45* :kconfig:option:`CONFIG_SDHC`
46
47API Reference
48*************
49
50.. doxygengroup:: sdhc_interface
51