📄 mass_conmmand.c
字号:
/****************************************Copyright (c)**************************************************
** Guangzou ZLG-MCU Development Co.,LTD.
** graduate school
** http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File Name: PORT_CTL.c
** Last modified Date: 2005-04-22
** Last Version: V1.0
** Description:
**
**------------------------------------------------------------------------------------------------------
** Created By: Lishan Zhou
** Created date: 2005-04-22
** Version: V1.0
** Description:
**
**------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Description:
**
********************************************************************************************************/
#include "HostStack.h"
void MCom_INQUIRY(uint8 *ComBuffPtr)
{
INQUIRY_COMMAND *inquiry_ptr;
memset( ComBuffPtr , 0x00 , 12 );
inquiry_ptr = (INQUIRY_COMMAND *)ComBuffPtr ;
inquiry_ptr->OperationCode = UFI_INQUIRY;
inquiry_ptr->AllocationLength = 0x24 ;
}
void MCom_Read10(uint8 *ComBuffPtr,uint32 LBA, uint16 TrBlocks)
{
READ_10 *read10_ptr;
memset( ComBuffPtr , 0x00 , 12 );
read10_ptr = (READ_10 *)ComBuffPtr ;
read10_ptr->OperationCode = UFI_READ10;
read10_ptr->LBA_0 = (uint8)LBA;
read10_ptr->LBA_1 = (uint8)(LBA/0x100);
read10_ptr->LBA_2 = (uint8)(LBA/0x10000);
read10_ptr->LBA_3 = (uint8)(LBA/0x1000000);
read10_ptr->TransferLength_0= (uint8)TrBlocks;
read10_ptr->TransferLength_1= (uint8)(TrBlocks/0x100);
}
void MCom_ReadCapacity(uint8 *ComBuffPtr)
{
READ_CAPACITY *read_capacity_ptr;
memset( ComBuffPtr , 0x00 , 12 );
read_capacity_ptr = (READ_CAPACITY *)ComBuffPtr ;
read_capacity_ptr->OperationCode = UFI_READCAPACITY;
}
void MCom_Write10(uint8 *ComBuffPtr, uint32 LBA, uint16 TrBlocks)
{
WRITE_10 *write10_ptr;
memset( ComBuffPtr , 0x00 , 12 );
write10_ptr = (WRITE_10 *)ComBuffPtr ;
write10_ptr->OperationCode = UFI_WRITE10;
write10_ptr->LBA_0 = (uint8)LBA;
write10_ptr->LBA_1 = (uint8)(LBA/0x100);
write10_ptr->LBA_2 = (uint8)(LBA/0x10000);
write10_ptr->LBA_3 = (uint8)(LBA/0x1000000);
write10_ptr->TransferLength_0= (uint8)TrBlocks;
write10_ptr->TransferLength_1= (uint8)(TrBlocks/0x100);
}
void MCom_RequestSense( uint8 *ComBuffPtr )
{
REQUEST_SENSE *RequestSense_ptr;
memset( ComBuffPtr , 0x00 , 12 );
RequestSense_ptr =(REQUEST_SENSE *) ComBuffPtr;
RequestSense_ptr->OperationCode = UFI_REQUESTSENSE ;
RequestSense_ptr->AllocationLength = 18;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -