高级会员
- 积分
- 797
- 金钱
- 797
- 注册时间
- 2012-2-27
- 在线时间
- 7 小时
|
楼主 |
发表于 2013-5-30 15:52:14
|
显示全部楼层
回复【4楼】正点原子:
---------------------------------
浏览了一下相关文件,USB底层读写函数不一样。其他都一样的。
改动地方应该只有mass_mal.c里的接口函数。
我实验了一下,一个成功的例子只改了mass_mal.c里的接口函数就出现了上面错误。其他都没动过。
uint16_t MAL_Init(uint8_t lun)
{
uint16_t status = MAL_OK;
switch (lun)
{
case 0:
// Status = SD_Init();
// Status =SD_Initialize();
Status = SD_Initialize();
printf("\r\n SD 容量 %dMB \n\r",SD_GetDeviceSize());
break;
#ifdef USE_STM3210E_EVAL
case 1:
NAND_Init();
break;
#endif
default:
return MAL_FAIL;
}
return status;
}
uint16_t MAL_Write(uint8_t lun, uint32_t Memory_Offset, uint32_t *Writebuff, uint16_t Transfer_Length)
{
switch (lun)
{
case 0:
// Status = SD_WriteBlock((uint8_t*)Writebuff, Memory_Offset, Transfer_Length);
Status = SD_WriteDisk((uint8_t*)Writebuff, Memory_Offset>>9, Transfer_Length>>9);
#ifdef USE_STM3210E_EVAL
if ( Status != SD_OK )
{
return MAL_FAIL;
}
#endif /* USE_STM3210E_EVAL */
break;
#ifdef USE_STM3210E_EVAL
case 1:
NAND_Write(Memory_Offset, Writebuff, Transfer_Length);
break;
#endif /* USE_STM3210E_EVAL */
default:
return MAL_FAIL;
}
return MAL_OK;
}
uint16_t MAL_Read(uint8_t lun, uint32_t Memory_Offset, uint32_t *Readbuff, uint16_t Transfer_Length)
{
switch (lun)
{
case 0:
// Status = SD_ReadBlock((uint8_t*)Readbuff, Memory_Offset, Transfer_Length);
Status = SD_ReadDisk((uint8_t*)Readbuff, Memory_Offset>>9, Transfer_Length>>9);
#ifdef USE_STM3210E_EVAL
if ( Status != SD_OK )
{
return MAL_FAIL;
}
#endif /* USE_STM3210E_EVAL */
break;
#ifdef USE_STM3210E_EVAL
case 1:
NAND_Read(Memory_Offset, Readbuff, Transfer_Length);
;
break;
#endif
default:
return MAL_FAIL;
}
return MAL_OK;
}
uint16_t MAL_GetStatus (uint8_t lun)
{
switch(lun)
{
case 0:
return MAL_OK;
case 1:
return MAL_FAIL;
case 2:
return MAL_FAIL;
default:
return MAL_FAIL;
}
return MAL_FAIL;
} |
|