[ILUG] compile error
hmoreau at digiserve.ie
Thu Jul 5 15:57:54 IST 2001
On 5 Jul, Oliver Ryan wrote:
> I've a PCI card and am told that certain onboard registers are memory
> mapped out into the PCI memory at a particular offset from the
> PCI_BASE_ADDRESS_2 of the onboard device (the address in this case is
> 0xfc020000). To read/write to these 32bit registers then I use the snippet
> below. I compile with gcc altregread.c -D __KERNEL__ -o altregread.o but
> then get lines and lines of parse errors in header files (see below). The
> KERNEL bit is for the io.h header file.
> Ideas? Thanks in advance.
> #include<asm/io.h> //contains readl/writel, etc.
> int main(void)
> int status, *base = ioremap(0xfc020000, 1024*1024);
> status = readl(base + 0x40);
> printf("%x", status);
Are you writing a kernel module? Device driver? Or actually doing kernel hacking?
If you are then there's a ton of stuff you have to #include that you're not.
Have a look on google or similar for docs on kernel hacking, module and device driver writing.
You can't just write user programs that use kernel functions or read/write memory addresses
This ain't DOS, CP/M or MacOS.
More information about the ILUG