]>
git.ipfire.org Git - people/ms/u-boot.git/blob - common/cmd_mfsl.c
2 * (C) Copyright 2007 Michal Simek
4 * Michal SIMEK <monstr@monstr.eu>
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 * Microblaze FSL support
34 int do_frd (cmd_tbl_t
* cmdtp
, int flag
, int argc
, char * const argv
[])
38 unsigned int blocking
;
43 fslnum
= (unsigned int)simple_strtoul (argv
[1], NULL
, 16);
44 blocking
= (unsigned int)simple_strtoul (argv
[2], NULL
, 16);
45 if (fslnum
< 0 || fslnum
>= XILINX_FSL_NUMBER
) {
46 puts ("Bad number of FSL\n");
51 #if (XILINX_FSL_NUMBER > 0)
54 case 0: NGET (num
, 0);
56 case 1: NCGET (num
, 0);
60 case 3: CGET (num
, 0);
67 #if (XILINX_FSL_NUMBER > 1)
70 case 0: NGET (num
, 1);
72 case 1: NCGET (num
, 1);
76 case 3: CGET (num
, 1);
83 #if (XILINX_FSL_NUMBER > 2)
86 case 0: NGET (num
, 2);
88 case 1: NCGET (num
, 2);
92 case 3: CGET (num
, 2);
99 #if (XILINX_FSL_NUMBER > 3)
102 case 0: NGET (num
, 3);
104 case 1: NCGET (num
, 3);
106 case 2: GET (num
, 3);
108 case 3: CGET (num
, 3);
115 #if (XILINX_FSL_NUMBER > 4)
118 case 0: NGET (num
, 4);
120 case 1: NCGET (num
, 4);
122 case 2: GET (num
, 4);
124 case 3: CGET (num
, 4);
131 #if (XILINX_FSL_NUMBER > 5)
134 case 0: NGET (num
, 5);
136 case 1: NCGET (num
, 5);
138 case 2: GET (num
, 5);
140 case 3: CGET (num
, 5);
147 #if (XILINX_FSL_NUMBER > 6)
150 case 0: NGET (num
, 6);
152 case 1: NCGET (num
, 6);
154 case 2: GET (num
, 6);
156 case 3: CGET (num
, 6);
163 #if (XILINX_FSL_NUMBER > 7)
166 case 0: NGET (num
, 7);
168 case 1: NCGET (num
, 7);
170 case 2: GET (num
, 7);
172 case 3: CGET (num
, 7);
183 printf ("%01x: 0x%08x - %s %s read\n", fslnum
, num
,
184 blocking
< 2 ? "non blocking" : "blocking",
185 ((blocking
== 1) || (blocking
== 3)) ? "control" : "data" );
189 int do_fwr (cmd_tbl_t
* cmdtp
, int flag
, int argc
, char * const argv
[])
193 unsigned int blocking
;
196 return CMD_RET_USAGE
;
198 fslnum
= (unsigned int)simple_strtoul (argv
[1], NULL
, 16);
199 num
= (unsigned int)simple_strtoul (argv
[2], NULL
, 16);
200 blocking
= (unsigned int)simple_strtoul (argv
[3], NULL
, 16);
201 if (fslnum
< 0 || fslnum
>= XILINX_FSL_NUMBER
)
202 return CMD_RET_USAGE
;
205 #if (XILINX_FSL_NUMBER > 0)
208 case 0: NPUT (num
, 0);
210 case 1: NCPUT (num
, 0);
212 case 2: PUT (num
, 0);
214 case 3: CPUT (num
, 0);
221 #if (XILINX_FSL_NUMBER > 1)
224 case 0: NPUT (num
, 1);
226 case 1: NCPUT (num
, 1);
228 case 2: PUT (num
, 1);
230 case 3: CPUT (num
, 1);
237 #if (XILINX_FSL_NUMBER > 2)
240 case 0: NPUT (num
, 2);
242 case 1: NCPUT (num
, 2);
244 case 2: PUT (num
, 2);
246 case 3: CPUT (num
, 2);
253 #if (XILINX_FSL_NUMBER > 3)
256 case 0: NPUT (num
, 3);
258 case 1: NCPUT (num
, 3);
260 case 2: PUT (num
, 3);
262 case 3: CPUT (num
, 3);
269 #if (XILINX_FSL_NUMBER > 4)
272 case 0: NPUT (num
, 4);
274 case 1: NCPUT (num
, 4);
276 case 2: PUT (num
, 4);
278 case 3: CPUT (num
, 4);
285 #if (XILINX_FSL_NUMBER > 5)
288 case 0: NPUT (num
, 5);
290 case 1: NCPUT (num
, 5);
292 case 2: PUT (num
, 5);
294 case 3: CPUT (num
, 5);
301 #if (XILINX_FSL_NUMBER > 6)
304 case 0: NPUT (num
, 6);
306 case 1: NCPUT (num
, 6);
308 case 2: PUT (num
, 6);
310 case 3: CPUT (num
, 6);
317 #if (XILINX_FSL_NUMBER > 7)
320 case 0: NPUT (num
, 7);
322 case 1: NCPUT (num
, 7);
324 case 2: PUT (num
, 7);
326 case 3: CPUT (num
, 7);
337 printf ("%01x: 0x%08x - %s %s write\n", fslnum
, num
,
338 blocking
< 2 ? "non blocking" : "blocking",
339 ((blocking
== 1) || (blocking
== 3)) ? "control" : "data" );
344 int do_rspr (cmd_tbl_t
* cmdtp
, int flag
, int argc
, char * const argv
[])
346 unsigned int reg
= 0;
347 unsigned int val
= 0;
350 return CMD_RET_USAGE
;
352 reg
= (unsigned int)simple_strtoul (argv
[1], NULL
, 16);
353 val
= (unsigned int)simple_strtoul (argv
[2], NULL
, 16);
374 puts ("Unsupported register\n");
377 printf (": 0x%08x\n", val
);
381 /***************************************************/
383 U_BOOT_CMD (frd
, 3, 1, do_frd
,
384 "read data from FSL",
385 "- [fslnum [0|1|2|3]]\n"
386 " 0 - non blocking data read\n"
387 " 1 - non blocking control read\n"
388 " 2 - blocking data read\n"
389 " 3 - blocking control read");
391 U_BOOT_CMD (fwr
, 4, 1, do_fwr
,
393 "- [fslnum [0|1|2|3]]\n"
394 " 0 - non blocking data write\n"
395 " 1 - non blocking control write\n"
396 " 2 - blocking data write\n"
397 " 3 - blocking control write");
399 U_BOOT_CMD (rspr
, 3, 1, do_rspr
,
400 "read/write special purpose register",
401 "- reg_num [write value] read/write special purpose register\n"
402 " 1 - MSR - Machine status register\n"
403 " 3 - EAR - Exception address register\n"
404 " 5 - ESR - Exception status register");