修改API框架,兼容1806

Change-Id: Ic68e966a32e4c7ffd7137b3d7ba94e4d813c71b2
diff --git a/mbtk/test/aiti_audio_test.c b/mbtk/test/aiti_audio_test.c
index c9fa936..4e24440 100755
--- a/mbtk/test/aiti_audio_test.c
+++ b/mbtk/test/aiti_audio_test.c
@@ -7,6 +7,7 @@
 // #include "ql_at.h"
 #include "ql/ql_audio.h"
 // #include "mopen_tts.h"
+#ifdef MBTK_PLATFORM_ASR1803
 
 #define MBTK_AUD_DEMO_WAV "/data/demo.wav"
 
@@ -125,7 +126,7 @@
     if (!fp) {
         printf("%s:fopen failed",__func__);
     }
-    
+
     fseek(fp,0,SEEK_END);
     filesize=ftell(fp);
     printf("%s:filesize:%d\n", __func__, filesize);
@@ -180,7 +181,7 @@
     pcmBuf = handle_file1(MBTK_AUD_DEMO_WAV);
 
     pcmBuf1 = handle_file1(MBTK_AUD_DEMO_WAV1);
-    
+
     if(file_size > 0  && file_size1 > 0 )
     {
         if(pcmBuf != NULL)
@@ -216,7 +217,7 @@
     int fd1 = open(MBTK_AUD_DEMO_WAV1, O_RDWR);
     if (fd1 <= 0)
         return 0;
-    
+
     Ql_AudPlayer_PlayFrmFile(play_hdl, fd, 0);
 
     Ql_Rxgain_Set(3);
@@ -534,7 +535,13 @@
 
     return 0;
 }
+#else
+int main(int argc, char *argv[])
+{
 
+    return 0;
+}
 
+#endif
 
 
diff --git a/mbtk/test/audio_test.c b/mbtk/test/audio_test.c
index c7cae08..b811307 100755
--- a/mbtk/test/audio_test.c
+++ b/mbtk/test/audio_test.c
@@ -8,6 +8,8 @@
 #include "ql/ql_audio.h"
 // #include "mopen_tts.h"
 
+#ifdef MBTK_PLATFORM_ASR1803
+
 #define MBTK_AUD_DEMO_WAV "/data/demo.wav"
 
 static int record_fd = 0;
@@ -339,3 +341,12 @@
 
     return 0;
 }
