1 /**\r
2 * @file bcp_osal.h\r
3 *\r
4 * @brief \r
5 * OS Adaptation Layer (OSAL) header file for BCP Test application. \r
6 * Contains the BCP OSAL API prototype definitions.\r
7 *\r
8 * This is a sample OSAL file ported to XDC/BIOS for demonstration\r
9 * purposes only. This would need to be ported by System integrator\r
10 * to a suitable OS and implemented accordingly.\r
11 *\r
12 * Uses <b> Approach 2 </b> for OSAL implementation, i.e, the \r
13 * BCP library sources would have to be re-compiled with the \r
14 * new OSAL implementations.\r
15 *\r
16 * \par\r
17 * ============================================================================\r
18 * @n (C) Copyright 2010, Texas Instruments, Inc.\r
19 * \r
20 * Redistribution and use in source and binary forms, with or without \r
21 * modification, are permitted provided that the following conditions \r
22 * are met:\r
23 *\r
24 * Redistributions of source code must retain the above copyright \r
25 * notice, this list of conditions and the following disclaimer.\r
26 *\r
27 * Redistributions in binary form must reproduce the above copyright\r
28 * notice, this list of conditions and the following disclaimer in the \r
29 * documentation and/or other materials provided with the \r
30 * distribution.\r
31 *\r
32 * Neither the name of Texas Instruments Incorporated nor the names of\r
33 * its contributors may be used to endorse or promote products derived\r
34 * from this software without specific prior written permission.\r
35 *\r
36 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \r
37 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT \r
38 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
39 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT \r
40 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, \r
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \r
42 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
43 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
44 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
45 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE \r
46 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
47 *\r
48 */\r
49 #ifndef _BCP_OSAL_H_\r
50 #define _BCP_OSAL_H_\r
51 \r
52 /* BCP Test application types include */\r
53 #include <bcp_types.h>\r
54 \r
55 /* XDC/BIOS include */\r
56 #include <xdc/runtime/System.h>\r
57 #include <ti/sysbios/BIOS.h>\r
58 #include <ti/sysbios/knl/Semaphore.h>\r
59 \r
60 extern Void* Osal_biosMalloc (UInt32 num_bytes, Bool bGlobalAddress);\r
61 extern Void Osal_biosFree (Void* dataPtr, UInt32 num_bytes, Bool bGlobalAddress);\r
62 extern Void Osal_biosMultiCoreCsEnter ();\r
63 extern Void Osal_biosMultiCoreCsExit ();\r
64 extern Void Osal_biosInterruptCsEnter ();\r
65 extern Void Osal_biosInterruptCsExit ();\r
66 extern Void Osal_bcpBeginMemAccess (Void* pBlockPtr,UInt32 byteCnt);\r
67 extern Void Osal_bcpEndMemAccess (Void* pBlockPtr,UInt32 byteCnt);\r
68 extern Void Osal_bcpBeginDescMemAccess (Void* hRx, Void* pBlockPtr);\r
69 \r
70 /* Map out all BCP OSAL APIs to BIOS implementations */\r
71 #define Bcp_osalMalloc Osal_biosMalloc\r
72 #define Bcp_osalFree Osal_biosFree\r
73 #define Bcp_osalMultiCoreCsEnter Osal_biosMultiCoreCsEnter\r
74 #define Bcp_osalMultiCoreCsExit Osal_biosMultiCoreCsExit\r
75 #define Bcp_osalInterruptCsEnter Osal_biosInterruptCsEnter\r
76 #define Bcp_osalInterruptCsExit Osal_biosInterruptCsExit\r
77 #define Bcp_osalLog System_printf\r
78 #define Bcp_osalBeginMemAccess Osal_bcpBeginMemAccess\r
79 #define Bcp_osalEndMemAccess Osal_bcpEndMemAccess\r
80 #define Bcp_osalBeginDescMemAccess Osal_bcpBeginDescMemAccess\r
81 \r
82 /* Map out all BCP Semaphore APIs to corresponding BIOS implementations */\r
83 #define Bcp_osalCreateSem() (Void *) Semaphore_create (0, NULL, NULL)\r
84 #define Bcp_osalDeleteSem(X) Semaphore_delete ((Semaphore_Handle *)&X)\r
85 #define Bcp_osalPendSem(X) Semaphore_pend (X, BIOS_WAIT_FOREVER)\r
86 #define Bcp_osalPostSem(X) Semaphore_post (X)\r
87 \r
88 #endif /* _BCP_OSAL_H_ */\r