[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ltib] How to add LPC32x0 EMC static memory device to Linux (MMU/Vi
From: |
Stuart Hughes |
Subject: |
Re: [Ltib] How to add LPC32x0 EMC static memory device to Linux (MMU/VirtualMemory/etc) |
Date: |
Thu, 03 Jun 2010 09:05:09 +0100 |
User-agent: |
Thunderbird 2.0.0.16 (X11/20080707) |
Hi Ayewin,
This is way off topic, but from what I recall, and this was a while ago
so you need to check if this is still relevant:
First it depends on the architecture etc and how the h/w is mapped into
the address space. If it's x86 style i/o ports, then you can use
inw/outw e.g: outw(register_value, IOPORT_ADDRESS). Ask the hardware
guys (or consult the manual for the device).
If on the other hand the hardware is mapped into some non-cacheable
memory location, then you can use mmap (without checks):
// open memory driver and get a file descriptor
mem_fd = open("/dev/mem", O_RDWR);
// map into our address space at the address chosen by kernel
mem_ptr = mmap(0, size_to_map, PROT_READ | PROT_WRITE,
MAP_SHARED, mem_fd, hardware_base_address );
struct hw_layout *hw_ptr = (struct hw_layout *)mem_ptr;
hw_ptr->control_reg_a = 0;
Alternatively (and depending on hardware, necessarily) you may need to
write an actual kernel driver for this and access via the usual
open/close/read/write/ioctl interfaces.
man mmmap, man outw and google are probably the best place to start, or
some other more hardware orientated list.
Regards, Stuart
Ayewin Oung wrote:
> Hi list
>
> I'm porting embedded linux to our LPC32x0 board, which hangs of FPGA via
> EMC static memory chip select. Which is used to access simple register
> rd/wr to FPGA.
>
> How do I go about mapping memory EMC static memory Chip Select(s) and
> letting kernel know the address in MMU so that it doesn't bomb out when
> I try to read write to the FPGA.
>
> I'm new to this, so pointers against existing code, device drivers would
> be very helpful.
>
> Thanks in advance.
>
> A
>