mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-11 18:36:41 +00:00
2006-02-27 Merged patch by Curt McDowell
pbuf.c: Fix alignment; pbuf_init() would not work unless pbuf_pool_memory[] is properly aligned.
This commit is contained in:
parent
182e1909b2
commit
db76ca248b
@ -73,7 +73,7 @@
|
|||||||
#include "lwip/sys.h"
|
#include "lwip/sys.h"
|
||||||
#include "arch/perf.h"
|
#include "arch/perf.h"
|
||||||
|
|
||||||
static u8_t pbuf_pool_memory[(PBUF_POOL_SIZE * MEM_ALIGN_SIZE(PBUF_POOL_BUFSIZE + sizeof(struct pbuf)))];
|
static u8_t pbuf_pool_memory[MEM_ALIGNMENT - 1 + PBUF_POOL_SIZE * MEM_ALIGN_SIZE(PBUF_POOL_BUFSIZE + sizeof(struct pbuf))];
|
||||||
|
|
||||||
#if !SYS_LIGHTWEIGHT_PROT
|
#if !SYS_LIGHTWEIGHT_PROT
|
||||||
static volatile u8_t pbuf_pool_free_lock, pbuf_pool_alloc_lock;
|
static volatile u8_t pbuf_pool_free_lock, pbuf_pool_alloc_lock;
|
||||||
@ -100,8 +100,7 @@ pbuf_init(void)
|
|||||||
struct pbuf *p, *q = NULL;
|
struct pbuf *p, *q = NULL;
|
||||||
u16_t i;
|
u16_t i;
|
||||||
|
|
||||||
pbuf_pool = (struct pbuf *)&pbuf_pool_memory[0];
|
pbuf_pool = (struct pbuf *)MEM_ALIGN(pbuf_pool_memory);
|
||||||
LWIP_ASSERT("pbuf_init: pool aligned", (mem_ptr_t)pbuf_pool % MEM_ALIGNMENT == 0);
|
|
||||||
|
|
||||||
#if PBUF_STATS
|
#if PBUF_STATS
|
||||||
lwip_stats.pbuf.avail = PBUF_POOL_SIZE;
|
lwip_stats.pbuf.avail = PBUF_POOL_SIZE;
|
||||||
|
Loading…
Reference in New Issue
Block a user