mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 13:34:38 +08:00
memp: allow initialization of pool memory if not in standard section
This commit is contained in:
parent
3aca7885a7
commit
dc2bdc2a21
@ -239,6 +239,14 @@ memp_init_pool(const struct memp_desc *desc)
|
|||||||
|
|
||||||
*desc->tab = NULL;
|
*desc->tab = NULL;
|
||||||
memp = (struct memp*)LWIP_MEM_ALIGN(desc->base);
|
memp = (struct memp*)LWIP_MEM_ALIGN(desc->base);
|
||||||
|
#if MEMP_MEM_INIT
|
||||||
|
/* force memset on pool memory */
|
||||||
|
memset(memp, 0, (size_t)desc->num * (MEMP_SIZE + desc->size
|
||||||
|
#if MEMP_OVERFLOW_CHECK
|
||||||
|
+ MEMP_SANITY_REGION_AFTER_ALIGNED
|
||||||
|
#endif
|
||||||
|
));
|
||||||
|
#endif
|
||||||
/* create a linked list of memp elements */
|
/* create a linked list of memp elements */
|
||||||
for (i = 0; i < desc->num; ++i) {
|
for (i = 0; i < desc->num; ++i) {
|
||||||
memp->next = *desc->tab;
|
memp->next = *desc->tab;
|
||||||
|
@ -248,6 +248,15 @@
|
|||||||
#define MEMP_MEM_MALLOC 0
|
#define MEMP_MEM_MALLOC 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MEMP_MEM_INIT==1: Force use of memset to initialize pool memory.
|
||||||
|
* Useful if pool are moved in uninitialized section of memory. This will ensure
|
||||||
|
* default values in pcbs struct are well initialized in all conditions.
|
||||||
|
*/
|
||||||
|
#if !defined MEMP_MEM_INIT || defined __DOXYGEN__
|
||||||
|
#define MEMP_MEM_INIT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MEM_ALIGNMENT: should be set to the alignment of the CPU
|
* MEM_ALIGNMENT: should be set to the alignment of the CPU
|
||||||
* 4 byte alignment -> \#define MEM_ALIGNMENT 4
|
* 4 byte alignment -> \#define MEM_ALIGNMENT 4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user