From 31446eab4c01fc7382ad7cd6363c253852ec1235 Mon Sep 17 00:00:00 2001 From: bernard Date: Sat, 11 Jan 2014 16:33:31 +0800 Subject: [Kernel] application module can support arguments --- include/rtdef.h | 15 ++++++++------- include/rtthread.h | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/rtdef.h b/include/rtdef.h index e21bc4eb41..3c91ae7d8d 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -952,10 +952,11 @@ struct rt_module rt_uint8_t *module_space; /**< module memory space */ - void *module_entry; /**< entry address of module's thread */ - rt_thread_t module_thread; /**< stack size of module's thread */ - rt_uint32_t stack_size; /**< priority of module's thread */ - rt_uint32_t thread_priority; + void *module_entry; /**< the entry address of module */ + rt_thread_t module_thread; /**< the main thread of module */ + + rt_uint8_t* module_cmd_line; /**< module command line */ + rt_uint32_t module_cmd_size; /**< the size of module command line */ #ifdef RT_USING_SLAB /* module memory allocator */ @@ -964,10 +965,10 @@ struct rt_module rt_uint32_t page_cnt; /**< module's using pages count */ #endif - rt_uint32_t nsym; /**< number of symbol in the module */ - struct rt_module_symtab *symtab; /**< module symbol table */ + rt_uint16_t nref; /**< reference count */ - rt_uint32_t nref; /**< reference count */ + rt_uint16_t nsym; /**< number of symbol in the module */ + struct rt_module_symtab *symtab; /**< module symbol table */ /* object in this module, module object is the last basic object type */ struct rt_object_information module_object[RT_Object_Class_Unknown]; diff --git a/include/rtthread.h b/include/rtthread.h index 0891ed9bcc..7704abf208 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -420,6 +420,7 @@ rt_module_t rt_module_load(const char *name, void *module_ptr); rt_err_t rt_module_unload(rt_module_t module); #ifdef RT_USING_DFS rt_module_t rt_module_open(const char *filename); +rt_module_t rt_module_exec_cmd(const char *path, char* cmd_line, int size); #endif void *rt_module_malloc(rt_size_t size); void *rt_module_realloc(void *ptr, rt_size_t size); -- cgit v1.3.1 From 86cdc22043d4f765aa2ad289fac09aca518fe525 Mon Sep 17 00:00:00 2001 From: prife Date: Sat, 11 Jan 2014 16:37:13 +0800 Subject: kernel: rearrange the header file include order There are some CONFIG OPTIONS in rtdebug.h, which may influence the rtdef.h, so rtdebug.h should be head of the rtdef.h --- include/rtdebug.h | 4 +--- include/rtdef.h | 2 -- include/rtthread.h | 3 ++- 3 files changed, 3 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/rtdebug.h b/include/rtdebug.h index 6ef04f6bf9..2d93e88b94 100644 --- a/include/rtdebug.h +++ b/include/rtdebug.h @@ -21,8 +21,6 @@ #ifndef __RTDEBUG_H__ #define __RTDEBUG_H__ -#include - /* Using this macro to control all kernel debug features. */ #ifdef RT_DEBUG @@ -64,7 +62,7 @@ #endif #ifndef RT_DEBUG_INIT -#define RT_DEBUG_INIT 0 +#define RT_DEBUG_INIT 0 #endif /* Turn on this to enable context check */ diff --git a/include/rtdef.h b/include/rtdef.h index e21bc4eb41..f5b59fa7e8 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -34,8 +34,6 @@ #ifndef __RT_DEF_H__ #define __RT_DEF_H__ -#include - #ifdef __cplusplus extern "C" { #endif diff --git a/include/rtthread.h b/include/rtthread.h index 0891ed9bcc..f201f3d9d7 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -31,8 +31,9 @@ #ifndef __RT_THREAD_H__ #define __RT_THREAD_H__ -#include +#include #include +#include #include #include -- cgit v1.3.1 From 8fdbb7c92b1f398668a280923f02a0355a6f7dcc Mon Sep 17 00:00:00 2001 From: bernard Date: Fri, 17 Jan 2014 22:32:32 +0800 Subject: [Kernel] Fix the compiling issue for not including rtconfig.h file in rtdebug.h/rtdef.h --- include/rtdebug.h | 2 ++ include/rtdef.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'include') diff --git a/include/rtdebug.h b/include/rtdebug.h index 2d93e88b94..8fd07b5b76 100644 --- a/include/rtdebug.h +++ b/include/rtdebug.h @@ -21,6 +21,8 @@ #ifndef __RTDEBUG_H__ #define __RTDEBUG_H__ +#include + /* Using this macro to control all kernel debug features. */ #ifdef RT_DEBUG diff --git a/include/rtdef.h b/include/rtdef.h index 7cd35c7f8c..3c91ae7d8d 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -34,6 +34,8 @@ #ifndef __RT_DEF_H__ #define __RT_DEF_H__ +#include + #ifdef __cplusplus extern "C" { #endif -- cgit v1.3.1 From e601c2a6ed1968517acf080b7d6cdc57b5a14070 Mon Sep 17 00:00:00 2001 From: bernard Date: Sun, 26 Jan 2014 20:30:37 +0800 Subject: Add sector size check when mounting a FAT file system. --- components/dfs/filesystems/elmfat/dfs_elm.c | 16 +++++++++++++--- include/rtdef.h | 3 +++ 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/components/dfs/filesystems/elmfat/dfs_elm.c b/components/dfs/filesystems/elmfat/dfs_elm.c index 0d7f9b781c..4495bd9b3e 100644 --- a/components/dfs/filesystems/elmfat/dfs_elm.c +++ b/components/dfs/filesystems/elmfat/dfs_elm.c @@ -110,20 +110,30 @@ int dfs_elm_mount(struct dfs_filesystem *fs, unsigned long rwflag, const void *d FATFS *fat; FRESULT result; int index; + struct rt_device_blk_geometry geometry; /* get an empty position */ index = get_disk(RT_NULL); if (index == -1) - return -DFS_STATUS_ENOSPC; + return -DFS_STATUS_ENOENT; /* save device */ disk[index] = fs->dev_id; - + /* check sector size */ + if (rt_device_control(fs->dev_id, RT_DEVICE_CTRL_BLK_GETGEOME, &geometry) == RT_EOK) + { + if (geometry.block_size > _MAX_SS) + { + rt_kprintf("Block size of device is great than sector size of FAT.\n"); + return -DFS_STATUS_EINVAL; + } + } + fat = (FATFS *)rt_malloc(sizeof(FATFS)); if (fat == RT_NULL) { disk[index] = RT_NULL; - return -1; + return -DFS_STATUS_ENOMEM; } /* mount fatfs, always 0 logic driver */ diff --git a/include/rtdef.h b/include/rtdef.h index 7cd35c7f8c..e24c2fa85b 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -34,6 +34,9 @@ #ifndef __RT_DEF_H__ #define __RT_DEF_H__ +/* include rtconfig header to import configuration */ +#include + #ifdef __cplusplus extern "C" { #endif -- cgit v1.3.1 From dbcb4a1ccff7c3840a722110d7a98816c0dd5cf2 Mon Sep 17 00:00:00 2001 From: bernard Date: Tue, 11 Mar 2014 15:44:35 +0800 Subject: [Kernel] declare more APIs in module --- include/rtthread.h | 3 +++ src/module.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/rtthread.h b/include/rtthread.h index f53c7b95b8..abe3a614ed 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -434,6 +434,9 @@ void rt_module_load_sethook(void (*hook)(rt_module_t module)); void rt_module_unload_sethook(void (*hook)(rt_module_t module)); #endif +void rt_module_init_object_container(struct rt_module *module); +rt_err_t rt_module_destroy(rt_module_t module); + /*@}*/ #endif diff --git a/src/module.c b/src/module.c index ec5ed3f7d0..428d42e961 100644 --- a/src/module.c +++ b/src/module.c @@ -242,7 +242,7 @@ static int rt_module_arm_relocate(struct rt_module *module, return 0; } -static void rt_module_init_object_container(struct rt_module *module) +void rt_module_init_object_container(struct rt_module *module) { RT_ASSERT(module != RT_NULL); -- cgit v1.3.1 From 40b7eba4461d1cfb21496e92caae1231321f94be Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Sat, 29 Mar 2014 14:59:02 +0800 Subject: [Kernel] Change the version number to 2.0.0. --- include/rtdef.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/rtdef.h b/include/rtdef.h index e24c2fa85b..e6b302d298 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -48,8 +48,8 @@ extern "C" { /*@{*/ /* RT-Thread version information */ -#define RT_VERSION 1L /**< major version number */ -#define RT_SUBVERSION 2L /**< minor version number */ +#define RT_VERSION 2L /**< major version number */ +#define RT_SUBVERSION 0L /**< minor version number */ #define RT_REVISION 0L /**< revise version number */ /* RT-Thread version */ -- cgit v1.3.1