diff options
| author | qiyongzhong0 <[email protected]> | 2019-12-05 13:40:04 +0800 |
|---|---|---|
| committer | qiyongzhong0 <[email protected]> | 2019-12-05 13:40:04 +0800 |
| commit | 5c15fd615d2108ca77ec55035d9c2ec6c9f0c706 (patch) | |
| tree | 01a9a7e82c792a72e19486ead9525dd03e1f02e7 /bsp/stm32 | |
| parent | 0dc7da688fa4d20745461b8835d3f6228fb90bf3 (diff) | |
修改stm32驱动库:
1.修改drv_flash_l4.c文件中stm32_onchip_flash定义的blk_size字段,由原来2048改为FLASH_PAGE_SIZE,以增强芯片适应性.
2.修改drv_usbd.c文件中stm_usbd_register函数,增加支持RT_USING_DEVICE_OPS配置.
Diffstat (limited to 'bsp/stm32')
| -rw-r--r-- | bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c | 2 | ||||
| -rw-r--r-- | bsp/stm32/libraries/HAL_Drivers/drv_usbd.c | 16 |
2 files changed, 17 insertions, 1 deletions
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 */ |
