change usb msc lun=2

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@324 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
wuyangyong 2010-01-20 12:56:51 +00:00
parent 736bd9fd66
commit 9b282bd925
4 changed files with 234 additions and 187 deletions

View File

@ -86,8 +86,9 @@
#define BLKVFY 0x04
extern uint8_t Page00_Inquiry_Data[];
extern uint8_t Standard_Inquiry_Data[];
extern uint8_t Standard_Inquiry_Data1[];
extern uint8_t Standard_Inquiry_Data2[];
extern uint8_t Standard_Inquiry_Data3[];
extern uint8_t Mode_Sense6_data[];
extern uint8_t Mode_Sense10_data[];
extern uint8_t Scsi_Sense_Data[];

View File

@ -21,7 +21,9 @@
uint32_t Mass_Memory_Size[3];
uint32_t Mass_Block_Size[3];
uint32_t Mass_Block_Count[3];
uint32_t Max_Lun = 0;
/* logic unit count; the first is 0 */
uint32_t Max_Lun = 2;
rt_device_t dev_sdio = RT_NULL;
@ -34,6 +36,12 @@ uint16_t MAL_Init(uint8_t lun)
case 0:
status = MAL_OK;
break;
case 1:
status = MAL_FAIL;
break;
case 2:
status = MAL_FAIL;
break;
default:
return MAL_FAIL;
}
@ -74,11 +82,24 @@ uint16_t MAL_Read(uint8_t lun, uint32_t Memory_Offset, uint32_t *Readbuff, uint1
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;
}
#if 0
if(lun == 0)
{
return MAL_OK;
}
return MAL_FAIL;
#endif
}
/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/

View File

@ -24,7 +24,7 @@ uint8_t Page00_Inquiry_Data[] =
0x00,
0x00 /* Supported Pages 00*/
};
uint8_t Standard_Inquiry_Data[] =
uint8_t Standard_Inquiry_Data1[] =
{
0x00, /* Direct Access Device */
0x80, /* RMB = 1: Removable Medium */
@ -63,6 +63,26 @@ uint8_t Standard_Inquiry_Data2[] =
/* Product Revision Level */
'1', '.', '0', ' '
};
uint8_t Standard_Inquiry_Data3[] =
{
0x00, /* Direct Access Device */
0x80, /* RMB = 1: Removable Medium */
0x02, /* Version: No conformance claim to standard */
0x02, /* 数据响应格式 */
36 - 4, /* 附加数据长度为31字节 */
0x00, /* SCCS = 1: Storage Controller Component */
0x00,
0x00,
/* Vendor Identification */
'S', 'T', 'M', '3', '2', ' ', ' ', ' ',
/* Product Identification */
'n', 'e', 't', 'r', 'a', 'd', 'i', 'o', ' ',
'D', 'I', 'S', 'K', '3', ' ', ' ',
/* Product Revision Level */
'1', '.', '0', ' '
};
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
uint8_t Mode_Sense6_data[] =
{

View File

@ -32,9 +32,11 @@ extern uint8_t Bulk_Data_Buff[BULK_MAX_PACKET_SIZE]; /* data buffer*/
extern uint8_t Bot_State;
extern Bulk_Only_CBW CBW;
extern Bulk_Only_CSW CSW;
extern uint32_t Mass_Memory_Size[2];
extern uint32_t Mass_Block_Size[2];
extern uint32_t Mass_Block_Count[2];
/* lun=3 1:SPI_FLASH 2:SD card 3:NAND-FLASH */
extern uint32_t Mass_Memory_Size[3];
extern uint32_t Mass_Block_Size[3];
extern uint32_t Mass_Block_Count[3];
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
@ -58,14 +60,17 @@ void SCSI_Inquiry_Cmd(uint8_t lun)
}
else
{
if ( lun == 0)
{
Inquiry_Data = Standard_Inquiry_Data;
}
else
switch(lun)
{
case 0:
Inquiry_Data = Standard_Inquiry_Data1;
break;
case 1:
Inquiry_Data = Standard_Inquiry_Data2;
break;
case 2:
Inquiry_Data = Standard_Inquiry_Data3;
break;
}
if (CBW.CB[4] <= STANDARD_INQUIRY_DATA_LEN)