OSDN Git Service

Updated the task relationship.
authorShinichiro Nakamura <shinta.main.jp@gmail.com>
Sun, 15 Jul 2012 12:11:35 +0000 (21:11 +0900)
committerShinichiro Nakamura <shinta.main.jp@gmail.com>
Sun, 15 Jul 2012 12:11:35 +0000 (21:11 +0900)
firm/sample/sample1/os/main.c
firm/sample/sample1/os/memory.c
firm/sample/sample1/os/task_audio.c
firm/sample/sample1/os/task_input.c
firm/sample/sample1/os/task_menu.c
firm/sample/sample1/os/vs1011e.c
firm/sample/sample1/os/vs1011e.h

index 88855c0..efeac67 100644 (file)
@@ -16,9 +16,9 @@ static int start_threads(int argc, char *argv[])
    * Tasks
    */
   kz_run(task_audio,        "tAudio",    5, 0x800, 0, NULL);
-  kz_run(task_display,      "tDisplay",  6, 0x800, 0, NULL);
-  kz_run(task_menu,         "tMenu",     7, 0x800, 0, NULL);
-  kz_run(task_input,        "tInput",    8, 0x800, 0, NULL);
+  kz_run(task_display,      "tDisplay",  5, 0x800, 0, NULL);
+  kz_run(task_menu,         "tMenu",     6, 0x800, 0, NULL);
+  kz_run(task_input,        "tInput",    6, 0x800, 0, NULL);
   kz_run(task_command,      "tCommand",  9, 0x800, 0, NULL);
 
   kz_chpri(15); /* Í¥Àè½ç°Ì¤ò²¼¤²¤Æ¡¤¥¢¥¤¥É¥ë¥¹¥ì¥Ã¥É¤Ë°Ü¹Ô¤¹¤ë */
index aadab69..869fdb2 100644 (file)
@@ -29,6 +29,7 @@ static kzmem_pool pool[] = {
   {  256, 8, NULL },
   {  512, 8, NULL },
   { 1024, 8, NULL },
+  { 2048, 8, NULL },
 };
 
 #define MEMORY_AREA_NUM (sizeof(pool) / sizeof(*pool))
index 4ba9ccc..47059e3 100644 (file)
@@ -27,6 +27,12 @@ void audio_play(void *buf, int siz)
   kz_send(MSGBOX_ID_AUDIO, 4 + siz, p);
 }
 
+static int waitfunc(void)
+{
+    kz_wait();
+    return 1;
+}
+
 static int audio_cmdproc(char *p)
 {
   int cmd = p[0];
@@ -41,7 +47,8 @@ static int audio_cmdproc(char *p)
   case AUDIO_CMD_PLAY:
     vs1011e_play_with_data(
         &p[4],
-        ((unsigned char)p[2] << 8) | ((unsigned char)p[3] << 0));
+        ((unsigned char)p[2] << 8) | ((unsigned char)p[3] << 0),
+        waitfunc);
     break;
   default:
     break;
index 954a90c..32c88b3 100644 (file)
@@ -105,15 +105,6 @@ int task_input(int argc, char *argv[])
   TMRINT_ENABLE();
   IRQ4_ENABLE();
 
-  /*
-   * Display clear
-   */
-  display_clear();
-  display_draw_logo(  0, 0, 2);
-  display_draw_box(0, 0, 121, 31, 1);
-  display_draw_text(40, 4, "KOZOS EXPBRD #00");
-  display_draw_logo(nx, ny, 0);
-
   uint16 prev = 0, curr = 0;
   while (1) {
     /*
index fd5ee1e..6d5ce9d 100644 (file)
@@ -1,6 +1,7 @@
 
 #include "task_menu.h"
 #include "task_audio.h"
+#include "task_display.h"
 #include "pff.h"
 #include "kozos.h"
 #include "lib.h"
@@ -12,12 +13,13 @@ static int play(const char *filename)
         return 1;
     }
     WORD cnt;
-    const int siz = 32;
+    const int siz = 1024;
     do {
-        puts("o");
         void *buf = kz_kmalloc(siz);
         pf_read(buf, siz, &cnt);
         audio_play(buf, cnt);
+        kz_kmfree(buf);
+        kz_wait();
     } while (cnt == siz);
     return 0;
 }
@@ -29,6 +31,11 @@ int task_menu(int argc, char *argv[])
   DIR dir;
   FILINFO filinfo;
 
+  display_clear();
+  display_draw_logo(  0, 0, 2);
+  display_draw_box(0, 0, 121, 31, 1);
+  display_draw_text(40, 4, "KOZOS EXPBRD #00");
+
   while (1) {
       if (pf_mount(&fatfs)) {
           continue;
@@ -47,9 +54,12 @@ int task_menu(int argc, char *argv[])
       }
   }
 #else
-  while (1) {
-    kz_sleep();
-  }
+  display_clear();
+  display_draw_logo(  0, 0, 2);
+  display_draw_box(0, 0, 121, 31, 1);
+  display_draw_text(40, 4, "KOZOS EXPBRD #00");
+
+  kz_sleep();
 #endif
 
   return 0;
index 7622b25..daf9c4c 100644 (file)
@@ -213,7 +213,9 @@ void vs1011e_play(
     }
 }
 
-void vs1011e_play_with_data(void *buf, int siz)
+void vs1011e_play_with_data(
+        void *buf, int siz,
+        int (*waitfunc)(void))
 {
     int i;
     /*
@@ -222,6 +224,7 @@ void vs1011e_play_with_data(void *buf, int siz)
     spi_select(SpiTarget_VS1011E_DATA);
     for (i = 0; i < siz; i++) {
         while (VS1011E_CHK_DREQ()) {
+            waitfunc();
         }
         spi_tx(*((char *)buf + i));
     }
index afd1200..0ba300e 100644 (file)
@@ -15,7 +15,9 @@ void vs1011e_play(
         void *buf, int siz,
         int (*waitfunc)(void),
         int (*readfunc)(void * buf, const int len));
-void vs1011e_play_with_data(void *buf, int siz);
+void vs1011e_play_with_data(
+        void *buf, int siz,
+        int (*waitfunc)(void));
 void vs1011e_decodetime_read(uint16 * sec);
 void vs1011e_decodetime_write(const uint16 sec);
 void vs1011e_register_print(void);