LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] asm/io.h + readl/writel

[ILUG] asm/io.h + readl/writel

jac1 jac1 at student.cs.ucc.ie
Fri Jul 6 12:52:00 IST 2001


Maybe you have to compile with optimisations turned on as they may not be 
functions as such, but macros. It's the same with inb/outb.
If you are calling from user space i think you have to have a higher CPU 
privilege level. Call the iopl() function. This has to be done as root or it 
will fail.

>===== Original Message From Paul Jakma <paulj at alphyra.ie> =====
>i may be wrong, but:
>
>- you can not call kernel functions from userspace
>- you can not call libc functions from the kernel
>
>the below is just not going to work.
>
>there are syscalls to access IO ports, outb/inb/etc...
>
>iirc, memory mapped IO is only possible from userspace by mmap()'ing
>appropriate part of /dev/mem. (and iirc this is how X does it).
>dangerous if you get it wrong though.
>
>otherwise you could write a small kernel driver to present that memory
>as a device and allow applications to mmap() it. best to ask on
>linux-kernel about this.
>
>regards,
>
>--paulj
>
>On Wed, 4 Jul 2001, Oliver Ryan wrote:
>
>> Hi,
>>
>> first time user of this group.  Thanks in advance.  Hope my
>> etiquette/procedure is correct.
>>
>>  This is a small program I'm trying to use to read a 32 bit word at an
>> offset of 0x20 from an address in PCI memory (0xfc020000). The number I
>> want to read was memory mapped to here from a PCI device (the address is
>> from PCI_BASE_ADDRESS_2). However it won't compile, giving the error
>> "undefined reference to 'readl' ", even though I've included the asm/io.h
>> header file.
>>
>> #include<stdio.h>
>> #include<stdlib.h>
>> #include<asm/io.h>
>>
>> int main(void)
>> {
>> int *base, status;
>>
>> base = (int*)0xfc020000;
>> status=readl(*(base) + 0x20);
>>
>> printf(" %x", status);
>>
>> return(0);
>>
>> }
>>
>>
>> Rgds.  Oliver.
>>
>> Dept. of Physics,
>> National University of Ireland, Galway,
>> Galway,
>> Ireland.
>>
>> Tel: +353 (0)91 524411 ext. 2716
>> Fax: +353 (0)91 750584
>>
>>
>
>
>--
>Irish Linux Users' Group: ilug at linux.ie
>http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
>List maintainer: listmaster at linux.ie





More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell