• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  * Copyright (c) 2022 Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK")
3  * All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************/
18 /*************************************************************************************************/
19 /*!
20  *  \file   my_heap.h
21  *
22  *  \brief  Buffer heap service.
23  *
24  *  Copyright (c) 2018 Arm Ltd. All Rights Reserved.
25  *
26  *  Copyright (c) 2019-2020 Packetcraft, Inc.
27  *
28  *  Licensed under the Apache License, Version 2.0 (the "License");
29  *  you may not use this file except in compliance with the License.
30  *  You may obtain a copy of the License at
31  *
32  *      http://www.apache.org/licenses/LICENSE-2.0
33  *
34  *  Unless required by applicable law or agreed to in writing, software
35  *  distributed under the License is distributed on an "AS IS" BASIS,
36  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37  *  See the License for the specific language governing permissions and
38  *  limitations under the License.
39  */
40 /*************************************************************************************************/
41 
42 #pragma once
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /*! \addtogroup MY_HEAP_API
49  *  \{ */
50 
51 #include "common/compiler.h"
52 #include "common/types.h"
53 
54 /*!
55  *  \brief      Get heap available.
56  *
57  *  \return     Number of bytes of heap memory available.
58  */
59 u32 myHeapCountAvailable(void);
60 
61 /*!
62  *  \brief      Get heap used.
63  *
64  *  \return     Number of bytes of heap memory used.
65  */
66 u32 myHeapCountUsed(void);
67 
68 /*!
69  *  \brief      Reserve heap memory.
70  *
71  *  \param      size    Number of bytes of heap memory used.
72  */
73 void myHeapAlloc(u32 size);
74 
75 /*!
76  *  \brief      Get next available heap memory.
77  *
78  *  \return     Address of the start of heap memory.
79  */
80 void *myHeapGetFreeStartAddress(void);
81 
82 /*! \} */ /* MY_HEAP_API */
83 
84 #ifdef __cplusplus
85 };
86 #endif
87