[ipc/ipcdev.git] / qnx / src / ipc3x_dev / ti / syslink / family / common / ti81xx / ti81xxducati / ti81xxvideom3 / Dm8168M3VideoHalBoot.c
1 /*
2 * @file Dm8168M3VideoHalBoot.c
3 *
4 * @brief Boot control module.
5 *
6 * This module is responsible for handling boot-related hardware-
7 * specific operations.
8 * The implementation is specific to DM8168VIDEOM3.
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/Error.h>
57 #endif /* #if defined(SYSLINK_BUILD_RTOS) */
59 #if defined(SYSLINK_BUILD_HLOS)
60 #include <ti/syslink/Std.h>
61 #endif /* #if defined(SYSLINK_BUILD_HLOS) */
63 /* OSAL & Utils headers */
64 #include <ti/syslink/utils/Trace.h>
66 /* Module headers */
67 //#include <_ProcDefs.h>
68 #include <Processor.h>
70 /* Hardware Abstraction Layer headers */
71 #include <Dm8168M3VideoHal.h>
72 #include <Dm8168M3VideoHalBoot.h>
75 #if defined (__cplusplus)
76 extern "C" {
77 #endif
80 /* =============================================================================
81 * Macros and types
82 * =============================================================================
83 */
84 /*!
85 * @brief Offsets of the DSP BOOT ADDR register
86 */
87 #define CONTROL_IVA2_BOOTADDR_OFFSET 0x190
88 #define CONTROL_IVA2_BOOTMOD_OFFSET 0x194
91 /* =============================================================================
92 * APIs called by DM8168VIDEOM3PROC module
93 * =============================================================================
94 */
95 /*!
96 * @brief Function to control boot operations
97 *
98 * @param halObj Pointer to the HAL object
99 * @param cmd Boot command
100 * @param arg Arguments specific to the boot command
101 *
102 * @sa
103 */
104 Int
105 DM8168VIDEOM3_halBootCtrl (Ptr halObj, Processor_BootCtrlCmd cmd, Ptr args)
106 {
107 Int status = PROCESSOR_SUCCESS;
108 DM8168VIDEOM3_HalObject * halObject = NULL;
110 GT_3trace (curTrace, GT_ENTER, "DM8168VIDEOM3_halBootCtrl", halObj, cmd, args);
112 GT_assert (curTrace, (halObj != NULL));
113 GT_assert (curTrace, (cmd < Processor_BootCtrlCmd_EndValue));
115 halObject = (DM8168VIDEOM3_HalObject *) halObj;
117 switch (cmd) {
118 case Processor_BootCtrlCmd_SetEntryPoint:
119 {
120 /* copy _c_int00 addresses to 0x4th location of Ducati
121 Last bit at this mem location has to be explicitly set to 1 to
122 ensure that M3 is in THUMB mode*/
123 REG (halObject->generalCtrlBase) = 0x0;
124 REG (halObject->generalCtrlBase) = ((UInt32)args | 0x1);
125 }
126 break ;
128 case Processor_BootCtrlCmd_SetBootComplete:
129 {
130 /* Do nothing here for DM8168VIDEOM3 gem */
131 }
132 break ;
134 case Processor_BootCtrlCmd_ResetBootComplete:
135 {
136 /* Do nothing here for DM8168VIDEOM3 gem */
137 }
138 break ;
140 default:
141 {
142 /*! @retval PROCESSOR_E_INVALIDARG Invalid argument */
143 status = PROCESSOR_E_INVALIDARG;
144 GT_setFailureReason (curTrace,
145 GT_4CLASS,
146 "DM8168VIDEOM3_halBootCtrl",
147 status,
148 "Unsupported boot ctrl cmd specified");
149 }
150 break ;
151 }
153 GT_1trace (curTrace, GT_LEAVE, "DM8168VIDEOM3_halBootCtrl",status);
155 /*! @retval PROCESSOR_SUCCESS Operation successful */
156 return status;
157 }
160 #if defined (__cplusplus)
161 }
162 #endif