38 #include "hal_platform.h" 40 #ifdef HAL_SD_MODULE_ENABLED 717 #ifdef HAL_SD_CARD_DETECTION 817 HAL_SD_TYPE_SD_CARD = 0,
823 HAL_SD_TYPE_UNKNOWN_CARD = 0xff,
826 #ifdef HAL_SD_CARD_DETECTION 865 #ifdef HAL_SD_CARD_DETECTION 919 #ifdef HAL_SD_CARD_DETECTION The SD/eMMC bus is busy error occurred.
Definition: hal_sd.h:802
hal_sd_status_t hal_sd_get_clock(hal_sd_port_t sd_port, uint32_t *clock)
This function gets the output clock of the MSDC.
An data timeout occurred during transaction.
Definition: hal_sd.h:843
hal_sd_port_t
This enum defines the SD/eMMC port.
Definition: hal_platform.h:1056
hal_sd_card_event_t
This enum defines the card detection result event.
Definition: hal_sd.h:830
hal_sd_status_t hal_sd_read_blocks_dma(hal_sd_port_t sd_port, uint32_t *read_buffer, uint32_t read_address, uint32_t block_number)
This function reads data from the SD/eMMC card in the DMA interrupt mode.
hal_sd_status_t hal_sd_get_card_status(hal_sd_port_t sd_port, uint32_t *card_status)
This function gets the card status of the SD/eMMC card.
hal_sd_status_t hal_sd_init(hal_sd_port_t sd_port, hal_sd_config_t *sd_config)
This function initializes the MSDC and SD/eMMC card.
void(* hal_sd_card_detect_callback_t)(hal_sd_card_event_t event, void *user_data)
This defines the callback function prototype.
Definition: hal_sd.h:877
hal_sd_status_t hal_sd_write_blocks_dma(hal_sd_port_t sd_port, const uint32_t *write_buffer, uint32_t write_address, uint32_t block_number)
This function writes data to the SD/eMMC card in the DMA interrupt mode.
hal_sd_status_t hal_sd_set_clock(hal_sd_port_t sd_port, uint32_t clock)
This function sets the output clock of the MSDC.
The SD/eMMC read/write data with 4 bit bus width.
Definition: hal_sd.h:811
hal_sd_status_t hal_sd_get_capacity(hal_sd_port_t sd_port, uint64_t *capacity)
This function gets the card capacity of the SD/eMMC card.
hal_sd_status_t hal_sd_write_blocks(hal_sd_port_t sd_port, const uint32_t *write_data, uint32_t start_address, uint32_t block_number)
This function writes data to the SD/eMMC card in the MCU mode.
An CRC error occurred during transaction.
Definition: hal_sd.h:842
The SD/eMMC read/write data with 1 bit bus width.
Definition: hal_sd.h:810
hal_sd_status_t hal_sd_get_csd(hal_sd_port_t sd_port, uint32_t *csd)
This function gets the CSD register value of the SD/eMMC card.
hal_sd_status_t hal_sd_register_card_detection_callback(hal_sd_port_t sd_port, hal_sd_callback_t sd_callback, void *user_data)
This function registers a callback function to detect a card.
hal_sd_bus_width_t bus_width
The SD/eMMC read/write bus width.
Definition: hal_sd.h:857
void(* hal_sd_callback_t)(hal_sd_callback_event_t event, void *user_data)
This defines the callback function prototype.
Definition: hal_sd.h:894
An SD card is removed.
Definition: hal_sd.h:832
hal_sd_status_t hal_sd_write_blocks_dma_blocking(hal_sd_port_t sd_port, const uint32_t *write_data, uint32_t start_address, uint32_t block_number)
This function writes data to the SD/eMMC card in the DMA blocking mode.
The transaction completed without any error.
Definition: hal_sd.h:840
hal_sd_card_type_t
This enum define the SD/eMMC card type.
Definition: hal_sd.h:816
hal_sd_status_t
This enum defines the SD/eMMC API's return type.
Definition: hal_sd.h:801
hal_sd_status_t hal_sd_erase_sectors(hal_sd_port_t sd_port, uint32_t start_sector, uint32_t sector_number)
This function erases the card sectors of the SD/eMMC card.
MMC card.
Definition: hal_sd.h:819
hal_sd_status_t hal_sd_deinit(hal_sd_port_t sd_port)
This function deinitializes the MSDC and the SD/eMMC settings.
uint32_t clock
The MSDC I/O bus clock, the unit is kHz.
Definition: hal_sd.h:858
SD 2.0 card and capacity less than 2GB.
Definition: hal_sd.h:820
hal_sd_status_t hal_sd_register_callback(hal_sd_port_t sd_port, hal_sd_callback_t sd_callback, void *user_data)
This function registers a callback function to transfer data with DMA.
hal_sd_bus_width_t
This enum defines the SD/eMMC bus width types.
Definition: hal_sd.h:809
hal_sd_status_t hal_sd_set_bus_width(hal_sd_port_t sd_port, hal_sd_bus_width_t bus_width)
This function sets a bus width for MSDC and the SD/eMMC card.
No error occurred during the function call.
Definition: hal_sd.h:804
This structure define the SD/eMMC initialize parameter.
Definition: hal_sd.h:856
hal_sd_status_t hal_sd_read_blocks(hal_sd_port_t sd_port, uint32_t *read_buffer, uint32_t start_address, uint32_t block_number)
This function reads data from the SD/eMMC card in the MCU mode.
hal_sd_status_t hal_sd_get_cid(hal_sd_port_t sd_port, uint32_t *cid)
This function gets the CID register value of the SD/eMMC card.
An error occurred and the operation failed.
Definition: hal_sd.h:803
hal_sd_status_t hal_sd_get_ocr(hal_sd_port_t sd_port, uint32_t *ocr)
This function gets the OCR register value of the SD/eMMC card.
hal_sd_callback_event_t
This enum defines the card DMA transfer result event.
Definition: hal_sd.h:839
hal_sd_status_t hal_sd_get_erase_sector_size(hal_sd_port_t sd_port, uint32_t *erase_sector_size)
This function gets the sector size of the SD/eMMC card to erase.
An SD card is inserted.
Definition: hal_sd.h:831
SD 2.0 card and capacity larger than 2GB.
Definition: hal_sd.h:821
hal_sd_status_t hal_sd_read_blocks_dma_blocking(hal_sd_port_t sd_port, uint32_t *read_buffer, uint32_t start_address, uint32_t block_number)
This function reads data from the SD/eMMC card in the DMA blocking mode.
hal_sd_status_t hal_sd_get_card_type(hal_sd_port_t sd_port, hal_sd_card_type_t *card_type)
This function gets the card type of the SD/eMMC card.
An error occurred during transaction.
Definition: hal_sd.h:841
EMMC 4.2 and above card.
Definition: hal_sd.h:822
SD card.
Definition: hal_sd.h:818