From 12b5e56f46e4b2b489a088c2ccfb6410c10686ea Mon Sep 17 00:00:00 2001 From: dzzxzz Date: Sat, 17 Mar 2012 06:43:49 +0000 Subject: unify the coding style of kernel git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1998 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- include/rtdebug.h | 4 +--- include/rtdef.h | 42 +++++++++++++++++++++++++++++++----------- include/rthw.h | 2 +- include/rtm.h | 3 +-- include/rtthread.h | 39 +++++++++++++++++++++++++++++---------- 5 files changed, 63 insertions(+), 27 deletions(-) (limited to 'include') diff --git a/include/rtdebug.h b/include/rtdebug.h index e648050c10..4d3cd53309 100644 --- a/include/rtdebug.h +++ b/include/rtdebug.h @@ -1,7 +1,7 @@ /* * File : rtdebug.h * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2011, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -78,6 +78,4 @@ #endif /* RT_DEBUG */ - - #endif /* __RTDEBUG_H__ */ diff --git a/include/rtdef.h b/include/rtdef.h index 092a9a2c63..1107e3bbf6 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -1,7 +1,7 @@ /* * File : rtdef.h * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2011, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -28,15 +28,16 @@ extern "C" { /** * @addtogroup BasicDef */ + /*@{*/ /* RT-Thread version information */ #define RT_VERSION 1L /**< major version number */ #define RT_SUBVERSION 1L /**< minor version number */ -#define RT_REVISION 0L /**< revise version number */ +#define RT_REVISION 0L /**< revise version number */ /* RT-Thread version */ -#define RTTHREAD_VERSION ((RT_VERSION * 10000) + \ +#define RTTHREAD_VERSION ((RT_VERSION * 10000) + \ (RT_SUBVERSION * 100) + RT_REVISION) /* RT-Thread basic data type definitions */ @@ -63,6 +64,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset /* boolean type definitions */ #define RT_TRUE 1 /**< boolean true */ #define RT_FALSE 0 /**< boolean fails */ + /*@}*/ /* maximum value of base type */ @@ -137,7 +139,9 @@ typedef rt_base_t rt_off_t; /**< Type for offset /** * @addtogroup Error */ + /*@{*/ + /* RT-Thread error code definitions */ #define RT_EOK 0 /**< There is no error */ #define RT_ERROR 1 /**< A generic error happens */ @@ -148,6 +152,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset #define RT_ENOSYS 6 /**< No system */ #define RT_EBUSY 7 /**< Busy */ #define RT_EIO 8 /**< IO error */ + /*@}*/ /** @@ -158,6 +163,7 @@ typedef rt_base_t rt_off_t; /**< Type for offset * would return 16. */ #define RT_ALIGN(size, align) (((size) + (align) - 1) & ~((align) - 1)) + /** * @ingroup BasicDef * @@ -185,6 +191,7 @@ typedef struct rt_list_node rt_list_t; /* Type for lists. * /** * @addtogroup KernelObject */ + /*@{*/ /* @@ -280,6 +287,7 @@ struct rt_object_information /** * @addtogroup Clock */ + /*@{*/ /** @@ -314,11 +322,13 @@ struct rt_timer rt_tick_t timeout_tick; /**< timeout tick */ }; typedef struct rt_timer *rt_timer_t; + /*@}*/ /** * @addtogroup Thread */ + /*@{*/ /* @@ -338,16 +348,13 @@ typedef struct rt_timer *rt_timer_t; /** * thread control command definitions */ -#define RT_THREAD_CTRL_STARTUP 0x00 /**< Startup thread. */ +#define RT_THREAD_CTRL_STARTUP 0x00 /**< Startup thread. */ #define RT_THREAD_CTRL_CLOSE 0x01 /**< Close thread. */ #define RT_THREAD_CTRL_CHANGE_PRIORITY 0x02 /**< Change thread priority. */ #define RT_THREAD_CTRL_INFO 0x03 /**< Get thread information. */ -typedef struct rt_thread *rt_thread_t; - /** * Thread structure - * */ struct rt_thread { @@ -399,11 +406,14 @@ struct rt_thread rt_uint32_t user_data; /**< private user data beyond this thread */ }; +typedef struct rt_thread *rt_thread_t; + /*@}*/ /** * @addtogroup IPC */ + /*@{*/ /** @@ -521,17 +531,21 @@ struct rt_messagequeue }; typedef struct rt_messagequeue *rt_mq_t; #endif + /*@}*/ +#ifdef RT_USING_MEMPOOL /** * @addtogroup MM */ + /*@{*/ + /* * memory management * heap & partition */ -#ifdef RT_USING_MEMPOOL + /** * Base structure of Memory pool object */ @@ -552,13 +566,15 @@ struct rt_mempool rt_size_t suspend_thread_count; /**< numbers of thread pended on this resource */ }; typedef struct rt_mempool *rt_mp_t; -#endif + /*@}*/ +#endif #ifdef RT_USING_DEVICE /** * @addtogroup Device */ + /*@{*/ /** @@ -689,6 +705,7 @@ enum RTGRAPHIC_PIXEL_FORMAT_RGB888, RTGRAPHIC_PIXEL_FORMAT_ARGB888 }; + /** * build a pixel position according to (x, y) coordinates. */ @@ -732,13 +749,17 @@ struct rt_device_graphic_ops void (*blit_line) (const char *pixel, int x, int y, rt_size_t size); }; #define rt_graphix_ops(device) ((struct rt_device_graphic_ops *)(device->user_data)) + /*@}*/ +#endif +#ifdef RT_USING_MODULE /** * @addtogroup Module */ + /*@{*/ -#ifdef RT_USING_MODULE + /* * module system */ @@ -774,7 +795,6 @@ struct rt_module struct rt_object_information module_object[RT_Object_Class_Unknown]; }; typedef struct rt_module *rt_module_t; -#endif /*@}*/ #endif diff --git a/include/rthw.h b/include/rthw.h index a24c483e20..14a60ab46a 100644 --- a/include/rthw.h +++ b/include/rthw.h @@ -1,7 +1,7 @@ /* * File : rthw.h * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2011, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at diff --git a/include/rtm.h b/include/rtm.h index 80d17ad9c7..040e2ee7ea 100644 --- a/include/rtm.h +++ b/include/rtm.h @@ -1,7 +1,7 @@ /* * File : rtm.h * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2011, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -22,7 +22,6 @@ const struct rt_module_symtab __rtmsym_##symbol SECTION("RTMSymTab")= \ (void *)&symbol, \ __rtmsym_##symbol##_name \ }; - #else #define RTM_EXPORT(symbol) #endif diff --git a/include/rtthread.h b/include/rtthread.h index 1cf0532627..f0a69c8aac 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -1,7 +1,7 @@ /* * File : rtthread.h * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2011, RT-Thread Development Team + * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -30,11 +30,12 @@ extern "C" { /** * @addtogroup KernelObject */ + /*@{*/ + /* * kernel object interface */ - void rt_system_object_init(void); struct rt_object_information *rt_object_get_information(enum rt_object_class_type type); void rt_object_init(struct rt_object *object, enum rt_object_class_type type, const char *name); @@ -57,7 +58,9 @@ void rt_object_put_sethook(void (*hook)(struct rt_object *object)); /** * @addtogroup Clock */ + /*@{*/ + /* * clock & timer interface */ @@ -86,12 +89,15 @@ rt_err_t rt_timer_control(rt_timer_t timer, rt_uint8_t cmd, void *arg); #ifdef RT_USING_HOOK void rt_timer_timeout_sethook(void (*hook)(struct rt_timer *timer)); #endif + /*@}*/ /** * @addtogroup Thread */ + /*@{*/ + /* * thread interface */ @@ -142,12 +148,15 @@ void rt_exit_critical(void); #ifdef RT_USING_HOOK void rt_scheduler_sethook(void (*hook)(rt_thread_t from, rt_thread_t to)); #endif + /*@}*/ /** * @addtogroup MM */ + /*@{*/ + /* * memory management interface */ @@ -167,6 +176,7 @@ void rt_mp_free(void *block); void rt_mp_alloc_sethook(void (*hook)(struct rt_mempool *mp, void *block)); void rt_mp_free_sethook(void (*hook)(struct rt_mempool *mp, void *block)); #endif + #endif #ifdef RT_USING_HEAP @@ -179,8 +189,8 @@ void *rt_malloc(rt_size_t nbytes); void rt_free(void *ptr); void *rt_realloc(void *ptr, rt_size_t nbytes); void *rt_calloc(rt_size_t count, rt_size_t size); -void* rt_malloc_align(rt_size_t size, rt_size_t align); -void rt_free_align(void* ptr); +void *rt_malloc_align(rt_size_t size, rt_size_t align); +void rt_free_align(void *ptr); void rt_memory_info(rt_uint32_t *total, rt_uint32_t *used, rt_uint32_t *max_used); @@ -195,12 +205,15 @@ void rt_free_sethook(void (*hook)(void *ptr)); #endif #endif + /*@}*/ /** * @addtogroup IPC */ + /*@{*/ + #ifdef RT_USING_SEMAPHORE /* * semaphore interface @@ -247,7 +260,6 @@ rt_err_t rt_event_control(rt_event_t event, rt_uint8_t cmd, void *arg); #ifdef RT_USING_MAILBOX /* * mailbox interface - * */ rt_err_t rt_mb_init(rt_mailbox_t mb, const char *name, void *msgpool, rt_size_t size, rt_uint8_t flag); rt_err_t rt_mb_detach(rt_mailbox_t mb); @@ -274,17 +286,19 @@ rt_err_t rt_mq_urgent(rt_mq_t mq, void *buffer, rt_size_t size); rt_err_t rt_mq_recv(rt_mq_t mq, void *buffer, rt_size_t size, rt_int32_t timeout); rt_err_t rt_mq_control(rt_mq_t mq, rt_uint8_t cmd, void *arg); #endif + /*@}*/ #ifdef RT_USING_DEVICE /** * @addtogroup Device */ + /*@{*/ + /* * device (I/O) system interface */ - rt_device_t rt_device_find(const char *name); rt_err_t rt_device_register(rt_device_t dev, const char *name, rt_uint16_t flags); @@ -300,6 +314,7 @@ rt_err_t rt_device_close(rt_device_t dev); rt_size_t rt_device_read (rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size); rt_size_t rt_device_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size); rt_err_t rt_device_control(rt_device_t dev, rt_uint8_t cmd, void *arg); + /*@}*/ #endif @@ -307,11 +322,12 @@ rt_err_t rt_device_control(rt_device_t dev, rt_uint8_t cmd, void *arg); /** * @addtogroup Module */ + /*@{*/ + /* * module interface */ - rt_module_t rt_module_load(const char *name, void *module_ptr); rt_err_t rt_module_unload(rt_module_t module); rt_module_t rt_module_open(const char *filename); @@ -327,8 +343,8 @@ void rt_module_load_sethook(void (*hook)(rt_module_t module)); void rt_module_unload_sethook(void (*hook)(rt_module_t module)); #endif -#endif /*@}*/ +#endif /* * interrupt service @@ -340,6 +356,7 @@ typedef void (*rt_isr_handler_t)(int vector); */ void rt_interrupt_enter(void); void rt_interrupt_leave(void); + /* * the number of nested interrupts. */ @@ -348,10 +365,13 @@ rt_uint8_t rt_interrupt_get_nest(void); /** * @addtogroup KernelService */ + /*@{*/ + /* * general kernel service */ +void rt_kprintf(const char *fmt, ...); rt_int32_t rt_sprintf(char *buf ,const char *format, ...); rt_int32_t rt_vsprintf(char *dest, const char *format, va_list arg_ptr); rt_int32_t rt_sprintf(char *buf ,const char *format, ...); @@ -360,7 +380,6 @@ rt_int32_t rt_snprintf(char *buf, rt_size_t size, const char *format, ...); #ifdef RT_USING_DEVICE rt_device_t rt_console_set_device(const char *name); #endif -void rt_kprintf(const char *fmt, ...); rt_err_t rt_get_errno(void); void rt_set_errno(rt_err_t no); @@ -393,5 +412,5 @@ void rt_show_version(void); #ifdef __cplusplus } #endif -/*@}*/ + #endif -- cgit v1.3.1