This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: variant rm7000 interrupt masking


There are a  couple more difficulties with the MASK/UNMASK MACROS.
These ones work better.



#define HAL_INTERRUPT_MASK( _vector_
)                                      \
   
CYG_MACRO_START                                                        
\
    if( (_vector_) <= CYGNUM_HAL_MAX_STATUS_VEC
)                           \
   
{                                                                      
\
        asm volatile
(                                                      \
            "mfc0  
$3,$12\n"                                               \
            "la    
$2,0x00000400\n"                                        \
            "sllv  
$2,$2,%0\n"                                             \
            "nor   
$2,$2,$0\n"                                             \
            "and   
$3,$3,$2\n"                                             \
            "mtc0  
$3,$12\n"                                               \
            "nop; nop;
nop\n"                                               \
           
:                                                               \
            :
"r"(_vector_)                                                 \
            : "$2",
"$3"                                                    \
           
);                                                              \
   
}                                                                      
\
   
else                                                                   
\
   
{                                                                      
\
        /* int 6:9 are masked in the Interrupt Control register
*/          \
        asm volatile
(                                                      \
            "cfc0  
$3,$20\n"                                               \
            "la    
$2,0x00000004\n"                                        \
            "sllv  
$2,$2,%0\n"                                             \
            "nor   
$2,$2,$0\n"                                             \
            "and   
$3,$3,$2\n"                                             \
            "ctc0  
$3,$20\n"                                               \
            "nop; nop;
nop\n"                                               \
           
:                                                               \
            : "r"((_vector_) )				                    \
            : "$2",
"$3"                                                    \
           
);                                                              \
   
}                                                                      
\
    CYG_MACRO_END

#define HAL_INTERRUPT_UNMASK( _vector_
)                                    \
   
CYG_MACRO_START                                                        
\
    if( (_vector_) <= CYGNUM_HAL_MAX_STATUS_VEC
)                           \
   
{                                                                      
\
        asm volatile
(                                                      \
            "mfc0  
$3,$12\n"                                               \
            "la    
$2,0x00000400\n"                                        \
            "sllv  
$2,$2,%0\n"                                             \
            "or    
$3,$3,$2\n"                                             \
            "mtc0  
$3,$12\n"                                               \
            "nop; nop;
nop\n"                                               \
           
:                                                               \
            :
"r"(_vector_)                                                 \
            : "$2",
"$3"                                                    \
           
);                                                              \
   
}                                                                      
\
    else								    \
   
{                                                                      
\
        /* int 6:9 are masked in the Interrupt Control register
*/          \
        asm volatile
(                                                      \
            "cfc0  
$3,$20\n"                                               \
            "la    
$2,0x00000004\n"                                        \
            "sllv  
$2,$2,%0\n"                                             \
            "or    
$3,$3,$2\n"                                             \
            "ctc0  
$3,$20\n"                                               \
            "nop; nop;
nop\n"                                               \
           
:                                                               \
            : "r"((_vector_)
)                                              \
            : "$2",
"$3"                                                    \
           
);                                                              \
   
}                                                                      
\
    CYG_MACRO_END

-- 
Chris Morrow	YottaYotta Inc. email: cmorrow@yottayotta.com
phone: (780) 989 6814 web:	http:  //www.yottayotta.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]