etc:users:jcmvbkbc:little-things:3
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| etc:users:jcmvbkbc:little-things:3 [2009/12/24 12:53] – plan jcmvbkbc | etc:users:jcmvbkbc:little-things:3 [2016/08/08 20:53] (current) – ↷ Page moved from users:jcmvbkbc:little-things:3 to etc:users:jcmvbkbc:little-things:3 kel | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| * Find some suitable reference PCI device in hw/ | * Find some suitable reference PCI device in hw/ | ||
| * See details of bus interface. See used idioms | * See details of bus interface. See used idioms | ||
| - | * Design ADC command system | + | * <del>Design ADC command system</ |
| * Implement ADC and plug it into reference platform, e.g. PC | * Implement ADC and plug it into reference platform, e.g. PC | ||
| ===== Worklog ===== | ===== Worklog ===== | ||
| + | * Make the following dummy device (qemu-0.12.1): | ||
| + | < | ||
| + | diff --git a/ | ||
| + | new file mode 100644 | ||
| + | index 0000000..c251dbe | ||
| + | --- /dev/null | ||
| + | +++ b/ | ||
| + | @@ -0,0 +1,48 @@ | ||
| + | + | ||
| + | +#include " | ||
| + | + | ||
| + | +#define PCI_CLASS_DA_DSP (0x1100) | ||
| + | +#define PCI_VENDOR_ID_II (0x8089) | ||
| + | +#define PCI_VENDOR_ID_II_GP1 (0x0001) | ||
| + | + | ||
| + | +typedef struct IIGP1State | ||
| + | +{ | ||
| + | + PCIDevice dev; | ||
| + | +} IIGP1State; | ||
| + | + | ||
| + | +static void iigp1_on_reset (void *opaque) | ||
| + | +{ | ||
| + | +} | ||
| + | + | ||
| + | +static inline void pci_config_set_byte (void *config, int offset, uint8_t byte) | ||
| + | +{ | ||
| + | + ((uint8_t*)config)[offset] = byte; | ||
| + | +} | ||
| + | + | ||
| + | +static int iigp1_initfn (PCIDevice *dev) | ||
| + | +{ | ||
| + | + pci_config_set_vendor_id (dev-> | ||
| + | + pci_config_set_device_id (dev-> | ||
| + | + pci_config_set_class (dev-> | ||
| + | + pci_config_set_byte (dev-> | ||
| + | + pci_config_set_byte (dev-> | ||
| + | + pci_config_set_byte (dev-> | ||
| + | + | ||
| + | + qemu_register_reset (iigp1_on_reset, | ||
| + | + | ||
| + | + return 0; | ||
| + | +} | ||
| + | + | ||
| + | +static PCIDeviceInfo iigp1_info = { | ||
| + | + .qdev.name | ||
| + | + .qdev.desc | ||
| + | + .qdev.size | ||
| + | + // | ||
| + | + .init = iigp1_initfn, | ||
| + | +}; | ||
| + | + | ||
| + | +static void iigp1_register (void) | ||
| + | +{ | ||
| + | + pci_qdev_register (& | ||
| + | +} | ||
| + | +device_init (iigp1_register); | ||
| + | </ | ||
| + | * add it to PC platform: | ||
| + | < | ||
| + | diff --git a/hw/pc.c b/hw/pc.c | ||
| + | index db7d58e..d47573f 100644 | ||
| + | --- a/hw/pc.c | ||
| + | +++ b/hw/pc.c | ||
| + | @@ -1251,6 +1251,10 @@ static void pc_init1(ram_addr_t ram_size, | ||
| + | } | ||
| + | } | ||
| + | |||
| + | + if (pci_enabled) { | ||
| + | + pci_create_simple(pci_bus, | ||
| + | + } | ||
| + | + | ||
| + | | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | * and add to makefile: | ||
| + | < | ||
| + | diff --git a/ | ||
| + | index 7c1f30c..b2bd1b7 100644 | ||
| + | --- a/ | ||
| + | +++ b/ | ||
| + | @@ -186,6 +186,8 @@ obj-y += pcnet.o | ||
| + | obj-y += rtl8139.o | ||
| + | obj-y += e1000.o | ||
| + | |||
| + | +obj-y += iigp1.o | ||
| + | + | ||
| + | # Hardware support | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | |||
| + | Code: ftp:// | ||
| + | |||
| ===== Conclusion ===== | ===== Conclusion ===== | ||
| + | * Too complex to complete in 2 hours; | ||
| + | * No clear infrastructure for PCI device plugging; | ||
| + | * Make a simple PCI device, modeled after es1370. | ||
| + | |||
| + | {{tag> | ||
etc/users/jcmvbkbc/little-things/3.1261648417.txt.gz · Last modified: 2009/12/24 12:53 by jcmvbkbc