当前位置: 首页>>代码示例>>C++>>正文


C++ HAL_PCD_EP_Open函数代码示例

本文整理汇总了C++中HAL_PCD_EP_Open函数的典型用法代码示例。如果您正苦于以下问题:C++ HAL_PCD_EP_Open函数的具体用法?C++ HAL_PCD_EP_Open怎么用?C++ HAL_PCD_EP_Open使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了HAL_PCD_EP_Open函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HAL_PCD_ResetCallback

void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd)
{
    LTRACE_ENTRY;


    /* fail all the outstanding transactions */
    for (uint i = 0; i < NUM_EP; i++) {
        if (usbc.ep_in[i].transfer) {
            usbc_transfer_t *t = usbc.ep_in[i].transfer;
            usbc.ep_in[i].transfer = NULL;
            t->result = ERR_CANCELLED;
            t->callback(i, t);
        }
        if (usbc.ep_out[i].transfer) {
            usbc_transfer_t *t = usbc.ep_out[i].transfer;
            usbc.ep_out[i].transfer = NULL;
            t->result = ERR_CANCELLED;
            t->callback(i, t);
        }
    }

    HAL_PCD_EP_Open(&usbc.handle, 0, 0x40, PCD_EP_TYPE_CTRL);
    HAL_PCD_EP_Open(&usbc.handle, 0x80, 0x40, PCD_EP_TYPE_CTRL);

    usbc_callback(USB_CB_RESET, NULL);
    usbc.do_resched = true;
}
开发者ID:Gitsyshk,项目名称:lk,代码行数:27,代码来源:usbc.c

示例2: EP_ADDR

bool USBHAL::realiseEndpoint(uint8_t endpoint, uint32_t maxPacket, uint32_t flags) {
    uint32_t epIndex = EP_ADDR(endpoint);
    uint32_t type;
    uint32_t len;
    HAL_StatusTypeDef ret;
    switch (endpoint) {
    case EP0IN:
    case EP0OUT:
        type =  0;
        break;
    case EPISO_IN:
    case EPISO_OUT:
        type = 1;
        break;
    case EPBULK_IN:
    case EPBULK_OUT:
        type =  2;
        break;
    case EPINT_IN:
    case EPINT_OUT:
        type =  3;
        break;
    }
    if (maxPacket > MAXTRANSFER_SIZE) return false;
    if (epIndex & 0x80) {
        len = HAL_PCDEx_GetTxFiFo(&hpcd,epIndex & 0x7f);
        MBED_ASSERT(len >= maxPacket);
    }
    ret = HAL_PCD_EP_Open(&hpcd, epIndex,  maxPacket, type);
    MBED_ASSERT(ret!=HAL_BUSY);
    return (ret == HAL_OK) ? true:false;
}
开发者ID:SolarTeamEindhoven,项目名称:mbed,代码行数:32,代码来源:USBHAL_STM32.cpp

示例3: USBD_LL_OpenEP

/**
  * @brief  Opens an endpoint of the Low Level Driver.
  * @param  pdev: Device handle
  * @param  ep_addr: Endpoint Number
  * @param  ep_type: Endpoint Type
  * @param  ep_mps: Endpoint Max Packet Size
  * @retval USBD Status
  */
USBD_StatusTypeDef  USBD_LL_OpenEP  (USBD_HandleTypeDef *pdev, 
                                      uint8_t  ep_addr,                                      
                                      uint8_t  ep_type,
                                      uint16_t ep_mps)
{
  HAL_StatusTypeDef hal_status = HAL_OK;
  USBD_StatusTypeDef usb_status = USBD_OK;

  hal_status = HAL_PCD_EP_Open(pdev->pData, 
                               ep_addr, 
                               ep_mps, 
                               ep_type);
  
     
  switch (hal_status) {
    case HAL_OK :
      usb_status = USBD_OK;
    break;
    case HAL_ERROR :
      usb_status = USBD_FAIL;
    break;
    case HAL_BUSY :
      usb_status = USBD_BUSY;
    break;
    case HAL_TIMEOUT :
      usb_status = USBD_FAIL;
    break;
    default :
      usb_status = USBD_FAIL;
    break;
  }
  return usb_status; 
}
开发者ID:quispiam,项目名称:ultrasonic_f3_disocvery,代码行数:41,代码来源:usbd_conf.c

示例4: usb_dc_ep_enable

