diff --git a/Components/USB/Source/usbh_config.c b/Components/USB/Source/usbh_config.c index 7162a45a..880d5329 100644 --- a/Components/USB/Source/usbh_config.c +++ b/Components/USB/Source/usbh_config.c @@ -8,6 +8,8 @@ #include "usbh_config.h" +#include "usbh_section.h" + /*------------------------------------------------------------------------------ * USB Host Configuration calculated macros *----------------------------------------------------------------------------*/ @@ -23,40 +25,6 @@ #define USBHn_DRIVER_(n) Driver_USBH##n #define USBHn_DRIVER(n) USBHn_DRIVER_(n) -#define USBHn_HC_MEM_POOL_SECTION_(x) __attribute__((section(x))) - -#ifdef USBH0_HC_NUM -#if (USBH0_HC_MEM_POOL_RELOC == 1) -#define USBH0_HC_MEM_POOL_SECTION(x) USBHn_HC_MEM_POOL_SECTION_(x) -#else -#define USBH0_HC_MEM_POOL_SECTION(x) -#endif -#endif - -#ifdef USBH1_HC_NUM -#if (USBH1_HC_MEM_POOL_RELOC == 1) -#define USBH1_HC_MEM_POOL_SECTION(x) USBHn_HC_MEM_POOL_SECTION_(x) -#else -#define USBH1_HC_MEM_POOL_SECTION(x) -#endif -#endif - -#ifdef USBH2_HC_NUM -#if (USBH2_HC_MEM_POOL_RELOC == 1) -#define USBH2_HC_MEM_POOL_SECTION(x) USBHn_HC_MEM_POOL_SECTION_(x) -#else -#define USBH2_HC_MEM_POOL_SECTION(x) -#endif -#endif - -#ifdef USBH3_HC_NUM -#if (USBH3_HC_MEM_POOL_RELOC == 1) -#define USBH3_HC_MEM_POOL_SECTION(x) USBHn_HC_MEM_POOL_SECTION_(x) -#else -#define USBH3_HC_MEM_POOL_SECTION(x) -#endif -#endif - /*------------------------------------------------------------------------------ * USB Host externals *----------------------------------------------------------------------------*/ @@ -91,7 +59,7 @@ static const uint32_t usbh0_pipe_num = USBH0_HC_PIPE_NUM; static const uint32_t usbh0_mem_pool_size = USBH0_HC_MEM_POOL_SIZE; static const uint8_t usbh0_mem_pool_reloc = USBH0_HC_MEM_POOL_RELOC; USBH_PIPE usbh0_pipe [USBH0_HC_PIPE_NUM]; -static uint32_t usbh0_mem_pool [USBH0_HC_MEM_POOL_SIZE / 4] USBH0_HC_MEM_POOL_SECTION(USBH0_HC_MEM_POOL_SECTION_NAME); +static uint32_t usbh0_mem_pool [USBH0_HC_MEM_POOL_SIZE / 4] USBH0_HC_MEM_POOL_SECTION; static ARM_DRIVER_USBH *usbh0_hcd_ptr = &USBHn_DRIVER(USBH0_HC_NUM); // Core Thread definitions @@ -133,7 +101,7 @@ static const uint32_t usbh1_pipe_num = USBH1_HC_PIPE_NUM; static const uint32_t usbh1_mem_pool_size = USBH1_HC_MEM_POOL_SIZE; static const uint8_t usbh1_mem_pool_reloc = USBH1_HC_MEM_POOL_RELOC; USBH_PIPE usbh1_pipe [USBH1_HC_PIPE_NUM]; -static uint32_t usbh1_mem_pool [USBH1_HC_MEM_POOL_SIZE / 4] USBH1_HC_MEM_POOL_SECTION(USBH1_HC_MEM_POOL_SECTION_NAME); +static uint32_t usbh1_mem_pool [USBH1_HC_MEM_POOL_SIZE / 4] USBH1_HC_MEM_POOL_SECTION; static ARM_DRIVER_USBH *usbh1_hcd_ptr = &USBHn_DRIVER(USBH1_HC_NUM); // Core Thread definitions @@ -175,7 +143,7 @@ static const uint32_t usbh2_pipe_num = USBH2_HC_PIPE_NUM; static const uint32_t usbh2_mem_pool_size = USBH2_HC_MEM_POOL_SIZE; static const uint8_t usbh2_mem_pool_reloc = USBH2_HC_MEM_POOL_RELOC; USBH_PIPE usbh2_pipe [USBH2_HC_PIPE_NUM]; -static uint32_t usbh2_mem_pool [USBH2_HC_MEM_POOL_SIZE / 4] USBH2_HC_MEM_POOL_SECTION(USBH2_HC_MEM_POOL_SECTION_NAME); +static uint32_t usbh2_mem_pool [USBH2_HC_MEM_POOL_SIZE / 4] USBH2_HC_MEM_POOL_SECTION; static ARM_DRIVER_USBH *usbh2_hcd_ptr = &USBHn_DRIVER(USBH2_HC_NUM); // Core Thread definitions @@ -217,7 +185,7 @@ static const uint32_t usbh3_pipe_num = USBH3_HC_PIPE_NUM; static const uint32_t usbh3_mem_pool_size = USBH3_HC_MEM_POOL_SIZE; static const uint8_t usbh3_mem_pool_reloc = USBH3_HC_MEM_POOL_RELOC; USBH_PIPE usbh3_pipe [USBH3_HC_PIPE_NUM]; -static uint32_t usbh3_mem_pool [USBH3_HC_MEM_POOL_SIZE / 4] USBH3_HC_MEM_POOL_SECTION(USBH3_HC_MEM_POOL_SECTION_NAME); +static uint32_t usbh3_mem_pool [USBH3_HC_MEM_POOL_SIZE / 4] USBH3_HC_MEM_POOL_SECTION; static ARM_DRIVER_USBH *usbh3_hcd_ptr = &USBHn_DRIVER(USBH3_HC_NUM); // Core Thread definitions diff --git a/Components/USB/Source/usbh_section.h b/Components/USB/Source/usbh_section.h new file mode 100644 index 00000000..a572b6f8 --- /dev/null +++ b/Components/USB/Source/usbh_section.h @@ -0,0 +1,50 @@ +/*------------------------------------------------------------------------------ + * MDK Middleware - Component ::USB:Host + * Copyright (c) 2024 Arm Limited (or its affiliates). All rights reserved. + *------------------------------------------------------------------------------ + * Name: usbh_section.h + * Purpose: USB Host (USBH) - Section definitions + *----------------------------------------------------------------------------*/ + +#ifndef USBH_SECTION_ +#define USBH_SECTION_ + +/*------------------------------------------------------------------------------ + * USB Host 0..3 section defines + *----------------------------------------------------------------------------*/ + +#define USBHn_HC_MEM_POOL_SECTION_(str) __attribute__((section(str))) + +#ifdef USBH0_HC_NUM +#if (USBH0_HC_MEM_POOL_RELOC == 1) +#define USBH0_HC_MEM_POOL_SECTION USBHn_HC_MEM_POOL_SECTION_(USBH0_HC_MEM_POOL_SECTION_NAME) +#else +#define USBH0_HC_MEM_POOL_SECTION +#endif +#endif + +#ifdef USBH1_HC_NUM +#if (USBH1_HC_MEM_POOL_RELOC == 1) +#define USBH1_HC_MEM_POOL_SECTION USBHn_HC_MEM_POOL_SECTION_(USBH1_HC_MEM_POOL_SECTION_NAME) +#else +#define USBH1_HC_MEM_POOL_SECTION +#endif +#endif + +#ifdef USBH2_HC_NUM +#if (USBH2_HC_MEM_POOL_RELOC == 1) +#define USBH2_HC_MEM_POOL_SECTION USBHn_HC_MEM_POOL_SECTION_(USBH2_HC_MEM_POOL_SECTION_NAME) +#else +#define USBH2_HC_MEM_POOL_SECTION +#endif +#endif + +#ifdef USBH3_HC_NUM +#if (USBH3_HC_MEM_POOL_RELOC == 1) +#define USBH3_HC_MEM_POOL_SECTION USBHn_HC_MEM_POOL_SECTION_(USBH3_HC_MEM_POOL_SECTION_NAME) +#else +#define USBH3_HC_MEM_POOL_SECTION +#endif +#endif + +#endif // USBH_SECTION_