8
8
9
9
/*
10
10
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
11
- * All rights reserved.
12
- *
13
- * Redistribution and use in source and binary forms, with or without modification,
11
+ * All rights reserved.
12
+ *
13
+ * Redistribution and use in source and binary forms, with or without modification,
14
14
* are permitted provided that the following conditions are met:
15
15
*
16
16
* 1. Redistributions of source code must retain the above copyright notice,
19
19
* this list of conditions and the following disclaimer in the documentation
20
20
* and/or other materials provided with the distribution.
21
21
* 3. The name of the author may not be used to endorse or promote products
22
- * derived from this software without specific prior written permission.
22
+ * derived from this software without specific prior written permission.
23
23
*
24
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
25
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
27
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
29
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
24
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
25
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
27
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
29
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
33
33
* OF SUCH DAMAGE.
34
34
*
35
35
* This file is part of the lwIP TCP/IP stack.
36
- *
36
+ *
37
37
* Author: Adam Dunkels <[email protected] >
38
38
*
39
39
*/
@@ -155,25 +155,34 @@ static const char *memp_desc[MEMP_MAX] = {
155
155
* extern u8_t __attribute__((section(".onchip_mem"))) memp_memory_UDP_PCB_base[];
156
156
*/
157
157
#define LWIP_MEMPOOL (name ,num ,size ,desc ) u8_t memp_memory_ ## name ## _base \
158
- [((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size)))];
158
+ [((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size)))];
159
159
#include "lwip/memp_std.h"
160
160
161
161
/** This array holds the base of each memory pool. */
162
- static u8_t * const memp_bases [] = {
163
- #define LWIP_MEMPOOL (name ,num ,size ,desc ) memp_memory_ ## name ## _base,
162
+ static u8_t * const memp_bases [] = {
163
+ #define LWIP_MEMPOOL (name ,num ,size ,desc ) memp_memory_ ## name ## _base ,
164
164
#include "lwip/memp_std.h"
165
165
};
166
166
167
167
#else /* MEMP_SEPARATE_POOLS */
168
168
169
169
#if defined(TARGET_LPC1768 )
170
- # define ETHMEM_SECTION __attribute((section("AHBSRAM1")))
170
+ # if defined (__ICCARM__ )
171
+ # define ETHMEM_SECTION
172
+ # elif defined(TOOLCHAIN_GCC_CR )
173
+ # define ETHMEM_SECTION __attribute__((section(".data.$RamPeriph32")))
174
+ # else
175
+ # define ETHMEM_SECTION __attribute__((section("AHBSRAM1"),aligned))
176
+ # endif
171
177
#else
172
- # define ETHMEM_SECTION
178
+ #define ETHMEM_SECTION
173
179
#endif
174
180
175
181
/** This is the actual memory used by the pools (all pools in one big block). */
176
- static u8_t memp_memory [MEM_ALIGNMENT - 1
182
+ #if defined (__ICCARM__ )
183
+ #pragma location = ".ethusbram"
184
+ #endif
185
+ static u8_t memp_memory [MEM_ALIGNMENT - 1
177
186
#define LWIP_MEMPOOL (name ,num ,size ,desc ) + ( (num ) * (MEMP_SIZE + MEMP_ALIGN_SIZE (size ) ) )
178
187
#include "lwip/memp_std.h"
179
188
] ETHMEM_SECTION ;
@@ -336,7 +345,7 @@ memp_overflow_init(void)
336
345
337
346
/**
338
347
* Initialize this module.
339
- *
348
+ *
340
349
* Carves out memp_memory into linked lists for each pool-type.
341
350
*/
342
351
void
@@ -399,7 +408,7 @@ memp_malloc_fn(memp_t type, const char* file, const int line)
399
408
{
400
409
struct memp * memp ;
401
410
SYS_ARCH_DECL_PROTECT (old_level );
402
-
411
+
403
412
LWIP_ERROR ("memp_malloc: type < MEMP_MAX" , (type < MEMP_MAX ), return NULL ;);
404
413
405
414
SYS_ARCH_PROTECT (old_level );
@@ -408,7 +417,7 @@ memp_malloc_fn(memp_t type, const char* file, const int line)
408
417
#endif /* MEMP_OVERFLOW_CHECK >= 2 */
409
418
410
419
memp = memp_tab [type ];
411
-
420
+
412
421
if (memp != NULL ) {
413
422
memp_tab [type ] = memp -> next ;
414
423
#if MEMP_OVERFLOW_CHECK
@@ -460,9 +469,9 @@ memp_free(memp_t type, void *mem)
460
469
#endif /* MEMP_OVERFLOW_CHECK >= 2 */
461
470
#endif /* MEMP_OVERFLOW_CHECK */
462
471
463
- MEMP_STATS_DEC (used , type );
464
-
465
- memp -> next = memp_tab [type ];
472
+ MEMP_STATS_DEC (used , type );
473
+
474
+ memp -> next = memp_tab [type ];
466
475
memp_tab [type ] = memp ;
467
476
468
477
#if MEMP_SANITY_CHECK
0 commit comments