diff --git a/include/libopencm3/stm32/l4/memorymap.h b/include/libopencm3/stm32/l4/memorymap.h index 161c3351..d8e12e53 100644 --- a/include/libopencm3/stm32/l4/memorymap.h +++ b/include/libopencm3/stm32/l4/memorymap.h @@ -58,6 +58,8 @@ #define I2C3_BASE (PERIPH_BASE_APB1 + 0x5c00) #define CRS_BASE (PERIPH_BASE_APB1 + 0x6000) #define CAN1_BASE (PERIPH_BASE_APB1 + 0x6400) +#define USB_DEV_FS_BASE (PERIPH_BASE_APB1 + 0x6800) +#define USB_PMA_BASE (PERIPH_BASE_APB1 + 0x6c00) #define POWER_CONTROL_BASE (PERIPH_BASE_APB1 + 0x7000) #define DAC1_BASE (PERIPH_BASE_APB1 + 0x7400) #define OPAMP_BASE (PERIPH_BASE_APB1 + 0x7800) diff --git a/include/libopencm3/stm32/l4/rcc.h b/include/libopencm3/stm32/l4/rcc.h index 0366752c..f49ea7e2 100644 --- a/include/libopencm3/stm32/l4/rcc.h +++ b/include/libopencm3/stm32/l4/rcc.h @@ -757,6 +757,7 @@ enum rcc_periph_clken { RCC_OPAMP = _REG_BIT(RCC_APB1ENR1_OFFSET, 30), RCC_DAC1 = _REG_BIT(RCC_APB1ENR1_OFFSET, 29), RCC_PWR = _REG_BIT(RCC_APB1ENR1_OFFSET, 28), + RCC_USB = _REG_BIT(RCC_APB1ENR1_OFFSET, 26), RCC_CAN1 = _REG_BIT(RCC_APB1ENR1_OFFSET, 25), RCC_CRS = _REG_BIT(RCC_APB1ENR1_OFFSET, 24), RCC_I2C3 = _REG_BIT(RCC_APB1ENR1_OFFSET, 23), @@ -898,6 +899,7 @@ enum rcc_periph_rst { RST_OPAMP = _REG_BIT(RCC_APB1RSTR1_OFFSET, 30), RST_DAC1 = _REG_BIT(RCC_APB1RSTR1_OFFSET, 29), RST_PWR = _REG_BIT(RCC_APB1RSTR1_OFFSET, 28), + RST_USB = _REG_BIT(RCC_APB1RSTR1_OFFSET, 26), RST_CAN1 = _REG_BIT(RCC_APB1RSTR1_OFFSET, 25), RST_CRS = _REG_BIT(RCC_APB1RSTR1_OFFSET, 24), RST_I2C3 = _REG_BIT(RCC_APB1RSTR1_OFFSET, 23), diff --git a/include/libopencm3/stm32/l4/st_usbfs.h b/include/libopencm3/stm32/l4/st_usbfs.h new file mode 100644 index 00000000..7b65d2b8 --- /dev/null +++ b/include/libopencm3/stm32/l4/st_usbfs.h @@ -0,0 +1,27 @@ +/* + * This file is part of the libopencm3 project. + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ +/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY ! + * Use top-level + */ + +#ifndef LIBOPENCM3_ST_USBFS_H +# error Do not include directly ! +#else + +#include + +#endif diff --git a/include/libopencm3/stm32/st_usbfs.h b/include/libopencm3/stm32/st_usbfs.h index efab45fd..08f5d247 100644 --- a/include/libopencm3/stm32/st_usbfs.h +++ b/include/libopencm3/stm32/st_usbfs.h @@ -33,6 +33,8 @@ # include #elif defined(STM32L1) # include +#elif defined(STM32L4) +# include #else # error "STM32 family not defined or not supported." #endif diff --git a/lib/stm32/l4/Makefile b/lib/stm32/l4/Makefile index 6af3cdaa..4f7ef0c3 100644 --- a/lib/stm32/l4/Makefile +++ b/lib/stm32/l4/Makefile @@ -54,6 +54,9 @@ OBJS += dma_common_l1f013.o OBJS += iwdg_common_all.o OBJS += rtc_common_l1f024.o +OBJS += usb.o usb_control.o usb_standard.o +OBJS += st_usbfs_core.o st_usbfs_v2.o + VPATH += ../../usb:../:../../cm3:../common VPATH += ../../ethernet