1 |
/* GXemul: $Id: dreamcast_sysasicvar.h,v 1.2 2006/10/28 01:37:54 debug Exp $ */ |
2 |
/* $NetBSD: sysasicvar.h,v 1.5 2005/12/24 23:24:00 perry Exp $ */ |
3 |
|
4 |
/* |
5 |
* Extended with useful macros and also some more event definitions |
6 |
* described in KOS comments by Dan Potter (kos/kernel/arch/dreamcast |
7 |
* /hardware/asic.c). |
8 |
*/ |
9 |
|
10 |
#ifndef _DREAMCAST_SYSASICVAR_H_ |
11 |
#define _DREAMCAST_SYSASICVAR_H_ |
12 |
|
13 |
/*- |
14 |
* Copyright (c) 2001 The NetBSD Foundation, Inc. |
15 |
* All rights reserved. |
16 |
* |
17 |
* This code is derived from software contributed to The NetBSD Foundation |
18 |
* by |
19 |
* |
20 |
* Redistribution and use in source and binary forms, with or without |
21 |
* modification, are permitted provided that the following conditions |
22 |
* are met: |
23 |
* 1. Redistributions of source code must retain the above copyright |
24 |
* notice, this list of conditions and the following disclaimer. |
25 |
* 2. Redistributions in binary form must reproduce the above copyright |
26 |
* notice, this list of conditions and the following disclaimer in the |
27 |
* documentation and/or other materials provided with the distribution. |
28 |
* 3. All advertising materials mentioning features or use of this software |
29 |
* must display the following acknowledgement: |
30 |
* This product includes software developed by the NetBSD |
31 |
* Foundation, Inc. and its contributors. |
32 |
* 4. Neither the name of The NetBSD Foundation nor the names of its |
33 |
* contributors may be used to endorse or promote products derived |
34 |
* from this software without specific prior written permission. |
35 |
* |
36 |
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
37 |
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
38 |
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
39 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
40 |
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
41 |
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
42 |
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
43 |
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
44 |
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
45 |
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
46 |
* POSSIBILITY OF SUCH DAMAGE. |
47 |
*/ |
48 |
|
49 |
#define SYSASIC_BASE 0x5f6900 |
50 |
#define SYSASIC_SIZE 0x100 |
51 |
|
52 |
#define SYSASIC_EVENT_RENDERDONE 2 /* Render Completed */ |
53 |
#define SYSASIC_EVENT_PVR_SCANINT1 3 /* Scanline interrupt 1 */ |
54 |
#define SYSASIC_EVENT_PVR_SCANINT2 4 /* Scanline interrupt 2 */ |
55 |
#define SYSASIC_EVENT_VBLINT 5 /* VBlank interrupt */ |
56 |
#define SYSASIC_EVENT_OPAQUEDONE 7 /* Opaque list complete */ |
57 |
#define SYSASIC_EVENT_OPAQUEMODDONE 8 /* Opaque modifiers complete */ |
58 |
#define SYSASIC_EVENT_TRANSDONE 9 /* Transparent list complete */ |
59 |
#define SYSASIC_EVENT_TRANSMODDONE 10 /* Trans. modifiers complete */ |
60 |
#define SYSASIC_EVENT_MAPLE_DMADONE 12 /* Maple DMA complete */ |
61 |
#define SYSASIC_EVENT_MAPLE_ERROR 13 /* Maple error */ |
62 |
#define SYSASIC_EVENT_GDROM_DMA 14 /* GD-ROM DMA Complete */ |
63 |
#define SYSASIC_EVENT_SPU_DMA 15 /* SPU DMA Complete */ |
64 |
#define SYSASIC_EVENT_SPU_IRQ 17 /* SPU Interrupt */ |
65 |
#define SYSASIC_EVENT_PVR_DMA 19 /* PVR DMA Complete */ |
66 |
#define SYSASIC_EVENT_PVR_PTDONE 21 /* Punch-through complete */ |
67 |
#define SYSASIC_EVENT_GDROM 32 /* GD-ROM Command status */ |
68 |
#define SYSASIC_EVENT_AICA 33 /* AICA (?) */ |
69 |
#define SYSASIC_EVENT_8BIT 34 /* Modem/Lan adapter */ |
70 |
#define SYSASIC_EVENT_EXT 35 /* PCI/BBA IRQ */ |
71 |
#define SYSASIC_EVENT_PRIMOUTOFMEM 66 /* Out of primitive mem */ |
72 |
#define SYSASIC_EVENT_MATOUTOFMEM 67 /* Out of matrix mem */ |
73 |
|
74 |
#define SYSASIC_EVENT_TO_ADDR(e) (SYSASIC_BASE + 4*((e)>>5)) |
75 |
#define SYSASIC_EVENT_TO_BITMASK(e) (1 << ((e) & 31)) |
76 |
|
77 |
#define SYSASIC_TRIGGER_EVENT(e) { \ |
78 |
uint8_t buf[8]; \ |
79 |
uint64_t tmp1 = SYSASIC_EVENT_TO_ADDR(e); \ |
80 |
uint64_t tmp2 = SYSASIC_EVENT_TO_BITMASK(e); \ |
81 |
tmp2 |= 0x100000000ULL; /* Internal GXemul hack */ \ |
82 |
memory_writemax64(cpu, buf, 8, tmp2); \ |
83 |
cpu->memory_rw(cpu, cpu->mem, tmp1, (void *) &tmp2, 8, \ |
84 |
MEM_WRITE, PHYSICAL); \ |
85 |
} |
86 |
|
87 |
|
88 |
#if 0 |
89 |
const char *__pure sysasic_intr_string(int /*ipl*/) __attribute__((const)); |
90 |
void *sysasic_intr_establish(int /*event*/, int /*ipl*/, |
91 |
int (*ih_fun)(void *), void *); |
92 |
void sysasic_intr_disestablish(void *); |
93 |
void sysasic_intr_enable(void *, int /*on*/); |
94 |
#endif |
95 |
|
96 |
#endif /* !_DREAMCAST_SYSASICVAR_H_ */ |