电子说
(2)usb_prop.c文件修改
原文件
修改后文件
(3)memory.h文件修改
(4)mass_mal.h文件修改
(5)memory.c文件修改
(6)usb_bot.c文件修改
(7)mass_mal.c文件重写
#include "platform_config.h"
#include "mass_mal.h"
#include "sdio_sdcard.h"
#include "w25q128.h"
long long Mass_Memory_Size[ MAX_LUN+1 ] ;
u32 Mass_Block_Size[ MAX_LUN+1 ] ;
u32 Mass_Block_Count[ MAX_LUN+1 ] ;
uint16_t MAL_Init( uint8_t lun )
{
u16 Status=MAL_OK ;
switch( lun )
{
case 0: break;
case 1: break;
default:return MAL_FAIL ;
}
return Status ;
}
uint16_t MAL_Write(uint8_t lun, uint64_t Memory_Offset, uint32_t *Writebuff, uint16_t Transfer_Length)
{
u8 STA ;
switch( lun )
{
//磁盘0为 SPI FLASH盘
case 0:
STA = 0 ;
W25QXX_Write( ( u8* )Writebuff, Memory_Offset, Transfer_Length ) ;
break ;
//磁盘1为SD卡
case 1:
STA = SD_WriteDisk( ( u8* )Writebuff, Memory_Offset>>9, Transfer_Length>>9 ) ;
break ;
default:
return MAL_FAIL ;
}
if( STA!=0 )
return MAL_FAIL ;
return MAL_OK ;
}
uint16_t MAL_Read( uint8_t lun, uint64_t Memory_Offset, uint32_t *Readbuff, uint16_t Transfer_Length )
{
u8 STA ;
switch( lun )
{
//磁盘0为 SPI FLASH盘
case 0 :
STA = 0 ;
W25QXX_Read( ( u8* )Readbuff, Memory_Offset, Transfer_Length ) ;
break;
//磁盘1为SD卡
case 1 :
STA = SD_ReadDisk( ( u8* )Readbuff, Memory_Offset>>9, Transfer_Length>>9 ) ;
break;
default:return MAL_FAIL ;
}
if( STA!=0 )
return MAL_FAIL ;
return MAL_OK ;
}
uint16_t MAL_GetStatus( uint8_t lun )
{
switch( lun )
{
case 0:return MAL_OK;
case 1:return MAL_OK;
default:return MAL_FAIL;
}
}
全部0条评论
快来发表一下你的评论吧 !