Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/22/03 08:43
Read: times


 
#36936 - RE: volatile keyword
Hi all !
I got a hard with this keyword "volatile" !
I used to meet some codes which others wrote to access into hardware address end then they formed device driver procedures (example as: embbeded programming for some targets) !
Example codes (in Linux programming):
//-------------------

#define __to_asm_token(s) #s

#define MF_DCR(rn) __mfdcr_or_dflt(rn, 0)

#define __mfdcr_or_dflt(rn,default_rval)
(
{ unsigned int rval;
if (rn == 0)
rval = default_rval;
else
asm volatile("mfdcr %0," __to_asm_token(rn) : "=r" (rval));
rval;
}
)

#define MT_DCR(rn, v)
{if (rn != 0)
asm volatile("mtdcr "
__to_asm_token(rn) ",%0" : : "r" (v));}

//-------------------

I see the general functions of that codes but can't understand the mean for detail !
Please explain to me the codes or tell me the methods to use keyword "volatile [....]" and "asm volatile [....]".
Thanks for all !

List of 18 messages in thread
TopicAuthorDate
volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
RE: volatile keyword            01/01/70 00:00      
volatile keyword and not-so-optimizer            01/01/70 00:00      

Back to Subject List