提交 d088d601 编写于 作者: wuyangyong's avatar wuyangyong

usb msc ghost

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@331 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 832ca0af
......@@ -56,12 +56,12 @@ uint16_t MAL_Write(uint8_t lun, uint32_t Memory_Offset, uint32_t *Writebuff, uin
{
case 0:
{
dev_spi_flash->write(dev_spi_flash,Memory_Offset,Writebuff,Transfer_Length);
dev_sdio->write(dev_sdio,Memory_Offset,Writebuff,Transfer_Length);
}
break;
case 1:
{
dev_sdio->write(dev_sdio,Memory_Offset,Writebuff,Transfer_Length);
dev_spi_flash->write(dev_spi_flash,Memory_Offset,Writebuff,Transfer_Length);
}
break;
default:
......@@ -77,12 +77,12 @@ uint16_t MAL_Read(uint8_t lun, uint32_t Memory_Offset, uint32_t *Readbuff, uint1
{
case 0:
{
dev_spi_flash->read(dev_spi_flash,Memory_Offset,Readbuff,Transfer_Length);
dev_sdio->read(dev_sdio,Memory_Offset,Readbuff,Transfer_Length);
}
break;
case 1:
{
dev_sdio->read(dev_sdio,Memory_Offset,Readbuff,Transfer_Length);
dev_spi_flash->read(dev_spi_flash,Memory_Offset,Readbuff,Transfer_Length);
}
break;
default:
......
......@@ -6,9 +6,9 @@
#include "rtthread.h"
extern uint32_t Mass_Memory_Size[2];
extern uint32_t Mass_Block_Size[2];
extern uint32_t Mass_Block_Count[2];
extern uint32_t Mass_Memory_Size[3];
extern uint32_t Mass_Block_Size[3];
extern uint32_t Mass_Block_Count[3];
extern rt_device_t dev_sdio;
extern rt_device_t dev_spi_flash;
......@@ -23,17 +23,17 @@ void USB_cable(void)
/* SPI_FLASH */
dev_spi_flash = rt_device_find("spi0");
Mass_Block_Size[0] = 512;
Mass_Block_Count[0] = 4096;
Mass_Memory_Size[0] = 4096*512;
Mass_Block_Size[1] = 512;
Mass_Block_Count[1] = 4096;
Mass_Memory_Size[1] = 4096*512;
if(dev != RT_NULL)
{
dev_sdio = dev;
sdio_info = (SD_CardInfo *)dev->private;
Mass_Memory_Size[1] = sdio_info->CardCapacity;
Mass_Block_Size[1] = sdio_info->CardBlockSize;
Mass_Block_Count[1] = Mass_Memory_Size[0] / Mass_Block_Size[0];
Mass_Memory_Size[0] = sdio_info->CardCapacity;
Mass_Block_Size[0] = sdio_info->CardBlockSize;
Mass_Block_Count[0] = Mass_Memory_Size[0] / Mass_Block_Size[0];
}
else
{
......
......@@ -243,7 +243,7 @@ void rt_hw_board_init()
SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_256;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_64;/* 72M/64=1.125M */
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_Init(SPI1, &SPI_InitStructure);
......
......@@ -73,7 +73,7 @@ static unsigned char AT45DB_StatusRegisterRead(void)
static void wait_busy(void)
{
unsigned int i=0;
while (i++<255)
while (i++<2000)
{
if (AT45DB_StatusRegisterRead()&0x80)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册