Last change
on this file since 167 was 167, checked in by coas-nagasima, 7 years ago |
MIMEにSJISを設定
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Id
-
Property svn:mime-type
set to
text/x-csrc; charset=SHIFT_JIS
|
File size:
797 bytes
|
Line | |
---|
1 | /*
|
---|
2 | * 第3回 TOPPERS活用アイデア・アプリケーション開発コンテスト
|
---|
3 | * 松浦 光洋さんの「lwIP の移植」をベースにしました。
|
---|
4 | * http://www.toppers.jp/contest.html
|
---|
5 | *
|
---|
6 | * @(#) $Id: mem_pool.c 167 2016-03-08 11:37:45Z coas-nagasima $
|
---|
7 | */
|
---|
8 | //asp\doc\porting.txt
|
---|
9 | //6.15.1より
|
---|
10 |
|
---|
11 | #include "kernel/kernel_impl.h"
|
---|
12 | #include "tlsf.h"
|
---|
13 |
|
---|
14 | static tlsf_t tlsf_kmm;
|
---|
15 | static pool_t pool_kmm;
|
---|
16 |
|
---|
17 | void
|
---|
18 | initialize_kmm(void)
|
---|
19 | {
|
---|
20 | if ((kmm == NULL) || (kmmsz <= tlsf_size())) {
|
---|
21 | tlsf_kmm = NULL;
|
---|
22 | return;
|
---|
23 | }
|
---|
24 |
|
---|
25 | tlsf_kmm = tlsf_create(kmm);
|
---|
26 | if (tlsf_kmm == NULL)
|
---|
27 | return;
|
---|
28 |
|
---|
29 | pool_kmm = tlsf_add_pool(tlsf_kmm, ((uint8_t *)kmm) + tlsf_size(), kmmsz - tlsf_size());
|
---|
30 | }
|
---|
31 |
|
---|
32 | void *
|
---|
33 | kernel_malloc(SIZE size)
|
---|
34 | {
|
---|
35 | if (tlsf_kmm != NULL) {
|
---|
36 | return tlsf_malloc(tlsf_kmm, size);
|
---|
37 | }
|
---|
38 | else {
|
---|
39 | return(NULL);
|
---|
40 | }
|
---|
41 | }
|
---|
42 |
|
---|
43 | void
|
---|
44 | kernel_free(void *ptr)
|
---|
45 | {
|
---|
46 | if (tlsf_kmm != NULL) {
|
---|
47 | tlsf_free(tlsf_kmm, ptr);
|
---|
48 | }
|
---|
49 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.