]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - sitara-dss-files/am335x-dss-files.git/blob - padconf/am335x-padconf.dss
Add files for decoding pinmux data
[sitara-dss-files/am335x-dss-files.git] / padconf / am335x-padconf.dss
1 /*
2  * Copyright (c) 2017, 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  */
34 var padconf_registers = [
35         0x44E10800,
36         0x44E10804,
37         0x44E10808,
38         0x44E1080C,
39         0x44E10810,
40         0x44E10814,
41         0x44E10818,
42         0x44E1081C,
43         0x44E10820,
44         0x44E10824,
45         0x44E10828,
46         0x44E1082C,
47         0x44E10830,
48         0x44E10834,
49         0x44E10838,
50         0x44E1083C,
51         0x44E10840,
52         0x44E10844,
53         0x44E10848,
54         0x44E1084C,
55         0x44E10850,
56         0x44E10854,
57         0x44E10858,
58         0x44E1085C,
59         0x44E10860,
60         0x44E10864,
61         0x44E10868,
62         0x44E1086C,
63         0x44E10870,
64         0x44E10874,
65         0x44E10878,
66         0x44E1087C,
67         0x44E10880,
68         0x44E10884,
69         0x44E10888,
70         0x44E1088C,
71         0x44E10890,
72         0x44E10894,
73         0x44E10898,
74         0x44E1089C,
75         0x44E108A0,
76         0x44E108A4,
77         0x44E108A8,
78         0x44E108AC,
79         0x44E108B0,
80         0x44E108B4,
81         0x44E108B8,
82         0x44E108BC,
83         0x44E108C0,
84         0x44E108C4,
85         0x44E108C8,
86         0x44E108CC,
87         0x44E108D0,
88         0x44E108D4,
89         0x44E108D8,
90         0x44E108DC,
91         0x44E108E0,
92         0x44E108E4,
93         0x44E108E8,
94         0x44E108EC,
95         0x44E108F0,
96         0x44E108F4,
97         0x44E108F8,
98         0x44E108FC,
99         0x44E10900,
100         0x44E10904,
101         0x44E10908,
102         0x44E1090C,
103         0x44E10910,
104         0x44E10914,
105         0x44E10918,
106         0x44E1091C,
107         0x44E10920,
108         0x44E10924,
109         0x44E10928,
110         0x44E1092C,
111         0x44E10930,
112         0x44E10934,
113         0x44E10938,
114         0x44E1093C,
115         0x44E10940,
116         0x44E10944,
117         0x44E10948,
118         0x44E1094C,
119         0x44E10950,
120         0x44E10954,
121         0x44E10958,
122         0x44E1095C,
123         0x44E10960,
124         0x44E10964,
125         0x44E10968,
126         0x44E1096C,
127         0x44E10970,
128         0x44E10974,
129         0x44E10978,
130         0x44E1097C,
131         0x44E10980,
132         0x44E10984,
133         0x44E10988,
134         0x44E1098C,
135         0x44E10990,
136         0x44E10994,
137         0x44E10998,
138         0x44E1099C,
139         0x44E109A0,
140         0x44E109A4,
141         0x44E109A8,
142         0x44E109AC,
143         0x44E109B0,
144         0x44E109B4,
145         0x44E109B8,
146         0x44E109C0,
147         0x44E109D0,
148         0x44E109D4,
149         0x44E109D8,
150         0x44E109DC,
151         0x44E109E0,
152         0x44E109E4,
153         0x44E109E8,
154         0x44E109F8,
155         0x44E109FC,
156         0x44E10A00,
157         0x44E10A1C,
158         0x44E10A34,
159 ];
161 debugSessionDAP = ds.openSession("*","CS_DAP_M3");
162 debugSessionDAP.target.connect();
164 // Check connection by reading a location known to be non-zero (CM_WKUP_DEBUGSS_CLKCTRL)
165 value = debugSessionDAP.memory.readWord(0,0x44e00414,false);
166 if (value == 0) {
167         // Use DebugSS instead
168         debugSessionDAP.target.disconnect();
169         debugSessionDAP = ds.openSession("*","CS_DAP_DebugSS");
170         debugSessionDAP.target.connect();
171         value = debugSessionDAP.memory.readWord(0,0x44e00414,false);
172         if (value == 0) {
173                 print("ERROR: Trouble reading sane values from memory.");
174                 print("CM_WKUP_DEBUGSS_CLKCTRL = 0x" + d2h(value));
175         }
179 //Build a filename that includes date/time
180 var today = new Date();
181 var year4digit = today.getFullYear();
182 var month2digit = ("0" + (today.getMonth()+1)).slice(-2);
183 var day2digit = ("0" + today.getDate()).slice(-2);
184 var hour2digit = ("0" + today.getHours()).slice(-2);
185 var minutes2digit = ("0" + today.getMinutes()).slice(-2);
186 var seconds2digit = ("0" + today.getSeconds()).slice(-2);
187 var filename_date = '_' + year4digit + '-' + month2digit + '-' + day2digit + '_' + hour2digit + minutes2digit + seconds2digit; 
188 var userHomeFolder = System.getProperty("user.home");
189 var filename = userHomeFolder + '/Desktop/' + 'am335x-padconf' + filename_date + '.rd1';
191 file = new java.io.FileWriter(filename);
192 file.write("PadConf AM335x\n");
194 // helper function to create 8-digit hex numbers in ascii format
195 function d2h(d) {return ("00000000" + (+d).toString(16)).slice(-8);}
197 // read CTT data from physical addresses
198 for(i=0; i<padconf_registers.length; i++)
200         try {
201                 value = debugSessionDAP.memory.readWord(0,padconf_registers[i],false);
202                 value_string = d2h(value);
203                 file.write('0x' + ("0000" + padconf_registers[i].toString(16)).slice(-8) + " 0x" + value_string + "\n");
204         } catch (ex) {
205                 print("\n Trouble reading address 0x" + d2h(padconf_registers[i]) + ". Skipping register.\n");
206         }
208 print("Data collection complete.");
210 file.close();
211 debugSessionDAP.target.disconnect();
212 print("Created file " + filename);