1 /**\r
2 * @file pa_osal.h\r
3 *\r
4 * @brief \r
5 * This is the sample OS Adaptation layer which is used by the PA low level\r
6 * driver. \r
7 * \r
8 * @details The OSAL layer can be ported in either of the following manners to a native OS:\r
9 *\r
10 * <b> Approach 1: </b>\r
11 * @n Use Prebuilt Libraries\r
12 * - Ensure that the LLD users provide an implementation of all \r
13 * Osal_XXX API for their native OS.\r
14 * - Link the prebuilt libraries with their application.\r
15 * - Refer to the "test" directory for an example of this\r
16 * @n <b> Pros: </b>\r
17 * - Customers can reuse prebuilt TI provided libraries\r
18 * @n <b> Cons: </b>\r
19 * - Level of indirection in the API to get to the actual OS call\r
20 * \r
21 * <b> Approach 2: </b>\r
22 * @n Rebuilt Library \r
23 * - Create a copy of this file and modify it to directly \r
24 * inline the native OS calls\r
25 * - Rebuild the PA low level driver library; ensure that the Include \r
26 * path points to the directory where the copy of this file \r
27 * has been provided.\r
28 * - Please refer to the "test" directory for an example of this \r
29 * @n <b> Pros: </b>\r
30 * - Optimizations can be done to remove the level of indirection\r
31 * @n <b> Cons: </b>\r
32 * - PA LLD Libraries need to be rebuilt by the customer.\r
33 *\r
34 * \par\r
35 * NOTE:\r
36 * (C) Copyright 2009-2010 Texas Instruments, Inc.\r
37 * \r
38 * Redistribution and use in source and binary forms, with or without \r
39 * modification, are permitted provided that the following conditions \r
40 * are met:\r
41 *\r
42 * Redistributions of source code must retain the above copyright \r
43 * notice, this list of conditions and the following disclaimer.\r
44 *\r
45 * Redistributions in binary form must reproduce the above copyright\r
46 * notice, this list of conditions and the following disclaimer in the \r
47 * documentation and/or other materials provided with the \r
48 * distribution.\r
49 *\r
50 * Neither the name of Texas Instruments Incorporated nor the names of\r
51 * its contributors may be used to endorse or promote products derived\r
52 * from this software without specific prior written permission.\r
53 *\r
54 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \r
55 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT \r
56 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
57 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT \r
58 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, \r
59 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \r
60 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
61 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
62 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
63 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE \r
64 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
65 *\r
66 */\r
67 #ifndef _PA_OSAL_H\r
68 #define _PA_OSAL_H\r
69 \r
70 /** @addtogroup PA_LLD_OSAL\r
71 @{ */\r
72 \r
73 /**********************************************************************\r
74 ************************* Extern Declarations ************************\r
75 **********************************************************************/\r
76 extern void Osal_paBeginMemAccess (void* addr, uint32_t size);\r
77 extern void Osal_paEndMemAccess (void* addr, uint32_t size);\r
78 \r
79 \r
80 /**\r
81 * @brief This macro is used to alert the application that the PA is\r
82 * going to access table memory. The application must ensure\r
83 * cache coherency and semaphores for multi-core applications\r
84 *\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_paBeginMemAccess (void* addr, uint32_t sizeWords)\r
91 @endverbatim\r
92 *\r
93 * <b> Parameters </b>\r
94 * @n The address of the table to be accessed\r
95 * @n The number of bytes in the table\r
96 *\r
97 * @note PA will make nested calls to this function for memory access\r
98 * protection of different memory tables. The multicore semaphore\r
99 * should be allocated only for the first call of a nested group \r
100 * of calls. \r
101 */\r
102 \r
103 #define Pa_osalBeginMemAccess Osal_paBeginMemAccess\r
104 \r
105 \r
106 /**\r
107 * @brief This macro is used to alert the application that the PA\r
108 * has completed access to table memory. This call will always\r
109 * be made following a call to Osal_paBeginMemAccess and have\r
110 * the same parameters\r
111 *\r
112 * <b> Prototype: </b>\r
113 * The following is the C prototype for the expected OSAL API.\r
114 *\r
115 * @verbatim\r
116 void Osal_paEndMemAccess (void* addr, uint32_t sizeWords)\r
117 @endverbatim\r
118 *\r
119 * <b> Parameters </b>\r
120 * @n The address of the table to be accessed\r
121 * @n The number of bytes in the table\r
122 *\r
123 * @note PA will make nested calls to this function for memory access\r
124 * protection of different memory tables. The multicore semaphore\r
125 * should be freed when all previous memory access has completed,\r
126 * in other words, when the nested call level reaches 0.\r
127 */\r
128 \r
129 #define Pa_osalEndMemAccess Osal_paEndMemAccess\r
130 \r
131 /**\r
132 @}\r
133 */\r
134 #endif /* _PA_OSAL_H */\r
135 \r