]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blob - qnx/src/ipc3x_dev/ti/syslink/family/omap4430/ipu/omap4430DucatiHal.c
9b3b389801938a36f683610785c3d22440448ebc
[ipc/ipcdev.git] / qnx / src / ipc3x_dev / ti / syslink / family / omap4430 / ipu / omap4430DucatiHal.c
1 /*
2  *  @file   omap4430DucatiHal.c
3  *
4  *  @brief      Top-level Hardware Abstraction Module implementation
5  *
6  *              This module implements the top-level Hardware Abstraction Layer
7  *              for OMAP4430.
8  *              The implementation is specific to OMAP4430.
9  *
10  *
11  *  @ver        02.00.00.44_pre-alpha3
12  *
13  *  ============================================================================
14  *
15  *  Copyright (c) 2008-2009, Texas Instruments Incorporated
16  *
17  *  Redistribution and use in source and binary forms, with or without
18  *  modification, are permitted provided that the following conditions
19  *  are met:
20  *
21  *  *  Redistributions of source code must retain the above copyright
22  *     notice, this list of conditions and the following disclaimer.
23  *
24  *  *  Redistributions in binary form must reproduce the above copyright
25  *     notice, this list of conditions and the following disclaimer in the
26  *     documentation and/or other materials provided with the distribution.
27  *
28  *  *  Neither the name of Texas Instruments Incorporated nor the names of
29  *     its contributors may be used to endorse or promote products derived
30  *     from this software without specific prior written permission.
31  *
32  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
34  *  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
35  *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
36  *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
37  *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
38  *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
39  *  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40  *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
41  *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
42  *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43  *  Contact information for paper mail:
44  *  Texas Instruments
45  *  Post Office Box 655303
46  *  Dallas, Texas 75265
47  *  Contact information:
48  *  http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
49  *  DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
50  *  ============================================================================
51  *
52  */
55 /* Standard headers */
56 #include <ti/syslink/Std.h>
58 /* OSAL & utils headers */
59 #include <ti/syslink/utils/Trace.h>
61 /* Hardware Abstraction Layer headers */
62 #include <_ProcDefs.h>
63 #include <Processor.h>
64 #include <OMAP4430DucatiHal.h>
65 #include <OMAP4430DucatiPhyShmem.h>
66 #include <ti/syslink/utils/OsalPrint.h>
67 #define INREG32(x) in32(x)
68 #define OUTREG32(x, y) out32(x, y)
71 #if defined (__cplusplus)
72 extern "C" {
73 #endif
76 /* =============================================================================
77  *  Macros and types
78  * =============================================================================
79  */
81 /* =============================================================================
82  * APIs called by OMAP4430DUCATIPROC module
83  * =============================================================================
84  */
85 /*!
86  *  @brief      Function to initialize the HAL object
87  *
88  *  @param      halObj      Return parameter: Pointer to the HAL object
89  *  @param      initParams  Optional initialization parameters
90  *
91  *  @sa         OMAP4430DUCATI_halExit
92  *              OMAP4430DUCATI_phyShmemInit
93  */
94 Int
95 OMAP4430DUCATI_halInit (Ptr * halObj, Ptr params,UInt16 procId)
96 {
97     Int                  status    = PROCESSOR_SUCCESS;
98     OMAP4430DUCATI_HalObject * halObject = NULL;
99     OMAP4430DUCATIPROC_Params *lpParams = params;
100     GT_2trace (curTrace, GT_ENTER, "OMAP4430DUCATI_halInit", halObj, params);
102     GT_assert (curTrace, (halObj != NULL));
105     halObject = (OMAP4430DUCATI_HalObject *) halObj ;
106     *halObj = Memory_calloc (NULL, sizeof (OMAP4430DUCATI_HalObject), 0, NULL);
107 #if !defined(SYSLINK_BUILD_OPTIMIZE)
108     if (halObject == NULL) {
109         /*! @retval PROCESSOR_E_MEMORY Memory allocation failed */
110         status = PROCESSOR_E_MEMORY;
111         GT_setFailureReason (curTrace,
112                              GT_4CLASS,
113                              "OMAP4430DUCATI_halInit",
114                              status,
115                              "Memory allocation failed for HAL object!");
116     }
117     else {
118 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
120         halObject = (OMAP4430DUCATI_HalObject *) *halObj ;
121         halObject->procId = procId;
122         halObject->procHandle = lpParams->procHandle;
124         status = OMAP4430DUCATI_phyShmemInit (*halObj, lpParams->memEntries);
125 #if !defined(SYSLINK_BUILD_OPTIMIZE)
126         if (status < 0) {
127             GT_setFailureReason (curTrace,
128                                  GT_4CLASS,
129                                  "OMAP4430DUCATI_halInit",
130                                  status,
131                                  "OMAP4430DUCATI_phyShmemInit failed!");
132             Memory_free (NULL, *halObj, sizeof (OMAP4430DUCATI_HalObject));
133             *halObj = NULL;
134         }
135     }
136 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
138     GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATI_halInit", status);
140     /*! @retval PROCESSOR_SUCCESS Operation successful */
141     return status;
145 /*!
146  *  @brief      Function to finalize the HAL object
147  *
148  *  @param      halObj      Pointer to the HAL object
149  *
150  *  @sa         OMAP4430DUCATI_halInit
151  *              OMAP4430DUCATI_phyShmemExit
152  */
153 Int
154 OMAP4430DUCATI_halExit (Ptr halObj, Ptr params)
156     Int                  status    = PROCESSOR_SUCCESS;
157     OMAP4430DUCATI_HalObject * halObject = NULL;
158     OMAP4430DUCATIPROC_Params *lpParams = params;
160     GT_1trace (curTrace, GT_ENTER, "OMAP4430DUCATI_halExit", halObj);
162     GT_assert (curTrace, (halObj != NULL));
164     halObject = (OMAP4430DUCATI_HalObject *) halObj ;
165     status = OMAP4430DUCATI_phyShmemExit(halObj, lpParams->memEntries);
166 #if !defined(SYSLINK_BUILD_OPTIMIZE)
167     if (status < 0) {
168         GT_setFailureReason (curTrace,
169                              GT_4CLASS,
170                              "OMAP4430DUCATI_halExit",
171                              status,
172                              "OMAP4430DUCATI_phyShmemExit failed!");
173     }
174 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
176     if (halObj != NULL) {
177         /* Free the memory for the HAL object. */
178         Memory_free (NULL, halObj, sizeof (OMAP4430DUCATI_HalObject));
179     }
181     GT_1trace (curTrace, GT_LEAVE, "OMAP4430DUCATI_halExit", status);
183     /*! @retval PROCESSOR_SUCCESS Operation successful */
184     return status;
188 #if defined (__cplusplus)
190 #endif