📄 spi_mmc.h
字号:
/*----------------------------------------------------------------------
www.mcu123.com
--------------------------------------------------------------------*/
#ifndef __SPI_MMC_H__
#define __SPI_MMC_H__
/* SPI select pin */
#define SPI_SEL 0x00100000
/* The SPI data is 8 bit long, the MMC use 48 bits, 6 bytes */
#define MMC_CMD_SIZE 6
/* the max SD/MMC flash size is 256MB */
#define MMC_DATA_SIZE 512 /* 16-bit in size, 512 bytes */
#define MAX_TIMEOUT 0xFF
#define IDLE_STATE_TIMEOUT 1
#define OP_COND_TIMEOUT 2
#define SET_BLOCKLEN_TIMEOUT 3
#define WRITE_BLOCK_TIMEOUT 4
#define WRITE_BLOCK_FAIL 5
#define READ_BLOCK_TIMEOUT 6
#define READ_BLOCK_DATA_TOKEN_MISSING 7
#define DATA_TOKEN_TIMEOUT 8
#define SELECT_CARD_TIMEOUT 9
#define SET_RELATIVE_ADDR_TIMEOUT 10
#define ACMD_TIMEOUT 11
void SPI_Init( void );
void SPI_Send( BYTE *Buf, DWORD Length );
void SPI_Receive( BYTE *Buf, DWORD Length );
BYTE SPI_ReceiveByte( void );
int mmc_init(void);int mmc_response(BYTE response);int mmc_read_block(WORD block_number);int mmc_write_block(WORD block_number);
int mmc_wait_for_write_finish(void);
#endif /* __SPI_MMC_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -