From: Dave H. <dhy...@gm...> - 2007-10-11 18:07:31
|
Hi Stephan, > I'm using outb() and in(b) for communication with the hardware. This works > fine on my x86 development system. But when I load the module on my gumstix, > the try to write to the I/O adress results in a segmentation fault. The x86 uses a separate memory space called I/O space to talk to peripherals like serial ports. So I/O address 0x3f8 and memory address 0x3f8 are completely different. The processor used on the gumstix has no I/O space. All of the peripherals are mapped in memory addresses (a technique called memory mapped I/O). So you can still talk directly to the hardware, but the addresses are totally different. For compatability, there are inb and outb macros available in the kernel, and they take the address as a memory address. For example, when my connex boots, it prints the following to the console: pxa2xx-uart.0: ttyS0 at MMIO 0x40100000 (irq = 15) is a FFUART pxa2xx-uart.1: ttyS1 at MMIO 0x40200000 (irq = 14) is a BTUART pxa2xx-uart.2: ttyS2 at MMIO 0x40700000 (irq = 13) is a STUART pxa2xx-uart.3: ttyS3 at MMIO 0x41600000 (irq = 0) is a HWUART This tells is the MMIO (memory mapped IO) address for each serial port. You'll find that the register layout for the PXA serial ports is similar to those used on the PC, except that the registers are all 4 bytes apart in memory space, where IIRC on the PC they're only 1 or two apart. So for example, on the x86, the IER register can be found at 0x3F8 + 1 = 0x3F9, on the gumstix it would be at 0x40100000 + 1 * 4 = 0x40100004 > I googled a bit and found out, that the Gumstix are using something called > GPIO. The principle is clear - a bunch of processor pins which can be > configured for input or output and so on. The gumstix doesn't actually use GPIO for the serial ports. The physical pins on the processor pins are multiplexed and can be connected to a variety of sources. One of the sources is almost always a GPIO source, but there are also UART sources as well. > But how can I directly access the hardware? Are the GPIOs mapped to a kind > of I/O address? Do the macros inb() and outb() work on ARM architecture at > all? Are the alternative macros for use with GPIO? For the PXA255, you can find all of the registers documented in the PXA255 Developer's Manual, which can be found here: <http://pubs.gumstix.com/documents/PXA%20Documentation/PXA255/> If you go up one directory, you'll find the PXA270 manuals as well. -- Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/ |