macros for get and set the SR register

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

macros for get and set the SR register

Jump to solution
1,336 Views
c393
Contributor II
Is there a standard macro for get and set of the SR register?
Labels (1)
0 Kudos
Reply
1 Solution
367 Views
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
    }
}

View solution in original post

0 Kudos
Reply
1 Reply
368 Views
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 Kudos
Reply