diff options
Diffstat (limited to 'hw/ppc/mac.h')
-rw-r--r-- | hw/ppc/mac.h | 68 |
1 files changed, 66 insertions, 2 deletions
diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index 3e390d3..26cb497 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -44,7 +44,72 @@ #define ESCC_CLOCK 3686400 /* Cuda */ -void cuda_init (MemoryRegion **cuda_mem, qemu_irq irq); +#define TYPE_CUDA "cuda" +#define CUDA(obj) OBJECT_CHECK(CUDAState, (obj), TYPE_CUDA) + +/** + * CUDATimer: + * @counter_value: counter value at load time + */ +typedef struct CUDATimer { + int index; + uint16_t latch; + uint16_t counter_value; + int64_t load_time; + int64_t next_irq_time; + QEMUTimer *timer; +} CUDATimer; + +/** + * CUDAState: + * @b: B-side data + * @a: A-side data + * @dirb: B-side direction (1=output) + * @dira: A-side direction (1=output) + * @sr: Shift register + * @acr: Auxiliary control register + * @pcr: Peripheral control register + * @ifr: Interrupt flag register + * @ier: Interrupt enable register + * @anh: A-side data, no handshake + * @last_b: last value of B register + * @last_acr: last value of ACR register + */ +typedef struct CUDAState { + /*< private >*/ + SysBusDevice parent_obj; + /*< public >*/ + + MemoryRegion mem; + /* cuda registers */ + uint8_t b; + uint8_t a; + uint8_t dirb; + uint8_t dira; + uint8_t sr; + uint8_t acr; + uint8_t pcr; + uint8_t ifr; + uint8_t ier; + uint8_t anh; + + CUDATimer timers[2]; + + uint32_t tick_offset; + + uint8_t last_b; + uint8_t last_acr; + + int data_in_size; + int data_in_index; + int data_out_index; + + qemu_irq irq; + uint8_t autopoll; + uint8_t data_in[128]; + uint8_t data_out[16]; + QEMUTimer *adb_poll_timer; +} CUDAState; /* MacIO */ #define TYPE_OLDWORLD_MACIO "macio-oldworld" @@ -71,7 +136,6 @@ void macio_ide_register_dma(MACIOIDEState *ide, void *dbdma, int channel); void macio_init(PCIDevice *dev, MemoryRegion *pic_mem, - MemoryRegion *cuda_mem, MemoryRegion *escc_mem); /* Heathrow PIC */ |