本文整理汇总了C++中HCD_IsDeviceConnected函数的典型用法代码示例。如果您正苦于以下问题:C++ HCD_IsDeviceConnected函数的具体用法?C++ HCD_IsDeviceConnected怎么用?C++ HCD_IsDeviceConnected使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HCD_IsDeviceConnected函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: USBH_MSC_Read10
BOOL USB_MSC_Driver::Read( void* context, ByteAddress Address, UINT32 NumBytes, BYTE * pSectorBuff ){
USB_OTG_CORE_HANDLE *pDev = (USB_OTG_CORE_HANDLE*)context;
BYTE status = USBH_MSC_OK;
if(!HCD_IsDeviceConnected(pDev)){
return FALSE;
}
//flat adressing
SectorAddress startSector = Address / 512;
if (Address % 512 != 0) {
CLR_Debug::Printf( "USB_MSC_Driver::Read error: Adress must match a sector start, sector=%08x, Address=%08x, NumBytes %d\r\n", startSector, Address, NumBytes);
return FALSE;
}
//CLR_Debug::Printf( "USB_MSC_Driver::Read() address=%lld, numBytes=%d sector=%d\r\n", Address, NumBytes, startSector);
//CLR_Debug::Printf( "USB_MSC_Driver::Read offset=%d, StartSector=0x%08x, Address=%08x, NumBytes %d\r\n", offset, StartSector, Address, NumBytes);
USBH_MSC_BOTXferParam.CmdStateMachine = CMD_SEND_STATE;
do {
status = USBH_MSC_Read10(pDev, pSectorBuff, startSector, NumBytes);
USBH_MSC_HandleBOTXfer(pDev ,&USB_Host);
if(!HCD_IsDeviceConnected(pDev)) {
//CLR_Debug::Printf( "USB_MSC_Driver::Read() USB device disconnection when reading\r\n");
return FALSE;
}
} while(status == USBH_MSC_BUSY );
if(status != USBH_MSC_OK)
return FALSE;
return TRUE;
}
示例2: disk_read
DRESULT disk_read (
BYTE drv, /* Physical drive number (0) */
BYTE *buff, /* Pointer to the data buffer to store read data */
DWORD sector, /* Start sector number (LBA) */
BYTE count /* Sector count (1..255) */
)
{
BYTE status = USBH_MSC_OK;
if (drv || !count) return RES_PARERR;
if (Stat & STA_NOINIT) return RES_NOTRDY;
if(HCD_IsDeviceConnected(&USB_OTG_Core))
{
do
{
status = USBH_MSC_Read10(&USB_OTG_Core, buff,sector,512);
USBH_MSC_HandleBOTXfer(&USB_OTG_Core ,&USB_Host);
if(!HCD_IsDeviceConnected(&USB_OTG_Core))
{
return RES_ERROR;
}
}
while(status == USBH_MSC_BUSY );
}
if(status == USBH_MSC_OK)
return RES_OK;
return RES_ERROR;
}
示例3: msc_write
/***********************************************************
* Function: // 函数名称
* Description: // 函数功能、性能等的描述
* Input: // 1.输入参数1,说明,包括每个参数的作用、取值说明及参数间关系
* Input: // 2.输入参数2,说明,包括每个参数的作用、取值说明及参数间关系
* Output: // 1.输出参数1,说明
* Return: // 函数返回值的说明
* Others: // 其它说明
***********************************************************/
static rt_size_t msc_write( rt_device_t dev, rt_off_t sector, const void* buff, rt_size_t count )
{
BYTE status = USBH_MSC_OK;
if( HCD_IsDeviceConnected( &USB_OTG_Core ) )
{
do
{
status = USBH_MSC_Write10( &USB_OTG_Core, (BYTE*)buff, sector, 512 * count );
USBH_MSC_HandleBOTXfer( &USB_OTG_Core, &USB_Host );
if( !HCD_IsDeviceConnected( &USB_OTG_Core ) )
{
//return RES_ERROR;
rt_kprintf( "\n%s error", __func__ );
return USBH_MSC_FAIL;
}
}
while( status == USBH_MSC_BUSY );
}
if( status == USBH_MSC_OK )
{
return count;
}
return 0xff;
}
示例4: TM_FATFS_USB_disk_read
/*-----------------------------------------------------------------------*/
DRESULT TM_FATFS_USB_disk_read (
BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Sector address (LBA) */
UINT count /* Number of sectors to read (1..128) */
)
{
BYTE status = USBH_MSC_OK;
uint32_t timeout;
if (!count) {
return RES_PARERR;
}
if (USB_Stat & STA_NOINIT) {
return RES_NOTRDY;
}
if (HCD_IsDeviceConnected(&USB_OTG_Core) && TM_USB_MSCHOST_INT_Result == TM_USB_MSCHOST_Result_Connected) {
timeout = FATFS_USB_TIMEOUT;
do
{
status = USBH_MSC_Read10(&USB_OTG_Core, buff, sector, 512 * count);
USBH_MSC_HandleBOTXfer(&USB_OTG_Core, &USB_Host);
if (!HCD_IsDeviceConnected(&USB_OTG_Core)) {
return RES_ERROR;
}
} while (status == USBH_MSC_BUSY && timeout--);
}
if (status == USBH_MSC_OK) {
return RES_OK;
}
return RES_ERROR;
}
示例5: TM_FATFS_USB_disk_write
DRESULT TM_FATFS_USB_disk_write (
const BYTE *buff, /* Data to be written */
DWORD sector, /* Sector address (LBA) */
UINT count /* Number of sectors to write (1..128) */
)
{
BYTE status = USBH_MSC_OK;
if (!count) {
return RES_PARERR;
}
if (USB_Stat & STA_NOINIT) {
return RES_NOTRDY;
}
// if (TM_USB_MSCHOST_INT_Result == TM_USB_MSCHOST_Result_WriteProtected) {
// return RES_WRPRT;
// }
if (HCD_IsDeviceConnected(&USB_OTG_Core) && USBH_USR_MSC_IsReady()) {
//USBH_MSC_Init(&USB_OTG_Core);
do
{
status = USBH_MSC_Write10(&USB_OTG_Core, (BYTE*)buff, sector, 512 * count);
USBH_MSC_HandleBOTXfer(&USB_OTG_Core, &USB_Host);
if (!HCD_IsDeviceConnected(&USB_OTG_Core)) {
return RES_ERROR;
}
} while (status == USBH_MSC_BUSY);
}
if (status == USBH_MSC_OK) {
return RES_OK;
}
return RES_ERROR;
}
示例6: TM_FATFS_USB_disk_read
/*-----------------------------------------------------------------------*/
DRESULT TM_FATFS_USB_disk_read (
BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Sector address (LBA) */
UINT count /* Number of sectors to read (1..128) */
)
{
BYTE status = USBH_MSC_OK;
if (!count) {
return RES_PARERR;
}
if (USB_Stat & STA_NOINIT) {
return RES_NOTRDY;
}
if (HCD_IsDeviceConnected(&USB_OTG_Core) && USBH_USR_MSC_IsReady()) {
//USBH_MSC_Init(&USB_OTG_Core);
do
{
status = USBH_MSC_Read10(&USB_OTG_Core, buff, sector, 512 * count);
USBH_MSC_HandleBOTXfer(&USB_OTG_Core, &USB_Host);
if (!HCD_IsDeviceConnected(&USB_OTG_Core)) {
return RES_ERROR;
}
} while (status == USBH_MSC_BUSY);
}
if (status == USBH_MSC_OK) {
return RES_OK;
}
return RES_ERROR;
}
示例7: msc_read
/***********************************************************
* Function: // 函数名称
* Description: // 函数功能、性能等的描述
* Input: // 1.输入参数1,说明,包括每个参数的作用、取值说明及参数间关系
* Input: // 2.输入参数2,说明,包括每个参数的作用、取值说明及参数间关系
* Output: // 1.输出参数1,说明
* Return: // 函数返回值的说明
* Others: // 其它说明
***********************************************************/
static rt_size_t msc_read( rt_device_t dev, rt_off_t sector, void *buff, rt_size_t count )
{
__IO uint8_t status = USBH_MSC_OK;
if( HCD_IsDeviceConnected( &USB_OTG_Core ) )
{
do
{
status = USBH_MSC_Read10( &USB_OTG_Core, buff, sector, 512 * count );
USBH_MSC_HandleBOTXfer( &USB_OTG_Core, &USB_Host );
if( !HCD_IsDeviceConnected( &USB_OTG_Core ) )
{
//return RES_ERROR;
rt_kprintf( "%s error\r\n", __func__ );
return USBH_MSC_FAIL;
}
}
while( status == USBH_MSC_BUSY );
}
if( status == USBH_MSC_OK )
{
return count;
}
return 0xff;
}
示例8: disk_write
DRESULT disk_write (
BYTE drv, /* Physical drive number (0) */
const BYTE *buff, /* Pointer to the data to be written */
DWORD sector, /* Start sector number (LBA) */
BYTE count /* Sector count (1..255) */
)
{
BYTE status = USBH_MSC_OK;
if (drv || !count) return RES_PARERR;
if (Stat & STA_NOINIT) return RES_NOTRDY;
if (Stat & STA_PROTECT) return RES_WRPRT;
if(HCD_IsDeviceConnected(&usbOTGHost))
{
do
{
status = USBH_MSC_Write10(&usbOTGHost,(BYTE*)buff, sector, 512*count);
USBH_MSC_HandleBOTXfer(&usbOTGHost, &usbHost);
if(!HCD_IsDeviceConnected(&usbOTGHost))
{
return RES_ERROR;
}
}
while(status == USBH_MSC_BUSY );
}
if(status == USBH_MSC_OK)
return RES_OK;
return RES_ERROR;
}
示例9: USBH_MSC_Write10
BOOL USB_MSC_Driver::Write( void* context, ByteAddress Address, UINT32 NumBytes, BYTE * pSectorBuff, BOOL ReadModifyWrite ){
//CLR_Debug::Printf( "USB_MSC_Driver::Write(*, %08x, %08x, *)\r\n", Address, NumBytes);
USB_OTG_CORE_HANDLE *pDev = (USB_OTG_CORE_HANDLE*)context;
BYTE status = USBH_MSC_OK;
if(!HCD_IsDeviceConnected(pDev)){
//CLR_Debug::Printf( "USB_MSC_Driver::Read() no USB device connected\r\n");
return FALSE;
}
UINT32 StartSector = g_USB_MSC_DeviceInfo.PhysicalToSectorAddress( &g_USB_MSC_DeviceInfo.Regions[0], Address);
//flat adressing
SectorAddress startSector = Address / 512;
if (Address % 512 != 0) {
CLR_Debug::Printf( "USB_MSC_Driver::Write error: Adress must match a sector start, sector=%08x, Address=%08x, NumBytes %d\r\n", startSector, Address, NumBytes);
return FALSE;
}
USBH_MSC_BOTXferParam.CmdStateMachine=CMD_SEND_STATE;
do {
status = USBH_MSC_Write10(pDev, pSectorBuff, StartSector, NumBytes);
USBH_MSC_HandleBOTXfer(pDev ,&USB_Host);
if(!HCD_IsDeviceConnected(pDev)) {
//CLR_Debug::Printf( "USB_MSC_Driver::Write() USB device disconnection when writing\r\n");
return FALSE;
}
} while(status == USBH_MSC_BUSY );
if(status != USBH_MSC_OK)
return FALSE;
return TRUE;
}
示例10: USBH_MSC_Issue_GETMaxLUN
USBH_Status USBH_MSC_Issue_GETMaxLUN(USB_OTG_CORE_HANDLE *pdev)
{
USBH_Status status = USBH_BUSY;
USBH_MSC_BOTXferParam.CmdStateMachine = CMD_SEND_STATE;
if(HCD_IsDeviceConnected(&USB_OTG_FS_dev))
{
do
{
status = USBH_MSC_GETMaxLUN(pdev);
}
while((status == USBH_BUSY ) && HCD_IsDeviceConnected(&USB_OTG_FS_dev));
}
return(status);
}
示例11: MOD_HandleModulesBackground
/**
* @brief Handle Modules Background processes in the main task
* @param None
* @retval None
*/
void MOD_HandleModulesBackground (void)
{
uint32_t idx = 0, group = 0;
for (group = 0; group < MAX_GROUP_NUM; group ++)
{
for (idx = 0 ; idx < MOD_table[group].counter ; idx ++)
{
if (MOD_table[group].module[idx]->background != NULL)
{
MOD_table[group].module[idx]->background();
}
}
}
if((USB_Host_Application_Ready == 0) || (HCD_IsDeviceConnected(&USB_OTG_Core) == 0))
{
USBH_Process(&USB_OTG_Core, &USB_Host);
}
if(SDStorage_StateChanged() < 0)
{
MOD_HandleModulesClanup(MSD_MEDIA_STORAGE);
}
}
示例12: if_writeBuf
int8_t if_writeBuf(hwInterface* file,uint32_t address,uint8_t* buf)
{
int8_t status = EFS_ERROR;
if(HCD_IsDeviceConnected(&USB_OTG_FS_dev))
{
do
{
status = USBH_MSC_Write10(buf,address,USBH_MSC_PAGE_LENGTH);
USBH_MSC_HandleBOTXfer();
}
while((status == USBH_MSC_BUSY ) && \
(HCD_IsDeviceConnected(&USB_OTG_FS_dev)));
}
return(status);
}
示例13: Show_Image
/**
* @brief Show_Image
* Displays BMP image
* @param None
* @retval None
*/
static void Show_Image(void)
{
uint16_t i = 0;
uint16_t numOfReadBytes = 0;
FRESULT res;
LCD_SetDisplayWindow(0, 0, 320, 240);
LCD_WriteReg(SSD2119_ENTRY_MODE_REG, ENTRY_MODE_BMP);
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
/* Bypass Bitmap header */
f_lseek (&file, 54);
while (HCD_IsDeviceConnected(&USB_OTG_Core))
{
res = f_read(&file, Image_Buf, IMAGE_BUFFER_SIZE, (void *)&numOfReadBytes);
if ((numOfReadBytes == 0) || (res != FR_OK)) {
/*EOF or Error*/
LCD_WriteReg(SSD2119_ENTRY_MODE_REG, ENTRY_MODE_DEFAULT);
break;
}
for (i = 0 ; i < IMAGE_BUFFER_SIZE; i+= 2) {
LCD_WriteRAM(Image_Buf[i+1] << 8 | Image_Buf[i]);
}
}
}
示例14: USBH_USR_BackgroundProcess
/**
* @brief Handle Modules Background processes in the main task
* @param None
* @retval None
*/
void USBH_USR_BackgroundProcess (void)
{
if((USB_Host_Application_Ready == 0) || (HCD_IsDeviceConnected(&USB_OTG_Core) == 0))
{
USBH_Process(&USB_OTG_Core, &USB_Host);
}
}
示例15: Show_Image
/**
* @brief Show_Image
* Displays BMP image
* @param None
* @retval None
*/
static void Show_Image(void)
{
uint16_t i = 0;
uint16_t numOfReadBytes = 0;
FRESULT res;
//LCD_SetDisplayWindow(239, 319, 240, 320);
//LCD_WriteReg(R3, 0x1008);
//LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
/* Bypass Bitmap header */
f_lseek (&file, 54);
while (HCD_IsDeviceConnected(&USB_OTG_Core))
{
res = f_read(&file, Image_Buf, IMAGE_BUFFER_SIZE, (void *)&numOfReadBytes);
if((numOfReadBytes == 0) || (res != FR_OK)) /*EOF or Error*/
{
break;
}
for(i = 0 ; i < IMAGE_BUFFER_SIZE; i+= 2)
{
//LCD_WriteRAM(Image_Buf[i+1] << 8 | Image_Buf[i]);
}
}
}