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