summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbernard <[email protected]>2014-11-01 21:52:26 +0800
committerbernard <[email protected]>2014-11-01 21:52:26 +0800
commita00cc57487f78629bf3aaa7c3c04708af6fa0800 (patch)
tree9ff51facb280baa4d427da3ad05bf07b70782876 /src
parentc7ee7f9858f2cc86d94a2eea8baacfc449865e9a (diff)
Prepare RT-Thread 1.2.3 release.
Diffstat (limited to 'src')
-rw-r--r--src/device.c43
-rw-r--r--src/idle.c18
-rw-r--r--src/mem.c6
-rw-r--r--src/module.c4
-rw-r--r--src/module.h2
5 files changed, 27 insertions, 46 deletions
diff --git a/src/device.c b/src/device.c
index 7ee130041c..2c5ea258ad 100644
--- a/src/device.c
+++ b/src/device.c
@@ -79,45 +79,12 @@ RTM_EXPORT(rt_device_unregister);
* This function initializes all registered device driver
*
* @return the error code, RT_EOK on successfully.
+ *
+ * @deprecated since 1.2.3, this function is not needed because the initialization
+ * of a device is performed when applicaiton opens it.
*/
rt_err_t rt_device_init_all(void)
{
- struct rt_device *device;
- struct rt_list_node *node;
- struct rt_object_information *information;
- register rt_err_t result;
-
- extern struct rt_object_information rt_object_container[];
-
- information = &rt_object_container[RT_Object_Class_Device];
-
- /* for each device */
- for (node = information->object_list.next;
- node != &(information->object_list);
- node = node->next)
- {
- rt_err_t (*init)(rt_device_t dev);
- device = (struct rt_device *)rt_list_entry(node,
- struct rt_object,
- list);
-
- /* get device init handler */
- init = device->init;
- if (init != RT_NULL && !(device->flag & RT_DEVICE_FLAG_ACTIVATED))
- {
- result = init(device);
- if (result != RT_EOK)
- {
- rt_kprintf("To initialize device:%s failed. The error code is %d\n",
- device->parent.name, result);
- }
- else
- {
- device->flag |= RT_DEVICE_FLAG_ACTIVATED;
- }
- }
- }
-
return RT_EOK;
}
@@ -395,8 +362,8 @@ rt_err_t rt_device_control(rt_device_t dev, rt_uint8_t cmd, void *arg)
RTM_EXPORT(rt_device_control);
/**
- * This function will set the indication callback function when device receives
- * data.
+ * This function will set the reception indication callback function. This callback function
+ * is invoked when this device receives data.
*
* @param dev the pointer of device driver structure
* @param rx_ind the indication callback function
diff --git a/src/idle.c b/src/idle.c
index 5f7fe45d4b..23c24e1059 100644
--- a/src/idle.c
+++ b/src/idle.c
@@ -67,6 +67,20 @@ void rt_thread_idle_sethook(void (*hook)(void))
/*@}*/
#endif
+/* Return whether there is defunctional thread to be deleted. */
+rt_inline int _has_defunct_thread(void)
+{
+ /* The rt_list_isempty has prototype of "int rt_list_isempty(const rt_list_t *l)".
+ * So the compiler has a good reason that the rt_thread_defunct list does
+ * not change within rt_thread_idle_excute thus optimize the "while" loop
+ * into a "if".
+ *
+ * So add the volatile qualifier here. */
+ const volatile rt_list_t *l = (const volatile rt_list_t*)&rt_thread_defunct;
+
+ return l->next != l;
+}
+
/**
* @ingroup Thread
*
@@ -76,7 +90,7 @@ void rt_thread_idle_excute(void)
{
/* Loop until there is no dead thread. So one call to rt_thread_idle_excute
* will do all the cleanups. */
- while (!rt_list_isempty(&rt_thread_defunct))
+ while (_has_defunct_thread())
{
rt_base_t lock;
rt_thread_t thread;
@@ -89,7 +103,7 @@ void rt_thread_idle_excute(void)
lock = rt_hw_interrupt_disable();
/* re-check whether list is empty */
- if (!rt_list_isempty(&rt_thread_defunct))
+ if (_has_defunct_thread())
{
/* get defunct thread */
thread = rt_list_entry(rt_thread_defunct.next,
diff --git a/src/mem.c b/src/mem.c
index e8aae72489..004de01d94 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -176,10 +176,10 @@ static void plug_holes(struct heap_mem *mem)
/**
* @ingroup SystemInit
*
- * This function will init system heap
+ * This function will initialize system heap memory.
*
- * @param begin_addr the beginning address of system page
- * @param end_addr the end address of system page
+ * @param begin_addr the beginning address of system heap memory.
+ * @param end_addr the end address of system heap memory.
*/
void rt_system_heap_init(void *begin_addr, void *end_addr)
{
diff --git a/src/module.c b/src/module.c
index 0603159b91..5d5d02c580 100644
--- a/src/module.c
+++ b/src/module.c
@@ -1120,8 +1120,8 @@ rt_module_t rt_module_open(const char *path)
* This function will do a excutable program with main function and parameters.
*
* @param path the full path of application module
- * @cmd_line the command line of program
- * @size the size of command line of program
+ * @param cmd_line the command line of program
+ * @param size the size of command line of program
*
* @return the module object
*/
diff --git a/src/module.h b/src/module.h
index d2d4c4fcc8..3c45c96d02 100644
--- a/src/module.h
+++ b/src/module.h
@@ -239,7 +239,7 @@ typedef struct
#define SHT_DYNAMIC 6 /* dynamic section */
#define SHT_NOTE 7 /* note section */
#define SHT_NOBITS 8 /* no space section */
-#define SHT_REL 9 /* relation section without addends */
+#define SHT_REL 9 /* relocation section without addends */
#define SHT_SHLIB 10 /* reserved - purpose unknown */
#define SHT_DYNSYM 11 /* dynamic symbol table section */
#define SHT_NUM 12 /* number of section types */