Skip to main content.
Navigation:
DENX
>
Training2
>
LddAccessingDevices
Translations:
Edit
|
Attach
|
Raw
|
Ref-By
|
Printable
|
More
Training2
Sections of this site:
DENX Home
|
DULG
|
ELDK-5
|
Know
|
Training
|
U-Boot
|
U-Bootdoc
Topics
Training2 Home
Changes
Index
Search
Go
List of pages in Training2
Search
%SECTION0{name=LddAcessingDevices}% Accessing devices * we must take care not to conflict with other drivers * Linux kernel only sees virtual addresses -> we cannot simply access physical memory. * we must take that compiler optimization / cpu reordering doesn't bite us, but forget about =volatile=! (Documentation/volatile-considered-harmfull) * especially powerpc people: beware of big endian registers! ---++API: *avoid conflicts with other drivers:* <verbatim> struct resource *request_mem_region(unsigned long start, unsigned long len, char *name); void release_mem_region(unsigned long start, unsigned long len); </verbatim> this shows up in =/proc/iomem=: <verbatim> -bash-3.2# cat /proc/iomem 90000000-97ffffff : /plb/pciex@0a0000000 98000000-9fffffff : /plb/pciex@0c0000000 ef600200-ef600207 : serial ef600300-ef600307 : serial ef600400-ef600411 : ibm_iic ef600500-ef600511 : ibm_iic ef6c0000-ef6cffff : dwc_otg.0 ef6c0000-ef6cffff : dwc_otg f8000000-f8001fff : ndfc-nand.0 fc000000-ffffffff : fc000000.nor_flash </verbatim> *exclusive variants* * protect against =/dev/mem= <verbatim> request_mem_region_exclusive(start, n, name); </verbatim> * control with =iomem=relaxed= *map physical address into kernel address space:* <verbatim> void *ioremap(unsigned long phys_addr, unsigned long size); void iounmap(void *addr); </verbatim> *avoid compiler optimization problems:* <verbatim> void barrier(); </verbatim> *avoid compiler _and_ hardware reordering problems:* <verbatim> mb(void) rmb(void) wmb(void) </verbatim> *be portable _and_ avoid above problems:* <verbatim> void io(write|read)(8|16|32)[be] functions </verbatim> =be= versions for big endian registers!
5.6. Interfacing real hardware
1. Denx Training Topics
5.6.2. Interrupt Handling
Prev
Home
Next