NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
mem.h
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#ifndef H_UTIL_MEM_
21#define H_UTIL_MEM_
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27struct os_mempool;
28struct os_mbuf_pool;
29
30
31#if SOC_ESP_NIMBLE_CONTROLLER && CONFIG_BT_CONTROLLER_ENABLED
32int r_mem_malloc_mempool(struct os_mempool *mempool, uint16_t num_blocks,
33 uint32_t block_size, char *name, void **out_buf);
34#define mem_malloc_mempool r_mem_malloc_mempool
35
36int r_mem_malloc_mempool_ext(struct os_mempool_ext *mempool, uint16_t num_blocks,
37 uint32_t block_size, char *name, void **out_buf);
38#define mem_malloc_mempool_ext r_mem_malloc_mempool_ext
39
40
41int r_mem_malloc_mbuf_pool(struct os_mempool *mempool,
42 struct os_mbuf_pool *mbuf_pool, uint16_t num_blocks,
43 uint32_t block_size, char *name,
44 void **out_buf);
45#define mem_malloc_mbuf_pool r_mem_malloc_mbuf_pool
46
47int r_mem_malloc_mbufpkt_pool(struct os_mempool *mempool,
48 struct os_mbuf_pool *mbuf_pool, int num_blocks,
49 int block_size, char *name,
50 void **out_buf);
51#define mem_malloc_mbufpkt_pool r_mem_malloc_mbufpkt_pool
52
53int r_mem_init_mbuf_pool(void *mem, struct os_mempool *mempool,
54 struct os_mbuf_pool *mbuf_pool, int num_blocks,
55 int block_size, const char *name);
56#define mem_init_mbuf_pool r_mem_init_mbuf_pool
57#else
58int mem_malloc_mempool(struct os_mempool *mempool, uint16_t num_blocks,
59 uint32_t block_size, char *name, void **out_buf);
60int mem_malloc_mempool_ext(struct os_mempool_ext *mempool, uint16_t num_blocks,
61 uint32_t block_size, char *name, void **out_buf);
62
63int mem_malloc_mbuf_pool(struct os_mempool *mempool,
64 struct os_mbuf_pool *mbuf_pool, uint16_t num_blocks,
65 uint32_t block_size, char *name,
66 void **out_buf);
67int mem_malloc_mbufpkt_pool(struct os_mempool *mempool,
68 struct os_mbuf_pool *mbuf_pool, int num_blocks,
69 int block_size, char *name,
70 void **out_buf);
71int mem_init_mbuf_pool(void *mem, struct os_mempool *mempool,
72 struct os_mbuf_pool *mbuf_pool, int num_blocks,
73 int block_size, const char *name);
74#endif
75
88typedef struct os_mbuf *mem_frag_alloc_fn(uint16_t frag_size, void *arg);
89
90
91#if SOC_ESP_NIMBLE_CONTROLLER && CONFIG_BT_CONTROLLER_ENABLED
92struct os_mbuf *r_mem_split_frag(struct os_mbuf **om, uint16_t max_frag_sz,
93 mem_frag_alloc_fn *alloc_cb, void *cb_arg);
94#define mem_split_frag r_mem_split_frag
95void *r_mem_pullup_obj(struct os_mbuf **om, uint16_t len);
96#define mem_pullup_obj r_mem_pullup_obj
97#else
98struct os_mbuf *mem_split_frag(struct os_mbuf **om, uint16_t max_frag_sz,
99 mem_frag_alloc_fn *alloc_cb, void *cb_arg);
100
101void *mem_pullup_obj(struct os_mbuf **om, uint16_t len);
102#endif
103#ifdef __cplusplus
104}
105#endif
106
107#endif
Definition os_mbuf.h:52
Definition os_mbuf.h:86
Definition os_mempool.h:57