Debug
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 31 Dec 2016 08:08:04 +0000 (00:08 -0800)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 31 Dec 2016 08:08:04 +0000 (00:08 -0800)
arm_chainloader/drivers/uart.c
romstage.c

index 3b20ac1..69473da 100644 (file)
@@ -1,10 +1,10 @@
 #include <hardware.h>\r
 \r
+#define UART_STATUS 0x3F201018\r
+#define UART_DATA   0x3F201000\r
+\r
 void uart_putc(unsigned int ch)\r
 {\r
-       while(1) {\r
-               if (mmio_read32(AUX_MU_LSR_REG) & 0x20)\r
-                       break;\r
-       }\r
-       mmio_write32(AUX_MU_IO_REG, ch);\r
+       while(mmio_read32(UART_STATUS) & 0x20);\r
+       mmio_write32(UART_DATA, ch);\r
 }\r
index b5444f9..e484dd3 100644 (file)
@@ -62,16 +62,15 @@ void uart_init(void) {
        udelay(150);\r
        GP_PUDCLK0 = 0;\r
 \r
-        CM_UARTDIV = CM_PASSWORD | 42667;\r
+        CM_UARTDIV = CM_PASSWORD | 0x619A;\r
         CM_UARTCTL = CM_PASSWORD | CM_SRC_OSC | CM_UARTCTL_FRAC_SET | CM_UARTCTL_ENAB_SET;\r
+        udelay(150);\r
 \r
-        mmio_write32(UART_ICR, 0x7FF);\r
         mmio_write32(UART_IBRD, 1);\r
         mmio_write32(UART_FBRD, 40);\r
+        mmio_write32(UART_ICR, 0x7FF);\r
         mmio_write32(UART_LCRH, 0x70);\r
         mmio_write32(UART_CR, 0x301);\r
-\r
-        for(;;) uart_putc('B');\r
 }\r
 \r
 void led_init(void) {\r
@@ -174,6 +173,7 @@ int _main(unsigned int cpuid, unsigned int load_address) {
        led_init();\r
        uart_init();\r
 \r
+        for(;;) {\r
        printf(\r
                "=========================================================\n"\r
                "::\n"\r
@@ -191,6 +191,7 @@ int _main(unsigned int cpuid, unsigned int load_address) {
        printf("LoadAddr = 0x%X\n", load_address);\r
 \r
        print_crap();\r
+        }\r
 \r
        g_CPUID = cpuid;\r
 \r
This page took 0.030789 seconds and 4 git commands to generate.