Line data Source code
1 1 : /*
2 : * Copyright 2022 NXP
3 : *
4 : * SPDX-License-Identifier: Apache-2.0
5 : */
6 :
7 : /**
8 : * @file
9 : * @brief Public API for MMC memory card subsystem
10 : */
11 :
12 : #ifndef ZEPHYR_INCLUDE_SD_MMC_H_
13 : #define ZEPHYR_INCLUDE_SD_MMC_H_
14 :
15 : #include <zephyr/device.h>
16 : #include <zephyr/drivers/sdhc.h>
17 : #include <zephyr/sd/sd.h>
18 :
19 : #ifdef __cplusplus
20 : extern "C" {
21 : #endif
22 :
23 : /**
24 : * @brief Write blocks to MMC card from buffer
25 : *
26 : * Writes blocks from MMC buffer to MMC card. For best performance, this buffer
27 : * should be aligned to CONFIG_SDHC_BUFFER_ALIGNMENT
28 : * @param card MMC card to write from
29 : * @param wbuf write buffer
30 : * @param start_block first block to write to
31 : * @param num_blocks number of blocks to write
32 : * @retval 0 write succeeded
33 : * @retval -EBUSY: card is busy with another request
34 : * @retval -ETIMEDOUT: card write timed out
35 : * @retval -EIO: I/O error
36 : */
37 1 : int mmc_write_blocks(struct sd_card *card, const uint8_t *wbuf,
38 : uint32_t start_block, uint32_t num_blocks);
39 :
40 : /**
41 : * @brief Read block from MMC card to buffer
42 : *
43 : * Reads blocks into MMC buffer from MMC card. For best performance, this buffer
44 : * should be aligned to CONFIG_SDHC_BUFFER_ALIGNMENT
45 : * @param card MMC card to read from
46 : * @param rbuf read buffer
47 : * @param start_block first block to read from
48 : * @param num_blocks number of blocks to read
49 : * @retval 0 read succeeded
50 : * @retval -EBUSY: card is busy with another request
51 : * @retval -ETIMEDOUT: card read timed out
52 : * @retval -EIO: I/O error
53 : */
54 1 : int mmc_read_blocks(struct sd_card *card, uint8_t *rbuf,
55 : uint32_t start_block, uint32_t num_blocks);
56 :
57 : /**
58 : * @brief Get I/O control data from MMC card
59 : *
60 : * Sends I/O control commands to MMC card.
61 : * @param card MMC card
62 : * @param cmd I/O control command
63 : * Mirrors disk subsystem,
64 : * see include/zephyr/drivers/disk.h for list of possible commands.
65 : * @param buf I/O control buf
66 : * @retval 0 IOCTL command succeeded
67 : * @retval -ENOTSUP: IOCTL command not supported
68 : * @retval -EIO: I/O failure
69 : */
70 1 : int mmc_ioctl(struct sd_card *card, uint8_t cmd, void *buf);
71 :
72 : #ifdef __cplusplus
73 : }
74 : #endif
75 :
76 : #endif /* ZEPHYR_INCLUDE_SD_MMC_H_ */
|