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.
19the SDHC api is designed to provide a generic way to send commands to and
20interact with attached SD devices.
21
22Requests
23========
24
25The core of the SDHC api is the :c:func:`sdhc_request` api. Requests contain a
26:c:struct:`sdhc_command` command structure, and an optional
27:c:struct:`sdhc_data` data structure. The caller may check the return code,
28or the ``response`` field of the SD command structure to determine if the
29SDHC request succeeded. The data structure allows the caller to specify a
30number of blocks to transfer, and a buffer location to read or write them from.
31Whether the provided buffer is used for sending or reading data depends on the
32command opcode provided.
33
34Host Controller I/O
35===================
36
37The :c:func:`sdhc_set_io` api allows the user to change I/O settings of the SD
38host controller, such as clock frequency, I/O voltage, and card power. Not all
39controllers will support applying all I/O settings. For example, SPI mode
40controllers typically cannot toggle power to the SD card.
41
42Related configuration options:
43
44* :kconfig:option:`CONFIG_SDHC`
45
46API Reference
47*************
48
49.. doxygengroup:: sdhc_interface
50