+
+#else
+int main(int argc, char *argv[])
+{
+
+    return 0;
+}
+
+#endif
diff --git a/mbtk/test/fb_demo.c b/mbtk/test/fb_demo.c
new file mode 100755
index 0000000..e160edf
--- /dev/null
+++ b/mbtk/test/fb_demo.c
@@ -0,0 +1,83 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include "mbtk_log.h"
+#include "mbtk_type.h"
+
+// RGB565
+#define COLOR_BLACK 0x0000
+#define COLOR_WRITE 0xFFFF
+#define DEV_FB_PATH "/dev/fb0"
+#define SCREEN_WIDTH 320
+#define SCREEN_HEIGTH 240
+
+typedef struct {
+    int left;
+    int top;
+    int width;
+    int heigth;
+} rect_t;
+
+static uint16 fb_buffer[SCREEN_WIDTH * SCREEN_HEIGTH];
+
+static int fb_refresh(int fd)
+{
+    rect_t rect;
+    rect.width = SCREEN_WIDTH / 2;
+    rect.heigth = SCREEN_HEIGTH / 2;
+    rect.left = (SCREEN_WIDTH - rect.width) / 2;
+    rect.top = (SCREEN_HEIGTH - rect.heigth) / 2;
+    // Fill in buffer.
+    int x,y;
+    for(y = 0; y < SCREEN_HEIGTH; y++) {
+        for(x = 0; x < SCREEN_WIDTH; x++) {
+            if(x >= rect.left && x <= rect.left + rect.width
+                && y >= rect.top && y <= rect.top + rect.heigth)
+            {
+                fb_buffer[x * SCREEN_HEIGTH + y] = COLOR_WRITE;
+            } else {
+                fb_buffer[x * SCREEN_HEIGTH + y] = COLOR_BLACK;
+            }
+        }
+    }
+
+    int len = write(fd, fb_buffer, sizeof(fb_buffer));
+    LOGD("Write : %d/%d", len, sizeof(fb_buffer));
+    // Write buffer to framebuffer.
+    if(sizeof(fb_buffer) != len) {
+        LOGE("Write fail:%d", errno);
+        return -1;
+    }
+
+    return 0;
+}
+
+int main(int argc, char *argv[]) {
+    if(access(DEV_FB_PATH, F_OK) != 0) {
+        LOGE("no %s, quit.", DEV_FB_PATH);
+        return -1;
+    }
+
+    int fb_fd = open(DEV_FB_PATH, O_RDWR);
+    if(fb_fd < 0) {
+        LOGE("open() fail:%d", errno);
+        return -1;
+    }
+
+    // Fresh framebuffer
+    while(1) {
+        if(fb_refresh(fb_fd)) {
+            break;
+        }
+
+        usleep(33); // 1000 / 30
+    }
+
+    LOGD("Exit");
+    return 0;
+}
+
+
diff --git a/mbtk/test/mbtk_dtmf_test.c b/mbtk/test/mbtk_dtmf_test.c
index a21464e..472e820 100755
--- a/mbtk/test/mbtk_dtmf_test.c
+++ b/mbtk/test/mbtk_dtmf_test.c
@@ -1,3 +1,5 @@
+#ifdef MBTK_PLATFORM_ASR1803
+
 /**
  *   \file dtmf_test.c
  *   \brief A Documented file.
@@ -33,6 +35,7 @@
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+
 #include "mbtk_audio.h"
 
 void dtmf_cb(char dtmf)
@@ -92,3 +95,13 @@
 
     return 0;
 }
+#else
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+
+    return 0;
+}
+
+#endif
diff --git a/mbtk/test/partition_write_demo.c b/mbtk/test/partition_write_demo.c
new file mode 100755
index 0000000..762e49c
--- /dev/null
+++ b/mbtk/test/partition_write_demo.c
@@ -0,0 +1,55 @@
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+int main(int argc, char *argv[])
+{
+
+#if 1
+    // 100K
+    char buffer[102400];
+    long len = -1;
+    long count = 0;
+    int fd = open("/etc/file.temp", O_CREAT | O_WRONLY | O_TRUNC);
+    if(fd < 0) {
+        printf("Open file error:%d\n", errno);
+        return -1;
+    }
+
+    while((len = write(fd, buffer, sizeof(buffer))) > 0){
+        count += len;
+        printf("write : %d\n", count);
+        //usleep(1000);
+    }
+
+    printf("Write complete,len = %d, errno = %d\n", len, errno);
+
+    close(fd);
+#else
+    // 100K
+    int buffer = 1;
+    long len = -1;
+    long count = 0;
+
+    FILE *file = fopen("/etc/file.temp", "w");
+    if(file == NULL) {
+        printf("Open file error:%d\n", errno);
+        return -1;
+    }
+
+    while((len = fwrite(&buffer, sizeof(int), 1,file)) > 0){
+        buffer++;
+
+        // printf("write : %d\n", buffer);
+        //usleep(1000);
+    }
+
+    printf("Write complete,len = %d, errno = %d\n", len, errno);
+
+    fclose(file);
+#endif
+    return 0;
+}
+
diff --git a/mbtk/test/yx_audio_test.c b/mbtk/test/yx_audio_test.c
index e01e9d9..e72d68a 100755
--- a/mbtk/test/yx_audio_test.c
+++ b/mbtk/test/yx_audio_test.c
@@ -8,6 +8,8 @@
 #include "ql/ql_audio.h"
 // #include "mopen_tts.h"
 
+#ifdef MBTK_PLATFORM_ASR1803
+
 #define MBTK_AUD_DEMO_WAV "/data/demo.wav"
 
 static int record_fd = 0;
@@ -363,3 +365,12 @@
 
     return 0;
 }
+#else
+
+int main(int argc, char *argv[])
+{
+
+    return 0;
+}
+
+#endif