1 /*
2 * Copyright (c) 2012-2014, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * */
32 /*
33 * ======== WatchdogTimer.xs ========
34 *
35 */
37 var Exception = null;
38 var Clock = null;
40 /*
41 * ======== module$meta$init ========
42 */
43 function module$meta$init()
44 {
45 /* Only process during "cfg" phase */
46 if (xdc.om.$name != "cfg") {
47 return;
48 }
50 this.RSTCTRL = 0x023100E8;
51 this.RSTCFG = 0x023100EC;
52 this.RSTMUXnBASE = 0x02620308;
53 this.TINTLDSPINT = 64;
55 if (Program.cpu.deviceName.match(/6614/)) {
56 /* Appleton */
57 this.biosReplacementTimer = 4;
58 this.biosReplacementTimerOwner = 0;
59 }
60 else {
61 /* K2 devices */
62 if (Program.cpu.deviceName.match(/6636/) ||
63 Program.cpu.deviceName.match(/6638/)) {
64 /* K2H & K2K */
65 this.biosReplacementTimer = 8;
66 this.biosReplacementTimerOwner = 0;
67 }
68 else if (Program.cpu.deviceName.match(/6630/)) {
69 /* K2L */
70 this.biosReplacementTimer = 8;
71 this.biosReplacementTimerOwner = 0;
72 }
73 else if (Program.cpu.deviceName.match(/AK2E/)) {
74 /* K2E */
75 this.biosReplacementTimer = 8;
76 this.biosReplacementTimerOwner = 0;
77 }
78 }
80 /* RegOverlay gets mapped in the source Init function since its address is based on
81 * the DSP number */
82 }
84 /*
85 * ======== module$use ========
86 */
87 function module$use()
88 {
89 var Clock = xdc.useModule('ti.sysbios.knl.Clock');
90 var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
92 WatchdogTimer = this;
94 /* Only configure the timerId if user has not done so in their *.cfg file */
95 if (!(Clock.$written("timerId"))) {
96 /* BIOS must be configured to use a different timer for the Clock module
97 * since the local timers for each core are the watchdog timers */
98 Clock.timerId = WatchdogTimer.biosReplacementTimer; // This will set BIOS to use a different timer for the Clock module
100 /* The timer will be shared by all cores. Configure the owner core */
101 Timer.timerSettings[Clock.timerId].ownerCoreId = WatchdogTimer.biosReplacementTimerOwner;
102 }
103 }
105 /*
106 * ======== module$static$init ========
107 */
108 function module$static$init(mod, params)
109 {
110 mod.wdTimerState = this.wdStates_INITIAL;
111 }