OSDN Git Service

Removed ssync from the port I/O.
authorShinichiro Nakamura <shinta.main.jp@gmail.com>
Thu, 23 Aug 2012 11:40:28 +0000 (20:40 +0900)
committerShinichiro Nakamura <shinta.main.jp@gmail.com>
Thu, 23 Aug 2012 11:40:28 +0000 (20:40 +0900)
firm/bare_metal/main.c
firm/bare_metal/mmc.c
firm/bare_metal/mmc.h [new file with mode: 0644]
firm/bare_metal/uzume.c

index d9afedf..44f0a0f 100644 (file)
@@ -38,7 +38,7 @@
 #include "lcd.h"
 #include "effect.h"
 
-#define KARAOKE_ENABLED (0)
+#define KARAOKE_ENABLED (1)
 
 static void system_default(UZUME *p)
 {
index ca79ecb..357e9d2 100644 (file)
 #define INIT_PORT() \\r
     do { \\r
         *pPORTG_FER &= ~(PG8 | PG9 | PG10 | PG11 | PG12); \\r
-        asm("ssync;"); \\r
         *pPORTGIO_DIR |= (PG8 | PG9 | PG11); \\r
-        asm("ssync;"); \\r
         *pPORTGIO_DIR &= ~(PG10 | PG12); \\r
-        asm("ssync;"); \\r
         *pPORTGIO_INEN |= (PG10 | PG12); \\r
-        asm("ssync;"); \\r
     } while (0)\r
 /* Delay n microseconds */\r
 #define DLY_US(n)   bfin_util_usleep(n)\r
 #define FORWARD(d)  do { } while (0)\r
 \r
 /* Set MMC CS "high" */\r
-#define CS_H()      do { *pPORTGIO_SET   = PG11; asm("ssync;"); DLY_US(10); } while (0)\r
+#define CS_H()      do { *pPORTGIO_SET   = PG11; DLY_US(10); } while (0)\r
 /* Set MMC CS "low" */\r
-#define CS_L()      do { *pPORTGIO_CLEAR = PG11; asm("ssync;"); DLY_US(10); } while (0)\r
+#define CS_L()      do { *pPORTGIO_CLEAR = PG11; DLY_US(10); } while (0)\r
 /* Set MMC SCLK "high" */\r
-#define CK_H()      do { *pPORTGIO_SET   = PG8;  asm("ssync;"); DLY_US(10); } while (0)\r
+#define CK_H()      do { *pPORTGIO_SET   = PG8;  DLY_US(10); } while (0)\r
 /* Set MMC SCLK "low" */\r
-#define CK_L()      do { *pPORTGIO_CLEAR = PG8;  asm("ssync;"); DLY_US(10); } while (0)\r
+#define CK_L()      do { *pPORTGIO_CLEAR = PG8;  DLY_US(10); } while (0)\r
 /* Set MMC DI "high" */\r
-#define DI_H()      do { *pPORTGIO_SET   = PG9;  asm("ssync;"); DLY_US(10); } while (0)\r
+#define DI_H()      do { *pPORTGIO_SET   = PG9;  DLY_US(10); } while (0)\r
 /* Set MMC DI "low" */\r
-#define DI_L()      do { *pPORTGIO_CLEAR = PG9;  asm("ssync;"); DLY_US(10); } while (0)\r
+#define DI_L()      do { *pPORTGIO_CLEAR = PG9;  DLY_US(10); } while (0)\r
 /* Get MMC DO value (high:true, low:false) */\r
 #define DO          (((*pPORTGIO) & (1 << 10)) ? 1 : 0)\r
 \r
diff --git a/firm/bare_metal/mmc.h b/firm/bare_metal/mmc.h
new file mode 100644 (file)
index 0000000..dfd138c
--- /dev/null
@@ -0,0 +1,10 @@
+
+#ifndef MMC_H
+#define MMC_H
+
+#include <cdefBF592-A.h>
+
+#define MMC_DETECT()    (((*pPORTGIO) & (1 << 12)) ? 0 : 1)
+
+#endif
+
index 3c66bec..4e35345 100644 (file)
@@ -43,6 +43,7 @@
 #include "pff.h"
 #include "ssm2603.h"
 #include "uzume.h"
+#include "mmc.h"
 
 #define SCLOCK_HZ           (100000000) /**< システムクロック(100MHz) */
 #define DMA_SAMPLE_SIZE     (256)       /**< 1回のサンプルサイズ */
@@ -145,12 +146,13 @@ void uzume_init(UZUME *p, void *user_data)
     /*
      * SDカードをマウントする。
      */
-    if (pf_mount(&fatfs) == FR_OK) {
-        lcd_goto(0, 0);
-        lcd_puts("MT:  OK ");
-    } else {
-        lcd_goto(0, 0);
-        lcd_puts("MT: FAIL");
+    if (MMC_DETECT()) {
+        if (pf_mount(&fatfs) != FR_OK) {
+            lcd_goto(0, 0);
+            lcd_puts("SDC FAIL");
+            while (1) {
+            }
+        }
     }
 
     /*