misc.c

来自「一个航天航空用的Sparc处理器(配美国欧洲宇航局用的R_tems嵌入式操作系统」· C语言 代码 · 共 25 行

C
25
字号
#include "leon.h"
struct lregs *lr = (struct lregs *) PREGS;
unsigned char *msg = (unsigned char *) IOAREA; 
unsigned short *msgh = (unsigned short *) IOAREA; 
unsigned int *msgw = (unsigned int *) IOAREA; 
unsigned long long *msgd = (unsigned long long *) IOAREA; 
int test ;
int dummy[4] = {0,0,0,0};

fail(err) int err; { msg[test] = err; }
report(test_case) int test_case; { test = test_case; msg[test] = 0; }

int getpsr() { asm(" mov %psr, %o0 "); }

setpsr(psr) int psr; { asm(" mov %o0, %psr;nop;nop;nop "); }

unsigned char inb(a) int a; { return(msg[a]); }
outb(a,d) int a; char d; { msg[a] = d; }
unsigned short inh(a) int a; { return(msgh[a]); }
outh(a,d) int a; short d; { msgh[a] = d; }
unsigned int inw(a) int a; { return(msgw[a]); }
outw(a,d) int a; short d; { msgw[a] = d; }
unsigned long long ind(a) int a; { return(msgd[a]); }
outd(a,d) int a; short d; { msgd[a] = d; }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?