From 2c4a50746aa222df4a151c6088226c64902e849a Mon Sep 17 00:00:00 2001 From: Courtney Darville Date: Wed, 30 Oct 2024 18:31:34 +1100 Subject: [PATCH] Still use size for the size of data regions, only use capacity for number of entries in a queue Signed-off-by: Courtney Darville --- examples/kitty/src/config/ethernet_config.h | 32 ++++++++++----------- examples/kitty/src/config/serial_config.h | 12 ++++---- examples/webserver/config/ethernet_config.h | 32 ++++++++++----------- examples/webserver/config/serial_config.h | 4 +-- 4 files changed, 40 insertions(+), 40 deletions(-) diff --git a/examples/kitty/src/config/ethernet_config.h b/examples/kitty/src/config/ethernet_config.h index fe6db9fb..122714db 100644 --- a/examples/kitty/src/config/ethernet_config.h +++ b/examples/kitty/src/config/ethernet_config.h @@ -22,7 +22,7 @@ #define NET_VIRT_TX_NAME "eth_virt_tx" #define NET_DRIVER_NAME "eth" -#define NET_DATA_REGION_CAPACITY 0x200000 +#define NET_DATA_REGION_SIZE 0x200000 #define NET_HW_REGION_SIZE 0x10000 #if defined(CONFIG_PLAT_ODROIDC4) @@ -40,13 +40,13 @@ #define NET_TX_QUEUE_CAPACITY_DRIV (NET_TX_QUEUE_CAPACITY_CLI0 \ + NET_TX_QUEUE_CAPACITY_CLI1) -#define NET_TX_DATA_REGION_CAPACITY_CLI0 NET_DATA_REGION_CAPACITY -#define NET_TX_DATA_REGION_CAPACITY_CLI1 NET_DATA_REGION_CAPACITY +#define NET_TX_DATA_REGION_SIZE_CLI0 NET_DATA_REGION_SIZE +#define NET_TX_DATA_REGION_SIZE_CLI1 NET_DATA_REGION_SIZE -_Static_assert(NET_TX_DATA_REGION_CAPACITY_CLI0 >= +_Static_assert(NET_TX_DATA_REGION_SIZE_CLI0 >= NET_TX_QUEUE_CAPACITY_CLI0 * NET_BUFFER_SIZE, "Client0 TX data region capacity must fit Client0 TX buffers"); -_Static_assert(NET_TX_DATA_REGION_CAPACITY_CLI1 >= +_Static_assert(NET_TX_DATA_REGION_SIZE_CLI1 >= NET_TX_QUEUE_CAPACITY_CLI1 * NET_BUFFER_SIZE, "Client1 TX data region capacity must fit Client1 TX buffers"); @@ -56,17 +56,17 @@ _Static_assert(NET_TX_DATA_REGION_CAPACITY_CLI1 >= #define NET_RX_QUEUE_CAPACITY_COPY0 NET_RX_QUEUE_CAPACITY_DRIV #define NET_RX_QUEUE_CAPACITY_COPY1 NET_RX_QUEUE_CAPACITY_DRIV -#define NET_RX_DATA_REGION_CAPACITY_DRIV NET_DATA_REGION_CAPACITY -#define NET_RX_DATA_REGION_CAPACITY_CLI0 NET_DATA_REGION_CAPACITY -#define NET_RX_DATA_REGION_CAPACITY_CLI1 NET_DATA_REGION_CAPACITY +#define NET_RX_DATA_REGION_SIZE_DRIV NET_DATA_REGION_SIZE +#define NET_RX_DATA_REGION_SIZE_CLI0 NET_DATA_REGION_SIZE +#define NET_RX_DATA_REGION_SIZE_CLI1 NET_DATA_REGION_SIZE -_Static_assert(NET_RX_DATA_REGION_CAPACITY_DRIV >= +_Static_assert(NET_RX_DATA_REGION_SIZE_DRIV >= NET_RX_QUEUE_CAPACITY_DRIV * NET_BUFFER_SIZE, "Driver RX data region capacity must fit Driver RX buffers"); -_Static_assert(NET_RX_DATA_REGION_CAPACITY_CLI0 >= +_Static_assert(NET_RX_DATA_REGION_SIZE_CLI0 >= NET_RX_QUEUE_CAPACITY_CLI0 * NET_BUFFER_SIZE, "Client0 RX data region capacity must fit Client0 RX buffers"); -_Static_assert(NET_RX_DATA_REGION_CAPACITY_CLI1 >= +_Static_assert(NET_RX_DATA_REGION_SIZE_CLI1 >= NET_RX_QUEUE_CAPACITY_CLI1 * NET_BUFFER_SIZE, "Client1 RX data region capacity must fit Client1 RX buffers"); @@ -147,8 +147,8 @@ static inline void net_virt_queue_info(char *pd_name, net_queue_t *cli0_free, ne .free = cli0_free, .active = cli0_active, .capacity = NET_RX_QUEUE_CAPACITY_COPY0 }; ret[1] = (net_queue_info_t) { - .free = (net_queue_t *)((uintptr_t)cli0_free + 2 * NET_DATA_REGION_CAPACITY), - .active = (net_queue_t *)((uintptr_t)cli0_active + 2 * NET_DATA_REGION_CAPACITY), + .free = (net_queue_t *)((uintptr_t)cli0_free + 2 * NET_DATA_REGION_SIZE), + .active = (net_queue_t *)((uintptr_t)cli0_active + 2 * NET_DATA_REGION_SIZE), .capacity = NET_RX_QUEUE_CAPACITY_COPY1 }; } else if (!sddf_strcmp(pd_name, NET_VIRT_TX_NAME)) { @@ -156,8 +156,8 @@ static inline void net_virt_queue_info(char *pd_name, net_queue_t *cli0_free, ne .free = cli0_free, .active = cli0_active, .capacity = NET_TX_QUEUE_CAPACITY_CLI0 }; ret[1] = (net_queue_info_t) { - .free = (net_queue_t *)((uintptr_t)cli0_free + 2 * NET_DATA_REGION_CAPACITY), - .active = (net_queue_t *)((uintptr_t)cli0_active + 2 * NET_DATA_REGION_CAPACITY), + .free = (net_queue_t *)((uintptr_t)cli0_free + 2 * NET_DATA_REGION_SIZE), + .active = (net_queue_t *)((uintptr_t)cli0_active + 2 * NET_DATA_REGION_SIZE), .capacity = NET_TX_QUEUE_CAPACITY_CLI1 }; } @@ -168,7 +168,7 @@ static inline void net_mem_region_vaddr(char *pd_name, uintptr_t mem_regions[NUM { if (!sddf_strcmp(pd_name, NET_VIRT_TX_NAME)) { mem_regions[0] = start_region; - mem_regions[1] = start_region + NET_DATA_REGION_CAPACITY; + mem_regions[1] = start_region + NET_DATA_REGION_SIZE; } } diff --git a/examples/kitty/src/config/serial_config.h b/examples/kitty/src/config/serial_config.h index 844c3ffe..c047ae1e 100644 --- a/examples/kitty/src/config/serial_config.h +++ b/examples/kitty/src/config/serial_config.h @@ -20,13 +20,17 @@ /* Default baud rate of the uart device */ #define UART_DEFAULT_BAUD 115200 +/* String to be printed to start console input */ +#define SERIAL_CONSOLE_BEGIN_STRING "" +#define SERIAL_CONSOLE_BEGIN_STRING_LEN 0 + /* One read/write client, one write only client */ #define SERIAL_CLI0_NAME "micropython" #define SERIAL_CLI1_NAME "nfs" #define SERIAL_VIRT_RX_NAME "serial_virt_rx" #define SERIAL_VIRT_TX_NAME "serial_virt_tx" -#define SERIAL_QUEUE_CAPACITY 0x1000 +#define SERIAL_QUEUE_SIZE 0x1000 #define SERIAL_DATA_REGION_CAPACITY 0x2000 #define SERIAL_TX_DATA_REGION_CAPACITY_DRIV (2 * SERIAL_DATA_REGION_CAPACITY) @@ -44,10 +48,6 @@ #define SERIAL_MAX_DATA_CAPACITY MAX(SERIAL_MAX_TX_DATA_CAPACITY, \ SERIAL_MAX_RX_DATA_CAPACITY) -/* String to be printed to start console input */ -#define SERIAL_CONSOLE_BEGIN_STRING "" -#define SERIAL_CONSOLE_BEGIN_STRING_LEN 0 - _Static_assert(SERIAL_MAX_DATA_CAPACITY < UINT32_MAX, "Data regions must be smaller than UINT32" " max to use queue data structure correctly."); @@ -86,7 +86,7 @@ static inline void serial_virt_queue_init_sys(char *pd_name, SERIAL_TX_DATA_REGION_CAPACITY_CLI0, cli_data); serial_queue_init(&cli_queue_handle[1], (serial_queue_t *)((uintptr_t)cli_queue + - SERIAL_QUEUE_CAPACITY), + SERIAL_QUEUE_SIZE), SERIAL_TX_DATA_REGION_CAPACITY_CLI1, cli_data + SERIAL_TX_DATA_REGION_CAPACITY_CLI0); } diff --git a/examples/webserver/config/ethernet_config.h b/examples/webserver/config/ethernet_config.h index 46f99bef..8b81e556 100644 --- a/examples/webserver/config/ethernet_config.h +++ b/examples/webserver/config/ethernet_config.h @@ -22,7 +22,7 @@ #define NET_VIRT_TX_NAME "eth_virt_tx" #define NET_DRIVER_NAME "eth" -#define NET_DATA_REGION_CAPACITY 0x200000 +#define NET_DATA_REGION_SIZE 0x200000 #define NET_HW_REGION_SIZE 0x10000 #if defined(CONFIG_PLAT_ODROIDC4) @@ -40,13 +40,13 @@ #define NET_TX_QUEUE_CAPACITY_DRIV (NET_TX_QUEUE_CAPACITY_CLI0 \ + NET_TX_QUEUE_CAPACITY_CLI1) -#define NET_TX_DATA_REGION_CAPACITY_CLI0 NET_DATA_REGION_CAPACITY -#define NET_TX_DATA_REGION_CAPACITY_CLI1 NET_DATA_REGION_CAPACITY +#define NET_TX_DATA_REGION_SIZE_CLI0 NET_DATA_REGION_SIZE +#define NET_TX_DATA_REGION_SIZE_CLI1 NET_DATA_REGION_SIZE -_Static_assert(NET_TX_DATA_REGION_CAPACITY_CLI0 >= +_Static_assert(NET_TX_DATA_REGION_SIZE_CLI0 >= NET_TX_QUEUE_CAPACITY_CLI0 * NET_BUFFER_SIZE, "Client0 TX data region size must fit Client0 TX buffers"); -_Static_assert(NET_TX_DATA_REGION_CAPACITY_CLI1 >= +_Static_assert(NET_TX_DATA_REGION_SIZE_CLI1 >= NET_TX_QUEUE_CAPACITY_CLI1 * NET_BUFFER_SIZE, "Client1 TX data region size must fit Client1 TX buffers"); @@ -56,17 +56,17 @@ _Static_assert(NET_TX_DATA_REGION_CAPACITY_CLI1 >= #define NET_RX_QUEUE_CAPACITY_COPY0 NET_RX_QUEUE_CAPACITY_DRIV #define NET_RX_QUEUE_CAPACITY_COPY1 NET_RX_QUEUE_CAPACITY_DRIV -#define NET_RX_DATA_REGION_CAPACITY_DRIV NET_DATA_REGION_CAPACITY -#define NET_RX_DATA_REGION_CAPACITY_CLI0 NET_DATA_REGION_CAPACITY -#define NET_RX_DATA_REGION_CAPACITY_CLI1 NET_DATA_REGION_CAPACITY +#define NET_RX_DATA_REGION_SIZE_DRIV NET_DATA_REGION_SIZE +#define NET_RX_DATA_REGION_SIZE_CLI0 NET_DATA_REGION_SIZE +#define NET_RX_DATA_REGION_SIZE_CLI1 NET_DATA_REGION_SIZE -_Static_assert(NET_RX_DATA_REGION_CAPACITY_DRIV >= +_Static_assert(NET_RX_DATA_REGION_SIZE_DRIV >= NET_RX_QUEUE_CAPACITY_DRIV * NET_BUFFER_SIZE, "Driver RX data region size must fit Driver RX buffers"); -_Static_assert(NET_RX_DATA_REGION_CAPACITY_CLI0 >= +_Static_assert(NET_RX_DATA_REGION_SIZE_CLI0 >= NET_RX_QUEUE_CAPACITY_CLI0 * NET_BUFFER_SIZE, "Client0 RX data region size must fit Client0 RX buffers"); -_Static_assert(NET_RX_DATA_REGION_CAPACITY_CLI1 >= +_Static_assert(NET_RX_DATA_REGION_SIZE_CLI1 >= NET_RX_QUEUE_CAPACITY_CLI1 * NET_BUFFER_SIZE, "Client1 RX data region size must fit Client1 RX buffers"); @@ -144,8 +144,8 @@ static inline void net_virt_queue_info(char *pd_name, net_queue_t *cli0_free, ne .free = cli0_free, .active = cli0_active, .capacity = NET_RX_QUEUE_CAPACITY_COPY0 }; ret[1] = (net_queue_info_t) { - .free = (net_queue_t *)((uintptr_t)cli0_free + 2 * NET_DATA_REGION_CAPACITY), - .active = (net_queue_t *)((uintptr_t)cli0_active + 2 * NET_DATA_REGION_CAPACITY), + .free = (net_queue_t *)((uintptr_t)cli0_free + 2 * NET_DATA_REGION_SIZE), + .active = (net_queue_t *)((uintptr_t)cli0_active + 2 * NET_DATA_REGION_SIZE), .capacity = NET_RX_QUEUE_CAPACITY_COPY1 }; } else if (!sddf_strcmp(pd_name, NET_VIRT_TX_NAME)) { @@ -153,8 +153,8 @@ static inline void net_virt_queue_info(char *pd_name, net_queue_t *cli0_free, ne .free = cli0_free, .active = cli0_active, .capacity = NET_TX_QUEUE_CAPACITY_CLI0 }; ret[1] = (net_queue_info_t) { - .free = (net_queue_t *)((uintptr_t)cli0_free + 2 * NET_DATA_REGION_CAPACITY), - .active = (net_queue_t *)((uintptr_t)cli0_active + 2 * NET_DATA_REGION_CAPACITY), + .free = (net_queue_t *)((uintptr_t)cli0_free + 2 * NET_DATA_REGION_SIZE), + .active = (net_queue_t *)((uintptr_t)cli0_active + 2 * NET_DATA_REGION_SIZE), .capacity = NET_TX_QUEUE_CAPACITY_CLI1 }; } @@ -165,7 +165,7 @@ static inline void net_mem_region_vaddr(char *pd_name, uintptr_t mem_regions[NUM { if (!sddf_strcmp(pd_name, NET_VIRT_TX_NAME)) { mem_regions[0] = start_region; - mem_regions[1] = start_region + NET_DATA_REGION_CAPACITY; + mem_regions[1] = start_region + NET_DATA_REGION_SIZE; } } diff --git a/examples/webserver/config/serial_config.h b/examples/webserver/config/serial_config.h index 3452711c..c5d61c1d 100644 --- a/examples/webserver/config/serial_config.h +++ b/examples/webserver/config/serial_config.h @@ -25,7 +25,7 @@ #define SERIAL_CLI1_NAME "nfs" #define SERIAL_VIRT_TX_NAME "serial_virt_tx" -#define SERIAL_QUEUE_CAPACITY 0x1000 +#define SERIAL_QUEUE_SIZE 0x1000 #define SERIAL_DATA_REGION_CAPACITY 0x2000 #define SERIAL_TX_DATA_REGION_CAPACITY_DRIV (2 * SERIAL_DATA_REGION_CAPACITY) @@ -73,7 +73,7 @@ static inline void serial_virt_queue_init_sys(char *pd_name, SERIAL_TX_DATA_REGION_CAPACITY_CLI0, cli_data); serial_queue_init(&cli_queue_handle[1], (serial_queue_t *)((uintptr_t)cli_queue + - SERIAL_QUEUE_CAPACITY), + SERIAL_QUEUE_SIZE), SERIAL_TX_DATA_REGION_CAPACITY_CLI1, cli_data + SERIAL_TX_DATA_REGION_CAPACITY_CLI0); }