mirror of
https://github.com/candle-usb/candleLight_fw.git
synced 2025-01-14 05:42:53 +08:00
(hopefully) solve usb problems through double buffering
This commit is contained in:
parent
b3c89ee20b
commit
ef9aca055c
14
.cproject
14
.cproject
@ -150,6 +150,20 @@
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="ilg.gnuarmeclipse.managedbuild.packs">
|
||||
<option id="cmsis.device.name" value="STM32F072C8"/>
|
||||
<option id="cmsis.subfamily.name" value="STM32F072"/>
|
||||
<option id="cmsis.family.name" value="STM32F0 Series"/>
|
||||
<option id="cmsis.device.vendor.name" value="STMicroelectronics"/>
|
||||
<option id="cmsis.device.vendor.id" value="13"/>
|
||||
<option id="cmsis.device.pack.vendor" value="Keil"/>
|
||||
<option id="cmsis.device.pack.name" value="STM32F0xx_DFP"/>
|
||||
<option id="cmsis.device.pack.version" value="1.4.0"/>
|
||||
<option id="cmsis.core.name" value="Cortex-M0"/>
|
||||
<option id="cmsis.compiler.define" value="STM32F072"/>
|
||||
<memory section="IRAM1" size="0x4000" start="0x20000000" startup="0"/>
|
||||
<memory section="IROM1" size="0x10000" start="0x08000000" startup="1"/>
|
||||
</storageModule>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.release.122516548">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.release.122516548" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
|
@ -68,8 +68,6 @@ int main(void)
|
||||
|
||||
struct gs_host_frame *frame = queue_pop_front(q_from_host);
|
||||
if (frame != 0) { // send can message from host
|
||||
USBD_GS_CAN_PrepareReceive(&hUSB);
|
||||
|
||||
if (can_send(&hCAN, frame)) {
|
||||
send_to_host_or_enqueue(frame);
|
||||
} else {
|
||||
|
@ -266,19 +266,26 @@ USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
|
||||
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_32;
|
||||
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);
|
||||
|
||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x00 , PCD_SNG_BUF, 0x18);
|
||||
/*
|
||||
* PMA layout
|
||||
*
|
||||
* 0x00 - 0x18 (24 bytes) metadata?
|
||||
* 0x18 - 0x58 (64 bytes) EP0 OUT
|
||||
* 0x58 - 0x98 (64 bytes) EP0 IN
|
||||
* 0x98 - 0xD8 (64 bytes) EP1 IN
|
||||
* 0xD8 - 0x118 (64 bytes) EP1 OUT (buffer 1)
|
||||
* 0x118 - 0x158 (64 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_DBL_BUF, 0x01000140);
|
||||
//HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x02 , PCD_DBL_BUF, 0x018001C0);
|
||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x81 , PCD_SNG_BUF, 0x0100);
|
||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x02 , PCD_SNG_BUF, 0x0180);
|
||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x81 , PCD_SNG_BUF, 0x98);
|
||||
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x02 , PCD_DBL_BUF, 0x00D80118);
|
||||
|
||||
return USBD_OK;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ static uint8_t USBD_GS_CAN_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum) {
|
||||
}
|
||||
retval = USBD_OK;
|
||||
}
|
||||
//USBD_GS_CAN_PrepareReceive(pdev);
|
||||
USBD_GS_CAN_PrepareReceive(pdev);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user