• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# SDIO
2
3## Overview<a name="section1155271783811"></a>
4
5Secure Digital Input/Output \(SDIO\) is a peripheral interface evolved from the Secure Digital \(SD\) memory card interface. The SDIO interface is compatible with SD memory cards and can be connected to devices that support the SDIO interface.
6
7SDIO is widely used. Currently, many smartphones support SDIO, and many SDIO peripherals are developed for connections to smartphones. Common SDIO peripherals include WLAN, GPS, cameras, and Bluetooth.
8
9The SDIO bus has two ends, named host and device. All communication starts when the host sends a command. The device can communicate with the host as long as it can parse the command of the host. An SDIO host can connect to multiple devices, as shown in the figure below.
10- CLK signal: clock signal sent from the host to the device
11- VDD signal: power signal
12- VSS signal: ground signal
13- D0-3 signal: four data lines. The DAT1 signal cable is multiplexed as the interrupt line. In 1-bit mode, DAT0 is used to transmit data. In 4-bit mode, DAT0 to DAT3 are used to transmit data.
14- CMD signal: used by the host to send commands and the device to respond to commands.
15
16**Figure 1**  Connections between the host and devices in SDIO
17
18![](figures/en-us_image_0000001160971556.png)
19
20The SDIO interface defines a set of common methods for operating an SDIO device, including opening and closing an SDIO controller, exclusively claiming and releasing the host, enabling and disabling devices, claiming and releasing an SDIO IRQ, reading and writing data based on SDIO, and obtaining and setting common information.
21
22## Available APIs<a name="section12601496259"></a>
23
24**Table 1**  APIs available for the SDIO driver
25
26<a name="table1731550155318"></a>
27<table><thead align="left"><tr id="row1625342317507"><th class="cellrowborder" valign="top" width="21.07%" id="mcps1.2.4.1.1"><p id="p1779183435016"><a name="p1779183435016"></a><a name="p1779183435016"></a>Capability</p>
28</th>
29<th class="cellrowborder" valign="top" width="34.04%" id="mcps1.2.4.1.2"><p id="p1879163417502"><a name="p1879163417502"></a><a name="p1879163417502"></a>Function</p>
30</th>
31<th class="cellrowborder" valign="top" width="44.89%" id="mcps1.2.4.1.3"><p id="p1379113410506"><a name="p1379113410506"></a><a name="p1379113410506"></a>Description</p>
32</th>
33</tr>
34</thead>
35<tbody><tr id="row1351945135614"><td class="cellrowborder" rowspan="2" valign="top" width="21.07%" headers="mcps1.2.4.1.1 "><p id="p146755118566"><a name="p146755118566"></a><a name="p146755118566"></a>SDIO device opening/closing</p>
36</td>
37<td class="cellrowborder" valign="top" width="34.04%" headers="mcps1.2.4.1.2 "><p id="p1151945185614"><a name="p1151945185614"></a><a name="p1151945185614"></a>SdioOpen</p>
38</td>
39<td class="cellrowborder" valign="top" width="44.89%" headers="mcps1.2.4.1.3 "><p id="p85110451565"><a name="p85110451565"></a><a name="p85110451565"></a>Opens an SDIO controller with a specified bus number.</p>
40</td>
41</tr>
42<tr id="row1062610995616"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p136261793568"><a name="p136261793568"></a><a name="p136261793568"></a>SdioClose</p>
43</td>
44<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p062614919566"><a name="p062614919566"></a><a name="p062614919566"></a>Closes an SDIO controller.</p>
45</td>
46</tr>
47<tr id="row337105133315"><td class="cellrowborder" rowspan="6" valign="top" width="21.07%" headers="mcps1.2.4.1.1 "><p id="p07631557153319"><a name="p07631557153319"></a><a name="p07631557153319"></a>SDIO reading/writing</p>
48</td>
49<td class="cellrowborder" valign="top" width="34.04%" headers="mcps1.2.4.1.2 "><p id="p34551320121416"><a name="p34551320121416"></a><a name="p34551320121416"></a>SdioReadBytes</p>
50</td>
51<td class="cellrowborder" valign="top" width="44.89%" headers="mcps1.2.4.1.3 "><p id="p748062291415"><a name="p748062291415"></a><a name="p748062291415"></a>Incrementally reads a given length of data from a specified SDIO address.</p>
52</td>
53</tr>
54<tr id="row9317134301618"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p10345104001412"><a name="p10345104001412"></a><a name="p10345104001412"></a>SdioWriteBytes</p>
55</td>
56<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p113452040141418"><a name="p113452040141418"></a><a name="p113452040141418"></a>Incrementally writes a given length of data into a specified SDIO address.</p>
57</td>
58</tr>
59<tr id="row131301734171616"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p713025410166"><a name="p713025410166"></a><a name="p713025410166"></a>SdioReadBytesFromFixedAddr</p>
60</td>
61<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p14130165418168"><a name="p14130165418168"></a><a name="p14130165418168"></a>Reads a given length of data from a fixed SDIO address.</p>
62</td>
63</tr>
64<tr id="row1434434011147"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1913013546161"><a name="p1913013546161"></a><a name="p1913013546161"></a>SdioWriteBytesToFixedAddr</p>
65</td>
66<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p111301954131614"><a name="p111301954131614"></a><a name="p111301954131614"></a>Writes a given length of data into a fixed SDIO address.</p>
67</td>
68</tr>
69<tr id="row364393591410"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1851815711620"><a name="p1851815711620"></a><a name="p1851815711620"></a>SdioReadBytesFromFunc0</p>
70</td>
71<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p751875761611"><a name="p751875761611"></a><a name="p751875761611"></a>Reads a given length of data from the address space of SDIO function 0.</p>
72</td>
73</tr>
74<tr id="row17455333175"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1645519318173"><a name="p1645519318173"></a><a name="p1645519318173"></a>SdioWriteBytesToFunc0</p>
75</td>
76<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p114552320176"><a name="p114552320176"></a><a name="p114552320176"></a>Writes a given length of data into the address space of SDIO function 0.</p>
77</td>
78</tr>
79<tr id="row34145016535"><td class="cellrowborder" valign="top" width="21.07%" headers="mcps1.2.4.1.1 "><p id="p229610227124"><a name="p229610227124"></a><a name="p229610227124"></a>SDIO block size setting</p>
80</td>
81<td class="cellrowborder" valign="top" width="34.04%" headers="mcps1.2.4.1.2 "><p id="p74531720181413"><a name="p74531720181413"></a><a name="p74531720181413"></a>SdioSetBlockSize</p>
82</td>
83<td class="cellrowborder" valign="top" width="44.89%" headers="mcps1.2.4.1.3 "><p id="p247972241411"><a name="p247972241411"></a><a name="p247972241411"></a>Sets the block size.</p>
84</td>
85</tr>
86<tr id="row778816813238"><td class="cellrowborder" rowspan="2" valign="top" width="21.07%" headers="mcps1.2.4.1.1 "><p id="p1578958142317"><a name="p1578958142317"></a><a name="p1578958142317"></a>SDIO common information retrieval/setting</p>
87</td>
88<td class="cellrowborder" valign="top" width="34.04%" headers="mcps1.2.4.1.2 "><p id="p378918842311"><a name="p378918842311"></a><a name="p378918842311"></a>SdioGetCommonInfo</p>
89</td>
90<td class="cellrowborder" valign="top" width="44.89%" headers="mcps1.2.4.1.3 "><p id="p1078919892313"><a name="p1078919892313"></a><a name="p1078919892313"></a>Obtains common information.</p>
91</td>
92</tr>
93<tr id="row5667102342417"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p2668623182411"><a name="p2668623182411"></a><a name="p2668623182411"></a>SdioSetCommonInfo</p>
94</td>
95<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p14668192362419"><a name="p14668192362419"></a><a name="p14668192362419"></a>Sets common information.</p>
96</td>
97</tr>
98<tr id="row1165101111256"><td class="cellrowborder" valign="top" width="21.07%" headers="mcps1.2.4.1.1 "><p id="p8166161192511"><a name="p8166161192511"></a><a name="p8166161192511"></a>SDIO data flushing</p>
99</td>
100<td class="cellrowborder" valign="top" width="34.04%" headers="mcps1.2.4.1.2 "><p id="p121662112256"><a name="p121662112256"></a><a name="p121662112256"></a>SdioFlushData</p>
101</td>
102<td class="cellrowborder" valign="top" width="44.89%" headers="mcps1.2.4.1.3 "><p id="p171661711112519"><a name="p171661711112519"></a><a name="p171661711112519"></a>Flushes data.</p>
103</td>
104</tr>
105<tr id="row17388101522515"><td class="cellrowborder" rowspan="2" valign="top" width="21.07%" headers="mcps1.2.4.1.1 "><p id="p53101413268"><a name="p53101413268"></a><a name="p53101413268"></a>SDIO host exclusively claiming or releasing</p>
106</td>
107<td class="cellrowborder" valign="top" width="34.04%" headers="mcps1.2.4.1.2 "><p id="p1638881562520"><a name="p1638881562520"></a><a name="p1638881562520"></a>SdioClaimHost</p>
108</td>
109<td class="cellrowborder" valign="top" width="44.89%" headers="mcps1.2.4.1.3 "><p id="p143881715152517"><a name="p143881715152517"></a><a name="p143881715152517"></a>Claims a host exclusively.</p>
110</td>
111</tr>
112<tr id="row5352175517251"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p93537557259"><a name="p93537557259"></a><a name="p93537557259"></a>SdioReleaseHost</p>
113</td>
114<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1235355511254"><a name="p1235355511254"></a><a name="p1235355511254"></a>Releases the exclusively claimed host.</p>
115</td>
116</tr>
117<tr id="row8759125415269"><td class="cellrowborder" rowspan="2" valign="top" width="21.07%" headers="mcps1.2.4.1.1 "><p id="p272143815359"><a name="p272143815359"></a><a name="p272143815359"></a>SDIO device enablement</p>
118</td>
119<td class="cellrowborder" valign="top" width="34.04%" headers="mcps1.2.4.1.2 "><p id="p6760195452615"><a name="p6760195452615"></a><a name="p6760195452615"></a>SdioEnableFunc</p>
120</td>
121<td class="cellrowborder" valign="top" width="44.89%" headers="mcps1.2.4.1.3 "><p id="p9760135417263"><a name="p9760135417263"></a><a name="p9760135417263"></a>Enables an SDIO device.</p>
122</td>
123</tr>
124<tr id="row1166105762620"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p5662175782616"><a name="p5662175782616"></a><a name="p5662175782616"></a>SdioDisableFunc</p>
125</td>
126<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p3662135722618"><a name="p3662135722618"></a><a name="p3662135722618"></a>Disables an SDIO device.</p>
127</td>
128</tr>
129<tr id="row12332331113517"><td class="cellrowborder" rowspan="2" valign="top" width="21.07%" headers="mcps1.2.4.1.1 "><p id="p188181849203614"><a name="p188181849203614"></a><a name="p188181849203614"></a>SDIO IRQ claiming/releasing</p>
130</td>
131<td class="cellrowborder" valign="top" width="34.04%" headers="mcps1.2.4.1.2 "><p id="p933383133517"><a name="p933383133517"></a><a name="p933383133517"></a>SdioClaimIrq</p>
132</td>
133<td class="cellrowborder" valign="top" width="44.89%" headers="mcps1.2.4.1.3 "><p id="p20333431203510"><a name="p20333431203510"></a><a name="p20333431203510"></a>Claims an SDIO IRQ.</p>
134</td>
135</tr>
136<tr id="row173103413357"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p2073123413515"><a name="p2073123413515"></a><a name="p2073123413515"></a>SdioReleaseIrq</p>
137</td>
138<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1773634153518"><a name="p1773634153518"></a><a name="p1773634153518"></a>Releases an SDIO IRQ.</p>
139</td>
140</tr>
141</tbody>
142</table>
143
144>![](../public_sys-resources/icon-note.gif) **NOTE:**<br>
145>All functions provided in this document can be called only in kernel mode.
146
147## Usage Guidelines<a name="section1878939192515"></a>
148
149### How to Use<a name="section1490685512255"></a>
150
151The figure below illustrates how to use the APIs.
152
153**Figure 2**  Using SDIO driver APIs
154
155
156
157
158![](figures/using-SDIO-process.png)
159
160### Opening an SDIO Controller<a name="section10782428132616"></a>
161
162Before performing SDIO communication, obtain the device handle of an SDIO controller by calling **SdioOpen**. This function returns the device handle of the SDIO controller with a specified bus number.
163
164DevHandle SdioOpen\(int16\_t mmcBusNum, struct SdioFunctionConfig \*config\);
165
166**Table 2**  Parameters and return values of SdioOpen
167
168<a name="table1036944152712"></a>
169<table><thead align="left"><tr id="row4370114192717"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p737074112720"><a name="p737074112720"></a><a name="p737074112720"></a>Parameter</p>
170</th>
171<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p15370154102716"><a name="p15370154102716"></a><a name="p15370154102716"></a>Description</p>
172</th>
173</tr>
174</thead>
175<tbody><tr id="row3370184112716"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p337094142715"><a name="p337094142715"></a><a name="p337094142715"></a>mmcBusNum</p>
176</td>
177<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p8370154162718"><a name="p8370154162718"></a><a name="p8370154162718"></a>Bus number.</p>
178</td>
179</tr>
180<tr id="row10370746272"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p23706402717"><a name="p23706402717"></a><a name="p23706402717"></a>config</p>
181</td>
182<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p153701492715"><a name="p153701492715"></a><a name="p153701492715"></a>SDIO functionality configurations.</p>
183</td>
184</tr>
185<tr id="row173703417274"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p183701349276"><a name="p183701349276"></a><a name="p183701349276"></a><strong id="b11478182120013"><a name="b11478182120013"></a><a name="b11478182120013"></a>Return Value</strong></p>
186</td>
187<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p203701647275"><a name="p203701647275"></a><a name="p203701647275"></a><strong id="b277217221307"><a name="b277217221307"></a><a name="b277217221307"></a>Description</strong></p>
188</td>
189</tr>
190<tr id="row837016462716"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p937184172716"><a name="p937184172716"></a><a name="p937184172716"></a>NULL</p>
191</td>
192<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p1837184182720"><a name="p1837184182720"></a><a name="p1837184182720"></a>Failed to obtain the device handle of an SDIO controller.</p>
193</td>
194</tr>
195<tr id="row737116492712"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p537174122715"><a name="p537174122715"></a><a name="p537174122715"></a>Device handle</p>
196</td>
197<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p113715411274"><a name="p113715411274"></a><a name="p113715411274"></a>Device handle of an SDIO controller.</p>
198</td>
199</tr>
200</tbody>
201</table>
202
203The following example shows how to open an SDIO controller.
204
205```
206DevHandle handle = NULL;
207struct SdioFunctionConfig config;
208config.funcNr = 1;
209config.vendorId = 0x123;
210config.deviceId = 0x456;
211/* Open an SDIO controller whose bus number is 1. */
212handle = SdioOpen(1, &config);
213if (handle == NULL) {
214    HDF_LOGE("SdioOpen: failed!\n");
215}
216```
217
218### Claiming a Host Exclusively<a name="section11263172312715"></a>
219
220After obtaining the device handle of an SDIO controller, exclusively claim the host before performing subsequent operations on the SDIO device.
221
222void SdioClaimHost\(DevHandle handle\);
223
224**Table 3**  Parameter description of SdioClaimHost
225
226<a name="table192822447271"></a>
227<table><thead align="left"><tr id="row192829443279"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p1128284452713"><a name="p1128284452713"></a><a name="p1128284452713"></a>Parameter</p>
228</th>
229<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p1528264418272"><a name="p1528264418272"></a><a name="p1528264418272"></a>Description</p>
230</th>
231</tr>
232</thead>
233<tbody><tr id="row328264472711"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p15282124420274"><a name="p15282124420274"></a><a name="p15282124420274"></a>handle</p>
234</td>
235<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p0282164432719"><a name="p0282164432719"></a><a name="p0282164432719"></a>Device handle of an SDIO controller.</p>
236</td>
237</tr>
238</tbody>
239</table>
240
241The following example shows how to exclusively claim a host.
242
243```
244SdioClaimHost(handle); /* Claim a host exclusively. */
245```
246
247### Enabling the SDIO Device<a name="section17861486271"></a>
248
249Before accessing a register, enable the SDIO device.
250
251int32\_t SdioEnableFunc\(DevHandle handle\);
252
253**Table 4**  Parameters and return values of SdioEnableFunc
254
255<a name="table144881047485"></a>
256<table><thead align="left"><tr id="row8487204184815"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p1648611415486"><a name="p1648611415486"></a><a name="p1648611415486"></a>Parameter</p>
257</th>
258<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p19487134124820"><a name="p19487134124820"></a><a name="p19487134124820"></a>Description</p>
259</th>
260</tr>
261</thead>
262<tbody><tr id="row16487044480"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p74878414810"><a name="p74878414810"></a><a name="p74878414810"></a>handle</p>
263</td>
264<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p17487184194819"><a name="p17487184194819"></a><a name="p17487184194819"></a>Device handle of an SDIO controller.</p>
265</td>
266</tr>
267<tr id="row13487748487"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p24873424811"><a name="p24873424811"></a><a name="p24873424811"></a><strong id="b048017216013"><a name="b048017216013"></a><a name="b048017216013"></a>Return Value</strong></p>
268</td>
269<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p4487174134813"><a name="p4487174134813"></a><a name="p4487174134813"></a><strong id="b87731622105"><a name="b87731622105"></a><a name="b87731622105"></a>Description</strong></p>
270</td>
271</tr>
272<tr id="row1748814494812"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p84878410488"><a name="p84878410488"></a><a name="p84878410488"></a>0</p>
273</td>
274<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p948715410483"><a name="p948715410483"></a><a name="p948715410483"></a>The SDIO device is enabled.</p>
275</td>
276</tr>
277<tr id="row54881416482"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p24881645489"><a name="p24881645489"></a><a name="p24881645489"></a>Negative value</p>
278</td>
279<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p10488247487"><a name="p10488247487"></a><a name="p10488247487"></a>Failed to enable the SDIO device.</p>
280</td>
281</tr>
282</tbody>
283</table>
284
285The following example shows how to enable the SDIO device.
286
287```
288int32_t ret;
289/* Enable the SDIO device. */
290ret = SdioEnableFunc(handle);
291if (ret != 0) {
292    HDF_LOGE("SdioEnableFunc: failed, ret %d\n", ret);
293}
294```
295
296### Claiming an SDIO IRQ<a name="section521213262286"></a>
297
298Before SDIO communication, claim an SDIO IRQ.
299
300int32\_t SdioClaimIrq\(DevHandle handle, SdioIrqHandler \*handler\);
301
302**Table 5**  Parameters and return values of SdioClaimIrq
303
304<a name="table1149014114815"></a>
305<table><thead align="left"><tr id="row114891042488"><th class="cellrowborder" valign="top" width="49.980000000000004%" id="mcps1.2.3.1.1"><p id="p1348864164811"><a name="p1348864164811"></a><a name="p1348864164811"></a>Parameter</p>
306</th>
307<th class="cellrowborder" valign="top" width="50.019999999999996%" id="mcps1.2.3.1.2"><p id="p14885410486"><a name="p14885410486"></a><a name="p14885410486"></a>Description</p>
308</th>
309</tr>
310</thead>
311<tbody><tr id="row048911404820"><td class="cellrowborder" valign="top" width="49.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p248974174814"><a name="p248974174814"></a><a name="p248974174814"></a>handle</p>
312</td>
313<td class="cellrowborder" valign="top" width="50.019999999999996%" headers="mcps1.2.3.1.2 "><p id="p1848915494813"><a name="p1848915494813"></a><a name="p1848915494813"></a>Device handle of an SDIO controller.</p>
314</td>
315</tr>
316<tr id="row204894454813"><td class="cellrowborder" valign="top" width="49.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p17489944488"><a name="p17489944488"></a><a name="p17489944488"></a>handler</p>
317</td>
318<td class="cellrowborder" valign="top" width="50.019999999999996%" headers="mcps1.2.3.1.2 "><p id="p1548984174813"><a name="p1548984174813"></a><a name="p1548984174813"></a>Pointer to the SDIO IRQ function.</p>
319</td>
320</tr>
321<tr id="row44898413488"><td class="cellrowborder" valign="top" width="49.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p1548934124815"><a name="p1548934124815"></a><a name="p1548934124815"></a><strong id="b548120216017"><a name="b548120216017"></a><a name="b548120216017"></a>Return Value</strong></p>
322</td>
323<td class="cellrowborder" valign="top" width="50.019999999999996%" headers="mcps1.2.3.1.2 "><p id="p54891444485"><a name="p54891444485"></a><a name="p54891444485"></a><strong id="b877422211013"><a name="b877422211013"></a><a name="b877422211013"></a>Description</strong></p>
324</td>
325</tr>
326<tr id="row748994144811"><td class="cellrowborder" valign="top" width="49.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p448918415484"><a name="p448918415484"></a><a name="p448918415484"></a>0</p>
327</td>
328<td class="cellrowborder" valign="top" width="50.019999999999996%" headers="mcps1.2.3.1.2 "><p id="p174892412489"><a name="p174892412489"></a><a name="p174892412489"></a>The SDIO IRQ is claimed.</p>
329</td>
330</tr>
331<tr id="row448914420489"><td class="cellrowborder" valign="top" width="49.980000000000004%" headers="mcps1.2.3.1.1 "><p id="p248912464817"><a name="p248912464817"></a><a name="p248912464817"></a>Negative value</p>
332</td>
333<td class="cellrowborder" valign="top" width="50.019999999999996%" headers="mcps1.2.3.1.2 "><p id="p34891645485"><a name="p34891645485"></a><a name="p34891645485"></a>Failed to claim an SDIO IRQ.</p>
334</td>
335</tr>
336</tbody>
337</table>
338
339The following example shows how to claim an SDIO IRQ.
340
341```
342/* Implement the SDIO IRQ function based on the application. */
343static void SdioIrqFunc(void *data)
344{
345    if (data == NULL) {
346        HDF_LOGE("SdioIrqFunc: data is NULL.\n");
347        return;
348    }
349    /* You need to add specific implementations. */
350}
351
352int32_t ret;
353/* Claim an SDIO IRQ. */
354ret = SdioClaimIrq(handle, SdioIrqFunc);
355if (ret != 0) {
356    HDF_LOGE("SdioClaimIrq: failed, ret %d\n", ret);
357}
358```
359
360### Performing SDIO Communication<a name="section85661522153420"></a>
361
362- Incrementally write a given length of data into the SDIO device.
363
364The corresponding function is as follows:
365
366int32\_t SdioWriteBytes\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\);
367
368**Table 6**  Parameters and return values of SdioWriteBytes
369
370<a name="table6887174174111"></a>
371<table><thead align="left"><tr id="row10887144111419"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p181381751164113"><a name="p181381751164113"></a><a name="p181381751164113"></a>Parameter</p>
372</th>
373<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p19138115184116"><a name="p19138115184116"></a><a name="p19138115184116"></a>Description</p>
374</th>
375</tr>
376</thead>
377<tbody><tr id="row4887341174114"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p1534612017427"><a name="p1534612017427"></a><a name="p1534612017427"></a>handle</p>
378</td>
379<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p8179347434"><a name="p8179347434"></a><a name="p8179347434"></a>Device handle of an SDIO controller.</p>
380</td>
381</tr>
382<tr id="row18881041144120"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p10888154118412"><a name="p10888154118412"></a><a name="p10888154118412"></a>data</p>
383</td>
384<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p1288854115413"><a name="p1288854115413"></a><a name="p1288854115413"></a>Pointer to the data to write.</p>
385</td>
386</tr>
387<tr id="row191054911432"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p91054994311"><a name="p91054994311"></a><a name="p91054994311"></a>addr</p>
388</td>
389<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p111024915432"><a name="p111024915432"></a><a name="p111024915432"></a>Start address where the data is written into.</p>
390</td>
391</tr>
392<tr id="row14888144124119"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p1588814413412"><a name="p1588814413412"></a><a name="p1588814413412"></a>size</p>
393</td>
394<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p1288813411413"><a name="p1288813411413"></a><a name="p1288813411413"></a>Length of the data to write.</p>
395</td>
396</tr>
397<tr id="row18247654163519"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p486155173610"><a name="p486155173610"></a><a name="p486155173610"></a><strong id="b84827210012"><a name="b84827210012"></a><a name="b84827210012"></a>Return Value</strong></p>
398</td>
399<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p1686155113620"><a name="p1686155113620"></a><a name="p1686155113620"></a><strong id="b16775152213010"><a name="b16775152213010"></a><a name="b16775152213010"></a>Description</strong></p>
400</td>
401</tr>
402<tr id="row10574165663512"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p912141012364"><a name="p912141012364"></a><a name="p912141012364"></a>0</p>
403</td>
404<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p51219107363"><a name="p51219107363"></a><a name="p51219107363"></a>Data is written into the SDIO device.</p>
405</td>
406</tr>
407<tr id="row1490635883519"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p10121510133617"><a name="p10121510133617"></a><a name="p10121510133617"></a>Negative value</p>
408</td>
409<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p131212106365"><a name="p131212106365"></a><a name="p131212106365"></a>Failed to write data into the SDIO device.</p>
410</td>
411</tr>
412</tbody>
413</table>
414
415The following example shows how to incrementally write a given length of data into the SDIO device.
416
417```
418int32_t ret;
419uint8_t wbuff[] = {1,2,3,4,5};
420uint32_t addr = 0x100 + 0x09;
421/* Incrementally write 5-byte data into the start address 0x109 of the SDIO device. */
422ret = SdioWriteBytes(handle, wbuff, addr, sizeof(wbuff) / sizeof(wbuff[0]));
423if (ret != 0) {
424    HDF_LOGE("SdioWriteBytes: failed, ret %d\n", ret);
425}
426```
427
428- Incrementally read a given length of data from the SDIO device.
429
430The corresponding function is as follows:
431
432int32\_t SdioReadBytes\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\);
433
434**Table 7**  Parameters and return values of SdioReadBytes
435
436<a name="table5783755152110"></a>
437<table><thead align="left"><tr id="row19783355162116"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p635754142212"><a name="p635754142212"></a><a name="p635754142212"></a>Parameter</p>
438</th>
439<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p1035774182215"><a name="p1035774182215"></a><a name="p1035774182215"></a>Description</p>
440</th>
441</tr>
442</thead>
443<tbody><tr id="row137831055192118"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p14783155192114"><a name="p14783155192114"></a><a name="p14783155192114"></a>handle</p>
444</td>
445<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p9676437202218"><a name="p9676437202218"></a><a name="p9676437202218"></a>Device handle of an SDIO controller.</p>
446</td>
447</tr>
448<tr id="row4784155102111"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p1978455510217"><a name="p1978455510217"></a><a name="p1978455510217"></a>data</p>
449</td>
450<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p767683714223"><a name="p767683714223"></a><a name="p767683714223"></a>Pointer to the data to read.</p>
451</td>
452</tr>
453<tr id="row63651118499"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p73669113496"><a name="p73669113496"></a><a name="p73669113496"></a>addr</p>
454</td>
455<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p53661144916"><a name="p53661144916"></a><a name="p53661144916"></a>Start address where the data is read from.</p>
456</td>
457</tr>
458<tr id="row7784145510218"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p1078413554219"><a name="p1078413554219"></a><a name="p1078413554219"></a>size</p>
459</td>
460<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p14676163782210"><a name="p14676163782210"></a><a name="p14676163782210"></a>Length of the data to read.</p>
461</td>
462</tr>
463<tr id="row964182643610"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p7833639163612"><a name="p7833639163612"></a><a name="p7833639163612"></a><strong id="b84831021108"><a name="b84831021108"></a><a name="b84831021108"></a>Return Value</strong></p>
464</td>
465<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p3833939113619"><a name="p3833939113619"></a><a name="p3833939113619"></a><strong id="b17775192216016"><a name="b17775192216016"></a><a name="b17775192216016"></a>Description</strong></p>
466</td>
467</tr>
468<tr id="row199479312363"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p567424413611"><a name="p567424413611"></a><a name="p567424413611"></a>0</p>
469</td>
470<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p166741544113615"><a name="p166741544113615"></a><a name="p166741544113615"></a>Data is read from the SDIO device.</p>
471</td>
472</tr>
473<tr id="row5166203418361"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p1167416448361"><a name="p1167416448361"></a><a name="p1167416448361"></a>Negative value</p>
474</td>
475<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p9674114410364"><a name="p9674114410364"></a><a name="p9674114410364"></a>Failed to read data from the SDIO device.</p>
476</td>
477</tr>
478</tbody>
479</table>
480
481The following example shows how to incrementally read a given length of data from the SDIO device.
482
483```
484int32_t ret;
485uint8_t rbuff[5] = {0};
486uint32_t addr = 0x100 + 0x09;
487/* Incrementally read 5-byte data from the start address 0x109 of the SDIO device. */
488ret = SdioReadBytes(handle, rbuff, addr, 5);
489if (ret != 0) {
490    HDF_LOGE("SdioReadBytes: failed, ret %d\n", ret);
491}
492```
493
494- Write a given length of data into the fixed address of an SDIO device.
495
496    The corresponding function is as follows:
497
498    int32\_t SdioWriteBytesToFixedAddr\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size, uint32\_t scatterLen\);
499
500   **Table 8**  Parameters and return values of SdioWriteBytesToFixedAddr
501
502    <a name="table1982918113010"></a>
503    <table><thead align="left"><tr id="row1582911114010"><th class="cellrowborder" valign="top" width="48.43%" id="mcps1.2.3.1.1"><p id="p28301411903"><a name="p28301411903"></a><a name="p28301411903"></a>Parameter</p>
504    </th>
505    <th class="cellrowborder" valign="top" width="51.57000000000001%" id="mcps1.2.3.1.2"><p id="p1883019111018"><a name="p1883019111018"></a><a name="p1883019111018"></a>Description</p>
506    </th>
507    </tr>
508    </thead>
509    <tbody><tr id="row10830141111014"><td class="cellrowborder" valign="top" width="48.43%" headers="mcps1.2.3.1.1 "><p id="p470818551018"><a name="p470818551018"></a><a name="p470818551018"></a>handle</p>
510    </td>
511    <td class="cellrowborder" valign="top" width="51.57000000000001%" headers="mcps1.2.3.1.2 "><p id="p18578510518"><a name="p18578510518"></a><a name="p18578510518"></a>Device handle of an SDIO controller.</p>
512    </td>
513    </tr>
514    <tr id="row48303111304"><td class="cellrowborder" valign="top" width="48.43%" headers="mcps1.2.3.1.1 "><p id="p127081955502"><a name="p127081955502"></a><a name="p127081955502"></a>data</p>
515    </td>
516    <td class="cellrowborder" valign="top" width="51.57000000000001%" headers="mcps1.2.3.1.2 "><p id="p1857841013110"><a name="p1857841013110"></a><a name="p1857841013110"></a>Pointer to the data to write.</p>
517    </td>
518    </tr>
519    <tr id="row9830111119019"><td class="cellrowborder" valign="top" width="48.43%" headers="mcps1.2.3.1.1 "><p id="p187085555011"><a name="p187085555011"></a><a name="p187085555011"></a>addr</p>
520    </td>
521    <td class="cellrowborder" valign="top" width="51.57000000000001%" headers="mcps1.2.3.1.2 "><p id="p257831016115"><a name="p257831016115"></a><a name="p257831016115"></a>Fixed address where the data is written into.</p>
522    </td>
523    </tr>
524    <tr id="row683091120012"><td class="cellrowborder" valign="top" width="48.43%" headers="mcps1.2.3.1.1 "><p id="p370819555013"><a name="p370819555013"></a><a name="p370819555013"></a>size</p>
525    </td>
526    <td class="cellrowborder" valign="top" width="51.57000000000001%" headers="mcps1.2.3.1.2 "><p id="p7578181015113"><a name="p7578181015113"></a><a name="p7578181015113"></a>Length of the data to write.</p>
527    </td>
528    </tr>
529    <tr id="row58301911309"><td class="cellrowborder" valign="top" width="48.43%" headers="mcps1.2.3.1.1 "><p id="p570810551107"><a name="p570810551107"></a><a name="p570810551107"></a>scatterLen</p>
530    </td>
531    <td class="cellrowborder" valign="top" width="51.57000000000001%" headers="mcps1.2.3.1.2 "><p id="p17579910915"><a name="p17579910915"></a><a name="p17579910915"></a>Length of the scatter list. If the value is not <strong id="b107381713254"><a name="b107381713254"></a><a name="b107381713254"></a>0</strong>, the data is of the scatter list type.</p>
532    </td>
533    </tr>
534    <tr id="row18215162810212"><td class="cellrowborder" valign="top" width="48.43%" headers="mcps1.2.3.1.1 "><p id="p1521319452211"><a name="p1521319452211"></a><a name="p1521319452211"></a><strong id="b648472113017"><a name="b648472113017"></a><a name="b648472113017"></a>Return Value</strong></p>
535    </td>
536    <td class="cellrowborder" valign="top" width="51.57000000000001%" headers="mcps1.2.3.1.2 "><p id="p162138457217"><a name="p162138457217"></a><a name="p162138457217"></a><strong id="b1277682210016"><a name="b1277682210016"></a><a name="b1277682210016"></a>Description</strong></p>
537    </td>
538    </tr>
539    <tr id="row2197123118210"><td class="cellrowborder" valign="top" width="48.43%" headers="mcps1.2.3.1.1 "><p id="p1921413451212"><a name="p1921413451212"></a><a name="p1921413451212"></a>0</p>
540    </td>
541    <td class="cellrowborder" valign="top" width="51.57000000000001%" headers="mcps1.2.3.1.2 "><p id="p32146451624"><a name="p32146451624"></a><a name="p32146451624"></a>Data is written into the SDIO device.</p>
542    </td>
543    </tr>
544    <tr id="row18629103314218"><td class="cellrowborder" valign="top" width="48.43%" headers="mcps1.2.3.1.1 "><p id="p132141245622"><a name="p132141245622"></a><a name="p132141245622"></a>Negative value</p>
545    </td>
546    <td class="cellrowborder" valign="top" width="51.57000000000001%" headers="mcps1.2.3.1.2 "><p id="p17214345328"><a name="p17214345328"></a><a name="p17214345328"></a>Failed to write data into the SDIO device.</p>
547    </td>
548    </tr>
549    </tbody>
550    </table>
551
552    The following example shows how to write a given length of data into the fixed address of an SDIO device.
553
554    ```
555    int32_t ret;
556    uint8_t wbuff[] = {1, 2, 3, 4, 5};
557    uint32_t addr = 0x100 + 0x09;
558    /* Write 5-byte data into the fixed address 0x109 of the SDIO device. */
559    ret = SdioWriteBytesToFixedAddr(handle, wbuff, addr, sizeof(wbuff) / sizeof(wbuff[0]), 0);
560    if (ret != 0) {
561        HDF_LOGE("SdioWriteBytesToFixedAddr: failed, ret %d\n", ret);
562    }
563    ```
564
565- Read a given length of data from the fixed address of an SDIO device.
566
567    The corresponding function is as follows:
568
569    int32\_t SdioReadBytesFromFixedAddr\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size, uint32\_t scatterLen\);
570
571   **Table 9**  Parameters and return values of SdioReadBytesFromFixedAddr
572
573    <a name="table2724132220115"></a>
574    <table><thead align="left"><tr id="row8724142214115"><th class="cellrowborder" valign="top" width="48.699999999999996%" id="mcps1.2.3.1.1"><p id="p16752055131112"><a name="p16752055131112"></a><a name="p16752055131112"></a>Parameter</p>
575    </th>
576    <th class="cellrowborder" valign="top" width="51.300000000000004%" id="mcps1.2.3.1.2"><p id="p914434191218"><a name="p914434191218"></a><a name="p914434191218"></a>Description</p>
577    </th>
578    </tr>
579    </thead>
580    <tbody><tr id="row1372462214119"><td class="cellrowborder" valign="top" width="48.699999999999996%" headers="mcps1.2.3.1.1 "><p id="p2752175516113"><a name="p2752175516113"></a><a name="p2752175516113"></a>handle</p>
581    </td>
582    <td class="cellrowborder" valign="top" width="51.300000000000004%" headers="mcps1.2.3.1.2 "><p id="p1353155020125"><a name="p1353155020125"></a><a name="p1353155020125"></a>Device handle of an SDIO controller.</p>
583    </td>
584    </tr>
585    <tr id="row197244220117"><td class="cellrowborder" valign="top" width="48.699999999999996%" headers="mcps1.2.3.1.1 "><p id="p12752165581117"><a name="p12752165581117"></a><a name="p12752165581117"></a>data</p>
586    </td>
587    <td class="cellrowborder" valign="top" width="51.300000000000004%" headers="mcps1.2.3.1.2 "><p id="p9540508121"><a name="p9540508121"></a><a name="p9540508121"></a>Pointer to the data to read.</p>
588    </td>
589    </tr>
590    <tr id="row172519228116"><td class="cellrowborder" valign="top" width="48.699999999999996%" headers="mcps1.2.3.1.1 "><p id="p1675315521120"><a name="p1675315521120"></a><a name="p1675315521120"></a>addr</p>
591    </td>
592    <td class="cellrowborder" valign="top" width="51.300000000000004%" headers="mcps1.2.3.1.2 "><p id="p05415501125"><a name="p05415501125"></a><a name="p05415501125"></a>Start address where the data is read from.</p>
593    </td>
594    </tr>
595    <tr id="row137251922131117"><td class="cellrowborder" valign="top" width="48.699999999999996%" headers="mcps1.2.3.1.1 "><p id="p47531355111111"><a name="p47531355111111"></a><a name="p47531355111111"></a>size</p>
596    </td>
597    <td class="cellrowborder" valign="top" width="51.300000000000004%" headers="mcps1.2.3.1.2 "><p id="p1954165031214"><a name="p1954165031214"></a><a name="p1954165031214"></a>Length of the data to read.</p>
598    </td>
599    </tr>
600    <tr id="row972552281111"><td class="cellrowborder" valign="top" width="48.699999999999996%" headers="mcps1.2.3.1.1 "><p id="p2753755161114"><a name="p2753755161114"></a><a name="p2753755161114"></a>scatterLen</p>
601    </td>
602    <td class="cellrowborder" valign="top" width="51.300000000000004%" headers="mcps1.2.3.1.2 "><p id="p3541350111218"><a name="p3541350111218"></a><a name="p3541350111218"></a>Length of the scatter list. If the value is not <strong id="b498517146511"><a name="b498517146511"></a><a name="b498517146511"></a>0</strong>, the data is of the scatter list type.</p>
603    </td>
604    </tr>
605    <tr id="row15725162210117"><td class="cellrowborder" valign="top" width="48.699999999999996%" headers="mcps1.2.3.1.1 "><p id="p681073451314"><a name="p681073451314"></a><a name="p681073451314"></a><strong id="b144852215014"><a name="b144852215014"></a><a name="b144852215014"></a>Return Value</strong></p>
606    </td>
607    <td class="cellrowborder" valign="top" width="51.300000000000004%" headers="mcps1.2.3.1.2 "><p id="p17810134121316"><a name="p17810134121316"></a><a name="p17810134121316"></a><strong id="b127776221003"><a name="b127776221003"></a><a name="b127776221003"></a>Description</strong></p>
608    </td>
609    </tr>
610    <tr id="row1772511227119"><td class="cellrowborder" valign="top" width="48.699999999999996%" headers="mcps1.2.3.1.1 "><p id="p78105346133"><a name="p78105346133"></a><a name="p78105346133"></a>0</p>
611    </td>
612    <td class="cellrowborder" valign="top" width="51.300000000000004%" headers="mcps1.2.3.1.2 "><p id="p18810173411312"><a name="p18810173411312"></a><a name="p18810173411312"></a>Data is read from the SDIO device.</p>
613    </td>
614    </tr>
615    <tr id="row191829161138"><td class="cellrowborder" valign="top" width="48.699999999999996%" headers="mcps1.2.3.1.1 "><p id="p1581012340131"><a name="p1581012340131"></a><a name="p1581012340131"></a>Negative value</p>
616    </td>
617    <td class="cellrowborder" valign="top" width="51.300000000000004%" headers="mcps1.2.3.1.2 "><p id="p28101834161317"><a name="p28101834161317"></a><a name="p28101834161317"></a>Failed to read data from the SDIO device.</p>
618    </td>
619    </tr>
620    </tbody>
621    </table>
622
623    The following example shows how to read a given length of data from the fixed address of an SDIO device.
624
625    ```
626    int32_t ret;
627    uint8_t rbuff[5] = {0};
628    uint32_t addr = 0x100 + 0x09;
629    /* Read 5-byte data from the fixed address 0x109 of the SDIO device. */
630    ret = SdioReadBytesFromFixedAddr(handle, rbuff, addr, 5, 0);
631    if (ret != 0) {
632        HDF_LOGE("SdioReadBytesFromFixedAddr: failed, ret %d\n", ret);
633    }
634    ```
635
636
637- Writes a given length of data into the address space of SDIO function 0.
638
639Currently, only 1-byte data can be written. The corresponding function is as follows:
640
641int32\_t SdioWriteBytesToFunc0\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\);
642
643**Table 10**  Parameters and return values of SdioWriteBytesToFunc0
644
645<a name="table5339151811112"></a>
646<table><thead align="left"><tr id="row2033991881120"><th class="cellrowborder" valign="top" width="49.94%" id="mcps1.2.3.1.1"><p id="p1116916499117"><a name="p1116916499117"></a><a name="p1116916499117"></a>Parameter</p>
647</th>
648<th class="cellrowborder" valign="top" width="50.06%" id="mcps1.2.3.1.2"><p id="p13169174971115"><a name="p13169174971115"></a><a name="p13169174971115"></a>Description</p>
649</th>
650</tr>
651</thead>
652<tbody><tr id="row9339171871118"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.2.3.1.1 "><p id="p16169194914117"><a name="p16169194914117"></a><a name="p16169194914117"></a>handle</p>
653</td>
654<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.2.3.1.2 "><p id="p10169114921110"><a name="p10169114921110"></a><a name="p10169114921110"></a>Device handle of an SDIO controller.</p>
655</td>
656</tr>
657<tr id="row93401118171116"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.2.3.1.1 "><p id="p216919491118"><a name="p216919491118"></a><a name="p216919491118"></a>data</p>
658</td>
659<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.2.3.1.2 "><p id="p5169449121117"><a name="p5169449121117"></a><a name="p5169449121117"></a>Pointer to the data to write.</p>
660</td>
661</tr>
662<tr id="row534019182114"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.2.3.1.1 "><p id="p2016934941114"><a name="p2016934941114"></a><a name="p2016934941114"></a>addr</p>
663</td>
664<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.2.3.1.2 "><p id="p8169649101112"><a name="p8169649101112"></a><a name="p8169649101112"></a>Start address where the data is written into.</p>
665</td>
666</tr>
667<tr id="row334011871113"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.2.3.1.1 "><p id="p6169194913117"><a name="p6169194913117"></a><a name="p6169194913117"></a>size</p>
668</td>
669<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.2.3.1.2 "><p id="p71691449141119"><a name="p71691449141119"></a><a name="p71691449141119"></a>Length of the data to write.</p>
670</td>
671</tr>
672<tr id="row123407185111"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.2.3.1.1 "><p id="p294173071617"><a name="p294173071617"></a><a name="p294173071617"></a><strong id="b848612215010"><a name="b848612215010"></a><a name="b848612215010"></a>Return Value</strong></p>
673</td>
674<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.2.3.1.2 "><p id="p39421830111616"><a name="p39421830111616"></a><a name="p39421830111616"></a><strong id="b27786221308"><a name="b27786221308"></a><a name="b27786221308"></a>Description</strong></p>
675</td>
676</tr>
677<tr id="row8950101811164"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.2.3.1.1 "><p id="p9942730181613"><a name="p9942730181613"></a><a name="p9942730181613"></a>0</p>
678</td>
679<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.2.3.1.2 "><p id="p89421130141617"><a name="p89421130141617"></a><a name="p89421130141617"></a>Data is written into the SDIO device.</p>
680</td>
681</tr>
682<tr id="row42485216168"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.2.3.1.1 "><p id="p1194223012167"><a name="p1194223012167"></a><a name="p1194223012167"></a>Negative value</p>
683</td>
684<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.2.3.1.2 "><p id="p19942630121617"><a name="p19942630121617"></a><a name="p19942630121617"></a>Failed to write data into the SDIO device.</p>
685</td>
686</tr>
687</tbody>
688</table>
689
690The following example shows how to write a given length of data into the address space of SDIO function 0.
691
692```
693int32_t ret;
694uint8_t wbuff = 1;
695/* Write 1-byte data into the address 0x2 of SDIO function 0. */
696ret = SdioWriteBytesToFunc0(handle, &wbuff, 0x2, 1);
697if (ret != 0) {
698    HDF_LOGE("SdioWriteBytesToFunc0: failed, ret %d\n", ret);
699}
700```
701
702- Reads a given length of data from the address space of SDIO function 0.
703
704Currently, only 1-byte data can be read. The corresponding function is as follows:
705
706int32\_t SdioReadBytesFromFunc0\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\);
707
708**Table 11**  Parameters and return values of SdioReadBytesFromFunc0
709
710<a name="table1071931161814"></a>
711<table><thead align="left"><tr id="row771918171819"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p71291418171813"><a name="p71291418171813"></a><a name="p71291418171813"></a>Parameter</p>
712</th>
713<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p51291818101818"><a name="p51291818101818"></a><a name="p51291818101818"></a>Description</p>
714</th>
715</tr>
716</thead>
717<tbody><tr id="row9720113186"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p121294185189"><a name="p121294185189"></a><a name="p121294185189"></a>handle</p>
718</td>
719<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p20129141815184"><a name="p20129141815184"></a><a name="p20129141815184"></a>Device handle of an SDIO controller.</p>
720</td>
721</tr>
722<tr id="row672017114185"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p171291186185"><a name="p171291186185"></a><a name="p171291186185"></a>data</p>
723</td>
724<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p8129118171820"><a name="p8129118171820"></a><a name="p8129118171820"></a>Pointer to the data to read.</p>
725</td>
726</tr>
727<tr id="row5720910188"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p8129121816184"><a name="p8129121816184"></a><a name="p8129121816184"></a>addr</p>
728</td>
729<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p21296189182"><a name="p21296189182"></a><a name="p21296189182"></a>Start address where the data is read from.</p>
730</td>
731</tr>
732<tr id="row172020115189"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p18129418191816"><a name="p18129418191816"></a><a name="p18129418191816"></a>size</p>
733</td>
734<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p612921851820"><a name="p612921851820"></a><a name="p612921851820"></a>Length of the data to read.</p>
735</td>
736</tr>
737<tr id="row167202113189"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p1813001881810"><a name="p1813001881810"></a><a name="p1813001881810"></a><strong id="b164871218012"><a name="b164871218012"></a><a name="b164871218012"></a>Return Value</strong></p>
738</td>
739<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p1313081817184"><a name="p1313081817184"></a><a name="p1313081817184"></a><strong id="b17795221202"><a name="b17795221202"></a><a name="b17795221202"></a>Description</strong></p>
740</td>
741</tr>
742<tr id="row17720151101818"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p131307185182"><a name="p131307185182"></a><a name="p131307185182"></a>0</p>
743</td>
744<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p113019187182"><a name="p113019187182"></a><a name="p113019187182"></a>Data is read from the SDIO device.</p>
745</td>
746</tr>
747<tr id="row1972019118189"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p18130151815185"><a name="p18130151815185"></a><a name="p18130151815185"></a>Negative value</p>
748</td>
749<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p1013001861815"><a name="p1013001861815"></a><a name="p1013001861815"></a>Failed to read data from the SDIO device.</p>
750</td>
751</tr>
752</tbody>
753</table>
754
755The following example shows how to read a given length of data from the address space of SDIO function 0.
756
757```
758int32_t ret;
759uint8_t rbuff;
760/* Read 1-byte data from the address 0x2 of SDIO function 0. */
761ret = SdioReadBytesFromFunc0(handle, &rbuff, 0x2, 1);
762if (ret != 0) {
763    HDF_LOGE("SdioReadBytesFromFunc0: failed, ret %d\n", ret);
764}
765```
766
767### Releasing the SDIO IRQ<a name="section1683449352"></a>
768
769After the SDIO communication, release the SDIO IRQ.
770
771int32\_t SdioReleaseIrq\(DevHandle handle\);
772
773**Table 12**  Parameters and return values of SdioReleaseIrq
774
775<a name="table165006412481"></a>
776<table><thead align="left"><tr id="row15499849482"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p1549964114814"><a name="p1549964114814"></a><a name="p1549964114814"></a>Parameter</p>
777</th>
778<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p749915484816"><a name="p749915484816"></a><a name="p749915484816"></a>Description</p>
779</th>
780</tr>
781</thead>
782<tbody><tr id="row1499194104813"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p9499743481"><a name="p9499743481"></a><a name="p9499743481"></a>handle</p>
783</td>
784<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p184999434815"><a name="p184999434815"></a><a name="p184999434815"></a>Device handle of an SDIO controller.</p>
785</td>
786</tr>
787<tr id="row3499442485"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p649918414812"><a name="p649918414812"></a><a name="p649918414812"></a><strong id="b54881821905"><a name="b54881821905"></a><a name="b54881821905"></a>Return Value</strong></p>
788</td>
789<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p164991242486"><a name="p164991242486"></a><a name="p164991242486"></a><strong id="b1078062218018"><a name="b1078062218018"></a><a name="b1078062218018"></a>Description</strong></p>
790</td>
791</tr>
792<tr id="row1349919494810"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p24994484820"><a name="p24994484820"></a><a name="p24994484820"></a>0</p>
793</td>
794<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p1649920414482"><a name="p1649920414482"></a><a name="p1649920414482"></a>The SDIO IRQ is released.</p>
795</td>
796</tr>
797<tr id="row17500204154810"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p194990415489"><a name="p194990415489"></a><a name="p194990415489"></a>Negative value</p>
798</td>
799<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p74997419484"><a name="p74997419484"></a><a name="p74997419484"></a>Failed to release the SDIO IRQ.</p>
800</td>
801</tr>
802</tbody>
803</table>
804
805The following example shows how to release the SDIO IRQ.
806
807```
808int32_t ret;
809/* Release the SDIO IRQ. */
810ret = SdioReleaseIrq(handle);
811if (ret != 0) {
812    HDF_LOGE("SdioReleaseIrq: failed, ret %d\n", ret);
813}
814```
815
816### Disabling the SDIO Device<a name="section15379324143611"></a>
817
818After the SDIO communication, disable the SDIO device.
819
820int32\_t SdioDisableFunc\(DevHandle handle\);
821
822**Table 13**  Parameters and return values of SdioDisableFunc
823
824<a name="table25012415481"></a>
825<table><thead align="left"><tr id="row1050010474810"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p05002419488"><a name="p05002419488"></a><a name="p05002419488"></a>Parameter</p>
826</th>
827<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p17500114174811"><a name="p17500114174811"></a><a name="p17500114174811"></a>Description</p>
828</th>
829</tr>
830</thead>
831<tbody><tr id="row65001946482"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p1150054104814"><a name="p1150054104814"></a><a name="p1150054104814"></a>handle</p>
832</td>
833<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p1850014184812"><a name="p1850014184812"></a><a name="p1850014184812"></a>Device handle of an SDIO controller.</p>
834</td>
835</tr>
836<tr id="row175013494817"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p350013434816"><a name="p350013434816"></a><a name="p350013434816"></a><strong id="b1448917215019"><a name="b1448917215019"></a><a name="b1448917215019"></a>Return Value</strong></p>
837</td>
838<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p1750184104813"><a name="p1750184104813"></a><a name="p1750184104813"></a><strong id="b37811222007"><a name="b37811222007"></a><a name="b37811222007"></a>Description</strong></p>
839</td>
840</tr>
841<tr id="row1850113413481"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p11501164114818"><a name="p11501164114818"></a><a name="p11501164114818"></a>0</p>
842</td>
843<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p1550116416489"><a name="p1550116416489"></a><a name="p1550116416489"></a>The SDIO device is disabled.</p>
844</td>
845</tr>
846<tr id="row45015444817"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p7501184154816"><a name="p7501184154816"></a><a name="p7501184154816"></a>Negative value</p>
847</td>
848<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p35011040484"><a name="p35011040484"></a><a name="p35011040484"></a>Failed to disable the SDIO device.</p>
849</td>
850</tr>
851</tbody>
852</table>
853
854The following example shows how to disable the SDIO device.
855
856```
857int32_t ret;
858/* Disable the SDIO device. */
859ret = SdioDisableFunc(handle);
860if (ret != 0) {
861    HDF_LOGE("SdioDisableFunc: failed, ret %d\n", ret);
862}
863```
864
865### Releasing the Exclusively Claimed Host<a name="section536018263713"></a>
866
867After the SDIO communication, release the exclusively claimed host.
868
869void SdioReleaseHost\(DevHandle handle\);
870
871**Table 14**  Parameter description of SdioReleaseHost
872
873<a name="table1350214164813"></a>
874<table><thead align="left"><tr id="row6502134194814"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p18501945486"><a name="p18501945486"></a><a name="p18501945486"></a>Parameter</p>
875</th>
876<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p45028414817"><a name="p45028414817"></a><a name="p45028414817"></a>Description</p>
877</th>
878</tr>
879</thead>
880<tbody><tr id="row135027411483"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p16502174204816"><a name="p16502174204816"></a><a name="p16502174204816"></a>handle</p>
881</td>
882<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p6502164184816"><a name="p6502164184816"></a><a name="p6502164184816"></a>Device handle of an SDIO controller.</p>
883</td>
884</tr>
885</tbody>
886</table>
887
888The following example shows how to release the exclusively claimed host.
889
890```
891SdioReleaseHost(handle); /* Release the exclusively claimed host. */
892```
893
894### Closing an SDIO Controller<a name="section4752739183716"></a>
895
896After the SDIO communication, close the SDIO controller.
897
898void SdioClose\(DevHandle handle\);
899
900This function releases the resources requested.
901
902**Table 15**  Parameter description of SdioClose
903
904<a name="table950324124815"></a>
905<table><thead align="left"><tr id="row1050213424819"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p18502134194818"><a name="p18502134194818"></a><a name="p18502134194818"></a>Parameter</p>
906</th>
907<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p2502154104813"><a name="p2502154104813"></a><a name="p2502154104813"></a>Description</p>
908</th>
909</tr>
910</thead>
911<tbody><tr id="row25035434810"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p175028434819"><a name="p175028434819"></a><a name="p175028434819"></a>handle</p>
912</td>
913<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p2050274194819"><a name="p2050274194819"></a><a name="p2050274194819"></a>Device handle of an SDIO controller.</p>
914</td>
915</tr>
916</tbody>
917</table>
918
919The following example shows how to close an SDIO controller.
920
921```
922SdioClose(handle); /* Close an SDIO controller. */
923```
924
925## Usage Example<a name="section376910122382"></a>
926
927The following example shows how to use an SDIO device. First, open an SDIO controller whose bus number is 1, exclusively claim a host, enable the SDIO device, claim an SDIO IRQ, and then perform SDIO communication \(such as reading and writing\). After the SDIO communication, release the SDIO IRQ, disable the SDIO device, release the host, and close the SDIO controller.
928
929```
930#include "hdf_log.h"
931#include "sdio_if.h"
932
933#define TEST_FUNC_NUM 1 /* The I/O function whose ID is 1 is used. */
934#define TEST_FBR_BASE_ADDR 0x100 /* FBR base address of the I/O function whose ID is 1 */
935#define TEST_ADDR_OFFSET 9 /* Address offset of the register to read or write */
936#define TEST_DATA_LEN 3 /* Length of the data to read or write */
937#define TEST_BLOCKSIZE 2 /* Size of a data block, in bytes */
938
939/* Implement the SDIO IRQ function based on the application. */
940static void SdioIrqFunc(void *data)
941{
942    if (data == NULL) {
943        HDF_LOGE("SdioIrqFunc: data is NULL.\n");
944        return;
945    }
946    /* You need to add specific implementations. */
947}
948
949void SdioTestSample(void)
950{
951    int32_t ret;
952    DevHandle handle = NULL;
953    uint8_t data[TEST_DATA_LEN] = {0};
954    struct SdioFunctionConfig config = {1, 0x123, 0x456};
955    uint8_t val;
956    uint32_t addr;
957
958    /* Open an SDIO controller whose bus number is 1. */
959    handle = SdioOpen(1, &config);
960    if (handle == NULL) {
961        HDF_LOGE("SdioOpen: failed!\n");
962        return;
963    }
964   /* Claim a host exclusively. */
965    SdioClaimHost(handle);
966   /* Enable the SDIO device. */
967    ret = SdioEnableFunc(handle);
968    if (ret != 0) {
969        HDF_LOGE("SdioEnableFunc: failed, ret %d\n", ret);
970        goto ENABLE_ERR;
971    }
972   /* Claim an SDIO IRQ. */
973    ret = SdioClaimIrq(handle, SdioIrqFunc);
974    if (ret != 0) {
975        HDF_LOGE("SdioClaimIrq: failed, ret %d\n", ret);
976        goto CLAIM_IRQ_ERR;
977    }
978    /* Set the block size to 2 bytes. */
979    ret = SdioSetBlockSize(handle, TEST_BLOCKSIZE);
980    if (ret != 0) {
981        HDF_LOGE("SdioSetBlockSize: failed, ret %d\n", ret);
982        goto COMM_ERR;
983    }
984    /* Read 3-byte data from the incremental address of an SDIO device. */
985    addr = TEST_FBR_BASE_ADDR * TEST_FUNC_NUM + TEST_ADDR_OFFSET;
986    ret = SdioReadBytes(handle, data, addr, TEST_DATA_LEN);
987    if (ret != 0) {
988        HDF_LOGE("SdioReadBytes: failed, ret %d\n", ret);
989        goto COMM_ERR;
990    }
991    /* Write 3-byte data into the incremental address of an SDIO device. */
992    ret = SdioWriteBytes(handle, data, addr, TEST_DATA_LEN);
993    if (ret != 0) {
994        HDF_LOGE("SdioWriteBytes: failed, ret %d\n", ret);
995        goto COMM_ERR;
996    }
997    /* Read 1-byte data from the SDIO device. */
998    ret = SdioReadBytes(handle, &val, addr, 1);
999    if (ret != 0) {
1000        HDF_LOGE("SdioReadBytes: failed, ret %d\n", ret);
1001        goto COMM_ERR;
1002    }
1003    /* Write 1-byte data into the SDIO device. */
1004    ret = SdioWriteBytes(handle, &val, addr, 1);
1005    if (ret != 0) {
1006        HDF_LOGE("SdioWriteBytes: failed, ret %d\n", ret);
1007        goto COMM_ERR;
1008    }
1009    /* Read 3-byte data from the fixed address of an SDIO device. */
1010    ret = SdioReadBytesFromFixedAddr(handle, data, addr, TEST_DATA_LEN, 0);
1011    if (ret != 0) {
1012        HDF_LOGE("SdioReadBytesFromFixedAddr: failed, ret %d\n", ret);
1013        goto COMM_ERR;
1014    }
1015    /* Write 1-byte data to the fixed address of an SDIO device. */
1016    ret = SdioWriteBytesToFixedAddr(handle, data, addr, 1, 0);
1017    if (ret != 0) {
1018        HDF_LOGE("SdioWriteBytesToFixedAddr: failed, ret %d\n", ret);
1019        goto COMM_ERR;
1020    }
1021    /* Read 1-byte data from SDIO function 0. */
1022    addr = 0x02;
1023    ret = SdioReadBytesFromFunc0(handle, &val, addr, 1);
1024    if (ret != 0) {
1025        HDF_LOGE("SdioReadBytesFromFunc0: failed, ret %d\n", ret);
1026        goto COMM_ERR;
1027    }
1028    /* Write 1-byte data into SDIO function 0. */
1029    ret = SdioWriteBytesToFunc0(handle, &val, addr, 1);
1030    if (ret != 0) {
1031        HDF_LOGE("SdioWriteBytesToFunc0: failed, ret %d\n", ret);
1032        goto COMM_ERR;
1033    }
1034COMM_ERR:
1035    /* Release the SDIO IRQ. */
1036    ret = SdioReleaseIrq(handle);
1037    if (ret != 0) {
1038        HDF_LOGE("SdioReleaseIrq: failed, ret %d\n", ret);
1039    }
1040CLAIM_IRQ_ERR:
1041    /* Disable the SDIO device. */
1042    ret = SdioDisableFunc(handle);
1043    if (ret != 0) {
1044        HDF_LOGE("SdioDisableFunc: failed, ret %d\n", ret);
1045    }
1046ENABLE_ERR:
1047    /* Release the exclusively claimed host. */
1048    SdioReleaseHost(handle);
1049    /* Close an SDIO controller. */
1050    SdioClose(handle);
1051}
1052```