本文整理汇总了C++中HAL_PCD_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ HAL_PCD_Init函数的具体用法?C++ HAL_PCD_Init怎么用?C++ HAL_PCD_Init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HAL_PCD_Init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: USBD_LL_Init
/**
* @brief Initializes the Low Level portion of the Device driver.
* @param pdev: Device handle
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
{
#ifdef USE_USB_FS
/* Set LL Driver parameters */
hpcd.Instance = USB_OTG_FS;
hpcd.Init.dev_endpoints = 4;
hpcd.Init.use_dedicated_ep1 = 0;
hpcd.Init.ep0_mps = 0x40;
hpcd.Init.dma_enable = 0;
hpcd.Init.low_power_enable = 0;
hpcd.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd.Init.Sof_enable = 0;
hpcd.Init.speed = PCD_SPEED_FULL;
hpcd.Init.vbus_sensing_enable = 1;
hpcd.Init.lpm_enable = 0;
/* Link The driver to the stack */
hpcd.pData = pdev;
pdev->pData = &hpcd;
/* Initialize LL Driver */
HAL_PCD_Init(&hpcd);
HAL_PCDEx_SetRxFiFo(&hpcd, 0xA0);
HAL_PCDEx_SetTxFiFo(&hpcd, 0, 0xA0);
#endif
#ifdef USE_USB_HS
/* Set LL Driver parameters */
hpcd.Instance = USB_OTG_HS;
hpcd.Init.dev_endpoints = 6;
hpcd.Init.use_dedicated_ep1 = 0;
hpcd.Init.ep0_mps = 0x40;
/* Be aware that enabling DMA mode will result in data being sent only by
multiple of 4 packet sizes. This is due to the fact that USB DMA does
not allow sending data from non word-aligned addresses.
For this specific application, it is advised to not enable this option
unless required. */
hpcd.Init.dma_enable = 0;
hpcd.Init.low_power_enable = 0;
hpcd.Init.phy_itface = PCD_PHY_ULPI;
hpcd.Init.Sof_enable = 0;
hpcd.Init.speed = PCD_SPEED_HIGH;
hpcd.Init.vbus_sensing_enable = 1;
hpcd.Init.lpm_enable = 0;
/* Link The driver to the stack */
hpcd.pData = pdev;
pdev->pData = &hpcd;
/* Initialize LL Driver */
HAL_PCD_Init(&hpcd);
HAL_PCDEx_SetRxFiFo(&hpcd, 0x200);
HAL_PCDEx_SetTxFiFo(&hpcd, 0, 0x200);
#endif
return USBD_OK;
}
开发者ID:nidhiyanandh,项目名称:STM32Cube_FW_F4_V1.5.0_GCC_Makefile,代码行数:65,代码来源:usbd_conf.c
示例2: USBD_LL_Init
/**
* @brief Initializes the Low Level portion of the Device driver.
* @param pdev: Device handle
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
{
/* Init USB_IP */
/* Link The driver to the stack */
hpcd_USB_OTG_FS.pData = pdev;
pdev->pData = &hpcd_USB_OTG_FS;
#ifdef STM32F4
hpcd_USB_OTG_FS.Instance = USB_OTG_FS;
hpcd_USB_OTG_FS.Init.dev_endpoints = 4;
hpcd_USB_OTG_FS.Init.speed = PCD_SPEED_FULL; // MUST KEEP THIS FULL - buffer sizes only big enough for this, not high
hpcd_USB_OTG_FS.Init.dma_enable = DISABLE; // NO DMA - we are assuming USBD_CtlSendData/USBD_LL_Transmit don't keep the pointer they are passed
hpcd_USB_OTG_FS.Init.ep0_mps = DEP0CTL_MPS_8;
hpcd_USB_OTG_FS.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd_USB_OTG_FS.Init.Sof_enable = ENABLE;
hpcd_USB_OTG_FS.Init.low_power_enable = DISABLE;
hpcd_USB_OTG_FS.Init.lpm_enable = DISABLE;
hpcd_USB_OTG_FS.Init.vbus_sensing_enable = ENABLE;
hpcd_USB_OTG_FS.Init.use_dedicated_ep1 = DISABLE;
HAL_PCD_Init(&hpcd_USB_OTG_FS);
// USB memory is 1.25kB - lots of room for big FIFO sizes
HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_FS, 0x40);
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 0, 0x20); // EP0 IN
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x40); // HID IN
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 2, 0x20); // CDC CMD
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 3, 0x40); // CDC IN
#endif
#ifdef STM32F1
hpcd_USB_OTG_FS.Instance = USB;
hpcd_USB_OTG_FS.Init.dev_endpoints = 8;
hpcd_USB_OTG_FS.Init.speed = PCD_SPEED_FULL;
hpcd_USB_OTG_FS.Init.ep0_mps = DEP0CTL_MPS_8;
hpcd_USB_OTG_FS.Init.Sof_enable = DISABLE;
hpcd_USB_OTG_FS.Init.low_power_enable = DISABLE;
hpcd_USB_OTG_FS.Init.lpm_enable = DISABLE;
hpcd_USB_OTG_FS.Init.battery_charging_enable = DISABLE;
HAL_PCD_Init(&hpcd_USB_OTG_FS);
// USB memory is 512 bytes according to datasheet, so we should have loads
// of space available?
/*HAL_PCDEx_PMAConfig(pdev->pData , 0x00 , PCD_SNG_BUF, 0x18);
HAL_PCDEx_PMAConfig(pdev->pData , 0x80 , PCD_SNG_BUF, 0x58);
HAL_PCDEx_PMAConfig(pdev->pData , 0x81 , PCD_SNG_BUF, 0xC0); // HID IN
HAL_PCDEx_PMAConfig(pdev->pData , 0x01 , PCD_SNG_BUF, 0x110); // unused?
HAL_PCDEx_PMAConfig(pdev->pData , 0x82 , PCD_SNG_BUF, 0x100); // CDC CMD
HAL_PCDEx_PMAConfig(pdev->pData , 0x83 , PCD_SNG_BUF, 0x180); // CDC IN
HAL_PCDEx_PMAConfig(pdev->pData , 0x03 , PCD_SNG_BUF, 0x1C0); // CDC OUT*/
// above doesn't work
HAL_PCDEx_PMAConfig(pdev->pData , 0x00 , PCD_SNG_BUF, 0x18);
HAL_PCDEx_PMAConfig(pdev->pData , 0x80 , PCD_SNG_BUF, 0x58);
HAL_PCDEx_PMAConfig(pdev->pData , 0x81 , PCD_SNG_BUF, 0xC0); // CDC IN
HAL_PCDEx_PMAConfig(pdev->pData , 0x01 , PCD_SNG_BUF, 0x110); // CDC OUT
HAL_PCDEx_PMAConfig(pdev->pData , 0x82 , PCD_SNG_BUF, 0x100); // CDC CMD
#endif
return USBD_OK;
}
开发者ID:nihaopaul,项目名称:Espruino,代码行数:62,代码来源:usbd_conf.c
示例3: stm32_usbc_init
void stm32_usbc_init(void)
{
LTRACE_ENTRY;
usbc.pma_highwater = 0x40;
// Set LL Driver parameters
usbc.handle.Instance = USB;
usbc.handle.Init.dev_endpoints = 4;
usbc.handle.Init.ep0_mps = 0x40;
usbc.handle.Init.phy_itface = PCD_PHY_EMBEDDED;
usbc.handle.Init.speed = PCD_SPEED_FULL;
usbc.handle.Init.low_power_enable = 0;
usbc.handle.Init.lpm_enable = 0;
usbc.handle.Init.battery_charging_enable = 0;
// Initialize LL Driver
HAL_PCD_Init(&usbc.handle);
HAL_PCDEx_PMAConfig(&usbc.handle, 0x00, PCD_SNG_BUF,
stm32_usbc_pma_alloc(0x40));
HAL_PCDEx_PMAConfig(&usbc.handle, 0x80, PCD_SNG_BUF,
stm32_usbc_pma_alloc(0x40));
}
开发者ID:Gitsyshk,项目名称:lk,代码行数:25,代码来源:usbc.c
示例4: USBD_LL_Init
/**
* @brief Initializes the Low Level portion of the Device driver.
* @param pdev: Device handle
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
{
/* Init USB_IP */
if (pdev->id == DEVICE_FS) {
/* Link The driver to the stack */
hpcd_USB_OTG_FS.pData = pdev;
pdev->pData = &hpcd_USB_OTG_FS;
hpcd_USB_OTG_FS.Instance = USB_OTG_FS;
hpcd_USB_OTG_FS.Init.dev_endpoints = 4;
hpcd_USB_OTG_FS.Init.speed = PCD_SPEED_FULL;
hpcd_USB_OTG_FS.Init.dma_enable = DISABLE;
// hpcd_USB_OTG_FS.Init.ep0_mps = DEP0CTL_MPS_64;
hpcd_USB_OTG_FS.Init.ep0_mps = 0x40;
hpcd_USB_OTG_FS.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd_USB_OTG_FS.Init.Sof_enable = DISABLE;
hpcd_USB_OTG_FS.Init.low_power_enable = DISABLE;
hpcd_USB_OTG_FS.Init.lpm_enable = DISABLE;
hpcd_USB_OTG_FS.Init.vbus_sensing_enable = DISABLE;
hpcd_USB_OTG_FS.Init.use_dedicated_ep1 = DISABLE;
if (HAL_PCD_Init(&hpcd_USB_OTG_FS) != HAL_OK)
{
Error_Handler();
}
HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_FS, 0x80);
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 0, 0x40);
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x80);
}
return USBD_OK;
}
开发者ID:fzi-forschungszentrum-informatik,项目名称:NIKI40,代码行数:36,代码来源:usbd_conf.c
示例5: USBD_LL_Init
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
{
/* Init USB_IP */
/* Link The driver to the stack */
hpcd_USB_FS.pData = pdev;
pdev->pData = &hpcd_USB_FS;
hpcd_USB_FS.Instance = USB;
hpcd_USB_FS.Init.dev_endpoints = 5;
hpcd_USB_FS.Init.speed = PCD_SPEED_FULL;
hpcd_USB_FS.Init.ep0_mps = DEP0CTL_MPS_64;
hpcd_USB_FS.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd_USB_FS.Init.low_power_enable = DISABLE;
hpcd_USB_FS.Init.lpm_enable = DISABLE;
HAL_PCD_Init(&hpcd_USB_FS);
/*
* PMA layout
* 0x00 - 0x17 (24 bytes) metadata?
* 0x18 - 0x57 (64 bytes) EP0 OUT
* 0x58 - 0x97 (64 bytes) EP0 IN
* 0x98 - 0xD7 (64 bytes) EP1 IN
* 0xD8 - 0x157 (128 bytes) EP1 OUT (buffer 1)
* 0x158 - 0x1D7 (128 bytes) EP1 OUT (buffer 2)
*/
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x00 , PCD_SNG_BUF, 24);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x80 , PCD_SNG_BUF, 0x58);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x81 , PCD_SNG_BUF, 0x98);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x02 , PCD_DBL_BUF, 0x00D80158);
return USBD_OK;
}
开发者ID:HubertD,项目名称:candleLight_fw,代码行数:32,代码来源:usbd_conf.c
示例6: USBD_LL_Init
/**
* @brief Initializes the Low Level portion of the Device driver.
* @param pdev: Device handle
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
{
/* Change Systick prioity */
NVIC_SetPriority (SysTick_IRQn, 0);
/*Set LL Driver parameters */
hpcd.Instance = USB_OTG_FS; /*Register base address*/
hpcd.Init.dev_endpoints = 4; /*device endpoints number*/
hpcd.Init.use_dedicated_ep1 = 0; /*Enable or disable the use of the dedicated EP1 interrupt.*/
hpcd.Init.ep0_mps = 0x40; /*Set the Endpoint 0 Max Packet size.(0x40=64)*/
hpcd.Init.dma_enable = 0; /*Enable or disable of the USB embedded DMA*/
hpcd.Init.low_power_enable = 0; /*Enable or disable the low power mode*/
hpcd.Init.phy_itface = PCD_PHY_EMBEDDED; /*Select the used PHY interface*/
hpcd.Init.Sof_enable = 0; /*Enable or disable the output of the SOF signal*/
hpcd.Init.speed = PCD_SPEED_FULL; /*USB Core speed*/
hpcd.Init.vbus_sensing_enable = 1; /*Enable or disable the VBUS Sensing feature*/
/* Link The driver to the stack */
hpcd.pData = pdev;
pdev->pData = &hpcd;
/*Initialize LL Driver */
HAL_PCD_Init(&hpcd);
HAL_PCDEx_SetRxFiFo(&hpcd, 0x80); /*0x80=128*/
HAL_PCDEx_SetTxFiFo(&hpcd, 0, 0x40); /*0x40=64*/
HAL_PCDEx_SetTxFiFo(&hpcd, 1, 0x80); /*0x80=128*/
return USBD_OK;
}
开发者ID:cooland,项目名称:oscockpit,代码行数:33,代码来源:usbd_conf.c
示例7: USBD_LL_Init
/**
* @brief Initializes the Low Level portion of the Device driver.
* @param pdev: Device handle
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
{
/* Init USB_IP */
if (pdev->id == DEVICE_HS) {
/* Link The driver to the stack */
hpcd_USB_OTG_HS.pData = pdev;
pdev->pData = &hpcd_USB_OTG_HS;
hpcd_USB_OTG_HS.Instance = USB_OTG_HS;
hpcd_USB_OTG_HS.Init.dev_endpoints = 11;
hpcd_USB_OTG_HS.Init.speed = PCD_SPEED_FULL;
hpcd_USB_OTG_HS.Init.dma_enable = DISABLE;
hpcd_USB_OTG_HS.Init.ep0_mps = DEP0CTL_MPS_64;
hpcd_USB_OTG_HS.Init.phy_itface = USB_OTG_EMBEDDED_PHY;
hpcd_USB_OTG_HS.Init.Sof_enable = DISABLE;
hpcd_USB_OTG_HS.Init.low_power_enable = DISABLE;
hpcd_USB_OTG_HS.Init.lpm_enable = DISABLE;
hpcd_USB_OTG_HS.Init.vbus_sensing_enable = DISABLE;
hpcd_USB_OTG_HS.Init.use_dedicated_ep1 = DISABLE;
hpcd_USB_OTG_HS.Init.use_external_vbus = DISABLE;
HAL_PCD_Init(&hpcd_USB_OTG_HS);
HAL_PCD_SetRxFiFo(&hpcd_USB_OTG_HS, 0x200);
HAL_PCD_SetTxFiFo(&hpcd_USB_OTG_HS, 0, 0x80);
HAL_PCD_SetTxFiFo(&hpcd_USB_OTG_HS, 1, 0x174);
}
return USBD_OK;
}
开发者ID:babelbi,项目名称:OpenLogicMaster,代码行数:33,代码来源:usbd_conf.c
示例8: USBD_LL_Init
/**
* @brief Initializes the Low Level portion of the Device driver.
* @param pdev: Device handle
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
{
/* Set LL Driver parameters */
hpcd.Instance = USB_OTG_FS;
hpcd.Init.dev_endpoints = 4;
hpcd.Init.use_dedicated_ep1 = 0;
hpcd.Init.ep0_mps = 0x40;
hpcd.Init.dma_enable = 0;
hpcd.Init.low_power_enable = 1;
hpcd.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd.Init.Sof_enable = 0;
hpcd.Init.speed = PCD_SPEED_FULL;
hpcd.Init.vbus_sensing_enable = 1;
hpcd.Init.lpm_enable = 0;
/* Link The driver to the stack */
hpcd.pData = pdev;
pdev->pData = &hpcd;
/* Initialize LL Driver */
HAL_PCD_Init(&hpcd);
HAL_PCDEx_SetRxFiFo(&hpcd, 0x80);
HAL_PCDEx_SetTxFiFo(&hpcd, 0, 0x40);
HAL_PCDEx_SetTxFiFo(&hpcd, 1, 0x80);
return USBD_OK;
}
开发者ID:JUMA-IO,项目名称:STM32_Platform,代码行数:33,代码来源:usbd_conf.c
示例9: USBD_LL_Init
/**
* @brief Initializes the Low Level portion of the Device driver.
* @param pdev: Device handle
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_LL_Init( USBD_HandleTypeDef *pdev )
{
hpcd.pData = pdev;
pdev->pData = &hpcd;
hpcd.Instance = USB_OTG_FS;
hpcd.Init.dev_endpoints = 4;
hpcd.Init.speed = PCD_SPEED_FULL;
hpcd.Init.dma_enable = DISABLE;
hpcd.Init.ep0_mps = DEP0CTL_MPS_64; // 0x40; ?
hpcd.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd.Init.Sof_enable = DISABLE;
hpcd.Init.low_power_enable = DISABLE;
hpcd.Init.lpm_enable = DISABLE;
hpcd.Init.use_dedicated_ep1 = DISABLE;
#ifdef BOARD_USB_DEFAULT_VBUS_PIN
hpcd.Init.vbus_sensing_enable = ENABLE;
#else
hpcd.Init.vbus_sensing_enable = DISABLE;
#endif
if( HAL_PCD_Init( &hpcd ) != HAL_OK ) {
errno = 50000;
return USBD_FAIL;
};
HAL_PCDEx_SetRxFiFo( &hpcd, 0x80 );
HAL_PCDEx_SetTxFiFo( &hpcd, 0, 0x40 );
HAL_PCDEx_SetTxFiFo( &hpcd, 1, 0x80 );
return USBD_OK;
}
开发者ID:atu-guda,项目名称:stm32oxc,代码行数:38,代码来源:usbd_conf.cpp
示例10: USBD_LL_Init
/**
* Initializes the Low Level portion of the Device driver.
*
* @param pdev: Device handle
* @return USBD Status
*/
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev) {
if(pdev->id == DEVICE_FS) {
// Set LL Driver parameters
hpcd_FS.Instance = USB_OTG_FS;
hpcd_FS.Init.speed = PCD_SPEED_FULL;
hpcd_FS.Init.dev_endpoints = 4;
hpcd_FS.Init.use_dedicated_ep1 = 0;
hpcd_FS.Init.ep0_mps = 0x40;
hpcd_FS.Init.dma_enable = DISABLE;
hpcd_FS.Init.low_power_enable = ENABLE;
hpcd_FS.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd_FS.Init.Sof_enable = DISABLE;
hpcd_FS.Init.vbus_sensing_enable = ENABLE;
hpcd_FS.Init.use_external_vbus = ENABLE;
// Link the driver to the stack
hpcd_FS.pData = pdev;
pdev->pData = &hpcd_FS;
// Initialize LL Driver
HAL_PCD_Init(&hpcd_FS);
HAL_PCD_SetRxFiFo(&hpcd_FS, 0x80);
HAL_PCD_SetTxFiFo(&hpcd_FS, 0, 0x40);
HAL_PCD_SetTxFiFo(&hpcd_FS, 1, 0x80);
}
return USBD_OK;
}
开发者ID:glocklueng,项目名称:impy,代码行数:33,代码来源:usbd_conf.c
示例11: USBD_LL_Init
/**
* @brief Initializes the Low Level portion of the Device driver.
* @param pdev: Device handle
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
{
/* Init USB_IP */
/* Link The driver to the stack */
hpcd_USB_FS.pData = pdev;
pdev->pData = &hpcd_USB_FS;
hpcd_USB_FS.Instance = USB;
hpcd_USB_FS.Init.dev_endpoints = 8;
hpcd_USB_FS.Init.speed = PCD_SPEED_FULL;
hpcd_USB_FS.Init.ep0_mps = DEP0CTL_MPS_8;
hpcd_USB_FS.Init.low_power_enable = DISABLE;
hpcd_USB_FS.Init.lpm_enable = DISABLE;
hpcd_USB_FS.Init.battery_charging_enable = DISABLE;
if (HAL_PCD_Init(&hpcd_USB_FS) != HAL_OK)
{
Error_Handler();
}
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x00 , PCD_SNG_BUF, 0x18);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x80 , PCD_SNG_BUF, 0x58);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x81 , PCD_SNG_BUF, 0xC0);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x01 , PCD_SNG_BUF, 0x110);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x82 , PCD_SNG_BUF, 0x100);
return USBD_OK;
}
开发者ID:loboris,项目名称:mini-sys,代码行数:31,代码来源:usbd_conf.c
示例12: MX_USB_PCD_Init
/* USB init function */
static void MX_USB_PCD_Init(void)
{
hpcd_USB_FS.Instance = USB;
hpcd_USB_FS.Init.dev_endpoints = 8;
hpcd_USB_FS.Init.speed = PCD_SPEED_FULL;
hpcd_USB_FS.Init.ep0_mps = DEP0CTL_MPS_8;
hpcd_USB_FS.Init.low_power_enable = DISABLE;
hpcd_USB_FS.Init.lpm_enable = DISABLE;
hpcd_USB_FS.Init.battery_charging_enable = DISABLE;
if (HAL_PCD_Init(&hpcd_USB_FS) != HAL_OK)
{
Error_Handler();
}
}
开发者ID:PaxInstruments,项目名称:PaxInstruments-LabWiz-firmware,代码行数:17,代码来源:labwiz_entry.c
示例13: MX_USB_PCD_Init
void MX_USB_PCD_Init(void)
{
hpcd_USB_FS.Instance = USB;
hpcd_USB_FS.Init.dev_endpoints = 8;
hpcd_USB_FS.Init.speed = PCD_SPEED_FULL;
hpcd_USB_FS.Init.ep0_mps = DEP0CTL_MPS_8;
hpcd_USB_FS.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd_USB_FS.Init.low_power_enable = DISABLE;
hpcd_USB_FS.Init.lpm_enable = DISABLE;
if (HAL_PCD_Init(&hpcd_USB_FS) != HAL_OK)
{
Error_Handler();
}
}
开发者ID:jbeck3,项目名称:QUADROTOR_CONTROLLER_STM32F070,代码行数:16,代码来源:usb.c
示例14: MX_USB_OTG_FS_PCD_Init
void MX_USB_OTG_FS_PCD_Init(void)
{
hpcd_USB_OTG_FS.Instance = USB_OTG_FS;
hpcd_USB_OTG_FS.Init.dev_endpoints = 7;
hpcd_USB_OTG_FS.Init.speed = PCD_SPEED_FULL;
hpcd_USB_OTG_FS.Init.dma_enable = DISABLE;
hpcd_USB_OTG_FS.Init.ep0_mps = DEP0CTL_MPS_64;
hpcd_USB_OTG_FS.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd_USB_OTG_FS.Init.Sof_enable = DISABLE;
hpcd_USB_OTG_FS.Init.low_power_enable = DISABLE;
hpcd_USB_OTG_FS.Init.lpm_enable = DISABLE;
hpcd_USB_OTG_FS.Init.vbus_sensing_enable = ENABLE;
hpcd_USB_OTG_FS.Init.use_dedicated_ep1 = DISABLE;
HAL_PCD_Init(&hpcd_USB_OTG_FS);
}
开发者ID:bitschieber,项目名称:ISFCarUc,代码行数:17,代码来源:usb_otg.c
示例15: USBD_LL_Init
/**
* @brief Initializes the Low Level portion of the Device driver.
* @param pdev: Device handle
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
{
/* Set LL Driver parameters */
hpcd.Instance = USB;
hpcd.Init.dev_endpoints = 8;
hpcd.Init.ep0_mps = 0x40;
hpcd.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd.Init.speed = PCD_SPEED_FULL;
/* Link The driver to the stack */
hpcd.pData = pdev;
pdev->pData = &hpcd;
/* Initialize LL Driver */
HAL_PCD_Init(&hpcd);
HAL_PCDEx_PMAConfig(&hpcd , 0x00 , PCD_SNG_BUF, 0x18);
HAL_PCDEx_PMAConfig(&hpcd , 0x80 , PCD_SNG_BUF, 0x58);
return USBD_OK;
}
开发者ID:jmoyerman,项目名称:stm32f0_cube,代码行数:24,代码来源:usbd_conf.c
示例16: USBD_LL_Init
/**
* @brief Initializes the Low Level portion of the Device driver.
* @param pdev: Device handle
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
{
/* Init USB_IP */
/* Link The driver to the stack */
hpcd_USB_FS.pData = pdev;
pdev->pData = &hpcd_USB_FS;
hpcd_USB_FS.Instance = USB;
hpcd_USB_FS.Init.dev_endpoints = 5;
hpcd_USB_FS.Init.speed = PCD_SPEED_FULL;
hpcd_USB_FS.Init.ep0_mps = DEP0CTL_MPS_8;
hpcd_USB_FS.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd_USB_FS.Init.low_power_enable = DISABLE;
hpcd_USB_FS.Init.battery_charging_enable = DISABLE;
HAL_PCD_Init(&hpcd_USB_FS);
HAL_PCDEx_PMAConfig(pdev->pData , 0x00 , PCD_SNG_BUF, 0x18);
HAL_PCDEx_PMAConfig(pdev->pData , 0x80 , PCD_SNG_BUF, 0x58);
HAL_PCDEx_PMAConfig(pdev->pData , 0x81 , PCD_SNG_BUF, 0x100);
return USBD_OK;
}
开发者ID:chathuranga1931,项目名称:Unit-Test-Development,代码行数:26,代码来源:usbd_conf.c
示例17: USBD_LL_Init
/**
* @brief Initializes the Low Level portion of the Device driver.
* @param pdev: Device handle
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
{
/* Set LL Driver parameters */
hpcd.Instance = USB;
hpcd.Init.dev_endpoints = 8;
hpcd.Init.ep0_mps = PCD_EP0MPS_64;
hpcd.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd.Init.speed = PCD_SPEED_FULL;
/* Link The driver to the stack */
hpcd.pData = pdev;
pdev->pData = &hpcd;
/* Initialize LL Driver */
HAL_PCD_Init(pdev->pData);
HAL_PCDEx_PMAConfig(pdev->pData , 0x00 , PCD_SNG_BUF, 0x40);
HAL_PCDEx_PMAConfig(pdev->pData , 0x80 , PCD_SNG_BUF, 0x80);
HAL_PCDEx_PMAConfig(pdev->pData , CDC_IN_EP , PCD_SNG_BUF, 0xC0);
HAL_PCDEx_PMAConfig(pdev->pData , CDC_OUT_EP , PCD_SNG_BUF, 0x110);
HAL_PCDEx_PMAConfig(pdev->pData , CDC_CMD_EP , PCD_SNG_BUF, 0x100);
return USBD_OK;
}
开发者ID:eleciawhite,项目名称:STM32Cube,代码行数:27,代码来源:usbd_conf.c
示例18: USBD_LL_Init
/**
* @brief Initializes the Low Level portion of the Device driver.
* @param pdev: Device handle
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
{
/* Set LL Driver parameters */
hpcd.Instance = USB;
hpcd.Init.dev_endpoints = 8;
hpcd.Init.ep0_mps = PCD_EP0MPS_64;
hpcd.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd.Init.speed = PCD_SPEED_FULL;
hpcd.Init.low_power_enable = 0;
/* Link The driver to the stack */
hpcd.pData = pdev;
pdev->pData = &hpcd;
/* Initialize LL Driver */
HAL_PCD_Init((PCD_HandleTypeDef*)pdev->pData);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x80 , PCD_SNG_BUF, 0x10);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x00 , PCD_SNG_BUF, 0x50);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x81 , PCD_SNG_BUF, 0x90);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x01 , PCD_SNG_BUF, 0xD0);
return USBD_OK;
}
开发者ID:apeng2012,项目名称:mi_ma_bao,代码行数:29,代码来源:usbd_conf.c
示例19: USBD_LL_Init
/**
* @brief Initializes the Low Level portion of the Device driver.
* @param pdev: Device handle
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
{
#if defined(USE_USB_FS)
if (pdev->id == USB_PHY_FS_ID)
{
/*Set LL Driver parameters */
pcd_fs_handle.Instance = USB_OTG_FS;
pcd_fs_handle.Init.dev_endpoints = 4;
pcd_fs_handle.Init.use_dedicated_ep1 = 0;
pcd_fs_handle.Init.ep0_mps = 0x40;
pcd_fs_handle.Init.dma_enable = 0;
pcd_fs_handle.Init.low_power_enable = 0;
pcd_fs_handle.Init.phy_itface = PCD_PHY_EMBEDDED;
pcd_fs_handle.Init.Sof_enable = 1;
pcd_fs_handle.Init.speed = PCD_SPEED_FULL;
#if defined(MCU_SERIES_L4)
pcd_fs_handle.Init.lpm_enable = DISABLE;
pcd_fs_handle.Init.battery_charging_enable = DISABLE;
#endif
#if !defined(MICROPY_HW_USB_VBUS_DETECT_PIN)
pcd_fs_handle.Init.vbus_sensing_enable = 0; // No VBUS Sensing on USB0
#else
pcd_fs_handle.Init.vbus_sensing_enable = 1;
#endif
/* Link The driver to the stack */
pcd_fs_handle.pData = pdev;
pdev->pData = &pcd_fs_handle;
/*Initialize LL Driver */
HAL_PCD_Init(&pcd_fs_handle);
HAL_PCD_SetRxFiFo(&pcd_fs_handle, 0x80);
HAL_PCD_SetTxFiFo(&pcd_fs_handle, 0, 0x20);
HAL_PCD_SetTxFiFo(&pcd_fs_handle, 1, 0x40);
HAL_PCD_SetTxFiFo(&pcd_fs_handle, 2, 0x20);
HAL_PCD_SetTxFiFo(&pcd_fs_handle, 3, 0x40);
}
#endif
#if defined(USE_USB_HS)
if (pdev->id == USB_PHY_HS_ID)
{
#if defined(USE_USB_HS_IN_FS)
/*Set LL Driver parameters */
pcd_hs_handle.Instance = USB_OTG_HS;
pcd_hs_handle.Init.dev_endpoints = 4;
pcd_hs_handle.Init.use_dedicated_ep1 = 0;
pcd_hs_handle.Init.ep0_mps = 0x40;
pcd_hs_handle.Init.dma_enable = 0;
pcd_hs_handle.Init.low_power_enable = 0;
pcd_hs_handle.Init.phy_itface = PCD_PHY_EMBEDDED;
pcd_hs_handle.Init.Sof_enable = 1;
pcd_hs_handle.Init.speed = PCD_SPEED_HIGH_IN_FULL;
#if !defined(MICROPY_HW_USB_VBUS_DETECT_PIN)
pcd_hs_handle.Init.vbus_sensing_enable = 0; // No VBUS Sensing on USB0
#else
pcd_hs_handle.Init.vbus_sensing_enable = 1;
#endif
/* Link The driver to the stack */
pcd_hs_handle.pData = pdev;
pdev->pData = &pcd_hs_handle;
/*Initialize LL Driver */
HAL_PCD_Init(&pcd_hs_handle);
HAL_PCD_SetRxFiFo(&pcd_hs_handle, 0x80);
HAL_PCD_SetTxFiFo(&pcd_hs_handle, 0, 0x20);
HAL_PCD_SetTxFiFo(&pcd_hs_handle, 1, 0x40);
HAL_PCD_SetTxFiFo(&pcd_hs_handle, 2, 0x20);
HAL_PCD_SetTxFiFo(&pcd_hs_handle, 3, 0x40);
#else // !defined(USE_USB_HS_IN_FS)
/*Set LL Driver parameters */
pcd_hs_handle.Instance = USB_OTG_HS;
pcd_hs_handle.Init.dev_endpoints = 6;
pcd_hs_handle.Init.use_dedicated_ep1 = 0;
pcd_hs_handle.Init.ep0_mps = 0x40;
/* Be aware that enabling USB-DMA mode will result in data being sent only by
multiple of 4 packet sizes. This is due to the fact that USB-DMA does
not allow sending data from non word-aligned addresses.
For this specific application, it is advised to not enable this option
unless required. */
pcd_hs_handle.Init.dma_enable = 0;
pcd_hs_handle.Init.low_power_enable = 0;
pcd_hs_handle.Init.phy_itface = PCD_PHY_ULPI;
pcd_hs_handle.Init.Sof_enable = 1;
pcd_hs_handle.Init.speed = PCD_SPEED_HIGH;
pcd_hs_handle.Init.vbus_sensing_enable = 1;
/* Link The driver to the stack */
pcd_hs_handle.pData = pdev;
pdev->pData = &pcd_hs_handle;
/*Initialize LL Driver */
HAL_PCD_Init(&pcd_hs_handle);
HAL_PCD_SetRxFiFo(&pcd_hs_handle, 0x200);
HAL_PCD_SetTxFiFo(&pcd_hs_handle, 0, 0x80);
HAL_PCD_SetTxFiFo(&pcd_hs_handle, 1, 0x174);
//.........这里部分代码省略.........
开发者ID:AriZuu,项目名称:micropython,代码行数:101,代码来源:usbd_conf.c
示例20: usb_dc_stm32_init
static int usb_dc_stm32_init(void)
{
HAL_StatusTypeDef status;
unsigned int i;
#ifdef USB
usb_dc_stm32_state.pcd.Instance = USB;
usb_dc_stm32_state.pcd.Init.speed = PCD_SPEED_FULL;
usb_dc_stm32_state.pcd.Init.dev_endpoints = DT_USB_NUM_BIDIR_ENDPOINTS;
usb_dc_stm32_state.pcd.Init.phy_itface = PCD_PHY_EMBEDDED;
usb_dc_stm32_state.pcd.Init.ep0_mps = PCD_EP0MPS_64;
usb_dc_stm32_state.pcd.Init.low_power_enable = 0;
#else /* USB_OTG_FS || USB_OTG_HS */
#ifdef DT_USB_HS_BASE_ADDRESS
usb_dc_stm32_state.pcd.Instance = USB_OTG_HS;
#else
usb_dc_stm32_state.pcd.Instance = USB_OTG_FS;
#endif
usb_dc_stm32_state.pcd.Init.dev_endpoints = DT_USB_NUM_BIDIR_ENDPOINTS;
usb_dc_stm32_state.pcd.Init.speed = usb_dc_stm32_get_maximum_speed();
#if defined(DT_COMPAT_ST_STM32_USBPHYC) && defined(DT_USB_HS_BASE_ADDRESS)
usb_dc_stm32_state.pcd.Init.phy_itface = USB_OTG_HS_EMBEDDED_PHY;
#else
usb_dc_stm32_state.pcd.Init.phy_itface = PCD_PHY_EMBEDDED;
#endif /* DT_COMPAT_ST_STM32_USBPHYC */
usb_dc_stm32_state.pcd.Init.ep0_mps = USB_OTG_MAX_EP0_SIZE;
usb_dc_stm32_state.pcd.Init.vbus_sensing_enable = DISABLE;
#ifndef CONFIG_SOC_SERIES_STM32F1X
usb_dc_stm32_state.pcd.Init.dma_enable = DISABLE;
#endif
#endif /* USB */
#ifdef CONFIG_USB_DEVICE_SOF
usb_dc_stm32_state.pcd.Init.Sof_enable = 1;
#endif /* CONFIG_USB_DEVICE_SOF */
LOG_DBG("HAL_PCD_Init");
status = HAL_PCD_Init(&usb_dc_stm32_state.pcd);
if (status != HAL_OK) {
LOG_ERR("PCD_Init failed, %d", (int)status);
return -EIO;
}
LOG_DBG("HAL_PCD_Start");
status = HAL_PCD_Start(&usb_dc_stm32_state.pcd);
if (status != HAL_OK) {
LOG_ERR("PCD_Start failed, %d", (int)status);
return -EIO;
}
usb_dc_stm32_state.out_ep_state[EP0_IDX].ep_mps = EP0_MPS;
usb_dc_stm32_state.out_ep_state[EP0_IDX].ep_type = EP_TYPE_CTRL;
usb_dc_stm32_state.in_ep_state[EP0_IDX].ep_mps = EP0_MPS;
usb_dc_stm32_state.in_ep_state[EP0_IDX].ep_type = EP_TYPE_CTRL;
#ifdef USB
/* Start PMA configuration for the endpoints after the BTABLE. */
usb_dc_stm32_state.pma_offset = USB_BTABLE_SIZE;
for (i = 0U; i < DT_USB_NUM_BIDIR_ENDPOINTS; i++) {
k_sem_init(&usb_dc_stm32_state.in_ep_state[i].write_sem, 1, 1);
}
#else /* USB_OTG_FS */
/* TODO: make this dynamic (depending usage) */
HAL_PCDEx_SetRxFiFo(&usb_dc_stm32_state.pcd, FIFO_EP_WORDS);
for (i = 0U; i < DT_USB_NUM_BIDIR_ENDPOINTS; i++) {
HAL_PCDEx_SetTxFiFo(&usb_dc_stm32_state.pcd, i,
FIFO_EP_WORDS);
k_sem_init(&usb_dc_stm32_state.in_ep_state[i].write_sem, 1, 1);
}
#endif /* USB */
IRQ_CONNECT(DT_USB_IRQ, DT_USB_IRQ_PRI,
usb_dc_stm32_isr, 0, 0);
irq_enable(DT_USB_IRQ);
return 0;
}
开发者ID:loicpoulain,项目名称:zephyr,代码行数:79,代码来源:usb_dc_stm32.c
注:本文中的HAL_PCD_Init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论