SansaAMS: Add a comment to clarifing a bit that the dcache is inactive without mmu...
[kugel-rb.git] / firmware / target / arm / as3525 / debug-as3525.c
bloba8a973b9b2f955797ad414c414688aa0d6184477
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright © 2008 Rafaël Carré
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include <stdbool.h>
23 #include "debug-target.h"
24 #include "button.h"
25 #include "lcd.h"
26 #include "font.h"
27 #include "system.h"
28 #include "sprintf.h"
29 #include "cpu.h"
31 #define _DEBUG_PRINTF(a,varargs...) \
32 snprintf(buf, sizeof(buf), (a), ##varargs); lcd_puts(0,line++,buf)
34 #define ON "Enabled"
35 #define OFF "Enabled"
37 #define CP15_MMU (1<<0) /* mmu off/on */
38 #define CP15_DC (1<<2) /* dcache off/on */
39 #define CP15_IC (1<<12) /* icache off/on */
41 /* FIXME: target tree is including ./debug-target.h rather than the one in
42 * sansa-fuze/, even though deps contains the correct one
43 * if I put the below into a sansa-fuze/debug-target.h, it doesn't work*/
44 #if defined(SANSA_FUZE) || defined(SANSA_E200V2)
45 #define DEBUG_DBOP
46 short button_dbop_data(void);
47 #endif
49 static unsigned read_cp15 (void)
51 unsigned value;
53 asm volatile (
54 "mrc p15, 0, %0, c1, c0, 0 @ read control reg\n":"=r"
55 (value)::"memory"
57 return (value);
60 bool __dbg_hw_info(void)
62 return false;
65 bool __dbg_ports(void)
67 char buf[50];
68 int line;
70 lcd_clear_display();
71 lcd_setfont(FONT_SYSFIXED);
73 while(1)
75 line = 0;
76 _DEBUG_PRINTF("[GPIO Values and Directions]");
77 _DEBUG_PRINTF("GPIOA: %2x DIR: %2x", GPIOA_DATA, GPIOA_DIR);
78 _DEBUG_PRINTF("GPIOB: %2x DIR: %2x", GPIOB_DATA, GPIOB_DIR);
79 _DEBUG_PRINTF("GPIOC: %2x DIR: %2x", GPIOC_DATA, GPIOC_DIR);
80 _DEBUG_PRINTF("GPIOD: %2x DIR: %2x", GPIOD_DATA, GPIOD_DIR);
81 #ifdef DEBUG_DBOP
82 line++;
83 _DEBUG_PRINTF("[DBOP_DIN]");
84 _DEBUG_PRINTF("DBOP_DIN: %4x", button_dbop_data());
85 #endif
86 line++;
87 _DEBUG_PRINTF("[CP15]");
88 _DEBUG_PRINTF("CP15: 0x%8x", read_cp15());
89 lcd_update();
90 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
91 break;
93 lcd_setfont(FONT_UI);
94 return false;