libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
bsp_sd_diskio.h
Go to the documentation of this file.
1#pragma once
2#ifndef DSY_BSP_SD_DISKIO_H
3#define DSY_BSP_SD_DISKIO_H
4#include <stdint.h>
5
16/*
17This struct is identical to the struct provided as "HAL_SD_CardInfoTypeDef"
18I'm using this to allow users to link to the fatfs middleware without having to then link in the entire HAL to their project.
19*/
20typedef struct
21{
22 uint32_t CardType;
24 uint32_t CardVersion;
26 uint32_t Class;
28 uint32_t RelCardAdd;
30 uint32_t BlockNbr;
32 uint32_t BlockSize;
34 uint32_t LogBlockNbr;
36 uint32_t LogBlockSize;
38 uint32_t CardSpeed;
41
42#define BSP_SD_CardInfo DSY_SD_CardInfoTypeDef
43#define MSD_OK ((uint8_t)0x00)
44#define MSD_ERROR ((uint8_t)0x01)
45#define MSD_ERROR_SD_NOT_PRESENT ((uint8_t)0x02)
46#define SD_TRANSFER_OK ((uint8_t)0x00)
47#define SD_TRANSFER_BUSY ((uint8_t)0x01)
48#define SD_PRESENT ((uint8_t)0x01)
49#define SD_NOT_PRESENT ((uint8_t)0x00)
50#define SD_DATATIMEOUT ((uint32_t)100000000)
52// Functions internal for diskIO
53uint8_t BSP_SD_Init(void);
54uint8_t BSP_SD_ITConfig(void);
62uint8_t BSP_SD_ReadBlocks(uint32_t *pData,
63 uint32_t ReadAddr,
64 uint32_t NumOfBlocks,
65 uint32_t Timeout);
72uint8_t BSP_SD_WriteBlocks(uint32_t *pData,
73 uint32_t WriteAddr,
74 uint32_t NumOfBlocks,
75 uint32_t Timeout);
76
83uint8_t
84BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks);
85
92uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData,
93 uint32_t WriteAddr,
94 uint32_t NumOfBlocks);
95
101uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);
102
105
108
110uint8_t BSP_SD_IsDetected(void);
111
121
122#endif
void BSP_SD_AbortCallback(void)
uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout)
uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks)
uint8_t BSP_SD_Init(void)
uint8_t BSP_SD_ITConfig(void)
void BSP_SD_ReadCpltCallback(void)
void BSP_SD_GetCardInfo(DSY_SD_CardInfoTypeDef *CardInfo)
#define BSP_SD_CardInfo
Definition bsp_sd_diskio.h:42
uint8_t BSP_SD_GetCardState(void)
uint8_t BSP_SD_IsDetected(void)
uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout)
uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks)
void BSP_SD_WriteCpltCallback(void)
uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr)
Definition bsp_sd_diskio.h:21
uint32_t BlockSize
Definition bsp_sd_diskio.h:32
uint32_t CardVersion
Definition bsp_sd_diskio.h:24
uint32_t BlockNbr
Definition bsp_sd_diskio.h:30
uint32_t RelCardAdd
Definition bsp_sd_diskio.h:28
uint32_t Class
Definition bsp_sd_diskio.h:26
uint32_t LogBlockNbr
Definition bsp_sd_diskio.h:34
uint32_t CardSpeed
Definition bsp_sd_diskio.h:38
uint32_t LogBlockSize
Definition bsp_sd_diskio.h:36
uint32_t CardType
Definition bsp_sd_diskio.h:22