From 68f6fb2eddc32cf6f2fbc3bf5aeb4189a2788486 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Fri, 24 Mar 2023 12:38:35 +0100 Subject: [PATCH] {stm32,stm32l4,stm32f0l0g0}/otg: move STM32_NENDPOINTS definitions to header files This value is useful for users when initializing a USB composite device in a board-specific logic --- arch/arm/src/stm32/stm32_otgfs.h | 8 ++++++++ arch/arm/src/stm32/stm32_otgfsdev.c | 4 ---- arch/arm/src/stm32/stm32_otghs.h | 8 ++++++++ arch/arm/src/stm32/stm32_otghsdev.c | 4 ---- arch/arm/src/stm32/stm32_usbdev.c | 1 - arch/arm/src/stm32/stm32_usbdev.h | 8 ++++++++ arch/arm/src/stm32/stm32_usbfs.c | 1 - arch/arm/src/stm32/stm32_usbfs.h | 8 ++++++++ arch/arm/src/stm32f0l0g0/stm32_usbdev.c | 1 - arch/arm/src/stm32l4/stm32l4_otgfs.h | 8 ++++++++ arch/arm/src/stm32l4/stm32l4_otgfsdev.c | 4 ---- 11 files changed, 40 insertions(+), 15 deletions(-) diff --git a/arch/arm/src/stm32/stm32_otgfs.h b/arch/arm/src/stm32/stm32_otgfs.h index e5a5820947..51aa5f667b 100644 --- a/arch/arm/src/stm32/stm32_otgfs.h +++ b/arch/arm/src/stm32/stm32_otgfs.h @@ -35,6 +35,14 @@ #if defined(CONFIG_STM32_OTGFS) +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Number of endpoints */ + +#define STM32_NENDPOINTS (4) /* ep0-3 x 2 for IN and OUT */ + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_otgfsdev.c b/arch/arm/src/stm32/stm32_otgfsdev.c index 8b53d27755..f982d8a93c 100644 --- a/arch/arm/src/stm32/stm32_otgfsdev.c +++ b/arch/arm/src/stm32/stm32_otgfsdev.c @@ -271,10 +271,6 @@ /* Endpoints ****************************************************************/ -/* Number of endpoints */ - -#define STM32_NENDPOINTS (4) /* ep0-3 x 2 for IN and OUT */ - /* Odd physical endpoint numbers are IN; even are OUT */ #define STM32_EPPHYIN2LOG(epphy) ((uint8_t)(epphy)|USB_DIR_IN) diff --git a/arch/arm/src/stm32/stm32_otghs.h b/arch/arm/src/stm32/stm32_otghs.h index 95fd182aed..a942a0c245 100644 --- a/arch/arm/src/stm32/stm32_otghs.h +++ b/arch/arm/src/stm32/stm32_otghs.h @@ -34,6 +34,14 @@ #if defined(CONFIG_STM32_OTGHS) +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Number of endpoints */ + +#define STM32_NENDPOINTS (4) /* ep0-3 x 2 for IN and OUT */ + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_otghsdev.c b/arch/arm/src/stm32/stm32_otghsdev.c index d99bd2f643..72e9fff030 100644 --- a/arch/arm/src/stm32/stm32_otghsdev.c +++ b/arch/arm/src/stm32/stm32_otghsdev.c @@ -227,10 +227,6 @@ /* Endpoints ****************************************************************/ -/* Number of endpoints */ - -#define STM32_NENDPOINTS (4) /* ep0-3 x 2 for IN and OUT */ - /* Odd physical endpoint numbers are IN; even are OUT */ #define STM32_EPPHYIN2LOG(epphy) ((uint8_t)(epphy)|USB_DIR_IN) diff --git a/arch/arm/src/stm32/stm32_usbdev.c b/arch/arm/src/stm32/stm32_usbdev.c index 41252a194c..9a56acea35 100644 --- a/arch/arm/src/stm32/stm32_usbdev.c +++ b/arch/arm/src/stm32/stm32_usbdev.c @@ -103,7 +103,6 @@ * endpoint register sets there are. */ -#define STM32_NENDPOINTS (8) #define EP0 (0) #define EP1 (1) #define EP2 (2) diff --git a/arch/arm/src/stm32/stm32_usbdev.h b/arch/arm/src/stm32/stm32_usbdev.h index f5adfcb9f1..b3839f720d 100644 --- a/arch/arm/src/stm32/stm32_usbdev.h +++ b/arch/arm/src/stm32/stm32_usbdev.h @@ -32,6 +32,14 @@ #include "chip.h" #include "hardware/stm32_usbdev.h" +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Number of endpoints */ + +#define STM32_NENDPOINTS (8) + /**************************************************************************** * Public Functions Prototypes ****************************************************************************/ diff --git a/arch/arm/src/stm32/stm32_usbfs.c b/arch/arm/src/stm32/stm32_usbfs.c index 8232afe7c9..3d5b717e8f 100644 --- a/arch/arm/src/stm32/stm32_usbfs.c +++ b/arch/arm/src/stm32/stm32_usbfs.c @@ -84,7 +84,6 @@ * endpoint register sets there are. */ -#define STM32_NENDPOINTS (8) #define EP0 (0) #define EP1 (1) #define EP2 (2) diff --git a/arch/arm/src/stm32/stm32_usbfs.h b/arch/arm/src/stm32/stm32_usbfs.h index cbb66172be..b4b4af3fda 100644 --- a/arch/arm/src/stm32/stm32_usbfs.h +++ b/arch/arm/src/stm32/stm32_usbfs.h @@ -32,6 +32,14 @@ #include "chip.h" #include "hardware/stm32_usbfs.h" +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Number of endpoints */ + +#define STM32_NENDPOINTS (8) + /**************************************************************************** * Public Functions Prototypes ****************************************************************************/ diff --git a/arch/arm/src/stm32f0l0g0/stm32_usbdev.c b/arch/arm/src/stm32f0l0g0/stm32_usbdev.c index 57a45b9341..7c5a86ddea 100644 --- a/arch/arm/src/stm32f0l0g0/stm32_usbdev.c +++ b/arch/arm/src/stm32f0l0g0/stm32_usbdev.c @@ -89,7 +89,6 @@ * endpoint register sets there are. */ -#define STM32_NENDPOINTS (8) #define EP0 (0) #define EP1 (1) #define EP2 (2) diff --git a/arch/arm/src/stm32l4/stm32l4_otgfs.h b/arch/arm/src/stm32l4/stm32l4_otgfs.h index 10697e9982..c98b832c0b 100644 --- a/arch/arm/src/stm32l4/stm32l4_otgfs.h +++ b/arch/arm/src/stm32l4/stm32l4_otgfs.h @@ -41,6 +41,14 @@ # error "Unsupported STM32L4 chip" #endif +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Number of endpoints */ + +#define STM32L4_NENDPOINTS (6) /* ep0-5 x 2 for IN and OUT */ + /**************************************************************************** * Public Functions Prototypes ****************************************************************************/ diff --git a/arch/arm/src/stm32l4/stm32l4_otgfsdev.c b/arch/arm/src/stm32l4/stm32l4_otgfsdev.c index 4e8983612b..b5f5f5314c 100644 --- a/arch/arm/src/stm32l4/stm32l4_otgfsdev.c +++ b/arch/arm/src/stm32l4/stm32l4_otgfsdev.c @@ -106,10 +106,6 @@ # define CONFIG_USBDEV_EP5_TXFIFO_SIZE 128 #endif -/* Number of endpoints */ - -#define STM32L4_NENDPOINTS (6) /* ep0-5 x 2 for IN and OUT */ - /* Adjust actual number of endpoints based upon size; * 0 means 'not available', and we expect that the first 0-length endpoint * implies that all others after are unused as well (irrespective of what