本文整理汇总了C++中Bot_Abort函数的典型用法代码示例。如果您正苦于以下问题:C++ Bot_Abort函数的具体用法?C++ Bot_Abort怎么用?C++ Bot_Abort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Bot_Abort函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Mass_Storage_Out
/*******************************************************************************
* Function Name : Mass_Storage_Out
* Description : Mass Storage OUT transfer.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void Mass_Storage_Out (void)
{
u8 CMD;
CMD = CBW.CB[0];
Data_Len = GetEPRxCount(ENDP2);
PMAToUserBufferCopy(Bulk_Data_Buff, ENDP2_RXADDR, Data_Len);
switch (Bot_State)
{
case BOT_IDLE:
CBW_Decode();
break;
case BOT_DATA_OUT:
if (CMD == SCSI_WRITE10)
{
SCSI_Write10_Cmd(SCSI_LBA , SCSI_BlkLen);
break;
}
Bot_Abort(DIR_OUT);
Set_Scsi_Sense_Data(ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_PHASE_ERROR, SEND_CSW_DISABLE);
break;
default:
Bot_Abort(BOTH_DIR);
Set_Scsi_Sense_Data(ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_PHASE_ERROR, SEND_CSW_DISABLE);
break;
}
}
示例2: Mass_Storage_Out
/*******************************************************************************
* Function Name : Mass_Storage_Out
* Description : Mass Storage OUT transfer.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void Mass_Storage_Out (void)
{
uint8_t CMD;
CMD = CBW.CB[0];
Data_Len = USB_SIL_Read(EP5_OUT, Bulk_Data_Buff);
switch (Bot_State)
{
case BOT_IDLE:
CBW_Decode();
break;
case BOT_DATA_OUT:
if (CMD == SCSI_WRITE10)
{
SCSI_Write10_Cmd(CBW.bLUN , SCSI_LBA , SCSI_BlkLen);
break;
}
Bot_Abort(DIR_OUT);
Set_Scsi_Sense_Data(CBW.bLUN, ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_PHASE_ERROR, SEND_CSW_DISABLE);
break;
default:
Bot_Abort(BOTH_DIR);
Set_Scsi_Sense_Data(CBW.bLUN, ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_PHASE_ERROR, SEND_CSW_DISABLE);
break;
}
//az
#ifndef STM32F10X_CL
/* Enable the receive of data on EP3 */
SetEPRxValid(ENDP5);
#endif /* STM32F10X_CL */
}
示例3: SCSI_Address_Management
/*******************************************************************************
* Function Name : SCSI_Address_Management
* Description : Test the received address.
* Input : u8 Cmd : the command can be SCSI_READ10 or SCSI_WRITE10.
* Output : None.
* Return : Read\Write status (bool).
*******************************************************************************/
bool SCSI_Address_Management(u8 Cmd , u32 LBA , u32 BlockNbr)
{
if ((LBA + BlockNbr) > Mass_Block_Count )
{
if (Cmd == SCSI_WRITE10)
{
Bot_Abort(BOTH_DIR);
}
Bot_Abort(DIR_IN);
Set_Scsi_Sense_Data(ILLEGAL_REQUEST, ADDRESS_OUT_OF_RANGE);
Set_CSW (CSW_CMD_FAILED, SEND_CSW_DISABLE);
return false;
}
if (CBW.dDataLength != BlockNbr * Mass_Block_Size)
{
if (Cmd == SCSI_WRITE10)
{
Bot_Abort(BOTH_DIR);
}
else
{
Bot_Abort(DIR_IN);
}
Set_Scsi_Sense_Data(ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_CMD_FAILED, SEND_CSW_DISABLE);
return false;
}
return true;
}
示例4: Mass_Storage_Out
/*******************************************************************************
* Function Name : Mass_Storage_Out
* Description : Mass Storage OUT transfer.
* Input : None.
* Output : None.
* Return : None.
//USB->设备
*******************************************************************************/
void Mass_Storage_Out (void)
{
u8 CMD;
USB_STATUS_REG|=0X10;//标记轮询
CMD = CBW.CB[0];
Data_Len = GetEPRxCount(ENDP4);
PMAToUserBufferCopy(Bulk_Data_Buff, ENDP4_RXADDR, Data_Len);
//printf("Bot_State_out:%d;Data_Len=%d",Bot_State,Data_Len);
switch (Bot_State)
{
case BOT_IDLE:
CBW_Decode();
break;
case BOT_DATA_OUT://USB发送数据到设备
if (CMD == SCSI_WRITE10)
{
USB_STATUS_REG|=0X01;//标记正在写数据
SCSI_Write10_Cmd(CBW.bLUN , SCSI_LBA , SCSI_BlkLen);
break;
}
Bot_Abort(DIR_OUT);
Set_Scsi_Sense_Data(CBW.bLUN, ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_PHASE_ERROR, SEND_CSW_DISABLE);
break;
default:
Bot_Abort(BOTH_DIR);
Set_Scsi_Sense_Data(CBW.bLUN, ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_PHASE_ERROR, SEND_CSW_DISABLE);
break;
}
}
示例5: SCSI_Address_Management
/*******************************************************************************
* Function Name : SCSI_Address_Management
* Description : Test the received address.
* Input : uint8_t Cmd : the command can be SCSI_READ10 or SCSI_WRITE10.
* Output : None.
* Return : Read\Write status (bool).
*******************************************************************************/
bool SCSI_Address_Management(uint8_t lun , uint8_t Cmd , uint32_t LBA , uint32_t BlockNbr)
{
if ((LBA + BlockNbr) > Mass_Block_Count[lun] )
{
if (Cmd == SCSI_WRITE10)
{
Bot_Abort(BOTH_DIR);
}
Bot_Abort(DIR_IN);
Set_Scsi_Sense_Data(lun, ILLEGAL_REQUEST, ADDRESS_OUT_OF_RANGE);
Set_CSW (CSW_CMD_FAILED, SEND_CSW_DISABLE);
return (FALSE);
}
if (CBW.dDataLength != BlockNbr * Mass_Block_Size[lun])
{
if (Cmd == SCSI_WRITE10)
{
Bot_Abort(BOTH_DIR);
}
else
{
Bot_Abort(DIR_IN);
}
Set_Scsi_Sense_Data(CBW.bLUN, ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_CMD_FAILED, SEND_CSW_DISABLE);
return (FALSE);
}
return (TRUE);
}
示例6: Mass_Storage_Out
/*******************************************************************************
* Function Name : Mass_Storage_Out
* Description : Mass Storage OUT transfer.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void Mass_Storage_Out (void)
{
u8 CMD;
CMD = CBW.CB[0];
Data_Len = USB_SIL_Read(EP2_OUT, Bulk_Data_Buff);
switch (Bot_State)
{
case BOT_IDLE:
CBW_Decode();
break;
case BOT_DATA_OUT:
if (CMD == SCSI_WRITE10)
{
SCSI_Write10_Cmd(CBW.bLUN , SCSI_LBA , SCSI_BlkLen);
break;
}
Bot_Abort(DIR_OUT);
Set_Scsi_Sense_Data(CBW.bLUN, ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_PHASE_ERROR, SEND_CSW_DISABLE);
break;
default:
Bot_Abort(BOTH_DIR);
Set_Scsi_Sense_Data(CBW.bLUN, ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_PHASE_ERROR, SEND_CSW_DISABLE);
break;
}
}
示例7: SCSI_Write10_Cmd
/*******************************************************************************
* Function Name : SCSI_Write10_Cmd
* Description : SCSI Write10 Command routine.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void SCSI_Write10_Cmd(u32 LBA , u32 BlockNbr)
{
if (Bot_State == BOT_IDLE)
{
if (!(SCSI_Address_Management(SCSI_WRITE10 , LBA, BlockNbr)))/*address out of range*/
{
return;
}
if ((CBW.bmFlags & 0x80) == 0)
{
Bot_State = BOT_DATA_OUT;
SetEPRxStatus(ENDP2, EP_RX_VALID);
}
else
{
Bot_Abort(DIR_IN);
Set_Scsi_Sense_Data(ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_CMD_FAILED, SEND_CSW_DISABLE);
}
return;
}
else if (Bot_State == BOT_DATA_OUT)
{
Write_Memory(LBA , BlockNbr);
}
}
示例8: SCSI_Write10_Cmd
/*******************************************************************************
* Function Name : SCSI_Write10_Cmd
* Description : SCSI Write10 Command routine.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void SCSI_Write10_Cmd(uint8_t lun , uint32_t LBA , uint32_t BlockNbr)
{
if (Bot_State == BOT_IDLE)
{
if (!(SCSI_Address_Management(CBW.bLUN, SCSI_WRITE10 , LBA, BlockNbr)))/*address out of range*/
{
return;
}
if ((CBW.bmFlags & 0x80) == 0)
{
Bot_State = BOT_DATA_OUT;
#ifndef STM32F10X_CL
SetEPRxStatus(ENDP2, EP_RX_VALID);
#endif /* STM32F10X_CL */
}
else
{
Bot_Abort(DIR_IN);
Set_Scsi_Sense_Data(CBW.bLUN, ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_CMD_FAILED, SEND_CSW_DISABLE);
}
return;
}
else if (Bot_State == BOT_DATA_OUT)
{
Write_Memory(lun , LBA , BlockNbr);
}
}
示例9: SCSI_Read10_Cmd
/*******************************************************************************
* Function Name : SCSI_Read10_Cmd
* Description : SCSI Read10 Command routine.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void SCSI_Read10_Cmd(uint8_t lun , uint32_t LBA , uint32_t BlockNbr)
{
if (Bot_State == BOT_IDLE)
{
if (!(SCSI_Address_Management(CBW.bLUN, SCSI_READ10, LBA, BlockNbr)))/*address out of range*/
{
return;
}
if ((CBW.bmFlags & 0x80) != 0)
{
Bot_State = BOT_DATA_IN;
Read_Memory(lun, LBA , BlockNbr);
}
else
{
Bot_Abort(BOTH_DIR);
Set_Scsi_Sense_Data(CBW.bLUN, ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_CMD_FAILED, SEND_CSW_ENABLE);
}
return;
}
else if (Bot_State == BOT_DATA_IN)
{
Read_Memory(lun , LBA , BlockNbr);
}
}
示例10: Mass_Storage_ClearFeature
/*******************************************************************************
* Function Name : Mass_Storage_ClearFeature
* Description : Handle the ClearFeature request.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void Mass_Storage_ClearFeature(void)
{
/* when the host send a CBW with invalid signature or invalid length the two
Endpoints (IN & OUT) shall stall until receiving a Mass Storage Reset */
if (CBW.dSignature != BOT_CBW_SIGNATURE)
Bot_Abort(BOTH_DIR);
}
示例11: Address_Management_Test
/*******************************************************************************
* Function Name : Address_Management_Test
* Description : Test the received address.
* Input : u8 Cmd : the command can be SCSI_READ10 or SCSI_WRITE10.
* Output : None.
* Return : Read\Write status (bool).
*******************************************************************************/
bool Address_Management_Test(u8 Cmd)
{
vu32 temp1;
vu32 temp2;
GPIO_SetBits(GPIOB, GPIO_Pin_5);
/* Logical Block Address of First Block */
temp1 = (CBW.CB[2] << 24) |
(CBW.CB[3] << 16) |
(CBW.CB[4] << 8) |
(CBW.CB[5] << 0);
/* Number of Blocks to transfer */
temp2 = (CBW.CB[7] << 8) |
(CBW.CB[8] << 0);
Memory_Offset = temp1 * Mass_Block_Size;
Transfer_Length = temp2 * Mass_Block_Size;
if ((Memory_Offset + Transfer_Length) > Mass_Memory_Size)
{
if (Cmd == SCSI_WRITE10)
{
Bot_Abort(BOTH_DIR);
}
Bot_Abort(DIR_IN);
Set_Scsi_Sense_Data(ILLEGAL_REQUEST, ADDRESS_OUT_OF_RANGE);
Set_CSW (CSW_CMD_FAILED, SEND_CSW_DISABLE);
return (FALSE);
}
if (CBW.dDataLength != Transfer_Length)
{
if (Cmd == SCSI_WRITE10)
{
Bot_Abort(BOTH_DIR);
}
else
{
Bot_Abort(DIR_IN);
}
Set_Scsi_Sense_Data(ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_CMD_FAILED, SEND_CSW_DISABLE);
return (FALSE);
}
return (TRUE);
}
示例12: SCSI_Format_Cmd
/*******************************************************************************
* Function Name : SCSI_Format_Cmd
* Description : Format Commands routine.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void SCSI_Format_Cmd(uint8_t lun)
{
if (MAL_GetStatus(lun))
{
Set_Scsi_Sense_Data(CBW.bLUN, NOT_READY, MEDIUM_NOT_PRESENT);
Set_CSW (CSW_CMD_FAILED, SEND_CSW_ENABLE);
Bot_Abort(DIR_IN);
return;
}
}
示例13: SCSI_Invalid_Cmd
/*******************************************************************************
* Function Name : SCSI_Invalid_Cmd
* Description : Invalid Commands routine
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void SCSI_Invalid_Cmd(uint8_t lun)
{
if (CBW.dDataLength == 0)
{
Bot_Abort(DIR_IN);
}
else
{
if ((CBW.bmFlags & 0x80) != 0)
{
Bot_Abort(DIR_IN);
}
else
{
Bot_Abort(BOTH_DIR);
}
}
Set_Scsi_Sense_Data(CBW.bLUN, ILLEGAL_REQUEST, INVALID_COMMAND);
Set_CSW (CSW_CMD_FAILED, SEND_CSW_DISABLE);
}
示例14: SCSI_Valid_Cmd
/*******************************************************************************
* Function Name : SCSI_Valid_Cmd
* Description : Valid Commands routine.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void SCSI_Valid_Cmd(uint8_t lun)
{
if (CBW.dDataLength != 0)
{
Bot_Abort(BOTH_DIR);
Set_Scsi_Sense_Data(CBW.bLUN, ILLEGAL_REQUEST, INVALID_COMMAND);
Set_CSW (CSW_CMD_FAILED, SEND_CSW_DISABLE);
}
else
Set_CSW (CSW_CMD_PASSED, SEND_CSW_ENABLE);
}
示例15: USB_APP_ClearFeature
/*******************************************************************************
* Function Name : Mass_Storage_ClearFeature
* Description : Handle the ClearFeature request.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void USB_APP_ClearFeature(void)
{
#if(USB_DEVICE_CONFIG & _USE_USB_MASS_STOARGE_DEVICE)
/* when the host send a CBW with invalid signature or invalid length the two
Endpoints (IN & OUT) shall stall until receiving a Mass Storage Reset */
if (g_usb_type == USB_MASSSTORAGE)
{
if (CBW.dSignature != BOT_CBW_SIGNATURE)
Bot_Abort(BOTH_DIR);
}
#endif
}