add license and copyright info

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@226 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong
2009-12-25 12:18:53 +00:00
parent 6cd35a87c3
commit 51e2d91378
45 changed files with 473 additions and 252 deletions
+3 -3
View File
@@ -1,11 +1,11 @@
/*
* File : clock.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
@@ -50,7 +50,7 @@ rt_tick_t rt_tick_get()
}
/**
* This function will notify kernel there is one tick passed. Normally,
* This function will notify kernel there is one tick passed. Normally,
* this function is invoked by clock ISR.
*/
void rt_tick_increase()
+3 -3
View File
@@ -1,11 +1,11 @@
/*
* File : device.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
@@ -81,7 +81,7 @@ rt_err_t rt_device_init_all()
result = init(device);
if (result != RT_EOK)
{
rt_kprintf("To initialize device:%s failed. The error code is %d\n",
rt_kprintf("To initialize device:%s failed. The error code is %d\n",
device->parent.name, result);
}
else
+2 -2
View File
@@ -1,11 +1,11 @@
/*
* File : idle.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
+11 -11
View File
@@ -1,7 +1,7 @@
/*
* File : ipc.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -26,9 +26,9 @@
* 2009-07-18 Bernard fix the event clear bug
* 2009-09-09 Bernard remove fast event and fix ipc release bug
* 2009-10-10 Bernard change semaphore and mutex value to unsigned value
* 2009-10-25 Bernard change the mb/mq receive timeout to 0 if the
* 2009-10-25 Bernard change the mb/mq receive timeout to 0 if the
* re-calculated delta tick is a negative number.
* 2009-12-16 Bernard fix the rt_ipc_object_suspend issue when IPC flag
* 2009-12-16 Bernard fix the rt_ipc_object_suspend issue when IPC flag
* is RT_IPC_FLAG_PRIO
*/
@@ -334,7 +334,7 @@ rt_err_t rt_sem_take (rt_sem_t sem, rt_int32_t time)
temp = rt_hw_interrupt_disable();
#ifdef RT_IPC_DEBUG
rt_kprintf("thread %s take sem:%s, which value is: %d\n", rt_thread_self()->name,
rt_kprintf("thread %s take sem:%s, which value is: %d\n", rt_thread_self()->name,
((struct rt_object*)sem)->name, sem->value);
#endif
if (sem->value > 0)
@@ -437,7 +437,7 @@ rt_err_t rt_sem_release(rt_sem_t sem)
temp = rt_hw_interrupt_disable();
#ifdef RT_IPC_DEBUG
rt_kprintf("thread %s releases sem:%s, which value is: %d\n", rt_thread_self()->name,
rt_kprintf("thread %s releases sem:%s, which value is: %d\n", rt_thread_self()->name,
((struct rt_object*)sem)->name, sem->value);
#endif
@@ -612,7 +612,7 @@ rt_err_t rt_mutex_take (rt_mutex_t mutex, rt_int32_t time)
#endif
#ifdef RT_IPC_DEBUG
rt_kprintf("mutex_take: current thread %s, mutex value: %d, hold: %d\n",
rt_kprintf("mutex_take: current thread %s, mutex value: %d, hold: %d\n",
thread->name, mutex->value, mutex->hold);
#endif
@@ -626,7 +626,7 @@ rt_err_t rt_mutex_take (rt_mutex_t mutex, rt_int32_t time)
}
else
{
/* in initialization status, the value is 1. Therefore, if the
/* in initialization status, the value is 1. Therefore, if the
* value is great than 1, which indicates the mutex is avaible.
*/
if (mutex->value > 0)
@@ -737,7 +737,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
temp = rt_hw_interrupt_disable();
#ifdef RT_IPC_DEBUG
rt_kprintf("mutex_release:current thread %s, mutex value: %d, hold: %d\n",
rt_kprintf("mutex_release:current thread %s, mutex value: %d, hold: %d\n",
thread->name, mutex->value, mutex->hold);
#endif
@@ -803,7 +803,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
/* perform a schedule */
if (need_schedule == RT_TRUE) rt_schedule();
return RT_EOK;
}
@@ -1799,7 +1799,7 @@ rt_err_t rt_mq_recv (rt_mq_t mq, void* buffer, rt_size_t size, rt_int32_t timeou
/* get current thread */
thread = rt_thread_self();
/* message queue is empty */
while (mq->entry == 0)
{
@@ -1824,7 +1824,7 @@ rt_err_t rt_mq_recv (rt_mq_t mq, void* buffer, rt_size_t size, rt_int32_t timeou
{
/* get the start tick of timer */
tick_delta = rt_tick_get();
#ifdef RT_IPC_DEBUG
rt_kprintf("set thread:%s to timer list\n", thread->name);
#endif
+3 -3
View File
@@ -1,11 +1,11 @@
/*
* File : irq.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
@@ -36,7 +36,7 @@ volatile rt_uint32_t rt_interrupt_nest;
void rt_interrupt_enter()
{
rt_base_t level;
#ifdef IRQ_DEBUG
rt_kprintf("irq comming..., irq nest:%d\n", rt_interrupt_nest);
#endif
+12 -12
View File
@@ -1,11 +1,11 @@
/*
* File : kservice.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
@@ -31,16 +31,16 @@ int errno;
/*
* This function will get errno
*
*
* @return errno
*/
rt_err_t rt_get_errno(void)
{
rt_thread_t tid;
tid = rt_thread_self();
if (tid == RT_NULL) return errno;
return tid->error;
}
@@ -52,10 +52,10 @@ rt_err_t rt_get_errno(void)
void rt_set_errno(rt_err_t error)
{
rt_thread_t tid;
tid = rt_thread_self();
if (tid == RT_NULL) { errno = error; return; }
tid->error = error;
}
@@ -605,12 +605,12 @@ static rt_int32_t vsnprintf(char *buf, rt_size_t size, const char *fmt, va_list
end = buf + size - 1;
/* Make sure end is always >= buf */
if (end < buf)
if (end < buf)
{
end = ((char *)-1);
size = end - buf;
}
for (; *fmt ; ++fmt)
{
if (*fmt != '%')
@@ -859,7 +859,7 @@ rt_int32_t rt_snprintf(char *buf, rt_size_t size, const char *fmt, ...)
* This function will fill a formatted string to buffer
*
* @param buf the buffer to save formatted string
* @param arg_ptr the arg_ptr
* @param arg_ptr the arg_ptr
* @param format the format
*/
rt_int32_t rt_vsprintf(char *buf, const char *format, va_list arg_ptr)
@@ -877,11 +877,11 @@ rt_int32_t rt_sprintf(char *buf ,const char *format,...)
{
rt_int32_t n;
va_list arg_ptr;
va_start(arg_ptr, format);
n = rt_vsprintf(buf ,format,arg_ptr);
va_end (arg_ptr);
return n;
}
+3 -3
View File
@@ -1,11 +1,11 @@
/*
* File : kservice.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
@@ -49,7 +49,7 @@ rt_inline void rt_list_insert_after(rt_list_t *l, rt_list_t *n)
}
/**
* @brief insert a node before a list
* @brief insert a node before a list
*
* @param n new node to be inserted
* @param l list to insert it
+14 -14
View File
@@ -1,7 +1,7 @@
/*
* File : kservice.c
* File : mem.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2008, RT-Thread Development Team
* COPYRIGHT (C) 2008 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -61,9 +61,9 @@ static void (*rt_free_hook)(void *ptr);
/*@{*/
/**
* This function will set a hook function, which will be invoked when a memory
* This function will set a hook function, which will be invoked when a memory
* block is allocated from heap memory.
*
*
* @param hook the hook function
*/
void rt_malloc_sethook(void (*hook)(void *ptr, rt_size_t size))
@@ -72,9 +72,9 @@ void rt_malloc_sethook(void (*hook)(void *ptr, rt_size_t size))
}
/**
* This function will set a hook function, which will be invoked when a memory
* This function will set a hook function, which will be invoked when a memory
* block is released to heap memory.
*
*
* @param hook the hook function
*/
void rt_free_sethook(void (*hook)(void *ptr))
@@ -238,7 +238,7 @@ void *rt_malloc(rt_size_t size)
/* take memory semaphore */
rt_sem_take(&heap_sem, RT_WAITING_FOREVER);
for (ptr = (rt_uint8_t *)lfree - heap_ptr; ptr < mem_size_aligned - size;
for (ptr = (rt_uint8_t *)lfree - heap_ptr; ptr < mem_size_aligned - size;
ptr = ((struct heap_mem *)&heap_ptr[ptr])->next)
{
mem = (struct heap_mem *)&heap_ptr[ptr];
@@ -334,7 +334,7 @@ void *rt_malloc(rt_size_t size)
*
* @param rmem pointer to memory allocated by rt_malloc
* @param newsize the required new size
*
*
* @return the changed memory block address
*/
void *rt_realloc(void *rmem, rt_size_t newsize)
@@ -356,7 +356,7 @@ void *rt_realloc(void *rmem, rt_size_t newsize)
rt_sem_take(&heap_sem, RT_WAITING_FOREVER);
if ((rt_uint8_t *)rmem < (rt_uint8_t *)heap_ptr ||
if ((rt_uint8_t *)rmem < (rt_uint8_t *)heap_ptr ||
(rt_uint8_t *)rmem >= (rt_uint8_t *)heap_end)
{
/* illegal memory */
@@ -404,8 +404,8 @@ void *rt_realloc(void *rmem, rt_size_t newsize)
}
/**
* This function will contiguously allocate enough space for count objects
* that are size bytes of memory each and returns a pointer to the allocated
* This function will contiguously allocate enough space for count objects
* that are size bytes of memory each and returns a pointer to the allocated
* memory.
*
* The allocated memory is filled with bytes of value zero.
@@ -429,7 +429,7 @@ void *rt_calloc(rt_size_t count, rt_size_t size)
}
/**
* This function will release the previously allocated memory block by rt_malloc.
* This function will release the previously allocated memory block by rt_malloc.
* The released memory block is taken back to system heap.
*
* @param rmem the address of memory which will be released
@@ -488,7 +488,7 @@ void rt_free(void *rmem)
}
#ifdef RT_MEM_STATS
void rt_memory_info(rt_uint32_t *total,
void rt_memory_info(rt_uint32_t *total,
rt_uint32_t *used,
rt_uint32_t *max_used)
{
@@ -496,7 +496,7 @@ void rt_memory_info(rt_uint32_t *total,
if (used != RT_NULL) *used = used_mem;
if (max_used != RT_NULL) *max_used = max_mem;
}
#ifdef RT_USING_FINSH
#include <finsh.h>
void list_mem()
+12 -12
View File
@@ -1,16 +1,16 @@
/*
* File : partition.c
* File : mempool.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2006-05-27 Bernard implement memory pool
* 2006-06-03 Bernard fix the thread timer init bug
* 2006-06-03 Bernard fix the thread timer init bug
* 2006-06-30 Bernard fix the allocate/free block bug
* 2006-08-04 Bernard add hook support
* 2006-08-10 Bernard fix interrupt bug in rt_mp_alloc
@@ -35,7 +35,7 @@ static void (*rt_mp_free_hook)(struct rt_mempool* mp, void *block);
/**
* This function will set a hook function, which will be invoked when a memory
* block is allocated from memory pool.
*
*
* @param hook the hook function
*/
void rt_mp_alloc_sethook(void (*hook)(struct rt_mempool* mp, void *block))
@@ -46,7 +46,7 @@ void rt_mp_alloc_sethook(void (*hook)(struct rt_mempool* mp, void *block))
/**
* This function will set a hook function, which will be invoked when a memory
* block is released to memory pool.
*
*
* @param hook the hook function
*/
void rt_mp_free_sethook(void (*hook)(struct rt_mempool* mp, void *block))
@@ -135,7 +135,7 @@ rt_err_t rt_mp_detach(struct rt_mempool* mp)
thread->error = -RT_ERROR;
/*
* resume thread
* resume thread
* In rt_thread_resume function, it will remove current thread from suspend
* list
*/
@@ -238,7 +238,7 @@ rt_err_t rt_mp_delete(rt_mp_t mp)
thread->error = -RT_ERROR;
/*
* resume thread
* resume thread
* In rt_thread_resume function, it will remove current thread from suspend
* list
*/
@@ -253,7 +253,7 @@ rt_err_t rt_mp_delete(rt_mp_t mp)
/* release allocated room */
rt_free(mp->start_address);
/* detach object */
rt_object_delete(&(mp->parent));
@@ -275,7 +275,7 @@ void *rt_mp_alloc (rt_mp_t mp, rt_int32_t time)
rt_uint8_t* block_ptr;
register rt_base_t level;
struct rt_thread* thread;
/* disable interrupt */
level = rt_hw_interrupt_disable();
@@ -314,7 +314,7 @@ void *rt_mp_alloc (rt_mp_t mp, rt_int32_t time)
{
/* init thread timer and start it */
rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, &time);
rt_timer_start(&(thread->thread_timer));
rt_timer_start(&(thread->thread_timer));
}
/* enable interrupt */
@@ -336,7 +336,7 @@ void *rt_mp_alloc (rt_mp_t mp, rt_int32_t time)
mp->block_list = *(rt_uint8_t**)block_ptr;
/* point to memory pool */
*(rt_uint8_t**)block_ptr = (rt_uint8_t*)mp;
*(rt_uint8_t**)block_ptr = (rt_uint8_t*)mp;
}
}
+2 -2
View File
@@ -1,11 +1,11 @@
/*
* File : object.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
+2 -2
View File
@@ -1,11 +1,11 @@
/*
* File : scheduler.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
+1 -1
View File
@@ -1,7 +1,7 @@
/*
* File : slab.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2008, RT-Thread Development Team
* COPYRIGHT (C) 2008 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
+3 -3
View File
@@ -1,11 +1,11 @@
/*
* File : thread.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://openlab.rt-thread.com/license/LICENSE
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
@@ -81,7 +81,7 @@ static rt_err_t _rt_thread_init(struct rt_thread* thread,
/* init user data */
thread->user_data = 0;
/* init thread timer */
rt_timer_init(&(thread->thread_timer),
thread->name,
+3 -3
View File
@@ -1,7 +1,7 @@
/*
* File : timer.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -420,12 +420,12 @@ static struct rt_thread timer_thread;
static rt_uint8_t timer_thread_stack[RT_TIMER_THREAD_STACK_SIZE];
static struct rt_semaphore timer_sem;
static rt_uint16_t timer_ex_cnt;
static rt_uint16_t timer_ex_cnt;
void rt_soft_timer_tick_increase (void)
{
timer_ex_cnt++;
if (timer_ex_cnt >= (RT_TICK_PER_SECOND / RT_TIMER_EX_TICKS_PER_SEC))
if (timer_ex_cnt >= (RT_TICK_PER_SECOND / RT_TIMER_TICK_PER_SECOND))
{
timer_ex_cnt = 0;
rt_sem_release(&timer_sem);