コード例 #1
0
ファイル: usbd_conf.c プロジェクト: babelbi/OpenLogicMaster
/**
  * @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;
}
コード例 #2
0
ファイル: usbd_conf.c プロジェクト: chsigi/blindschleiche
/**
  * @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)
{

  HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
  
  /* 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;
  /* Link The driver to the stack */
  hpcd.pData = pdev;
  pdev->pData = &hpcd;
  /* Initialize LL Driver */
  HAL_PCD_Init(&hpcd);
  
  HAL_PCD_SetRxFiFo(&hpcd, 0x80);
  HAL_PCD_SetTxFiFo(&hpcd, 0, 0x40);
  HAL_PCD_SetTxFiFo(&hpcd, 1, 0x80);

  return USBD_OK;
}
コード例 #3
0
ファイル: usbd_conf.c プロジェクト: glocklueng/impy
/**
 * 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;
}
コード例 #4
0
/**
  * @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);

#ifdef USE_USB_FS
    /*Set LL Driver parameters */
    hpcd.Instance = USB_OTG_FS;
    hpcd.Init.dev_endpoints = 3;
    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;
    /* Link The driver to the stack */
    hpcd.pData = pdev;
    pdev->pData = &hpcd;
    /*Initialize LL Driver */
    HAL_PCD_Init(&hpcd);

    HAL_PCD_SetRxFiFo(&hpcd, 0xA0);
    HAL_PCD_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;

    /* In High Speed mode, it is not possible to use USB-DMA for writing/reading to/from Flash memory
      because the USB HS DMA is not connected (at product level) to this memory
      (refer to RM0090 reference manual for more details).
      If USB-DMA mode is enabled, an intermediate buffer must be used to interface between
      memory and DMA controller. This may result in performance degradation for
      transfers relative to flash memory in High Speed mode.
      It is advised to disable USB-DMA mode if it is not used for other interfaces. */
    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;
    /* Link The driver to the stack */
    hpcd.pData = pdev;
    pdev->pData = &hpcd;
    /*Initialize LL Driver */
    HAL_PCD_Init(&hpcd);

    HAL_PCD_SetRxFiFo(&hpcd, 0x200);
    HAL_PCD_SetTxFiFo(&hpcd, 0, 0x200);
#endif
    return USBD_OK;
}
コード例 #5
0
/**
  * @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 = 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;
  /* Link The driver to the stack */
  hpcd.pData = pdev;
  pdev->pData = &hpcd;
  /* Initialize LL Driver */
  HAL_PCD_Init(&hpcd);
  
  HAL_PCD_SetRxFiFo(&hpcd, 0x80);
  HAL_PCD_SetTxFiFo(&hpcd, 0, 0x40);
  HAL_PCD_SetTxFiFo(&hpcd, 1, 0x80);
#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 = 1;
  
  hpcd.Init.low_power_enable = 1;
  hpcd.Init.phy_itface = PCD_PHY_ULPI;
  hpcd.Init.Sof_enable = 0;
  hpcd.Init.speed = PCD_SPEED_HIGH;
  hpcd.Init.vbus_sensing_enable = 1;
  /* Link The driver to the stack */
  hpcd.pData = pdev;
  pdev->pData = &hpcd;
  /* Initialize LL Driver */
  HAL_PCD_Init(&hpcd);
  
  HAL_PCD_SetRxFiFo(&hpcd, 0x200);
  HAL_PCD_SetTxFiFo(&hpcd, 0, 0x80);
  HAL_PCD_SetTxFiFo(&hpcd, 1, 0x174);
#endif 
  
  return USBD_OK;
}
コード例 #6
0
ファイル: usbd_conf.c プロジェクト: AriZuu/micropython
/**
  * @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);

#endif  // !USE_USB_HS_IN_FS
}
#endif  // USE_USB_HS
  return USBD_OK;
}