[IO] rework dprintf to take a debug level, defined in DEBUGLEVEL
printf at the moment just calls dprintf, but soon will become
a seperate I/O queue.
diff --git a/platform/armemu/debug.c b/platform/armemu/debug.c
index aca3931..09aabd5 100644
--- a/platform/armemu/debug.c
+++ b/platform/armemu/debug.c
@@ -27,7 +27,7 @@
#include <platform/armemu/memmap.h>
#include <platform/debug.h>
-void dputc(char c)
+void _dputc(char c)
{
*REG8(DEBUG_STDOUT) = c;
}
@@ -48,7 +48,7 @@
*REG32(DEBUG_REGDUMP) = 1;
}
-void debug_halt(void)
+void platform_halt(void)
{
*REG32(DEBUG_HALT) = 1;
for(;;);
diff --git a/platform/at91sam7/debug.c b/platform/at91sam7/debug.c
index 2cca7b3..ad8f262 100644
--- a/platform/at91sam7/debug.c
+++ b/platform/at91sam7/debug.c
@@ -64,12 +64,12 @@
}
}
-void dputc(char c)
+void _dputc(char c)
{
ser_putc(c);
}
-void debug_halt()
+void platform_halt()
{
arch_disable_ints();
for(;;);
diff --git a/platform/at91sam7/emac_dev.c b/platform/at91sam7/emac_dev.c
index d042ef6..03a3237 100644
--- a/platform/at91sam7/emac_dev.c
+++ b/platform/at91sam7/emac_dev.c
@@ -20,6 +20,7 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <debug.h>
#include <kernel/thread.h>
#include <kernel/mutex.h>
#include <platform/at91sam7.h>
@@ -98,7 +99,7 @@
AT91PMC *pmc = AT91PMC_ADDR;
AT91RSTC *rstc = AT91RSTC_ADDR;
- dprintf("emac_init()\n");
+ dprintf(INFO, "emac_init()\n");
/* enable clock to EMAC */
pmc->PCER = (1 << PID_EMAC);
@@ -119,7 +120,7 @@
thread_sleep(30);
- dprintf("emac_init() - reset phy\n");
+ dprintf(INFO, "emac_init() - reset phy\n");
/* assert the RST line and wait until the it deasserts */
rstc->CR = RSTC_KEY | RSTC_EXTRST;
@@ -135,14 +136,14 @@
thread_sleep(1000);
- dprintf("emac_init() - read state\n");
+ dprintf(INFO, "emac_init() - read state\n");
emac->NCR = NCR_MPE;
emac->NCFG = NCFG_CLK_d64;
- dprintf("bcr = %x\n", mi_rd(emac, MII_REG_BCR));
- dprintf("id1 = %x\n", mi_rd(emac, MII_REG_PHY_ID1));
- dprintf("id2 = %x\n", mi_rd(emac, MII_REG_PHY_ID2));
+ dprintf(INFO, "bcr = %x\n", mi_rd(emac, MII_REG_BCR));
+ dprintf(INFO, "id1 = %x\n", mi_rd(emac, MII_REG_PHY_ID1));
+ dprintf(INFO, "id2 = %x\n", mi_rd(emac, MII_REG_PHY_ID2));
#if 0
unsigned state, last;
@@ -175,7 +176,7 @@
default:
name = "unknown";
}
- dprintf("link state: %s\n", name);
+ dprintf(INFO, "link state: %s\n", name);
}
thread_sleep(100);
}
@@ -225,7 +226,7 @@
waited++;
}
- if(waited) dprintf("W%d\n",waited);
+ if(waited) dprintf(INFO, "W%d\n",waited);
if(xe->addr != 0) {
free((void*) xe->addr);
diff --git a/platform/at91sam7/timer.c b/platform/at91sam7/timer.c
index 52224c5..be65e9c 100644
--- a/platform/at91sam7/timer.c
+++ b/platform/at91sam7/timer.c
@@ -21,6 +21,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <err.h>
+#include <debug.h>
#include <sys/types.h>
#include <kernel/thread.h>
@@ -76,7 +77,7 @@
AT91PIT *pit = AT91PIT_ADDR;
n = AT91_MCK_MHZ / 16 / 1000;
- dprintf("timer: MCK=%dKHz, n=%d\n", AT91_MCK_MHZ / 1000, n);
+ dprintf(INFO, "timer: MCK=%dKHz, n=%d\n", AT91_MCK_MHZ / 1000, n);
enter_critical_section();
diff --git a/platform/integrator/debug.c b/platform/integrator/debug.c
index ab9f901..0a2e058 100644
--- a/platform/integrator/debug.c
+++ b/platform/integrator/debug.c
@@ -93,7 +93,7 @@
return -1;
}
-void dputc(char c)
+void _dputc(char c)
{
uart_putc(0, c);
}
@@ -114,9 +114,9 @@
PANIC_UNIMPLEMENTED;
}
-void debug_halt(void)
+void platform_halt(void)
{
- dprintf("HALT: spinning forever...\n");
+ dprintf(ALWAYS, "HALT: spinning forever...\n");
for(;;);
}
diff --git a/platform/omap3/debug.c b/platform/omap3/debug.c
index 973287b..ac6300d 100644
--- a/platform/omap3/debug.c
+++ b/platform/omap3/debug.c
@@ -30,7 +30,7 @@
#include <dev/uart.h>
#include <target/debugconfig.h>
-void dputc(char c)
+void _dputc(char c)
{
if (c == '\n')
uart_putc(DEBUG_UART, '\r');
@@ -53,9 +53,9 @@
PANIC_UNIMPLEMENTED;
}
-void debug_halt(void)
+void platform_halt(void)
{
- dprintf("HALT: spinning forever...\n");
+ dprintf(ALWAYS, "HALT: spinning forever...\n");
for(;;);
}
diff --git a/platform/omap5912/debug.c b/platform/omap5912/debug.c
index cb3ea29..d190fa0 100644
--- a/platform/omap5912/debug.c
+++ b/platform/omap5912/debug.c
@@ -87,7 +87,7 @@
return read_uart_reg(port, UART_RHR);
}
-void dputc(char c)
+void _dputc(char c)
{
if (c == '\n')
uart_putc(0, '\r');
@@ -110,9 +110,9 @@
PANIC_UNIMPLEMENTED;
}
-void debug_halt(void)
+void platform_halt(void)
{
- dprintf("HALT: spinning forever...\n");
+ dprintf(ALWAYS, "HALT: spinning forever...\n");
for(;;);
}