📄 pg_port.c
字号:
///////////////////////////////////////////////////////////////
//
//
// PGOS : A Portable,Configable Embedded System Kernel
//
// Sunplus unSP(TM) Specific code
//
// This is an open source project under GPL lincence
//
// Version 0.9.0 ---- Development Snopshot
//
// File name : pg_port.c : Portable code on unSP(TM) architecture
// History :
//
// 2005-07-24 First build by X.K. @ PGOS Team
// 2005-08-22 Rewrite for unSP(TM) by X.K.
//
/////////////////////////////////////////////////////////////////
#include "pgos.h"
VOID BREAK() __attribute__((ISR)) ;
extern BYTE task_cur_id ;
extern BYTE task_cur_prio ;
extern BYTE task_nxt_id ;
extern BYTE task_nxt_prio ;
pgTASK* task_nxt ;
pgTASK* task_prv ;
extern pgTASKLIST* task_list_head ;
#if PG_TASK_BASIC_SUPPORT == 1
REGSZ* pgos_tk_initstk( REGSZ* stk,VOID ( *task )() )
{
/*------------------------------
The init task stack looks like this :
SR
BP
R4
R3
R2
R1
Entry Point of TASK
-------------------------------*/
/*-------------------------------
GCC compiler uses a pointer to
save the true address of a fun
entry point.so we must get the
true value here.
-------------------------------*/
*stk -- = *( ( WORD* )( task + 1 ) );
*stk -- = 0x0000 ; // For the segment register
*stk -- = 0x0001 ;
*stk -- = 0x0002 ;
*stk -- = 0x0003 ;
*stk -- = 0x0004 ;
*stk -- = ( ( 'B' << 8 ) | 'P' ) ;
return ( REGSZ* ) stk ;
}
#endif // PG_TASK_BASIC_SUPPORT
VOID pgos_sys_runhigh()
{
__asm("
r2 = [_task_nxt]
r1 = [r2]
sp = r1
pop bp,r1 from [sp]
//pop r1,r4 from [sp]
reti
");
}
VOID BREAK()
{
__asm("
r2 = [_task_prv]
[r2] = sp
r1 = [_task_nxt]
r1 = [r1]
sp = r1
pop bp,r1 from [sp]
//pop r1,r4 from [sp]
reti
") ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -