NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Accessing a hardware device



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

On Mar 4, 2008, at 14:51, David Dudley wrote:

How do I:

1.) Find the device (I know the PCI Vendor ID, and the board id)?

man 4 pci
You can mess with PCI devices via /dev/pci*, scan the bus(es), read BARs etc.

2.) Map the device into my memory space?

That's more difficult without a driver - in i386 you can just mmap(/ dev/mem, bussaddress) but you need options INSECURE in your kernel for that to work. On other machines bus- and memory-addresses may be different.

3.) I assume I have to release the device before exiting my program.
How do I do that?

Not sure what you mean by that - I'd assume you map the registers exclusively, in that case you'd have to unmap them but that would happen anyway when your program exits.

have fun
Michael

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iQEVAwUBR83HbspnzkX8Yg2nAQLN6gf/el8srEBO3Ri1z0owfEEBWL6MDl9UMOPY
coT3LcUjkY6hjeFiV5VFkfHQ/VLg8l3VlR8fcT9itIL9DcCxLnZ7JMc9Kn/2LDBR
YEv/71UA2o3Wa4A1AD+EJB08Pu8CiF18fh/3vsLpvZR04gidLJrmpVPzy2/868q3
Rh/pCgABrg/7eoXWBNYg4biARbxUIV1uwRUhrkz0hf8KrWifv5ujm0SPTH0iX52Y
Nw0oQnrMNvz9rjBRM/y+NZExqk0s8ZMq0eFHKPIhfao1Ncxhf6J7s6L+ne6Z/vQ9
uVkTfnBwK4NDUqCXTiTShIrFAGg83BfCGJNgWXNeZs/TpbHFqSPrcA==
=43ez
-----END PGP SIGNATURE-----


Home | Main Index | Thread Index | Old Index