mirror of
https://github.com/apache/nuttx.git
synced 2025-12-19 01:29:44 +08:00
net/xx/wrbuffer: Do not use SEM_INITIALIZER for buffers
Using the macro places the buffers into .data section which means they will consume the full buffer size of flash / read only memory as well. Place the buffers into .bss to avoid this case.
This commit is contained in:
@@ -73,10 +73,7 @@ struct wrbuffer_s
|
||||
|
||||
/* This is the state of the global write buffer resource */
|
||||
|
||||
static struct wrbuffer_s g_wrbuffer =
|
||||
{
|
||||
SEM_INITIALIZER(CONFIG_NET_TCP_NWRBCHAINS),
|
||||
};
|
||||
static struct wrbuffer_s g_wrbuffer;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -97,6 +94,10 @@ void tcp_wrbuffer_initialize(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
sq_init(&g_wrbuffer.freebuffers);
|
||||
|
||||
nxsem_init(&g_wrbuffer.sem, 0, CONFIG_NET_TCP_NWRBCHAINS);
|
||||
|
||||
for (i = 0; i < CONFIG_NET_TCP_NWRBCHAINS; i++)
|
||||
{
|
||||
sq_addfirst(&g_wrbuffer.buffers[i].wb_node, &g_wrbuffer.freebuffers);
|
||||
|
||||
@@ -72,10 +72,7 @@ struct wrbuffer_s
|
||||
|
||||
/* This is the state of the global write buffer resource */
|
||||
|
||||
static struct wrbuffer_s g_wrbuffer =
|
||||
{
|
||||
SEM_INITIALIZER(CONFIG_NET_UDP_NWRBCHAINS)
|
||||
};
|
||||
static struct wrbuffer_s g_wrbuffer;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -98,6 +95,8 @@ void udp_wrbuffer_initialize(void)
|
||||
|
||||
sq_init(&g_wrbuffer.freebuffers);
|
||||
|
||||
nxsem_init(&g_wrbuffer.sem, 0, CONFIG_NET_UDP_NWRBCHAINS);
|
||||
|
||||
for (i = 0; i < CONFIG_NET_UDP_NWRBCHAINS; i++)
|
||||
{
|
||||
sq_addfirst(&g_wrbuffer.buffers[i].wb_node, &g_wrbuffer.freebuffers);
|
||||
|
||||
Reference in New Issue
Block a user