mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-06 09:02:20 +08:00
convert dos endline to unix endline; cleanup schedule code for STM32
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@49 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -528,7 +528,7 @@ enum rt_device_class_type
|
||||
RT_Device_Class_Block, /* block device */
|
||||
RT_Device_Class_NetIf, /* net interface */
|
||||
RT_Device_Class_MTD, /* memory device */
|
||||
RT_Device_Class_CAN, /* CAN device */
|
||||
RT_Device_Class_CAN, /* CAN device */
|
||||
RT_Device_Class_RTC, /* RTC device */
|
||||
RT_Device_Class_Unknown /* unknown device */
|
||||
};
|
||||
@@ -566,9 +566,9 @@ enum rt_device_class_type
|
||||
#define RT_DEVICE_CTRL_BLK_GETGEOME 0x10 /* get geometry information */
|
||||
#define RT_DEVICE_CTRL_NETIF_GETMAC 0x10 /* get mac address */
|
||||
#define RT_DEVICE_CTRL_MTD_FORMAT 0x10 /* format a MTD device */
|
||||
#define RT_DEVICE_CTRL_RTC_GET_TIME 0x10 /* get time */
|
||||
#define RT_DEVICE_CTRL_RTC_GET_TIME 0x10 /* get time */
|
||||
#define RT_DEVICE_CTRL_RTC_SET_TIME 0x11 /* set time */
|
||||
|
||||
|
||||
typedef struct rt_device* rt_device_t;
|
||||
/*
|
||||
* Device related structure
|
||||
|
||||
@@ -55,24 +55,29 @@ rt_hw_interrupt_enable PROC
|
||||
; * r0 --> from
|
||||
; * r1 --> to
|
||||
; */
|
||||
rt_hw_context_switch_interrupt
|
||||
EXPORT rt_hw_context_switch_interrupt
|
||||
rt_hw_context_switch PROC
|
||||
EXPORT rt_hw_context_switch
|
||||
|
||||
; set rt_thread_switch_interrput_flag to 1
|
||||
LDR r2, =rt_thread_switch_interrput_flag
|
||||
LDR r3, [r2]
|
||||
CMP r3, #1
|
||||
BEQ _reswitch
|
||||
MOV r3, #1
|
||||
STR r3, [r2]
|
||||
|
||||
LDR r2, =rt_interrupt_from_thread ; set rt_interrupt_from_thread
|
||||
STR r0, [r2]
|
||||
|
||||
_reswitch
|
||||
LDR r2, =rt_interrupt_to_thread ; set rt_interrupt_to_thread
|
||||
STR r1, [r2]
|
||||
|
||||
LDR r0, =NVIC_INT_CTRL ; trigger the PendSV exception (causes context switch)
|
||||
LDR r0, =NVIC_INT_CTRL ; trigger the PendSV exception (causes context switch)
|
||||
LDR r1, =NVIC_PENDSVSET
|
||||
STR r1, [r0]
|
||||
; CPSIE I ; enable interrupts at processor level
|
||||
BX LR
|
||||
ENDP
|
||||
|
||||
@@ -143,55 +148,11 @@ rt_hw_context_switch_to PROC
|
||||
; never reach here!
|
||||
ENDP
|
||||
|
||||
;/*
|
||||
; * void rt_hw_context_switch_interrupt(rt_uint32 from, rt_uint32 to)
|
||||
; * {
|
||||
; * if (rt_thread_switch_interrput_flag == 1)
|
||||
; * {
|
||||
; * rt_interrupt_to_thread = to;
|
||||
; * }
|
||||
; * else
|
||||
; * {
|
||||
; * rt_thread_switch_interrput_flag = 1;
|
||||
; * rt_interrupt_from_thread = from;
|
||||
; * rt_interrupt_to_thread = to;
|
||||
; * }
|
||||
; * }
|
||||
; */
|
||||
rt_hw_context_switch_interrupt PROC
|
||||
EXPORT rt_hw_context_switch_interrupt
|
||||
LDR r2, =rt_thread_switch_interrput_flag
|
||||
LDR r3, [r2]
|
||||
CMP r3, #1
|
||||
BEQ _reswitch
|
||||
MOV r3, #1 ; set rt_thread_switch_interrput_flag to 1
|
||||
STR r3, [r2]
|
||||
LDR r2, =rt_interrupt_from_thread ; set rt_interrupt_from_thread
|
||||
STR r0, [r2]
|
||||
_reswitch
|
||||
LDR r2, =rt_interrupt_to_thread ; set rt_interrupt_to_thread
|
||||
STR r1, [r2]
|
||||
BX lr
|
||||
ENDP
|
||||
|
||||
rt_hw_interrupt_thread_switch PROC
|
||||
; compatible with old version
|
||||
rt_hw_interrupt_thread_switch PROC
|
||||
EXPORT rt_hw_interrupt_thread_switch
|
||||
LDR r0, =rt_thread_switch_interrput_flag
|
||||
LDR r1, [r0]
|
||||
CBZ r1, _no_switch
|
||||
|
||||
; clear rt_thread_switch_interrput_flag to 0
|
||||
; MOV r1, #0x00
|
||||
; STR r1, [r0]
|
||||
|
||||
; trigger context switch
|
||||
LDR r0, =NVIC_INT_CTRL ; trigger the PendSV exception (causes context switch)
|
||||
LDR r1, =NVIC_PENDSVSET
|
||||
STR r1, [r0]
|
||||
|
||||
_no_switch
|
||||
BX lr
|
||||
|
||||
NOP
|
||||
ENDP
|
||||
|
||||
END
|
||||
END
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#define MAX_HANDLERS 32
|
||||
|
||||
extern rt_uint32_t rt_interrupt_nest;
|
||||
|
||||
/* exception and interrupt handler table */
|
||||
rt_uint32_t rt_interrupt_from_thread, rt_interrupt_to_thread;
|
||||
rt_uint32_t rt_thread_switch_interrput_flag;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1340,6 +1340,7 @@ rt_err_t rt_mb_recv (rt_mailbox_t mb, rt_uint32_t* value, rt_int32_t timeout)
|
||||
/* parameter check */
|
||||
RT_ASSERT(mb != RT_NULL);
|
||||
|
||||
tick_delta = 0;
|
||||
#ifdef RT_USING_HOOK
|
||||
if (rt_object_trytake_hook != RT_NULL) rt_object_trytake_hook(&(mb->parent.parent));
|
||||
#endif
|
||||
@@ -1788,6 +1789,7 @@ rt_err_t rt_mq_recv (rt_mq_t mq, void* buffer, rt_size_t size, rt_int32_t timeou
|
||||
if (rt_object_trytake_hook != RT_NULL) rt_object_trytake_hook(&(mq->parent.parent));
|
||||
#endif
|
||||
|
||||
tick_delta = 0;
|
||||
/* disable interrupt */
|
||||
temp = rt_hw_interrupt_disable();
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ void rt_system_object_init(void)
|
||||
rt_object_container[RT_Object_Class_Thread].object_size = sizeof(struct rt_thread);
|
||||
rt_object_container[RT_Object_Class_Thread].type = RT_Object_Class_Thread;
|
||||
|
||||
#ifdef RT_USING_MODULE
|
||||
#ifdef RT_USING_MODULE
|
||||
/* init object container - module */
|
||||
rt_list_init(&(rt_object_container[RT_Object_Class_Module].object_list));
|
||||
rt_object_container[RT_Object_Class_Module].object_size = sizeof(struct rt_module);
|
||||
|
||||
834
src/scheduler.c
834
src/scheduler.c
File diff suppressed because it is too large
Load Diff
12
src/thread.c
12
src/thread.c
@@ -60,7 +60,7 @@ static rt_err_t _rt_thread_init(struct rt_thread* thread,
|
||||
(void *) ((char *)thread->stack_addr + thread->stack_size - 4),
|
||||
(void*)rt_thread_exit);
|
||||
|
||||
/* priority init */
|
||||
/* priority init */
|
||||
RT_ASSERT(priority < RT_THREAD_PRIORITY_MAX);
|
||||
thread->init_priority = priority;
|
||||
thread->current_priority = priority;
|
||||
@@ -74,13 +74,13 @@ static rt_err_t _rt_thread_init(struct rt_thread* thread,
|
||||
thread->stat = RT_THREAD_INIT;
|
||||
thread->flags = 0;
|
||||
|
||||
#ifdef RT_USING_MODULE
|
||||
/* init module parent */
|
||||
thread->module_parent = RT_NULL;
|
||||
#ifdef RT_USING_MODULE
|
||||
/* init module parent */
|
||||
thread->module_parent = RT_NULL;
|
||||
#endif
|
||||
|
||||
/* init user data */
|
||||
thread->user_data = 0;
|
||||
/* init user data */
|
||||
thread->user_data = 0;
|
||||
|
||||
/* init thread timer */
|
||||
rt_timer_init(&(thread->thread_timer),
|
||||
|
||||
Reference in New Issue
Block a user