macros for get and set the SR register

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

macros for get and set the SR register

跳至解决方案
1,416 次查看
c393
Contributor II
Is there a standard macro for get and set of the SR register?
标签 (1)
标记 (1)
0 项奖励
回复
1 解答
447 次查看
RichTestardi
Senior Contributor II

I don't know if there is anything standard, but this is what I use (for coldfire V2):

 

uint16
get_sr(void)
{
    uint16 csr;
    asm {
        move.w     sr,d0
        move.w     d0,csr
    }
    return csr;
}

 

void
set_sr(uint16 csr)
{
    asm {
        move.w     csr,d0
        move.w     d0,sr
    }
}

在原帖中查看解决方案

0 项奖励
回复
1 回复
448 次查看
RichTestardi
Senior Contributor II

I don't know if there is anything standard, but this is what I use (for coldfire V2):

 

uint16
get_sr(void)
{
    uint16 csr;
    asm {
        move.w     sr,d0
        move.w     d0,csr
    }
    return csr;
}

 

void
set_sr(uint16 csr)
{
    asm {
        move.w     csr,d0
        move.w     d0,sr
    }
}

0 项奖励
回复