Re: Base Address's, etc...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dan Erickson wrote:

>	Howdy,
>
>	I am a bit confused on this subject. Lets say a base address for 
>some odd device is 0x240. Ok.. that is cool, but then suddenly you need to 
>write to a control register at base address +3.
> So... lets say 
>
>static short io = 0x240;
>
>and then I need to write to the control register, which is at 
>base address + 3;
>
>	and in some code, they define some macro, like
>
>#define FOO_BAR (io+3)
>
>so... when they say +3, does it mean that 0x240 becomes 0x243?
>
>Thanks for the help
>
>-Dan Erickson-
>-ColdOneKnight@rogers.com-
>
That is correct Dan.  Most times I do something like this:

#define CTRLREG 3
#define ANOTHERREG 5

and then do

writeb(value, io + CTRLREG);
writeb(anothervalue, io + ANOTHERREG);

HTH

-- 
Best regards,
David Stroupe
Keyed-Up Software


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux