1 /* 2 * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 8 #pragma once 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 #if SOC_ESP_NIMBLE_CONTROLLER && CONFIG_BT_CONTROLLER_ENABLED 15 16 struct os_mempool; 17 struct os_mbuf_pool; 18 19 20 int r_mem_malloc_mempool(struct os_mempool *mempool, uint16_t num_blocks, 21 uint32_t block_size, char *name, void **out_buf); 22 #define mem_malloc_mempool r_mem_malloc_mempool 23 24 int r_mem_malloc_mempool_ext(struct os_mempool_ext *mempool, uint16_t num_blocks, 25 uint32_t block_size, char *name, void **out_buf); 26 #define mem_malloc_mempool_ext r_mem_malloc_mempool_ext 27 28 29 int r_mem_malloc_mbuf_pool(struct os_mempool *mempool, 30 struct os_mbuf_pool *mbuf_pool, uint16_t num_blocks, 31 uint32_t block_size, char *name, 32 void **out_buf); 33 #define mem_malloc_mbuf_pool r_mem_malloc_mbuf_pool 34 35 int r_mem_malloc_mbufpkt_pool(struct os_mempool *mempool, 36 struct os_mbuf_pool *mbuf_pool, int num_blocks, 37 int block_size, char *name, 38 void **out_buf); 39 #define mem_malloc_mbufpkt_pool r_mem_malloc_mbufpkt_pool 40 41 int r_mem_init_mbuf_pool(void *mem, struct os_mempool *mempool, 42 struct os_mbuf_pool *mbuf_pool, int num_blocks, 43 int block_size, const char *name); 44 #define mem_init_mbuf_pool r_mem_init_mbuf_pool 45 46 47 48 /** 49 * Specifies a function used as a callback. Functions of this type allocate an 50 * mbuf chain meant to hold a packet fragment. The resulting mbuf must contain 51 * a pkthdr. 52 * 53 * @param frag_size The number of data bytes that the mbuf will 54 * eventually contain. 55 * @param arg A generic parameter. 56 * 57 * @return An allocated mbuf chain on success; 58 * NULL on failure. 59 */ 60 typedef struct os_mbuf *mem_frag_alloc_fn(uint16_t frag_size, void *arg); 61 62 63 64 struct os_mbuf *r_mem_split_frag(struct os_mbuf **om, uint16_t max_frag_sz, 65 mem_frag_alloc_fn *alloc_cb, void *cb_arg); 66 #define mem_split_frag r_mem_split_frag 67 68 void *r_mem_pullup_obj(struct os_mbuf **om, uint16_t len); 69 #define mem_pullup_obj r_mem_pullup_obj 70 71 #endif 72 73 #ifdef __cplusplus 74 } 75 #endif 76