diff options
| -rw-r--r-- | bsp/stm32_radio/application.c | 16 | ||||
| -rw-r--r-- | bsp/stm32_radio/dm9000.c | 2 | ||||
| -rw-r--r-- | bsp/stm32_radio/player_ui.c | 2 | ||||
| -rw-r--r-- | bsp/stm32_radio/sdcard.c | 2 | ||||
| -rw-r--r-- | filesystem/dfs/src/dfs_raw.c | 48 | ||||
| -rw-r--r-- | rtgui/server/topwin.c | 25 |
6 files changed, 41 insertions, 54 deletions
diff --git a/bsp/stm32_radio/application.c b/bsp/stm32_radio/application.c index 8f2544f574..65d9cb7445 100644 --- a/bsp/stm32_radio/application.c +++ b/bsp/stm32_radio/application.c @@ -57,17 +57,17 @@ void rt_init_thread_entry(void *parameter) /* init the elm FAT filesystam*/
elm_init();
- /* mount sd card fat partition 1 as root directory */
- if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
- rt_kprintf("File System initialized!\n");
- else
- rt_kprintf("File System init failed!\n");
-
- /* mount spi flash fat as resource directory */
- if (dfs_mount("spi0", "/flash", "elm", 0, 0) == 0)
+ /* mount spi flash fat as root directory */
+ if (dfs_mount("spi0", "/", "elm", 0, 0) == 0)
rt_kprintf("SPI File System initialized!\n");
else
rt_kprintf("SPI File System init failed!\n");
+
+ /* mount sd card fat partition 1 as SD directory */
+ if (dfs_mount("sd0", "/SD", "elm", 0, 0) == 0)
+ rt_kprintf("File System initialized!\n");
+ else
+ rt_kprintf("File System init failed!\n");
}
#endif
diff --git a/bsp/stm32_radio/dm9000.c b/bsp/stm32_radio/dm9000.c index fb26bf1910..7d577d1543 100644 --- a/bsp/stm32_radio/dm9000.c +++ b/bsp/stm32_radio/dm9000.c @@ -541,7 +541,7 @@ struct pbuf *rt_dm9000_rx(rt_device_t dev) }
/* it issues an error, release pbuf */
- pbuf_free(p);
+ if (p != RT_NULL) pbuf_free(p);
p = RT_NULL;
}
}
diff --git a/bsp/stm32_radio/player_ui.c b/bsp/stm32_radio/player_ui.c index 7034ebfa6d..ad6ad51acc 100644 --- a/bsp/stm32_radio/player_ui.c +++ b/bsp/stm32_radio/player_ui.c @@ -945,7 +945,7 @@ void player_notify_stop() void player_ui_init()
{
player_ui_tid = rt_thread_create("ply_ui", player_entry, RT_NULL,
- 0x800, 25, 5);
+ 4096, 25, 5);
if (player_ui_tid != RT_NULL)
rt_thread_startup(player_ui_tid);
}
diff --git a/bsp/stm32_radio/sdcard.c b/bsp/stm32_radio/sdcard.c index c58f04a5f7..415dc18677 100644 --- a/bsp/stm32_radio/sdcard.c +++ b/bsp/stm32_radio/sdcard.c @@ -78,7 +78,7 @@ #define SD_CARD_LOCKED ((uint32_t)0x02000000)
#define SD_CARD_PROGRAMMING ((uint32_t)0x00000007)
#define SD_CARD_RECEIVING ((uint32_t)0x00000006)
-#define SD_DATATIMEOUT ((uint32_t)0x000FFFFF)
+#define SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF)
#define SD_0TO7BITS ((uint32_t)0x000000FF)
#define SD_8TO15BITS ((uint32_t)0x0000FF00)
#define SD_16TO23BITS ((uint32_t)0x00FF0000)
diff --git a/filesystem/dfs/src/dfs_raw.c b/filesystem/dfs/src/dfs_raw.c index ec0bce6820..c96b4089bd 100644 --- a/filesystem/dfs/src/dfs_raw.c +++ b/filesystem/dfs/src/dfs_raw.c @@ -18,6 +18,8 @@ extern struct dfs_fd fd_table[];
+#define NO_WORKING_DIR "system does not support working dir\n"
+
/*
+------------------------------------------------------------------------------
| Function : fd_new
@@ -150,9 +152,7 @@ int dfile_raw_open(struct dfs_fd* fd, const char *path, int flags) build_fullpath(working_directory, path, fullpath);
dfs_unlock();
#else
-#ifdef RT_USING_FINSH
- rt_kprintf("bad filename");
-#endif
+ rt_kprintf(NO_WORKING_DIR);
return -1;
#endif
}
@@ -367,9 +367,7 @@ int dfile_raw_unlink(const char *path) build_fullpath(working_directory, path, fullpath);
dfs_unlock();
#else
-#ifdef RT_USING_FINSH
- rt_kprintf("bad filename");
-#endif
+ rt_kprintf(NO_WORKING_DIR);
return -1;
#endif
}
@@ -476,9 +474,7 @@ int dfile_raw_stat(const char *path, struct dfs_stat *buf) build_fullpath(working_directory, path, fullpath);
dfs_unlock();
#else
-#ifdef RT_USING_FINSH
- rt_kprintf("not support working directory, bad filename\n");
-#endif
+ rt_kprintf(NO_WORKING_DIR);
return -1;
#endif
}
@@ -491,9 +487,24 @@ int dfile_raw_stat(const char *path, struct dfs_stat *buf) fspathlen = strlen(fs->path);
rt_memset(real_path, 0, sizeof(real_path));
- if (*(fullpath + fspathlen) != '/') strcpy(real_path, "/");
+ if (*(fullpath + fspathlen) != '/') real_path[0] = '/';
strcat(real_path, fullpath + fspathlen);
+ if (real_path[0] == '/' && real_path[1] == '\0')
+ {
+ /* it's the root directory */
+ buf->st_dev = 0;
+
+ buf->st_mode = DFS_S_IRUSR | DFS_S_IRGRP | DFS_S_IROTH |
+ DFS_S_IWUSR | DFS_S_IWGRP | DFS_S_IWOTH;
+ buf->st_mode |= DFS_S_IFDIR | DFS_S_IXUSR | DFS_S_IXGRP | DFS_S_IXOTH;
+
+ buf->st_size = 0;
+ buf->st_mtime = 0;
+ buf->st_blksize = 512;
+ return DFS_STATUS_OK;
+ }
+
if (fs->ops->stat == RT_NULL)
{
dfs_log(DFS_DEBUG_ERROR, ("the filesystem didn't implement this function"));
@@ -535,7 +546,7 @@ int dfile_raw_rename(const char* oldpath, const char* newpath) build_fullpath(working_directory, oldpath, oldfullpath);
dfs_unlock();
#else
- rt_kprintf("bad filename\n");
+ rt_kprintf(NO_WORKING_DIR);
return -1;
#endif
}
@@ -549,7 +560,7 @@ int dfile_raw_rename(const char* oldpath, const char* newpath) build_fullpath(working_directory, newpath, newfullpath);
dfs_unlock();
#else
- rt_kprintf("bad filename");
+ rt_kprintf(NO_WORKING_DIR);
return -1;
#endif
}
@@ -597,11 +608,12 @@ void ls(const char* pathname) if ( length > 0 )
{
rt_memset(&stat, 0, sizeof(struct dfs_stat));
-
+
/* build full path for each file */
- strncpy(fullpath, pathname, 256);
- strcat(fullpath, "/");
- strcat(fullpath, dirent.d_name);
+ if (pathname[strlen(pathname) - 1] != '/')
+ rt_snprintf(fullpath, sizeof(fullpath), "%s%c%s", pathname, '/', dirent.d_name);
+ else
+ rt_snprintf(fullpath, sizeof(fullpath), "%s%s", pathname, dirent.d_name);
dfile_raw_stat(fullpath, &stat);
if ( stat.st_mode & DFS_S_IFDIR )
@@ -624,7 +636,7 @@ void ls(const char* pathname) }
FINSH_FUNCTION_EXPORT(ls, list directory contents)
-void _mkdir(const char* pathname)
+static void mkdir(const char* pathname)
{
/* make a new directory */
if (dfile_raw_open(&fd, pathname, DFS_O_DIRECTORY | DFS_O_CREAT) == 0)
@@ -633,7 +645,7 @@ void _mkdir(const char* pathname) }
else rt_kprintf("Can't mkdir %s\n", pathname);
}
-FINSH_FUNCTION_EXPORT(_mkdir, make a directory)
+FINSH_FUNCTION_EXPORT(mkdir, make a directory)
void rm(const char* filename)
{
diff --git a/rtgui/server/topwin.c b/rtgui/server/topwin.c index abd7266119..ac807e26bc 100644 --- a/rtgui/server/topwin.c +++ b/rtgui/server/topwin.c @@ -1042,28 +1042,3 @@ void rtgui_topwin_get_clipinfo(struct rtgui_rect* rect_list, rt_int32_t count) rt_sem_release(&_rtgui_topwin_lock); } #endif - -#ifdef RT_USING_FINSH -#include <finsh.h> -void rtgui_topwin_dump() -{ - struct rtgui_list_node* node; - - rtgui_list_foreach(node, &_rtgui_topwin_show_list) - { - struct rtgui_topwin* wnd = rtgui_list_entry(node, struct rtgui_topwin, list); - - rt_kprintf("wnd at (%d, %d) - (%d, %d)\n", - wnd->extent.x1, wnd->extent.y1, wnd->extent.x2, wnd->extent.y2); - - if (wnd->title != RT_NULL) - { - rt_kprintf("title[%s] border (%d, %d) - (%d, %d)\n", wnd->title->title, - RTGUI_WIDGET(wnd->title)->extent.x1, RTGUI_WIDGET(wnd->title)->extent.y1, - RTGUI_WIDGET(wnd->title)->extent.x2, RTGUI_WIDGET(wnd->title)->extent.y2); - } - } -} -FINSH_FUNCTION_EXPORT(rtgui_topwin_dump, dump topwindow list); -#endif - |
