TI BLE-Stack for Bluetooth 4.2 API Documentation  3.01.00.07
osal_memory.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  Group: WCS, LPC, BTS
4  $Target Device: DEVICES $
5 
6  ******************************************************************************
7  $License: BSD3 2004 $
8  ******************************************************************************
9  $Release Name: PACKAGE NAME $
10  $Release Date: PACKAGE RELEASE DATE $
11  *****************************************************************************/
12 
18 #ifndef OSAL_MEMORY_H
19 #define OSAL_MEMORY_H
20 
21 #ifdef __cplusplus
22 extern "C"
23 {
24 #endif
25 
26 /*********************************************************************
27  * INCLUDES
28  */
29 #include "comdef.h"
30 
31 /*********************************************************************
32  * CONSTANTS
33  */
34 
35 #if !defined ( OSALMEM_METRICS )
36  #define OSALMEM_METRICS FALSE
37 #endif
38 
39 /*********************************************************************
40  * MACROS
41  */
42 
44 #define osal_stack_used() OnBoard_stack_used()
45 
46 /*********************************************************************
47  * TYPEDEFS
48  */
49 
50 /*********************************************************************
51  * GLOBAL VARIABLES
52  */
53 
54 /*********************************************************************
55  * FUNCTIONS
56  */
57 
61  void osal_mem_init( void );
62 
70  void osal_mem_kick( void );
71 
73 
74  /*
75  * Allocate a block of memory.
76  */
77 #ifdef DPRINTF_OSALHEAPTRACE
78  void *osal_mem_alloc_dbg( uint16 size, const char *fname, unsigned lnum );
79 #define osal_mem_alloc(_size ) osal_mem_alloc_dbg(_size, __FILE__, __LINE__)
80 #else /* DPRINTF_OSALHEAPTRACE */
81 
86  void *osal_mem_alloc( uint16 size );
87 #endif /* DPRINTF_OSALHEAPTRACE */
88 
89  /*
90  * Free a block of memory.
91  */
92 #ifdef DPRINTF_OSALHEAPTRACE
93  void osal_mem_free_dbg( void *ptr, const char *fname, unsigned lnum );
94 #define osal_mem_free(_ptr ) osal_mem_free_dbg(_ptr, __FILE__, __LINE__)
95 #else /* DPRINTF_OSALHEAPTRACE */
96 
101  void osal_mem_free( void *ptr );
102 #endif /* DPRINTF_OSALHEAPTRACE */
103 
104 #if ( OSALMEM_METRICS )
105 
110  uint16 osal_heap_block_max( void );
111 
117  uint16 osal_heap_block_cnt( void );
118 
124  uint16 osal_heap_block_free( void );
125 
131  uint16 osal_heap_mem_used( void );
132 #endif
133 
134 #if defined (ZTOOL_P1) || defined (ZTOOL_P2)
135 
140  uint16 osal_heap_high_water( void );
141 #endif
142 
143 /*********************************************************************
144 *********************************************************************/
145 
146 #ifdef __cplusplus
147 }
148 #endif
149 
150 #endif /* #ifndef OSAL_MEMORY_H */
Common Defines.
void * osal_mem_alloc(uint16 size)
Implement the OSAL dynamic memory allocation functionality.
void osal_mem_free(void *ptr)
Implement the OSAL dynamic memory de-allocation functionality.
Copyright 2017, Texas Instruments Incorporated