From 5c15fd615d2108ca77ec55035d9c2ec6c9f0c706 Mon Sep 17 00:00:00 2001 From: qiyongzhong0 <917768104@qq.com> Date: Thu, 5 Dec 2019 13:40:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9stm32=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?=E5=BA=93:=201.=E4=BF=AE=E6=94=B9drv=5Fflash=5Fl4.c=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=ADstm32=5Fonchip=5Fflash=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=9A=84blk=5Fsize=E5=AD=97=E6=AE=B5,=E7=94=B1=E5=8E=9F?= =?UTF-8?q?=E6=9D=A52048=E6=94=B9=E4=B8=BAFLASH=5FPAGE=5FSIZE,=E4=BB=A5?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E8=8A=AF=E7=89=87=E9=80=82=E5=BA=94=E6=80=A7?= =?UTF-8?q?.=202.=E4=BF=AE=E6=94=B9drv=5Fusbd.c=E6=96=87=E4=BB=B6=E4=B8=AD?= =?UTF-8?q?stm=5Fusbd=5Fregister=E5=87=BD=E6=95=B0,=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=94=AF=E6=8C=81RT=5FUSING=5FDEVICE=5FOPS=E9=85=8D=E7=BD=AE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HAL_Drivers/drv_flash/drv_flash_l4.c | 2 +- bsp/stm32/libraries/HAL_Drivers/drv_usbd.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c index 2f724de718..00f84711f5 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c @@ -270,7 +270,7 @@ static int fal_flash_read(long offset, rt_uint8_t *buf, size_t size); static int fal_flash_write(long offset, const rt_uint8_t *buf, size_t size); static int fal_flash_erase(long offset, size_t size); -const struct fal_flash_dev stm32_onchip_flash = { "onchip_flash", STM32_FLASH_START_ADRESS, STM32_FLASH_SIZE, 2048, {NULL, fal_flash_read, fal_flash_write, fal_flash_erase} }; +const struct fal_flash_dev stm32_onchip_flash = { "onchip_flash", STM32_FLASH_START_ADRESS, STM32_FLASH_SIZE, FLASH_PAGE_SIZE, {NULL, fal_flash_read, fal_flash_write, fal_flash_erase} }; static int fal_flash_read(long offset, rt_uint8_t *buf, size_t size) { diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_usbd.c b/bsp/stm32/libraries/HAL_Drivers/drv_usbd.c index 79cb327ed8..19e8d7f3d4 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_usbd.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_usbd.c @@ -239,11 +239,27 @@ const static struct udcd_ops _udc_ops = _wakeup, }; +#ifdef RT_USING_DEVICE_OPS +const static struct rt_device_ops _ops = +{ + _init, + RT_NULL, + RT_NULL, + RT_NULL, + RT_NULL, + RT_NULL, +}; +#endif + int stm_usbd_register(void) { rt_memset((void *)&_stm_udc, 0, sizeof(struct udcd)); _stm_udc.parent.type = RT_Device_Class_USBDevice; +#ifdef RT_USING_DEVICE_OPS + _stm_udc.parent.ops = &_ops; +#else _stm_udc.parent.init = _init; +#endif _stm_udc.parent.user_data = &_stm_pcd; _stm_udc.ops = &_udc_ops; /* Register endpoint infomation */