-
大小: 4.79MB文件類型: .rar金幣: 2下載: 0 次發(fā)布日期: 2023-10-04
- 語言: 其他
- 標簽:
資源簡介
在stm32f10x板子上實現(xiàn)多線程,A,B線程相互調(diào)用,來測試線程的切換是否成功。

代碼片段和文件信息
/**
?*?@ingroup?BasicDef
?*
?*?@def?RT_ALIGN_DOWN(size?align)
?*?Return?the?down?number?of?aligned?at?specified?width.?RT_ALIGN_DOWN(13?4)
?*?would?return?12.
?*/
#define?RT_ALIGN_DOWN(size?align)??????((size)?&?~((align)?-?1))
unsigned?long?rt_interrupt_from_thread?rt_interrupt_to_thread?rt_thread_switch_interrupt_flag;
struct?exception_stack_frame
{
????unsigned?long?r0;
????unsigned?long?r1;
????unsigned?long?r2;
????unsigned?long?r3;
????unsigned?long?r12;
????unsigned?long?lr;???//14
????unsigned?long?pc;???//15
????unsigned?long?psr;??//13
};
struct?stack_frame
{
????/*?r4?~?r11?register?*/
????unsigned?long?r4;
????unsigned?long?r5;
????unsigned?long?r6;
????unsigned?long?r7;
????unsigned?long?r8;
????unsigned?long?r9;
????unsigned?long?r10;
????unsigned?long?r11;
????struct?exception_stack_frame?exception_stack_frame;
};
unsigned?char?*rt_hw_stack_init(void???????*tentry
?????????????????????????????void???????*parameter
?????????????????????????????unsigned?char?*stack_addr
?????????????????????????????void???????*texit)
{
????struct?stack_frame?*stack_frame;
????unsigned?char?????????*stk;
????unsigned?long???????i;
????stk??=?stack_addr?+?sizeof(unsigned?long);
????stk??=?(unsigned?char?*)RT_ALIGN_DOWN((unsigned?long)stk?8);
????stk?-=?sizeof(struct?stack_frame);
????stack_frame?=?(struct?stack_frame?*)stk;
????/*?init?all?register?*/
????for?(i?=?0;?i?ame)?/?sizeof(unsigned?long);?i?++)
????{
????????((unsigned?long?*)stack_frame)[i]?=?0xdeadbeef;
????}
????stack_frame->exception_stack_frame.r0??=?(unsigned?long)parameter;?/*?r0?:?argument?*/
????stack_frame->exception_stack_frame.r1??=?0;????????????????????????/*?r1?*/
????stack_frame->exception_stack_frame.r2??=?0;????????????????????????/*?r2?*/
????stack_frame->exception_stack_frame.r3??=?0;????????????????????????/*?r3?*/
????stack_frame->exception_stack_frame.r12?=?0;????????????????????????/*?r12?*/
????stack_frame->exception_stack_frame.lr??=?(unsigned?long)texit;?????/*?lr?*/
????stack_frame->exception_stack_frame.pc??=?(unsigned?long)tentry;????/*?entry?point?pc?*/
????stack_frame->exception_stack_frame.psr?=?0x01000000L;??????????????/*?PSR?*/
????/*?return?task‘s?current?stack?address?*/
????return?stk;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????14??2019-05-10?11:25??RTT-Mini\.git\COMMIT_EDITMSG
?????文件????????157??2019-05-06?14:14??RTT-Mini\.git\config
?????文件?????????73??2019-05-06?14:14??RTT-Mini\.git\desc
?????文件?????????31??2019-05-10?11:22??RTT-Mini\.git\HEAD
?????文件????????478??2019-05-06?14:14??RTT-Mini\.git\hooks\applypatch-msg.sample
?????文件????????896??2019-05-06?14:14??RTT-Mini\.git\hooks\commit-msg.sample
?????文件????????189??2019-05-06?14:14??RTT-Mini\.git\hooks\post-update.sample
?????文件????????424??2019-05-06?14:14??RTT-Mini\.git\hooks\pre-applypatch.sample
?????文件???????1642??2019-05-06?14:14??RTT-Mini\.git\hooks\pre-commit.sample
?????文件???????1348??2019-05-06?14:14??RTT-Mini\.git\hooks\pre-push.sample
?????文件???????4951??2019-05-06?14:14??RTT-Mini\.git\hooks\pre-reba
?????文件???????1239??2019-05-06?14:14??RTT-Mini\.git\hooks\prepare-commit-msg.sample
?????文件???????3611??2019-05-06?14:14??RTT-Mini\.git\hooks\update.sample
?????文件??????15252??2019-05-10?11:25??RTT-Mini\.git\index
?????文件????????240??2019-05-06?14:14??RTT-Mini\.git\info\exclude
?????文件???????1004??2019-05-10?11:25??RTT-Mini\.git\logs\HEAD
?????文件????????498??2019-05-10?11:25??RTT-Mini\.git\logs\refs\heads\context_switch
?????文件????????487??2019-05-10?11:21??RTT-Mini\.git\logs\refs\heads\master
?????文件???????3443??2019-05-06?14:16??RTT-Mini\.git\ob
?????文件????????152??2019-05-10?11:21??RTT-Mini\.git\ob
?????文件????????152??2019-05-10?11:20??RTT-Mini\.git\ob
?????文件???????2841??2019-05-06?14:16??RTT-Mini\.git\ob
?????文件?????????45??2019-05-06?14:18??RTT-Mini\.git\ob
?????文件???????3097??2019-05-06?14:16??RTT-Mini\.git\ob
?????文件???????3318??2019-05-06?14:16??RTT-Mini\.git\ob
?????文件????????254??2019-05-06?14:18??RTT-Mini\.git\ob
?????文件???????5474??2019-05-06?14:16??RTT-Mini\.git\ob
?????文件???????3386??2019-05-06?14:16??RTT-Mini\.git\ob
?????文件????????923??2019-05-06?14:17??RTT-Mini\.git\ob
?????文件?????????17??2019-05-06?14:16??RTT-Mini\.git\ob
............此處省略514個文件信息
- 上一篇:北大陣列天線講稿
- 下一篇:學校內(nèi)部工資管理系統(tǒng).rar
評論
共有 條評論