• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*******************************************************************************
2 * Copyright (C) 2018 Cadence Design Systems, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to use this Software with Cadence processor cores only and
7 * not with any other processors and platforms, subject to
8 * the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included
11 * in all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
17 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
18 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 
21 ******************************************************************************/
22 
23 #define MEM_NUM_MEM_ALLOC 32
24 
25 typedef struct {
26     void* heap_ptr;
27     int size;
28 }mem_obj_dev_t;
29 
30 typedef struct {
31     void* heap_ptr;
32     int size;
33 }mem_obj_comp_t;
34 
35 typedef struct {
36     mem_obj_dev_t mem_dev[MEM_NUM_MEM_ALLOC];
37     mem_obj_comp_t mem_comp[MEM_NUM_MEM_ALLOC];
38     int num_malloc_dev;
39     int num_malloc_comp;
40     int persi_mem_dev;
41     int persi_mem_comp;
42 }mem_obj_t;
43 
44 void* mem_malloc(int size, int id);
45 void mem_free(void * heap_ptr, int id);
46 void* mem_init();
47 void mem_exit();
48 int mem_get_alloc_size(mem_obj_t* mem_handle, int id);
49 
50