[ECOS] eCos VME Bus Device Driver.
Fri Mar 5 08:29:00 GMT 2004
Jason Thomas said:
> I'm trying to write a Universe Bridge VME Bus Device Driver for eCos. I
> used "cyg_pci_find_device((CYG_PCI_VENDOR_ID_TUNDRA,
> PCI_DEVICE_ID_TUNDRA_CA91C042, &devid);" to begin with, it it always
> returned false. So, instead I used cyg_pci_find_device in a loop, and
> compared the device registers to these two in order to find the device.
> After finding the device I can read and write to the configuration
> registers, but now I want to map the configuration space hardware
> address from a register variable on the Universe chip to a virtual
> memory space.
> //Tell the chip I want to read CONFIG_REG_SPACE address.
> cyg_pci_write_config_uint32(uni_pci_dev, PCI_BS, CONFIG_REG_SPACE);
> //Read it.
> cyg_pci_read_config_uint32(uni_pci_dev, PCI_BS, &ba);
> //Map it to a virtual memory address space.
> baseaddr = (char *)ioremap(ba,4096);
> Except, ioremap doesn't exist... From reading the documentation on device
> drivers it seems like "cyg_pci_allocate_io" probably is the equivolent
> call. I'm not exactly clear on how to use this.
There's no "ioremap" because eCos isn't a mapped system.
> Does the "cyg_pci_configure_device" call do this memory mapping
> automagicaly for you? The cyg_pci_dev structure seems to have an array of
> the base addresses inside of it. Are these already the virtual memory
> mapped base addresses for the PCI device??
Yes - once the device has been configured, you can use those addresses
to access the various portions of your devices.
> It would be nice to look at other eCos driver example implementations, I
> just can't find where they're located in the build tree. All I can find
> are the binaries for these drivers under the <target>_build directory
A few examples:
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
More information about the Ecos-discuss