int usb_dc_ep_enable(const u8_t ep)
{
	struct usb_dc_stm32_ep_state *ep_state = usb_dc_stm32_get_ep_state(ep);
	HAL_StatusTypeDef status;

	LOG_DBG("ep 0x%02x", ep);

	if (!ep_state) {
		return -EINVAL;
	}

	LOG_DBG("HAL_PCD_EP_Open(0x%02x, %u, %u)", ep, ep_state->ep_mps,
		ep_state->ep_type);

	status = HAL_PCD_EP_Open(&usb_dc_stm32_state.pcd, ep,
				 ep_state->ep_mps, ep_state->ep_type);
	if (status != HAL_OK) {
		LOG_ERR("HAL_PCD_EP_Open failed(0x%02x), %d", ep,
			(int)status);
		return -EIO;
	}

	if (EP_IS_OUT(ep) && ep != EP0_OUT) {
		return usb_dc_ep_start_read(ep,
					  usb_dc_stm32_state.ep_buf[EP_IDX(ep)],
					  EP_MPS);
	}

	return 0;
}
开发者ID:loicpoulain,项目名称:zephyr,代码行数:30,代码来源:usb_dc_stm32.c

示例5: USBD_LL_OpenEP

/**
  * @brief  Opens an endpoint of the Low Level Driver. 
  * @param  pdev: Device handle
  * @param  ep_addr: Endpoint Number
  * @param  ep_type: Endpoint Type
  * @param  ep_mps: Endpoint Max Packet Size                 
  * @retval USBD Status
  */
USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, 
                                  uint8_t  ep_addr,                                      
                                  uint8_t  ep_type,
                                  uint16_t ep_mps)
{
  HAL_PCD_EP_Open(pdev->pData, ep_addr, ep_mps, ep_type);
  return USBD_OK; 
}
开发者ID:AriZuu,项目名称:micropython,代码行数:16,代码来源:usbd_conf.c

示例6: HAL_PCD_ResetCallback

void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd)
{
	int i;

	LOG_DBG("");

	HAL_PCD_EP_Open(&usb_dc_stm32_state.pcd, EP0_IN, EP0_MPS, EP_TYPE_CTRL);
	HAL_PCD_EP_Open(&usb_dc_stm32_state.pcd, EP0_OUT, EP0_MPS,
			EP_TYPE_CTRL);

	/* The DataInCallback will never be called at this point for any pending
	 * transactions. Reset the IN semaphores to prevent perpetual locked state.
	 * */
	for (i = 0; i < DT_USB_NUM_BIDIR_ENDPOINTS; i++) {
		k_sem_give(&usb_dc_stm32_state.in_ep_state[i].write_sem);
	}

	if (usb_dc_stm32_state.status_cb) {
		usb_dc_stm32_state.status_cb(USB_DC_RESET, NULL);
	}
}
开发者ID:loicpoulain,项目名称:zephyr,代码行数:21,代码来源:usb_dc_stm32.c

示例7: USBD_LL_OpenEP

/**
  * @brief  USBD_LL_OpenEP 
  *         Open an endpoint of the Low Level Driver.
  * @param  pdev: device handle
  * @param  ep_addr: Endpoint Number
  * @param  ep_type: Endpoint Type
  * @param  ep_mps: Endpoint Max Packet Size                 
  * @retval USBD Status
  */
USBD_StatusTypeDef  USBD_LL_OpenEP  (USBD_HandleTypeDef *pdev, 
                                      uint8_t  ep_addr,                                      
                                      uint8_t  ep_type,
                                      uint16_t ep_mps)
{
	USBD_EndpointTypeDef * ep;
	if (ep_addr & 0x80 == 0x80) {
		ep = &pdev->ep_in[ep_addr & 0x7F];
	} else {
		ep = &pdev->ep_out[ep_addr & 0x7F];
	}
	ep->maxpacket = ep_mps;

	HAL_PCD_EP_Open(pdev->pData, ep_addr, ep_mps, ep_type);
    
	return USBD_OK;
}
开发者ID:EvgeneOskin,项目名称:usb-machine-stm,代码行数:26,代码来源:usbd_conf.c

示例8: usbc_setup_endpoint

status_t usbc_setup_endpoint(ep_t ep, ep_dir_t dir, uint width, ep_type_t type)
{
    LTRACEF("ep %u dir %u width %u\n", ep, dir, width);

    DEBUG_ASSERT(ep <= NUM_EP);
    // PCD_EP_TYPE* and USB_* have the same values.  Let's make sure that
    // doesn't change.
    DEBUG_ASSERT(PCD_EP_TYPE_CTRL == USB_CTRL);
    DEBUG_ASSERT(PCD_EP_TYPE_ISOC == USB_ISOC);
    DEBUG_ASSERT(PCD_EP_TYPE_BULK == USB_BULK);
    DEBUG_ASSERT(PCD_EP_TYPE_INTR == USB_INTR);

    uint8_t ep_addr = ep | ((dir == USB_IN) ? 0x80 : 0);

    HAL_PCDEx_PMAConfig(&usbc.handle, ep_addr, PCD_SNG_BUF,
                        stm32_usbc_pma_alloc(width));

    HAL_StatusTypeDef ret = HAL_PCD_EP_Open(&usbc.handle, ep_addr, width, type);

    return (ret == HAL_OK) ? NO_ERROR : ERR_GENERIC;
}
开发者ID:Gitsyshk,项目名称:lk,代码行数:21,代码来源:usbc.c


注:本文中的HAL_PCD_EP_Open函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。