-
C codes problem
Code:
static inline void outw( unsigned long address, unsigned long value )
{
*((volatile unsigned long *const)address)=value;
}
static inline unsigned int inw( unsigned long address )
{
return *((volatile unsigned long *const)address);
}
can somebody explain me the codes above in detail?
-
* means to dereference a pointer, and a type in parentheses means to cast to that type (so "(volatile unsigned long *const)address" means to cast address to the type volatile unsigned long *const. And of course = means assignment.
-
The first function moves the data from variable "value" to the location pointed to by "address".
The second function retrieves the value at "address" and returns it to the caller.
By being designated as "volatile", that means a process outside of this program can update it as well.
(tabstop gave you what you asked for, the detail, and I gave you the high level summary)
-
What did you mean by 'caller'?
-
When the term "caller" is used in software, it refers to the routine that called a function or a program.