From 4d352fc93ff2356ff68716e42dcf0d554847b693 Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Tue, 19 Mar 2019 20:14:31 +0100 Subject: [PATCH 1/2] usbdev: Extend with low level initialization functions --- drivers/include/periph/usbdev.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/include/periph/usbdev.h b/drivers/include/periph/usbdev.h index d5bcd69ad4..115a613d6f 100644 --- a/drivers/include/periph/usbdev.h +++ b/drivers/include/periph/usbdev.h @@ -355,6 +355,22 @@ typedef struct usbdev_driver { int (*ready)(usbdev_ep_t *ep, size_t len); } usbdev_driver_t; +/** + * @brief Low level USB peripheral driver initialization + * + * This function prepares all usbdev peripherals available for initialization + */ +void usbdev_init_lowlevel(void); + +/** + * @brief Retrieve usbdev context from the peripheral + * + * @param num usbdev peripheral number to retrieve + * + * @returns the usbdev context at index @p num + */ +usbdev_t *usbdev_get_ctx(unsigned num); + /** * @brief Initialize the USB peripheral device * From cf093c5a25a762d87ed9c3cbf5b55132d9af8a52 Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Tue, 19 Mar 2019 20:16:28 +0100 Subject: [PATCH 2/2] periph: add low level usbdev initialization --- drivers/periph_common/init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/periph_common/init.c b/drivers/periph_common/init.c index a235eb7b65..4025f06310 100644 --- a/drivers/periph_common/init.c +++ b/drivers/periph_common/init.c @@ -35,6 +35,9 @@ #ifdef MODULE_PERIPH_HWRNG #include "periph/hwrng.h" #endif +#ifdef MODULE_PERIPH_USBDEV +#include "periph/usbdev.h" +#endif void periph_init(void) { @@ -65,4 +68,8 @@ void periph_init(void) #ifdef MODULE_PERIPH_HWRNG hwrng_init(); #endif + +#ifdef MODULE_PERIPH_USBDEV + usbdev_init_lowlevel(); +#endif }