[ipc/ipcdev.git] / qnx / src / ipc3x_dev / ti / syslink / family / common / ti81xx / ti81xxducati / ti81xxvpssm3 / Dm8168M3DssHal.c
1 /*
2 * @file Dm8168M3DssHal.c
3 *
4 * @brief Top-level Hardware Abstraction Module implementation
5 *
6 * This module implements the top-level Hardware Abstraction Layer
7 * for DM8168VPSSM3.
8 * The implementation is specific to DM8168VPSSM3.
9 *
10 *
11 * ============================================================================
12 *
13 * Copyright (c) 2008-2012, Texas Instruments Incorporated
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 *
19 * * Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 *
22 * * Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution.
25 *
26 * * Neither the name of Texas Instruments Incorporated nor the names of
27 * its contributors may be used to endorse or promote products derived
28 * from this software without specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
32 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
34 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
35 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
37 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
38 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
39 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
40 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 * Contact information for paper mail:
42 * Texas Instruments
43 * Post Office Box 655303
44 * Dallas, Texas 75265
45 * Contact information:
46 * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
47 * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
48 * ============================================================================
49 *
50 */
54 #if defined(SYSLINK_BUILD_RTOS)
55 #include <xdc/std.h>
56 #include <xdc/runtime/Memory.h>
57 #include <xdc/runtime/Error.h>
58 #endif /* #if defined(SYSLINK_BUILD_RTOS) */
60 #if defined(SYSLINK_BUILD_HLOS)
61 #include <ti/syslink/Std.h>
62 /* OSAL & utils headers */
63 #include <ti/syslink/utils/Memory.h>
65 #endif /* #if defined(SYSLINK_BUILD_HLOS) */
67 #include <ti/syslink/utils/Trace.h>
69 /* Hardware Abstraction Layer headers */
70 #include <_ProcDefs.h>
71 #include <Processor.h>
72 #include <Dm8168M3DssHal.h>
73 #include <Dm8168M3DssHalBoot.h>
74 #include <Dm8168M3DssPhyShmem.h>
77 #if defined (__cplusplus)
78 extern "C" {
79 #endif
82 /* =============================================================================
83 * Macros and types
84 * =============================================================================
85 */
87 /* =============================================================================
88 * APIs called by DM8168VPSSM3PROC module
89 * =============================================================================
90 */
91 /*!
92 * @brief Function to initialize the HAL object
93 *
94 * @param halObj Return parameter: Pointer to the HAL object
95 * @param initParams Optional initialization parameters
96 *
97 * @sa DM8168VPSSM3_halExit
98 * DM8168VPSSM3_phyShmemInit
99 */
100 Int
101 DM8168VPSSM3_halInit (Ptr * halObj, Ptr params)
102 {
103 Int status = PROCESSOR_SUCCESS;
104 DM8168VPSSM3_HalObject * halObject = NULL;
106 GT_2trace (curTrace, GT_ENTER, "DM8168VPSSM3_halInit", halObj, params);
108 GT_assert (curTrace, (halObj != NULL));
110 halObject = (DM8168VPSSM3_HalObject *) halObj ;
112 (Void) params ; /* Not used. */
114 *halObj = Memory_calloc (NULL, sizeof (DM8168VPSSM3_HalObject), 0, NULL);
115 if (halObject == NULL) {
116 /*! @retval PROCESSOR_E_MEMORY Memory allocation failed */
117 status = PROCESSOR_E_MEMORY;
118 GT_setFailureReason (curTrace,
119 GT_4CLASS,
120 "DM8168VPSSM3_halInit",
121 status,
122 "Memory allocation failed for HAL object!");
123 }
124 else {
125 status = DM8168VPSSM3_phyShmemInit (*halObj);
126 #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS)
127 if (status < 0) {
128 GT_setFailureReason (curTrace,
129 GT_4CLASS,
130 "DM8168VPSSM3_halInit",
131 status,
132 "DM8168VPSSM3_phyShmemInit failed!");
133 Memory_free (NULL, *halObj, sizeof (DM8168VPSSM3_HalObject));
134 *halObj = NULL;
135 }
136 #endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS) */
137 }
138 GT_1trace (curTrace, GT_LEAVE, "DM8168VPSSM3_halInit", status);
140 /*! @retval PROCESSOR_SUCCESS Operation successful */
141 return status;
142 }
145 /*!
146 * @brief Function to finalize the HAL object
147 *
148 * @param halObj Pointer to the HAL object
149 *
150 * @sa DM8168VPSSM3_halInit
151 * DM8168VPSSM3_phyShmemExit
152 */
153 Int
154 DM8168VPSSM3_halExit (Ptr halObj)
155 {
156 Int status = PROCESSOR_SUCCESS;
158 GT_1trace (curTrace, GT_ENTER, "DM8168VPSSM3_halExit", halObj);
160 GT_assert (curTrace, (halObj != NULL));
162 status = DM8168VPSSM3_phyShmemExit (halObj);
163 #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS)
164 if (status < 0) {
165 GT_setFailureReason (curTrace,
166 GT_4CLASS,
167 "DM8168VPSSM3_halExit",
168 status,
169 "DM8168VPSSM3_phyShmemExit failed!");
170 }
171 #endif /* #if !defined(SYSLINK_BUILD_OPTIMIZE) && defined (SYSLINK_BUILD_HLOS) */
173 if (halObj != NULL) {
174 /* Free the memory for the HAL object. */
175 Memory_free (NULL, halObj, sizeof (DM8168VPSSM3_HalObject));
176 }
178 GT_1trace (curTrace, GT_LEAVE, "DM8168VPSSM3_halExit", status);
180 /*! @retval PROCESSOR_SUCCESS Operation successful */
181 return status;
182 }
185 #if defined (__cplusplus)
186 }
187 #endif