1 /**
2 * @file rm_osal.h
3 *
4 * @brief
5 * This is the sample OS Adaptation layer which is used by the Resource
6 * Manager. The OSAL layer can be ported in either of the following
7 * manners to a native OS:
8 *
9 * <b> Approach 1: </b>
10 * @n Use Prebuilt Libraries
11 * - Ensure that the provide an implementation of all
12 * Osal_XXX API for their native OS.
13 * - Link the prebuilt libraries with their application.
14 * - Refer to the "example" directory for an example of this
15 * @n <b> Pros: </b>
16 * - Customers can reuse prebuilt TI provided libraries
17 * @n <b> Cons: </b>
18 * - Level of indirection in the API to get to the actual OS call
19 *
20 * <b> Approach 2: </b>
21 * @n Rebuilt Library
22 * - Create a copy of this file and modify it to directly
23 * inline the native OS calls
24 * - Rebuild the RM low level drivver library; ensure that the Include
25 * path points to the directory where the copy of this file
26 * has been provided.
27 * - Please refer to the "test" directory for an example of this
28 * @n <b> Pros: </b>
29 * - Optimizations can be done to remove the level of indirection
30 * @n <b> Cons: </b>
31 * - RM LLD Libraries need to be rebuilt by the customer.
32 *
33 * \par
34 * NOTE:
35 * (C) Copyright 2012-2013 Texas Instruments, Inc.
36 *
37 * Redistribution and use in source and binary forms, with or without
38 * modification, are permitted provided that the following conditions
39 * are met:
40 *
41 * Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 *
44 * Redistributions in binary form must reproduce the above copyright
45 * notice, this list of conditions and the following disclaimer in the
46 * documentation and/or other materials provided with the
47 * distribution.
48 *
49 * Neither the name of Texas Instruments Incorporated nor the names of
50 * its contributors may be used to endorse or promote products derived
51 * from this software without specific prior written permission.
52 *
53 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
54 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
55 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
56 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
57 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
58 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
59 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
60 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
61 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
62 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
63 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64 *
65 * \par
66 */
67 #ifndef RM_OSAL_H_
68 #define RM_OSAL_H_
70 /** @addtogroup RM_OSAL_API
71 @{
72 */
74 /**********************************************************************
75 ************************* Extern Declarations ************************
76 **********************************************************************/
78 extern void *Osal_rmMalloc (uint32_t num_bytes);
79 extern void Osal_rmFree (void *ptr, uint32_t size);
80 extern void *Osal_rmLocalGateEnter (void);
81 extern void Osal_rmLocalGateLeave (void *localGateKey);
82 extern void Osal_rmLog (char *fmt, ... );
84 /**
85 * @brief The macro is used by RM to allocate memory of specified
86 * size
87 *
88 * <b> Prototype: </b>
89 * The following is the C prototype for the expected OSAL API.
90 *
91 * @verbatim
92 void* Osal_rmMalloc (uint32_t numBytes)
93 @endverbatim
94 *
95 * <b> Parameter </b>
96 * @n Number of bytes to be allocated
97 *
98 * <b> Return Value </b>
99 * @n Pointer to the allocated block size
100 */
101 #define Rm_osalMalloc Osal_rmMalloc
103 /**
104 * @brief The macro is used by RM to free a allocated block of
105 * memory
106 *
107 * <b> Prototype: </b>
108 * The following is the C prototype for the expected OSAL API.
109 *
110 * @verbatim
111 void Osal_rmFree (void *ptr, uint32_t size)
112 @endverbatim
113 *
114 * <b> Parameter </b>
115 * @n Pointer to the block of memory to be cleaned up.
116 * @n Size of the allocated memory which is being freed.
117 *
118 * <b> Return Value </b>
119 * @n Not applicable.
120 */
121 #define Rm_osalFree Osal_rmFree
124 #define Rm_osalLocalGateEnter Osal_rmLocalGateEnter
126 #define Rm_osalLocalGateLeave Osal_rmLocalGateLeave
128 /**
129 * @brief The macro is used by RM to log various
130 * messages.
131 *
132 * <b> Prototype: </b>
133 * The following is the C prototype for the expected OSAL API.
134 *
135 * @verbatim
136 void Osal_rmLog( char *fmt, ... )
137 @endverbatim
138 *
139 * <b> Parameter </b>
140 * @n printf-style format string
141 *
142 * <b> Return Value </b>
143 * @n Not applicable.
144 */
145 #define Rm_osalLog Osal_rmLog
147 /**
148 @}
149 */
151 #endif /* RM_OSAL_H_ */