mirror of
https://github.com/apache/nuttx.git
synced 2025-12-19 10:54:48 +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 */
|
/* This is the state of the global write buffer resource */
|
||||||
|
|
||||||
static struct wrbuffer_s g_wrbuffer =
|
static struct wrbuffer_s g_wrbuffer;
|
||||||
{
|
|
||||||
SEM_INITIALIZER(CONFIG_NET_TCP_NWRBCHAINS),
|
|
||||||
};
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@@ -97,6 +94,10 @@ void tcp_wrbuffer_initialize(void)
|
|||||||
{
|
{
|
||||||
int i;
|
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++)
|
for (i = 0; i < CONFIG_NET_TCP_NWRBCHAINS; i++)
|
||||||
{
|
{
|
||||||
sq_addfirst(&g_wrbuffer.buffers[i].wb_node, &g_wrbuffer.freebuffers);
|
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 */
|
/* This is the state of the global write buffer resource */
|
||||||
|
|
||||||
static struct wrbuffer_s g_wrbuffer =
|
static struct wrbuffer_s g_wrbuffer;
|
||||||
{
|
|
||||||
SEM_INITIALIZER(CONFIG_NET_UDP_NWRBCHAINS)
|
|
||||||
};
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@@ -98,6 +95,8 @@ void udp_wrbuffer_initialize(void)
|
|||||||
|
|
||||||
sq_init(&g_wrbuffer.freebuffers);
|
sq_init(&g_wrbuffer.freebuffers);
|
||||||
|
|
||||||
|
nxsem_init(&g_wrbuffer.sem, 0, CONFIG_NET_UDP_NWRBCHAINS);
|
||||||
|
|
||||||
for (i = 0; i < CONFIG_NET_UDP_NWRBCHAINS; i++)
|
for (i = 0; i < CONFIG_NET_UDP_NWRBCHAINS; i++)
|
||||||
{
|
{
|
||||||
sq_addfirst(&g_wrbuffer.buffers[i].wb_node, &g_wrbuffer.freebuffers);
|
sq_addfirst(&g_wrbuffer.buffers[i].wb_node, &g_wrbuffer.freebuffers);
|
||||||
|
|||||||
Reference in New Issue
Block a user