commit
c8f72a215c
|
@ -24,7 +24,7 @@
|
|||
#define rt_tick rt_cpu_index(0)->tick
|
||||
#else
|
||||
static volatile rt_tick_t rt_tick = 0;
|
||||
#endif
|
||||
#endif /* RT_USING_SMP */
|
||||
|
||||
/**
|
||||
* @addtogroup Clock
|
||||
|
@ -72,7 +72,7 @@ void rt_tick_increase(void)
|
|||
rt_cpu_self()->tick ++;
|
||||
#else
|
||||
++ rt_tick;
|
||||
#endif
|
||||
#endif /* RT_USING_SMP */
|
||||
|
||||
/* check time slice */
|
||||
thread = rt_thread_self();
|
||||
|
@ -138,7 +138,7 @@ RT_WEAK rt_tick_t rt_tick_get_millisecond(void)
|
|||
#warning "rt-thread cannot provide a correct 1ms-based tick any longer,\
|
||||
please redefine this function in another file by using a high-precision hard-timer."
|
||||
return 0;
|
||||
#endif
|
||||
#endif /* 1000 % RT_TICK_PER_SECOND == 0u */
|
||||
}
|
||||
|
||||
/**@}*/
|
||||
|
|
|
@ -23,11 +23,11 @@
|
|||
#ifdef RT_USING_USER_MAIN
|
||||
#ifndef RT_MAIN_THREAD_STACK_SIZE
|
||||
#define RT_MAIN_THREAD_STACK_SIZE 2048
|
||||
#endif
|
||||
#endif /* RT_MAIN_THREAD_STACK_SIZE */
|
||||
#ifndef RT_MAIN_THREAD_PRIORITY
|
||||
#define RT_MAIN_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX / 3)
|
||||
#endif
|
||||
#endif
|
||||
#endif /* RT_MAIN_THREAD_PRIORITY */
|
||||
#endif /* RT_USING_USER_MAIN */
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
/*
|
||||
|
@ -98,7 +98,7 @@ void rt_components_board_init(void)
|
|||
{
|
||||
(*fn_ptr)();
|
||||
}
|
||||
#endif
|
||||
#endif /* RT_DEBUG_INIT */
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,9 +124,9 @@ void rt_components_init(void)
|
|||
{
|
||||
(*fn_ptr)();
|
||||
}
|
||||
#endif
|
||||
#endif /* RT_DEBUG_INIT */
|
||||
}
|
||||
#endif /* RT_USING_COMPONENTS_INIT */
|
||||
#endif /* RT_USING_COMPONENTS_INIT */
|
||||
|
||||
#ifdef RT_USING_USER_MAIN
|
||||
|
||||
|
@ -167,7 +167,7 @@ int entry(void)
|
|||
ALIGN(8)
|
||||
static rt_uint8_t main_stack[RT_MAIN_THREAD_STACK_SIZE];
|
||||
struct rt_thread main_thread;
|
||||
#endif
|
||||
#endif /* RT_USING_HEAP */
|
||||
|
||||
/* the system main thread */
|
||||
void main_thread_entry(void *parameter)
|
||||
|
@ -177,11 +177,11 @@ void main_thread_entry(void *parameter)
|
|||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
/* RT-Thread components initialization */
|
||||
rt_components_init();
|
||||
#endif
|
||||
#endif /* RT_USING_COMPONENTS_INIT */
|
||||
|
||||
#ifdef RT_USING_SMP
|
||||
rt_hw_secondary_cpu_up();
|
||||
#endif
|
||||
#endif /* RT_USING_SMP */
|
||||
/* invoke system main function */
|
||||
#if defined(__CC_ARM) || defined(__CLANG_ARM)
|
||||
{
|
||||
|
@ -211,7 +211,7 @@ void rt_application_init(void)
|
|||
|
||||
/* if not define RT_USING_HEAP, using to eliminate the warning */
|
||||
(void)result;
|
||||
#endif
|
||||
#endif /* RT_USING_HEAP */
|
||||
|
||||
rt_thread_startup(tid);
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ int rtthread_startup(void)
|
|||
#ifdef RT_USING_SIGNALS
|
||||
/* signal system initialization */
|
||||
rt_system_signal_init();
|
||||
#endif
|
||||
#endif /* RT_USING_SIGNALS */
|
||||
|
||||
/* create init_thread */
|
||||
rt_application_init();
|
||||
|
@ -250,7 +250,7 @@ int rtthread_startup(void)
|
|||
|
||||
#ifdef RT_USING_SMP
|
||||
rt_hw_spin_lock(&_cpus_lock);
|
||||
#endif /*RT_USING_SMP*/
|
||||
#endif /* RT_USING_SMP */
|
||||
|
||||
/* start scheduler */
|
||||
rt_system_scheduler_start();
|
||||
|
@ -258,4 +258,4 @@ int rtthread_startup(void)
|
|||
/* never reach here */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* RT_USING_USER_MAIN */
|
||||
|
|
|
@ -185,4 +185,4 @@ void rt_cpus_lock_status_restore(struct rt_thread *thread)
|
|||
}
|
||||
RTM_EXPORT(rt_cpus_lock_status_restore);
|
||||
|
||||
#endif
|
||||
#endif /* RT_USING_SMP */
|
||||
|
|
14
src/device.c
14
src/device.c
|
@ -16,9 +16,9 @@
|
|||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#if defined(RT_USING_POSIX)
|
||||
#ifdef RT_USING_POSIX
|
||||
#include <rtdevice.h> /* for wqueue_init */
|
||||
#endif
|
||||
#endif /* RT_USING_POSIX */
|
||||
|
||||
#ifdef RT_USING_DEVICE
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
|||
#define device_read (dev->read)
|
||||
#define device_write (dev->write)
|
||||
#define device_control (dev->control)
|
||||
#endif
|
||||
#endif /* RT_USING_DEVICE_OPS */
|
||||
|
||||
/**
|
||||
* This function registers a device driver with specified name.
|
||||
|
@ -62,10 +62,10 @@ rt_err_t rt_device_register(rt_device_t dev,
|
|||
dev->ref_count = 0;
|
||||
dev->open_flag = 0;
|
||||
|
||||
#if defined(RT_USING_POSIX)
|
||||
#ifdef RT_USING_POSIX
|
||||
dev->fops = RT_NULL;
|
||||
rt_wqueue_init(&(dev->wait_queue));
|
||||
#endif
|
||||
#endif /* RT_USING_POSIX */
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ void rt_device_destroy(rt_device_t dev)
|
|||
rt_free(dev);
|
||||
}
|
||||
RTM_EXPORT(rt_device_destroy);
|
||||
#endif
|
||||
#endif /* RT_USING_HEAP */
|
||||
|
||||
/**
|
||||
* This function will initialize the specified device
|
||||
|
@ -434,4 +434,4 @@ rt_device_set_tx_complete(rt_device_t dev,
|
|||
}
|
||||
RTM_EXPORT(rt_device_set_tx_complete);
|
||||
|
||||
#endif
|
||||
#endif /* RT_USING_DEVICE */
|
||||
|
|
32
src/idle.c
32
src/idle.c
|
@ -22,27 +22,27 @@
|
|||
|
||||
#ifdef RT_USING_MODULE
|
||||
#include <dlmodule.h>
|
||||
#endif
|
||||
#endif /* RT_USING_MODULE */
|
||||
|
||||
#if defined (RT_USING_HOOK)
|
||||
#ifdef RT_USING_HOOK
|
||||
#ifndef RT_USING_IDLE_HOOK
|
||||
#define RT_USING_IDLE_HOOK
|
||||
#endif
|
||||
#endif
|
||||
#endif /* RT_USING_IDLE_HOOK */
|
||||
#endif /* RT_USING_HOOK */
|
||||
|
||||
#ifndef IDLE_THREAD_STACK_SIZE
|
||||
#if defined (RT_USING_IDLE_HOOK) || defined(RT_USING_HEAP)
|
||||
#define IDLE_THREAD_STACK_SIZE 256
|
||||
#else
|
||||
#define IDLE_THREAD_STACK_SIZE 128
|
||||
#endif
|
||||
#endif
|
||||
#endif /* (RT_USING_IDLE_HOOK) || defined(RT_USING_HEAP) */
|
||||
#endif /* IDLE_THREAD_STACK_SIZE */
|
||||
|
||||
#ifdef RT_USING_SMP
|
||||
#define _CPUS_NR RT_CPUS_NR
|
||||
#else
|
||||
#define _CPUS_NR 1
|
||||
#endif
|
||||
#endif /* RT_USING_SMP */
|
||||
|
||||
extern rt_list_t rt_thread_defunct;
|
||||
|
||||
|
@ -53,7 +53,7 @@ static rt_uint8_t rt_thread_stack[_CPUS_NR][IDLE_THREAD_STACK_SIZE];
|
|||
#ifdef RT_USING_IDLE_HOOK
|
||||
#ifndef RT_IDLE_HOOK_LIST_SIZE
|
||||
#define RT_IDLE_HOOK_LIST_SIZE 4
|
||||
#endif
|
||||
#endif /* RT_IDLE_HOOK_LIST_SIZE */
|
||||
|
||||
static void (*idle_hook_list[RT_IDLE_HOOK_LIST_SIZE])(void);
|
||||
|
||||
|
@ -125,7 +125,7 @@ rt_err_t rt_thread_idle_delhook(void (*hook)(void))
|
|||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* RT_USING_IDLE_HOOK */
|
||||
|
||||
#ifdef RT_USING_HEAP
|
||||
/* Return whether there is defunctional thread to be deleted. */
|
||||
|
@ -141,7 +141,7 @@ rt_inline int _has_defunct_thread(void)
|
|||
|
||||
return l->next != l;
|
||||
}
|
||||
#endif
|
||||
#endif /* RT_USING_HEAP */
|
||||
|
||||
/**
|
||||
* @ingroup Thread
|
||||
|
@ -182,7 +182,7 @@ void rt_thread_idle_excute(void)
|
|||
rt_object_delete((rt_object_t)thread);
|
||||
rt_hw_interrupt_enable(lock);
|
||||
}
|
||||
#endif
|
||||
#endif /* RT_USING_HEAP */
|
||||
}
|
||||
|
||||
extern void rt_system_power_manager(void);
|
||||
|
@ -196,7 +196,7 @@ static void rt_thread_idle_entry(void *parameter)
|
|||
rt_hw_secondary_cpu_idle_exec();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* RT_USING_SMP */
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
@ -212,12 +212,12 @@ static void rt_thread_idle_entry(void *parameter)
|
|||
idle_hook();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* RT_USING_IDLE_HOOK */
|
||||
|
||||
rt_thread_idle_excute();
|
||||
#ifdef RT_USING_PM
|
||||
rt_system_power_manager();
|
||||
#endif
|
||||
#endif /* RT_USING_PM */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ void rt_thread_idle_init(void)
|
|||
32);
|
||||
#ifdef RT_USING_SMP
|
||||
rt_thread_control(&idle[i], RT_THREAD_CTRL_BIND_CPU, (void*)i);
|
||||
#endif
|
||||
#endif /* RT_USING_SMP */
|
||||
/* startup */
|
||||
rt_thread_startup(&idle[i]);
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ rt_thread_t rt_thread_idle_gethandler(void)
|
|||
register int id = rt_hw_cpu_id();
|
||||
#else
|
||||
register int id = 0;
|
||||
#endif
|
||||
#endif /* RT_USING_SMP */
|
||||
|
||||
return (rt_thread_t)(&idle[id]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue