trunk/src/emu/machine/mc68328.h
| r21686 | r21687 | |
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | | Motorola 68328 ("DragonBall") System-on-a-Chip private data |
| 3 | Motorola 68328 ("DragonBall") System-on-a-Chip implementation |
| 4 | 4 | |
| 5 | 5 | By MooglyGuy |
| 6 | 6 | contact mooglyguy@gmail.com with licensing and usage questions. |
| 7 | 7 | |
| 8 | 8 | **********************************************************************/ |
| 9 | 9 | |
| 10 | | #ifndef __MC68328_PRIVATE_H_ |
| 11 | | #define __MC68328_PRIVATE_H_ |
| 10 | /***************************************************************************************************************** |
| 12 | 11 | |
| 13 | | struct mc68328_regs_t |
| 14 | | { |
| 15 | | // $(FF)FFF000 |
| 16 | | UINT8 scr; // System Control Register |
| 17 | | UINT8 unused0[255]; |
| 12 | P P P P P P P P P P P P P P |
| 13 | E E E E E E E J J J J J J J |
| 14 | 1 2 3 4 5 6 7 0 1 2 3 4 5 6 |
| 15 | D D D D D / / / / / / / / / / / / / / |
| 16 | 3 4 5 6 7 ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! |
| 17 | / / / / / ! ! C C C C C C C C C C C C C C C |
| 18 | P V P P P P D D G D D D D T T L U V S S S S S S S S G S S S S S S S |
| 19 | B C B B B B D D 1 1 N 1 1 1 1 M C W W C A A A A B B B B N C C C C D D D |
| 20 | 3 C 4 5 6 7 8 9 0 1 D 2 3 4 5 S K E E C 0 1 2 3 0 1 2 3 D 0 1 2 3 0 1 2 |
| 21 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| 22 | +-------------------------------------------------------------------------------+ |
| 23 | | | |
| 24 | | | |
| 25 | | | |
| 26 | | | |
| 27 | | | |
| 28 | D2/PB2--| |--PJ7/!CSD3 |
| 29 | D1/PB1--| |--VCC |
| 30 | D0/PB0--| |--PD0/!KBD0/!INT0 |
| 31 | TDO--| |--PD1/!KBD1/!INT1 |
| 32 | TDI--| |--PD2/!KBD2/!INT2 |
| 33 | GND--| |--PD3/!KBD3/!INT3 |
| 34 | !OE--| |--PD4/!KBD4/!INT4 |
| 35 | !UDS/PC1--| |--PD5/!KBD5/!INT5 |
| 36 | !AS--| |--PD6/!KBD6/!INT6 |
| 37 | A0--| |--PD7/!KBD7/!INT7 |
| 38 | !LDS--| |--GND |
| 39 | R/!W--| |--LD0 |
| 40 | !DTACK/PC5--| |--LD1 |
| 41 | !RESET--| |--LD2 |
| 42 | VCC--| |--LD3 |
| 43 | !WE/PC6--| |--LFRM |
| 44 | !JTAGRST--| |--LLP |
| 45 | BBUSW--| MC68328PV |--LCLK |
| 46 | A1--| TOP VIEW |--LACD |
| 47 | A2--| |--VCC |
| 48 | A3--| |--PK0/SPMTXD0 |
| 49 | A4--| |--PK1/SPMRXD0 |
| 50 | A5--| |--PK2/SPMCLK0 |
| 51 | A6--| |--PK3/SPSEN |
| 52 | GND--| |--PK4/SPSRXD1 |
| 53 | A7--| |--PK5/SPSCLK1 |
| 54 | A8--| |--PK6/!CE2 |
| 55 | A9--| |--PK7/!CE1 |
| 56 | A10--| |--GND |
| 57 | A11--| |--PM0/!CTS |
| 58 | A12--| |--PM1/!RTS |
| 59 | A13--| |--PM2/!IRQ6 |
| 60 | A14--| |--PM3/!IRQ3 |
| 61 | VCC--| |--PM4/!IRQ2 |
| 62 | A15--| |--PM5/!IRQ1 |
| 63 | A16/PA0--| |--PM6/!PENIRQ |
| 64 | | | |
| 65 | | _ | |
| 66 | | (_) | |
| 67 | |\ | |
| 68 | | \ | |
| 69 | +-------------------------------------------------------------------------------+ |
| 70 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| 71 | P P P P P G P P P P P P P P V P P P P P P P P G P P P V C G P P P E X P |
| 72 | A A A A A N A A F F F F F F C F F G G G G G G N G G C C L N C M L X T L |
| 73 | 1 2 3 4 5 D 6 7 0 1 2 3 4 5 C 6 7 7 6 5 4 3 2 D 1 0 0 C K D 4 7 L T A L |
| 74 | / / / / / / / / / / / / / / / / / / / / / / / / O / / G A L V |
| 75 | A A A A A A A A A A A A A A A R T ! T ! P R T M ! U N L C |
| 76 | 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 T I T I T W X X O I A D C |
| 77 | 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 C N O N O M D D C R R |
| 78 | O 1 U 2 U O L Q T |
| 79 | T T K 7 G |
| 80 | 1 2 P |
| 81 | I |
| 82 | O |
| 18 | 83 | |
| 19 | | // $(FF)FFF100 |
| 20 | | UINT16 grpbasea; // Chip Select Group A Base Register |
| 21 | | UINT16 grpbaseb; // Chip Select Group B Base Register |
| 22 | | UINT16 grpbasec; // Chip Select Group C Base Register |
| 23 | | UINT16 grpbased; // Chip Select Group D Base Register |
| 24 | | UINT16 grpmaska; // Chip Select Group A Mask Register |
| 25 | | UINT16 grpmaskb; // Chip Select Group B Mask Register |
| 26 | | UINT16 grpmaskc; // Chip Select Group C Mask Register |
| 27 | | UINT16 grpmaskd; // Chip Select Group D Mask Register |
| 28 | | UINT32 csa0; // Group A Chip Select 0 Register |
| 29 | | UINT32 csa1; // Group A Chip Select 1 Register |
| 30 | | UINT32 csa2; // Group A Chip Select 2 Register |
| 31 | | UINT32 csa3; // Group A Chip Select 3 Register |
| 32 | | UINT32 csb0; // Group B Chip Select 0 Register |
| 33 | | UINT32 csb1; // Group B Chip Select 1 Register |
| 34 | | UINT32 csb2; // Group B Chip Select 2 Register |
| 35 | | UINT32 csb3; // Group B Chip Select 3 Register |
| 36 | | UINT32 csc0; // Group C Chip Select 0 Register |
| 37 | | UINT32 csc1; // Group C Chip Select 1 Register |
| 38 | | UINT32 csc2; // Group C Chip Select 2 Register |
| 39 | | UINT32 csc3; // Group C Chip Select 3 Register |
| 40 | | UINT32 csd0; // Group D Chip Select 0 Register |
| 41 | | UINT32 csd1; // Group D Chip Select 1 Register |
| 42 | | UINT32 csd2; // Group D Chip Select 2 Register |
| 43 | | UINT32 csd3; // Group D Chip Select 3 Register |
| 44 | | UINT8 unused1[176]; |
| 84 | Figure 12-1. MC68328 144-Lead Plastic Thin-Quad Flat Pack Pin Assignment |
| 45 | 85 | |
| 46 | | // $(FF)FFF200 |
| 47 | | UINT16 pllcr; // PLL Control Register |
| 48 | | UINT16 pllfsr; // PLL Frequency Select Register |
| 49 | | UINT8 pad2[3]; |
| 50 | | UINT8 pctlr; // Power Control Register |
| 51 | | UINT8 unused3[248]; |
| 86 | Source: MC68328 (DragonBall)(tm) Integrated Processor User's Manual |
| 52 | 87 | |
| 53 | | // $(FF)FFF300 |
| 54 | | UINT8 ivr; // Interrupt Vector Register |
| 55 | | UINT8 unused4[1]; |
| 56 | | UINT16 icr; // Interrupt Control Register |
| 57 | | UINT32 imr; // Interrupt Mask Register |
| 58 | | UINT32 iwr; // Interrupt Wakeup Enable Register |
| 59 | | UINT32 isr; // Interrupt Status Register |
| 60 | | UINT32 ipr; // Interrupt Pending Register |
| 61 | | UINT8 unused5[236]; |
| 88 | *****************************************************************************************************************/ |
| 62 | 89 | |
| 63 | | // $(FF)FFF400 |
| 64 | | UINT8 padir; // Port A Direction Register |
| 65 | | UINT8 padata; // Port A Data Register |
| 66 | | UINT8 unused6[1]; |
| 67 | | UINT8 pasel; // Port A Select Register |
| 68 | | UINT8 unused7[4]; |
| 90 | #ifndef __MC68328_H_ |
| 91 | #define __MC68328_H_ |
| 69 | 92 | |
| 70 | | UINT8 pbdir; // Port B Direction Register |
| 71 | | UINT8 pbdata; // Port B Data Register |
| 72 | | UINT8 unused8[1]; |
| 73 | | UINT8 pbsel; // Port B Select Register |
| 74 | | UINT8 unused9[4]; |
| 93 | /*************************************************************************** |
| 94 | TYPE DEFINITIONS |
| 95 | ***************************************************************************/ |
| 75 | 96 | |
| 76 | | UINT8 pcdir; // Port C Direction Register |
| 77 | | UINT8 pcdata; // Port C Data Register |
| 78 | | UINT8 unused10[1]; |
| 79 | | UINT8 pcsel; // Port C Select Register |
| 80 | | UINT8 unused11[4]; |
| 81 | | |
| 82 | | UINT8 pddir; // Port D Direction Register |
| 83 | | UINT8 pddata; // Port D Data Register |
| 84 | | UINT8 pdpuen; // Port D Pullup Enable Register |
| 85 | | UINT8 unused12[1]; |
| 86 | | UINT8 pdpol; // Port D Polarity Register |
| 87 | | UINT8 pdirqen; // Port D IRQ Enable Register |
| 88 | | UINT8 pddataedge; // Port D Data Edge Level |
| 89 | | UINT8 pdirqedge; // Port D IRQ Edge Register |
| 90 | | |
| 91 | | UINT8 pedir; // Port E Direction Register |
| 92 | | UINT8 pedata; // Port E Data Register |
| 93 | | UINT8 pepuen; // Port E Pullup Enable Register |
| 94 | | UINT8 pesel; // Port E Select Register |
| 95 | | UINT8 unused14[4]; |
| 96 | | |
| 97 | | UINT8 pfdir; // Port F Direction Register |
| 98 | | UINT8 pfdata; // Port F Data Register |
| 99 | | UINT8 pfpuen; // Port F Pullup Enable Register |
| 100 | | UINT8 pfsel; // Port F Select Register |
| 101 | | UINT8 unused15[4]; |
| 102 | | |
| 103 | | UINT8 pgdir; // Port G Direction Register |
| 104 | | UINT8 pgdata; // Port G Data Register |
| 105 | | UINT8 pgpuen; // Port G Pullup Enable Register |
| 106 | | UINT8 pgsel; // Port G Select Register |
| 107 | | UINT8 unused16[4]; |
| 108 | | |
| 109 | | UINT8 pjdir; // Port J Direction Register |
| 110 | | UINT8 pjdata; // Port J Data Register |
| 111 | | UINT8 unused17[1]; |
| 112 | | UINT8 pjsel; // Port J Select Register |
| 113 | | UINT8 unused18[4]; |
| 114 | | UINT8 pkdir; // Port K Direction Register |
| 115 | | UINT8 pkdata; // Port K Data Register |
| 116 | | UINT8 pkpuen; // Port K Pullup Enable Register |
| 117 | | UINT8 pksel; // Port K Select Register |
| 118 | | UINT8 unused19[4]; |
| 119 | | |
| 120 | | UINT8 pmdir; // Port M Direction Register |
| 121 | | UINT8 pmdata; // Port M Data Register |
| 122 | | UINT8 pmpuen; // Port M Pullup Enable Register |
| 123 | | UINT8 pmsel; // Port M Select Register |
| 124 | | UINT8 unused20[180]; |
| 125 | | |
| 126 | | // $(FF)FFF500 |
| 127 | | UINT16 pwmc; // PWM Control Register |
| 128 | | UINT16 pwmp; // PWM Period Register |
| 129 | | UINT16 pwmw; // PWM Width Register |
| 130 | | UINT16 pwmcnt; // PWN Counter |
| 131 | | UINT8 unused21[248]; |
| 132 | | |
| 133 | | // $(FF)FFF600 |
| 134 | | UINT16 tctl[2]; // Timer Control Register |
| 135 | | UINT16 tprer[2]; // Timer Prescaler Register |
| 136 | | UINT16 tcmp[2]; // Timer Compare Register |
| 137 | | UINT16 tcr[2]; // Timer Capture Register |
| 138 | | UINT16 tcn[2]; // Timer Counter |
| 139 | | UINT16 tstat[2]; // Timer Status |
| 140 | | UINT16 wctlr; // Watchdog Control Register |
| 141 | | UINT16 wcmpr; // Watchdog Compare Register |
| 142 | | UINT16 wcn; // Watchdog Counter |
| 143 | | UINT8 tclear[2]; // Timer Clearable Status |
| 144 | | UINT8 unused22[224]; |
| 145 | | |
| 146 | | // $(FF)FFF700 |
| 147 | | UINT16 spisr; // SPIS Register |
| 148 | | UINT8 unused23[254]; |
| 149 | | |
| 150 | | // $(FF)FFF800 |
| 151 | | UINT16 spimdata; // SPIM Data Register |
| 152 | | UINT16 spimcont; // SPIM Control/Status Register |
| 153 | | UINT8 unused24[252]; |
| 154 | | |
| 155 | | // $(FF)FFF900 |
| 156 | | UINT16 ustcnt; // UART Status/Control Register |
| 157 | | UINT16 ubaud; // UART Baud Control Register |
| 158 | | UINT16 urx; // UART RX Register |
| 159 | | UINT16 utx; // UART TX Register |
| 160 | | UINT16 umisc; // UART Misc Register |
| 161 | | UINT8 unused25[246]; |
| 162 | | |
| 163 | | // $(FF)FFFA00 |
| 164 | | UINT32 lssa; // Screen Starting Address Register |
| 165 | | UINT8 unused26[1]; |
| 166 | | UINT8 lvpw; // Virtual Page Width Register |
| 167 | | UINT8 unused27[2]; |
| 168 | | UINT16 lxmax; // Screen Width Register |
| 169 | | UINT16 lymax; // Screen Height Register |
| 170 | | UINT8 unused28[12]; |
| 171 | | UINT16 lcxp; // Cursor X Position |
| 172 | | UINT16 lcyp; // Cursor Y Position |
| 173 | | UINT16 lcwch; // Cursor Width & Height Register |
| 174 | | UINT8 unused29[1]; |
| 175 | | UINT8 lblkc; // Blink Control Register |
| 176 | | UINT8 lpicf; // Panel Interface Config Register |
| 177 | | UINT8 lpolcf; // Polarity Config Register |
| 178 | | UINT8 unused30[1]; |
| 179 | | UINT8 lacdrc; // ACD (M) Rate Control Register |
| 180 | | UINT8 unused31[1]; |
| 181 | | UINT8 lpxcd; // Pixel Clock Divider Register |
| 182 | | UINT8 unused32[1]; |
| 183 | | UINT8 lckcon; // Clocking Control Register |
| 184 | | UINT8 unused33[1]; |
| 185 | | UINT8 llbar; // Last Buffer Address Register |
| 186 | | UINT8 unused34[1]; |
| 187 | | UINT8 lotcr; // Octet Terminal Count Register |
| 188 | | UINT8 unused35[1]; |
| 189 | | UINT8 lposr; // Panning Offset Register |
| 190 | | UINT8 unused36[3]; |
| 191 | | UINT8 lfrcm; // Frame Rate Control Modulation Register |
| 192 | | UINT16 lgpmr; // Gray Palette Mapping Register |
| 193 | | UINT8 unused37[204]; |
| 194 | | |
| 195 | | // $(FF)FFFB00 |
| 196 | | UINT32 hmsr; // RTC Hours Minutes Seconds Register |
| 197 | | UINT32 alarm; // RTC Alarm Register |
| 198 | | UINT8 unused38[4]; |
| 199 | | UINT16 rtcctl; // RTC Control Register |
| 200 | | UINT16 rtcisr; // RTC Interrupt Status Register |
| 201 | | UINT16 rtcienr; // RTC Interrupt Enable Register |
| 202 | | UINT16 stpwtch; // Stopwatch Minutes |
| 203 | | UINT8 unused42[1260]; |
| 204 | | }; |
| 205 | | |
| 206 | | struct mc68328_t |
| 97 | struct mc68328_interface |
| 207 | 98 | { |
| 208 | | const mc68328_interface* iface; |
| 99 | const char *m68k_cpu_tag; |
| 209 | 100 | |
| 210 | | mc68328_regs_t regs; |
| 101 | devcb_write8 out_port_a_func; /* 8-bit output */ |
| 102 | devcb_write8 out_port_b_func; /* 8-bit output */ |
| 103 | devcb_write8 out_port_c_func; /* 8-bit output */ |
| 104 | devcb_write8 out_port_d_func; /* 8-bit output */ |
| 105 | devcb_write8 out_port_e_func; /* 8-bit output */ |
| 106 | devcb_write8 out_port_f_func; /* 8-bit output */ |
| 107 | devcb_write8 out_port_g_func; /* 8-bit output */ |
| 108 | devcb_write8 out_port_j_func; /* 8-bit output */ |
| 109 | devcb_write8 out_port_k_func; /* 8-bit output */ |
| 110 | devcb_write8 out_port_m_func; /* 8-bit output */ |
| 211 | 111 | |
| 212 | | emu_timer *gptimer[2]; |
| 213 | | emu_timer *rtc; |
| 214 | | emu_timer *pwm; |
| 112 | devcb_read8 in_port_a_func; /* 8-bit input */ |
| 113 | devcb_read8 in_port_b_func; /* 8-bit input */ |
| 114 | devcb_read8 in_port_c_func; /* 8-bit input */ |
| 115 | devcb_read8 in_port_d_func; /* 8-bit input */ |
| 116 | devcb_read8 in_port_e_func; /* 8-bit input */ |
| 117 | devcb_read8 in_port_f_func; /* 8-bit input */ |
| 118 | devcb_read8 in_port_g_func; /* 8-bit input */ |
| 119 | devcb_read8 in_port_j_func; /* 8-bit input */ |
| 120 | devcb_read8 in_port_k_func; /* 8-bit input */ |
| 121 | devcb_read8 in_port_m_func; /* 8-bit input */ |
| 215 | 122 | |
| 216 | | devcb_resolved_write8 out_port_a; /* 8-bit output */ |
| 217 | | devcb_resolved_write8 out_port_b; /* 8-bit output */ |
| 218 | | devcb_resolved_write8 out_port_c; /* 8-bit output */ |
| 219 | | devcb_resolved_write8 out_port_d; /* 8-bit output */ |
| 220 | | devcb_resolved_write8 out_port_e; /* 8-bit output */ |
| 221 | | devcb_resolved_write8 out_port_f; /* 8-bit output */ |
| 222 | | devcb_resolved_write8 out_port_g; /* 8-bit output */ |
| 223 | | devcb_resolved_write8 out_port_j; /* 8-bit output */ |
| 224 | | devcb_resolved_write8 out_port_k; /* 8-bit output */ |
| 225 | | devcb_resolved_write8 out_port_m; /* 8-bit output */ |
| 123 | devcb_write8 out_pwm_func; /* 1-bit output */ |
| 226 | 124 | |
| 227 | | devcb_resolved_read8 in_port_a; /* 8-bit input */ |
| 228 | | devcb_resolved_read8 in_port_b; /* 8-bit input */ |
| 229 | | devcb_resolved_read8 in_port_c; /* 8-bit input */ |
| 230 | | devcb_resolved_read8 in_port_d; /* 8-bit input */ |
| 231 | | devcb_resolved_read8 in_port_e; /* 8-bit input */ |
| 232 | | devcb_resolved_read8 in_port_f; /* 8-bit input */ |
| 233 | | devcb_resolved_read8 in_port_g; /* 8-bit input */ |
| 234 | | devcb_resolved_read8 in_port_j; /* 8-bit input */ |
| 235 | | devcb_resolved_read8 in_port_k; /* 8-bit input */ |
| 236 | | devcb_resolved_read8 in_port_m; /* 8-bit input */ |
| 237 | | |
| 238 | | devcb_resolved_write8 out_pwm; /* 1-bit output */ |
| 239 | | |
| 240 | | devcb_resolved_write16 out_spim; /* 16-bit output */ |
| 241 | | devcb_resolved_read16 in_spim; /* 16-bit input */ |
| 125 | devcb_write16 out_spim_func; /* 16-bit output */ |
| 126 | devcb_read16 in_spim_func; /* 16-bit input */ |
| 127 | void (*spim_xch_trigger)( device_t *device ); /* SPIM exchange trigger */ |
| 242 | 128 | }; |
| 129 | #define MC68328_INTERFACE(name) const mc68328_interface (name)= |
| 243 | 130 | |
| 244 | | #define SCR_BETO 0x80 |
| 245 | | #define SCR_WPV 0x40 |
| 246 | | #define SCR_PRV 0x20 |
| 247 | | #define SCR_BETEN 0x10 |
| 248 | | #define SCR_SO 0x08 |
| 249 | | #define SCR_DMAP 0x04 |
| 250 | | #define SCR_WDTH8 0x01 |
| 131 | #define MC68328_TAG "dragonball" |
| 251 | 132 | |
| 252 | | #define ICR_POL6 0x0100 |
| 253 | | #define ICR_POL3 0x0200 |
| 254 | | #define ICR_POL2 0x0400 |
| 255 | | #define ICR_POL1 0x0800 |
| 256 | | #define ICR_ET6 0x1000 |
| 257 | | #define ICR_ET3 0x2000 |
| 258 | | #define ICR_ET2 0x4000 |
| 259 | | #define ICR_ET1 0x8000 |
| 133 | /*************************************************************************** |
| 134 | DEVICE CONFIGURATION MACROS |
| 135 | ***************************************************************************/ |
| 260 | 136 | |
| 261 | | #define INT_SPIM 0x000001 |
| 262 | | #define INT_TIMER2 0x000002 |
| 263 | | #define INT_UART 0x000004 |
| 264 | | #define INT_WDT 0x000008 |
| 265 | | #define INT_RTC 0x000010 |
| 266 | | #define INT_RESERVED 0x000020 |
| 267 | | #define INT_KB 0x000040 |
| 268 | | #define INT_PWM 0x000080 |
| 269 | | #define INT_INT0 0x000100 |
| 270 | | #define INT_INT1 0x000200 |
| 271 | | #define INT_INT2 0x000400 |
| 272 | | #define INT_INT3 0x000800 |
| 273 | | #define INT_INT4 0x001000 |
| 274 | | #define INT_INT5 0x002000 |
| 275 | | #define INT_INT6 0x004000 |
| 276 | | #define INT_INT7 0x008000 |
| 277 | | #define INT_KBDINTS 0x00ff00 |
| 278 | | #define INT_IRQ1 0x010000 |
| 279 | | #define INT_IRQ2 0x020000 |
| 280 | | #define INT_IRQ3 0x040000 |
| 281 | | #define INT_IRQ6 0x080000 |
| 282 | | #define INT_PEN 0x100000 |
| 283 | | #define INT_SPIS 0x200000 |
| 284 | | #define INT_TIMER1 0x400000 |
| 285 | | #define INT_IRQ7 0x800000 |
| 137 | #define MCFG_MC68328_ADD(_intrf) \ |
| 138 | MCFG_DEVICE_ADD("dragonball", MC68328, 0) \ |
| 139 | MCFG_DEVICE_CONFIG(_intrf) |
| 286 | 140 | |
| 287 | | #define INT_M68K_LINE1 (INT_IRQ1) |
| 288 | | #define INT_M68K_LINE2 (INT_IRQ2) |
| 289 | | #define INT_M68K_LINE3 (INT_IRQ3) |
| 290 | | #define INT_M68K_LINE4 (INT_INT0 | INT_INT1 | INT_INT2 | INT_INT3 | INT_INT4 | INT_INT5 | INT_INT6 | INT_INT7 | \ |
| 291 | | INT_PWM | INT_KB | INT_RTC | INT_WDT | INT_UART | INT_TIMER2 | INT_SPIM) |
| 292 | | #define INT_M68K_LINE5 (INT_PEN) |
| 293 | | #define INT_M68K_LINE6 (INT_IRQ6 | INT_TIMER1 | INT_SPIS) |
| 294 | | #define INT_M68K_LINE7 (INT_IRQ7) |
| 295 | | #define INT_M68K_LINE67 (INT_M68K_LINE6 | INT_M68K_LINE7) |
| 296 | | #define INT_M68K_LINE567 (INT_M68K_LINE5 | INT_M68K_LINE6 | INT_M68K_LINE7) |
| 297 | | #define INT_M68K_LINE4567 (INT_M68K_LINE4 | INT_M68K_LINE5 | INT_M68K_LINE6 | INT_M68K_LINE7) |
| 298 | | #define INT_M68K_LINE34567 (INT_M68K_LINE3 | INT_M68K_LINE4 | INT_M68K_LINE5 | INT_M68K_LINE6 | INT_M68K_LINE7) |
| 299 | | #define INT_M68K_LINE234567 (INT_M68K_LINE2 | INT_M68K_LINE3 | INT_M68K_LINE4 | INT_M68K_LINE5 | INT_M68K_LINE6 | INT_M68K_LINE7) |
| 141 | /*----------- defined in machine/mc68328.c -----------*/ |
| 300 | 142 | |
| 301 | | #define INT_IRQ1_SHIFT 0x000001 |
| 302 | | #define INT_IRQ2_SHIFT 0x000002 |
| 303 | | #define INT_IRQ3_SHIFT 0x000004 |
| 304 | | #define INT_IRQ6_SHIFT 0x000008 |
| 305 | | #define INT_PEN_SHIFT 0x000010 |
| 306 | | #define INT_SPIS_SHIFT 0x000020 |
| 307 | | #define INT_TIMER1_SHIFT 0x000040 |
| 308 | | #define INT_IRQ7_SHIFT 0x000080 |
| 143 | /*************************************************************************** |
| 144 | READ/WRITE HANDLERS |
| 145 | ***************************************************************************/ |
| 309 | 146 | |
| 310 | | #define INT_ACTIVE 1 |
| 311 | | #define INT_INACTIVE 0 |
| 147 | DECLARE_WRITE16_DEVICE_HANDLER( mc68328_w ); |
| 148 | DECLARE_READ16_DEVICE_HANDLER( mc68328_r ); |
| 312 | 149 | |
| 313 | | #define GRPBASE_BASE_ADDR 0xfff0 |
| 314 | | #define GRPBASE_VALID 0x0001 |
| 315 | 150 | |
| 316 | | #define GRPMASK_BASE_MASK 0xfff0 |
| 151 | /*************************************************************************** |
| 152 | EXTERNAL I/O LINES |
| 153 | ***************************************************************************/ |
| 317 | 154 | |
| 318 | | #define CSAB_COMPARE 0xff000000 |
| 319 | | #define CSAB_BSW 0x00010000 |
| 320 | | #define CSAB_MASK 0x0000ff00 |
| 321 | | #define CSAB_RO 0x00000008 |
| 322 | | #define CSAB_WAIT 0x00000007 |
| 155 | void mc68328_set_penirq_line(device_t *device, int state); |
| 156 | void mc68328_set_port_d_lines(device_t *device, UINT8 state, int bit); |
| 323 | 157 | |
| 324 | | #define CSCD_COMPARE 0xfff00000 |
| 325 | | #define CSCD_BSW 0x00010000 |
| 326 | | #define CSCD_MASK 0x0000fff0 |
| 327 | | #define CSCD_RO 0x00000008 |
| 328 | | #define CSCD_WAIT 0x00000007 |
| 158 | /*************************************************************************** |
| 159 | DEVICE INTERFACE |
| 160 | ***************************************************************************/ |
| 329 | 161 | |
| 330 | | #define PLLCR_PIXCLK_SEL 0x3800 |
| 331 | | #define PLLCR_PIXCLK_SEL_DIV2 0x0000 |
| 332 | | #define PLLCR_PIXCLK_SEL_DIV4 0x0800 |
| 333 | | #define PLLCR_PIXCLK_SEL_DIV8 0x1000 |
| 334 | | #define PLLCR_PIXCLK_SEL_DIV16 0x1800 |
| 335 | | #define PLLCR_PIXCLK_SEL_DIV1_0 0x2000 |
| 336 | | #define PLLCR_PIXCLK_SEL_DIV1_1 0x2800 |
| 337 | | #define PLLCR_PIXCLK_SEL_DIV1_2 0x3000 |
| 338 | | #define PLLCR_PIXCLK_SEL_DIV1_3 0x3800 |
| 339 | | #define PLLCR_SYSCLK_SEL 0x0700 |
| 340 | | #define PLLCR_SYSCLK_SEL_DIV2 0x0000 |
| 341 | | #define PLLCR_SYSCLK_SEL_DIV4 0x0100 |
| 342 | | #define PLLCR_SYSCLK_SEL_DIV8 0x0200 |
| 343 | | #define PLLCR_SYSCLK_SEL_DIV16 0x0300 |
| 344 | | #define PLLCR_SYSCLK_SEL_DIV1_0 0x0400 |
| 345 | | #define PLLCR_SYSCLK_SEL_DIV1_1 0x0500 |
| 346 | | #define PLLCR_SYSCLK_SEL_DIV1_2 0x0600 |
| 347 | | #define PLLCR_SYSCLK_SEL_DIV1_3 0x0700 |
| 348 | | #define PLLCR_CLKEN 0x0010 |
| 349 | | #define PLLCR_DISPLL 0x0008 |
| 162 | class mc68328_device : public device_t |
| 163 | { |
| 164 | public: |
| 165 | mc68328_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 166 | ~mc68328_device() { global_free(m_token); } |
| 350 | 167 | |
| 351 | | #define PLLFSR_CLK32 0x8000 |
| 352 | | #define PLLFSR_PROT 0x4000 |
| 353 | | #define PLLFSR_QCNT 0x0f00 |
| 354 | | #define PLLFSR_PCNT 0x00ff |
| 168 | // access to legacy token |
| 169 | void *token() const { assert(m_token != NULL); return m_token; } |
| 170 | protected: |
| 171 | // device-level overrides |
| 172 | virtual void device_config_complete(); |
| 173 | virtual void device_start(); |
| 174 | virtual void device_reset(); |
| 175 | private: |
| 176 | // internal state |
| 177 | void *m_token; |
| 178 | }; |
| 355 | 179 | |
| 356 | | #define PCTLR_PC_EN 0x80 |
| 357 | | #define PCTLR_STOP 0x40 |
| 358 | | #define PCTLR_WIDTH 0x1f |
| 180 | extern const device_type MC68328; |
| 359 | 181 | |
| 360 | | #define CXP_CC 0xc000 |
| 361 | | #define CXP_CC_XLU 0x0000 |
| 362 | | #define CXP_CC_BLACK 0x4000 |
| 363 | | #define CXP_CC_INVERSE 0x8000 |
| 364 | | #define CXP_CC_INVALID 0xc000 |
| 365 | | #define CXP_MASK 0x03ff |
| 366 | 182 | |
| 367 | | #define CYP_MASK 0x01ff |
| 183 | /*----------- defined in video/mc68328.c -----------*/ |
| 368 | 184 | |
| 369 | | #define CWCH_CW 0x1f00 |
| 370 | | #define CWCH_CH 0x001f |
| 185 | /*************************************************************************** |
| 186 | VIDEO INTERFACE |
| 187 | ***************************************************************************/ |
| 371 | 188 | |
| 372 | | #define BLKC_BKEN 0x80 |
| 373 | | #define BLKC_BD 0x7f |
| 189 | PALETTE_INIT( mc68328 ); |
| 190 | VIDEO_START( mc68328 ); |
| 191 | SCREEN_UPDATE_IND16( mc68328 ); |
| 374 | 192 | |
| 375 | | #define LPICF_PBSIZ 0x06 |
| 376 | | #define LPICF_PBSIZ_1 0x00 |
| 377 | | #define LPICF_PBSIZ_2 0x02 |
| 378 | | #define LPICF_PBSIZ_4 0x04 |
| 379 | | #define LPICF_PBSIZ_INVALID 0x06 |
| 380 | | |
| 381 | | #define LPOLCF_LCKPOL 0x08 |
| 382 | | #define LPOLCF_FLMPOL 0x04 |
| 383 | | #define LPOLCF_LPPOL 0x02 |
| 384 | | #define LPOLCF_PIXPOL 0x01 |
| 385 | | |
| 386 | | #define LACDRC_MASK 0x0f |
| 387 | | |
| 388 | | #define LPXCD_MASK 0x3f |
| 389 | | |
| 390 | | #define LCKCON_LCDC_EN 0x80 |
| 391 | | #define LCKCON_LCDON 0x80 |
| 392 | | #define LCKCON_DMA16 0x40 |
| 393 | | #define LCKCON_WS 0x30 |
| 394 | | #define LCKCON_WS_1 0x00 |
| 395 | | #define LCKCON_WS_2 0x10 |
| 396 | | #define LCKCON_WS_3 0x20 |
| 397 | | #define LCKCON_WS_4 0x30 |
| 398 | | #define LCKCON_DWIDTH 0x02 |
| 399 | | #define LCKCON_PCDS 0x01 |
| 400 | | |
| 401 | | #define LBAR_MASK 0x7f |
| 402 | | |
| 403 | | #define LPOSR_BOS 0x08 |
| 404 | | #define LPOSR_POS 0x07 |
| 405 | | |
| 406 | | #define LFRCM_XMOD 0xf0 |
| 407 | | #define LFRCM_YMOD 0x0f |
| 408 | | |
| 409 | | #define LGPMR_PAL1 0x7000 |
| 410 | | #define LGPMR_PAL0 0x0700 |
| 411 | | #define LGPMR_PAL3 0x0070 |
| 412 | | #define LGPMR_PAL2 0x0007 |
| 413 | | |
| 414 | | #define RTCHMSR_HOURS 0x1f000000 |
| 415 | | #define RTCHMSR_MINUTES 0x003f0000 |
| 416 | | #define RTCHMSR_SECONDS 0x0000003f |
| 417 | | |
| 418 | | #define RTCCTL_38_4 0x0020 |
| 419 | | #define RTCCTL_ENABLE 0x0080 |
| 420 | | |
| 421 | | #define RTCINT_STOPWATCH 0x0001 |
| 422 | | #define RTCINT_MINUTE 0x0002 |
| 423 | | #define RTCINT_ALARM 0x0004 |
| 424 | | #define RTCINT_DAY 0x0008 |
| 425 | | #define RTCINT_SECOND 0x0010 |
| 426 | | |
| 427 | | #define RTCSTPWTCH_MASK 0x003f |
| 428 | | |
| 429 | | #define TCTL_TEN 0x0001 |
| 430 | | #define TCTL_TEN_ENABLE 0x0001 |
| 431 | | #define TCTL_CLKSOURCE 0x000e |
| 432 | | #define TCTL_CLKSOURCE_STOP 0x0000 |
| 433 | | #define TCTL_CLKSOURCE_SYSCLK 0x0002 |
| 434 | | #define TCTL_CLKSOURCE_SYSCLK16 0x0004 |
| 435 | | #define TCTL_CLKSOURCE_TIN 0x0006 |
| 436 | | #define TCTL_CLKSOURCE_32KHZ4 0x0008 |
| 437 | | #define TCTL_CLKSOURCE_32KHZ5 0x000a |
| 438 | | #define TCTL_CLKSOURCE_32KHZ6 0x000c |
| 439 | | #define TCTL_CLKSOURCE_32KHZ7 0x000e |
| 440 | | #define TCTL_IRQEN 0x0010 |
| 441 | | #define TCTL_IRQEN_ENABLE 0x0010 |
| 442 | | #define TCTL_OM 0x0020 |
| 443 | | #define TCTL_OM_ACTIVELOW 0x0000 |
| 444 | | #define TCTL_OM_TOGGLE 0x0020 |
| 445 | | #define TCTL_CAPTURE 0x00c0 |
| 446 | | #define TCTL_CAPTURE_NOINT 0x0000 |
| 447 | | #define TCTL_CAPTURE_RISING 0x0040 |
| 448 | | #define TCTL_CAPTURE_FALLING 0x0080 |
| 449 | | #define TCTL_CAPTURE_BOTH 0x00c0 |
| 450 | | #define TCTL_FRR 0x0100 |
| 451 | | #define TCTL_FRR_RESTART 0x0000 |
| 452 | | #define TCTL_FRR_FREERUN 0x0100 |
| 453 | | |
| 454 | | #define TSTAT_COMP 0x0001 |
| 455 | | #define TSTAT_CAPT 0x0002 |
| 456 | | |
| 457 | | #define WCTLR_WDRST 0x0008 |
| 458 | | #define WCTLR_LOCK 0x0004 |
| 459 | | #define WCTLR_FI 0x0002 |
| 460 | | #define WCTLR_WDEN 0x0001 |
| 461 | | |
| 462 | | #define USTCNT_UART_EN 0x8000 |
| 463 | | #define USTCNT_RX_EN 0x4000 |
| 464 | | #define USTCNT_TX_EN 0x2000 |
| 465 | | #define USTCNT_RX_CLK_CONT 0x1000 |
| 466 | | #define USTCNT_PARITY_EN 0x0800 |
| 467 | | #define USTCNT_ODD_EVEN 0x0400 |
| 468 | | #define USTCNT_STOP_BITS 0x0200 |
| 469 | | #define USTCNT_8_7 0x0100 |
| 470 | | #define USTCNT_GPIO_DELTA_EN 0x0080 |
| 471 | | #define USTCNT_CTS_DELTA_EN 0x0040 |
| 472 | | #define USTCNT_RX_FULL_EN 0x0020 |
| 473 | | #define USTCNT_RX_HALF_EN 0x0010 |
| 474 | | #define USTCNT_RX_RDY_EN 0x0008 |
| 475 | | #define USTCNT_TX_EMPTY_EN 0x0004 |
| 476 | | #define USTCNT_TX_HALF_EN 0x0002 |
| 477 | | #define USTCNT_TX_AVAIL_EN 0x0001 |
| 478 | | |
| 479 | | #define UBAUD_GPIO_DELTA 0x8000 |
| 480 | | #define UBAUD_GPIO 0x4000 |
| 481 | | #define UBAUD_GPIO_DIR 0x2000 |
| 482 | | #define UBAUD_GPIO_SRC 0x1000 |
| 483 | | #define UBAUD_BAUD_SRC 0x0800 |
| 484 | | #define UBAUD_DIVIDE 0x0700 |
| 485 | | #define UBAUD_DIVIDE_1 0x0000 |
| 486 | | #define UBAUD_DIVIDE_2 0x0100 |
| 487 | | #define UBAUD_DIVIDE_4 0x0200 |
| 488 | | #define UBAUD_DIVIDE_8 0x0300 |
| 489 | | #define UBAUD_DIVIDE_16 0x0400 |
| 490 | | #define UBAUD_DIVIDE_32 0x0500 |
| 491 | | #define UBAUD_DIVIDE_64 0x0600 |
| 492 | | #define UBAUD_DIVIDE_128 0x0700 |
| 493 | | #define UBAUD_PRESCALER 0x00ff |
| 494 | | |
| 495 | | #define URX_FIFO_FULL 0x8000 |
| 496 | | #define URX_FIFO_HALF 0x4000 |
| 497 | | #define URX_DATA_READY 0x2000 |
| 498 | | #define URX_OVRUN 0x0800 |
| 499 | | #define URX_FRAME_ERROR 0x0400 |
| 500 | | #define URX_BREAK 0x0200 |
| 501 | | #define URX_PARITY_ERROR 0x0100 |
| 502 | | |
| 503 | | #define UTX_FIFO_EMPTY 0x8000 |
| 504 | | #define UTX_FIFO_HALF 0x4000 |
| 505 | | #define UTX_TX_AVAIL 0x2000 |
| 506 | | #define UTX_SEND_BREAK 0x1000 |
| 507 | | #define UTX_IGNORE_CTS 0x0800 |
| 508 | | #define UTX_CTS_STATUS 0x0200 |
| 509 | | #define UTX_CTS_DELTA 0x0100 |
| 510 | | |
| 511 | | #define UMISC_CLK_SRC 0x4000 |
| 512 | | #define UMISC_FORCE_PERR 0x2000 |
| 513 | | #define UMISC_LOOP 0x1000 |
| 514 | | #define UMISC_RTS_CONT 0x0080 |
| 515 | | #define UMISC_RTS 0x0040 |
| 516 | | #define UMISC_IRDA_ENABLE 0x0020 |
| 517 | | #define UMISC_IRDA_LOOP 0x0010 |
| 518 | | |
| 519 | | #define SPIS_SPIS_IRQ 0x8000 |
| 520 | | #define SPIS_IRQEN 0x4000 |
| 521 | | #define SPIS_ENPOL 0x2000 |
| 522 | | #define SPIS_DATA_RDY 0x1000 |
| 523 | | #define SPIS_OVRWR 0x0800 |
| 524 | | #define SPIS_PHA 0x0400 |
| 525 | | #define SPIS_POL 0x0200 |
| 526 | | #define SPIS_SPISEN 0x0100 |
| 527 | | |
| 528 | | #define SPIM_CLOCK_COUNT 0x000f |
| 529 | | #define SPIM_POL 0x0010 |
| 530 | | #define SPIM_POL_HIGH 0x0000 |
| 531 | | #define SPIM_POL_LOW 0x0010 |
| 532 | | #define SPIM_PHA 0x0020 |
| 533 | | #define SPIM_PHA_NORMAL 0x0000 |
| 534 | | #define SPIM_PHA_OPPOSITE 0x0020 |
| 535 | | #define SPIM_IRQEN 0x0040 |
| 536 | | #define SPIM_SPIMIRQ 0x0080 |
| 537 | | #define SPIM_XCH 0x0100 |
| 538 | | #define SPIM_XCH_IDLE 0x0000 |
| 539 | | #define SPIM_XCH_INIT 0x0100 |
| 540 | | #define SPIM_SPMEN 0x0200 |
| 541 | | #define SPIM_SPMEN_DISABLE 0x0000 |
| 542 | | #define SPIM_SPMEN_ENABLE 0x0200 |
| 543 | | #define SPIM_RATE 0xe000 |
| 544 | | #define SPIM_RATE_4 0x0000 |
| 545 | | #define SPIM_RATE_8 0x2000 |
| 546 | | #define SPIM_RATE_16 0x4000 |
| 547 | | #define SPIM_RATE_32 0x6000 |
| 548 | | #define SPIM_RATE_64 0x8000 |
| 549 | | #define SPIM_RATE_128 0xa000 |
| 550 | | #define SPIM_RATE_256 0xc000 |
| 551 | | #define SPIM_RATE_512 0xe000 |
| 552 | | |
| 553 | | #define PWMC_PWMIRQ 0x8000 |
| 554 | | #define PWMC_IRQEN 0x4000 |
| 555 | | #define PWMC_LOAD 0x0100 |
| 556 | | #define PWMC_PIN 0x0080 |
| 557 | | #define PWMC_POL 0x0040 |
| 558 | | #define PWMC_PWMEN 0x0010 |
| 559 | | #define PWMC_CLKSEL 0x0007 |
| 560 | | |
| 561 | | INLINE mc68328_t* mc68328_get_safe_token( device_t *device ) |
| 562 | | { |
| 563 | | assert( device != NULL ); |
| 564 | | assert( device->type() == MC68328 ); |
| 565 | | return (mc68328_t*) downcast<mc68328_device *>(device)->token(); |
| 566 | | } |
| 567 | | |
| 568 | | #endif // __MC68328_PRIVATE_H_ |
| 193 | #endif // __MC68328_H_ |
trunk/src/emu/machine/mc68328p.h
| r0 | r21687 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Motorola 68328 ("DragonBall") System-on-a-Chip private data |
| 4 | |
| 5 | By MooglyGuy |
| 6 | contact mooglyguy@gmail.com with licensing and usage questions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | #ifndef __MC68328_PRIVATE_H_ |
| 11 | #define __MC68328_PRIVATE_H_ |
| 12 | |
| 13 | struct mc68328_regs_t |
| 14 | { |
| 15 | // $(FF)FFF000 |
| 16 | UINT8 scr; // System Control Register |
| 17 | UINT8 unused0[255]; |
| 18 | |
| 19 | // $(FF)FFF100 |
| 20 | UINT16 grpbasea; // Chip Select Group A Base Register |
| 21 | UINT16 grpbaseb; // Chip Select Group B Base Register |
| 22 | UINT16 grpbasec; // Chip Select Group C Base Register |
| 23 | UINT16 grpbased; // Chip Select Group D Base Register |
| 24 | UINT16 grpmaska; // Chip Select Group A Mask Register |
| 25 | UINT16 grpmaskb; // Chip Select Group B Mask Register |
| 26 | UINT16 grpmaskc; // Chip Select Group C Mask Register |
| 27 | UINT16 grpmaskd; // Chip Select Group D Mask Register |
| 28 | UINT32 csa0; // Group A Chip Select 0 Register |
| 29 | UINT32 csa1; // Group A Chip Select 1 Register |
| 30 | UINT32 csa2; // Group A Chip Select 2 Register |
| 31 | UINT32 csa3; // Group A Chip Select 3 Register |
| 32 | UINT32 csb0; // Group B Chip Select 0 Register |
| 33 | UINT32 csb1; // Group B Chip Select 1 Register |
| 34 | UINT32 csb2; // Group B Chip Select 2 Register |
| 35 | UINT32 csb3; // Group B Chip Select 3 Register |
| 36 | UINT32 csc0; // Group C Chip Select 0 Register |
| 37 | UINT32 csc1; // Group C Chip Select 1 Register |
| 38 | UINT32 csc2; // Group C Chip Select 2 Register |
| 39 | UINT32 csc3; // Group C Chip Select 3 Register |
| 40 | UINT32 csd0; // Group D Chip Select 0 Register |
| 41 | UINT32 csd1; // Group D Chip Select 1 Register |
| 42 | UINT32 csd2; // Group D Chip Select 2 Register |
| 43 | UINT32 csd3; // Group D Chip Select 3 Register |
| 44 | UINT8 unused1[176]; |
| 45 | |
| 46 | // $(FF)FFF200 |
| 47 | UINT16 pllcr; // PLL Control Register |
| 48 | UINT16 pllfsr; // PLL Frequency Select Register |
| 49 | UINT8 pad2[3]; |
| 50 | UINT8 pctlr; // Power Control Register |
| 51 | UINT8 unused3[248]; |
| 52 | |
| 53 | // $(FF)FFF300 |
| 54 | UINT8 ivr; // Interrupt Vector Register |
| 55 | UINT8 unused4[1]; |
| 56 | UINT16 icr; // Interrupt Control Register |
| 57 | UINT32 imr; // Interrupt Mask Register |
| 58 | UINT32 iwr; // Interrupt Wakeup Enable Register |
| 59 | UINT32 isr; // Interrupt Status Register |
| 60 | UINT32 ipr; // Interrupt Pending Register |
| 61 | UINT8 unused5[236]; |
| 62 | |
| 63 | // $(FF)FFF400 |
| 64 | UINT8 padir; // Port A Direction Register |
| 65 | UINT8 padata; // Port A Data Register |
| 66 | UINT8 unused6[1]; |
| 67 | UINT8 pasel; // Port A Select Register |
| 68 | UINT8 unused7[4]; |
| 69 | |
| 70 | UINT8 pbdir; // Port B Direction Register |
| 71 | UINT8 pbdata; // Port B Data Register |
| 72 | UINT8 unused8[1]; |
| 73 | UINT8 pbsel; // Port B Select Register |
| 74 | UINT8 unused9[4]; |
| 75 | |
| 76 | UINT8 pcdir; // Port C Direction Register |
| 77 | UINT8 pcdata; // Port C Data Register |
| 78 | UINT8 unused10[1]; |
| 79 | UINT8 pcsel; // Port C Select Register |
| 80 | UINT8 unused11[4]; |
| 81 | |
| 82 | UINT8 pddir; // Port D Direction Register |
| 83 | UINT8 pddata; // Port D Data Register |
| 84 | UINT8 pdpuen; // Port D Pullup Enable Register |
| 85 | UINT8 unused12[1]; |
| 86 | UINT8 pdpol; // Port D Polarity Register |
| 87 | UINT8 pdirqen; // Port D IRQ Enable Register |
| 88 | UINT8 pddataedge; // Port D Data Edge Level |
| 89 | UINT8 pdirqedge; // Port D IRQ Edge Register |
| 90 | |
| 91 | UINT8 pedir; // Port E Direction Register |
| 92 | UINT8 pedata; // Port E Data Register |
| 93 | UINT8 pepuen; // Port E Pullup Enable Register |
| 94 | UINT8 pesel; // Port E Select Register |
| 95 | UINT8 unused14[4]; |
| 96 | |
| 97 | UINT8 pfdir; // Port F Direction Register |
| 98 | UINT8 pfdata; // Port F Data Register |
| 99 | UINT8 pfpuen; // Port F Pullup Enable Register |
| 100 | UINT8 pfsel; // Port F Select Register |
| 101 | UINT8 unused15[4]; |
| 102 | |
| 103 | UINT8 pgdir; // Port G Direction Register |
| 104 | UINT8 pgdata; // Port G Data Register |
| 105 | UINT8 pgpuen; // Port G Pullup Enable Register |
| 106 | UINT8 pgsel; // Port G Select Register |
| 107 | UINT8 unused16[4]; |
| 108 | |
| 109 | UINT8 pjdir; // Port J Direction Register |
| 110 | UINT8 pjdata; // Port J Data Register |
| 111 | UINT8 unused17[1]; |
| 112 | UINT8 pjsel; // Port J Select Register |
| 113 | UINT8 unused18[4]; |
| 114 | UINT8 pkdir; // Port K Direction Register |
| 115 | UINT8 pkdata; // Port K Data Register |
| 116 | UINT8 pkpuen; // Port K Pullup Enable Register |
| 117 | UINT8 pksel; // Port K Select Register |
| 118 | UINT8 unused19[4]; |
| 119 | |
| 120 | UINT8 pmdir; // Port M Direction Register |
| 121 | UINT8 pmdata; // Port M Data Register |
| 122 | UINT8 pmpuen; // Port M Pullup Enable Register |
| 123 | UINT8 pmsel; // Port M Select Register |
| 124 | UINT8 unused20[180]; |
| 125 | |
| 126 | // $(FF)FFF500 |
| 127 | UINT16 pwmc; // PWM Control Register |
| 128 | UINT16 pwmp; // PWM Period Register |
| 129 | UINT16 pwmw; // PWM Width Register |
| 130 | UINT16 pwmcnt; // PWN Counter |
| 131 | UINT8 unused21[248]; |
| 132 | |
| 133 | // $(FF)FFF600 |
| 134 | UINT16 tctl[2]; // Timer Control Register |
| 135 | UINT16 tprer[2]; // Timer Prescaler Register |
| 136 | UINT16 tcmp[2]; // Timer Compare Register |
| 137 | UINT16 tcr[2]; // Timer Capture Register |
| 138 | UINT16 tcn[2]; // Timer Counter |
| 139 | UINT16 tstat[2]; // Timer Status |
| 140 | UINT16 wctlr; // Watchdog Control Register |
| 141 | UINT16 wcmpr; // Watchdog Compare Register |
| 142 | UINT16 wcn; // Watchdog Counter |
| 143 | UINT8 tclear[2]; // Timer Clearable Status |
| 144 | UINT8 unused22[224]; |
| 145 | |
| 146 | // $(FF)FFF700 |
| 147 | UINT16 spisr; // SPIS Register |
| 148 | UINT8 unused23[254]; |
| 149 | |
| 150 | // $(FF)FFF800 |
| 151 | UINT16 spimdata; // SPIM Data Register |
| 152 | UINT16 spimcont; // SPIM Control/Status Register |
| 153 | UINT8 unused24[252]; |
| 154 | |
| 155 | // $(FF)FFF900 |
| 156 | UINT16 ustcnt; // UART Status/Control Register |
| 157 | UINT16 ubaud; // UART Baud Control Register |
| 158 | UINT16 urx; // UART RX Register |
| 159 | UINT16 utx; // UART TX Register |
| 160 | UINT16 umisc; // UART Misc Register |
| 161 | UINT8 unused25[246]; |
| 162 | |
| 163 | // $(FF)FFFA00 |
| 164 | UINT32 lssa; // Screen Starting Address Register |
| 165 | UINT8 unused26[1]; |
| 166 | UINT8 lvpw; // Virtual Page Width Register |
| 167 | UINT8 unused27[2]; |
| 168 | UINT16 lxmax; // Screen Width Register |
| 169 | UINT16 lymax; // Screen Height Register |
| 170 | UINT8 unused28[12]; |
| 171 | UINT16 lcxp; // Cursor X Position |
| 172 | UINT16 lcyp; // Cursor Y Position |
| 173 | UINT16 lcwch; // Cursor Width & Height Register |
| 174 | UINT8 unused29[1]; |
| 175 | UINT8 lblkc; // Blink Control Register |
| 176 | UINT8 lpicf; // Panel Interface Config Register |
| 177 | UINT8 lpolcf; // Polarity Config Register |
| 178 | UINT8 unused30[1]; |
| 179 | UINT8 lacdrc; // ACD (M) Rate Control Register |
| 180 | UINT8 unused31[1]; |
| 181 | UINT8 lpxcd; // Pixel Clock Divider Register |
| 182 | UINT8 unused32[1]; |
| 183 | UINT8 lckcon; // Clocking Control Register |
| 184 | UINT8 unused33[1]; |
| 185 | UINT8 llbar; // Last Buffer Address Register |
| 186 | UINT8 unused34[1]; |
| 187 | UINT8 lotcr; // Octet Terminal Count Register |
| 188 | UINT8 unused35[1]; |
| 189 | UINT8 lposr; // Panning Offset Register |
| 190 | UINT8 unused36[3]; |
| 191 | UINT8 lfrcm; // Frame Rate Control Modulation Register |
| 192 | UINT16 lgpmr; // Gray Palette Mapping Register |
| 193 | UINT8 unused37[204]; |
| 194 | |
| 195 | // $(FF)FFFB00 |
| 196 | UINT32 hmsr; // RTC Hours Minutes Seconds Register |
| 197 | UINT32 alarm; // RTC Alarm Register |
| 198 | UINT8 unused38[4]; |
| 199 | UINT16 rtcctl; // RTC Control Register |
| 200 | UINT16 rtcisr; // RTC Interrupt Status Register |
| 201 | UINT16 rtcienr; // RTC Interrupt Enable Register |
| 202 | UINT16 stpwtch; // Stopwatch Minutes |
| 203 | UINT8 unused42[1260]; |
| 204 | }; |
| 205 | |
| 206 | struct mc68328_t |
| 207 | { |
| 208 | const mc68328_interface* iface; |
| 209 | |
| 210 | mc68328_regs_t regs; |
| 211 | |
| 212 | emu_timer *gptimer[2]; |
| 213 | emu_timer *rtc; |
| 214 | emu_timer *pwm; |
| 215 | |
| 216 | devcb_resolved_write8 out_port_a; /* 8-bit output */ |
| 217 | devcb_resolved_write8 out_port_b; /* 8-bit output */ |
| 218 | devcb_resolved_write8 out_port_c; /* 8-bit output */ |
| 219 | devcb_resolved_write8 out_port_d; /* 8-bit output */ |
| 220 | devcb_resolved_write8 out_port_e; /* 8-bit output */ |
| 221 | devcb_resolved_write8 out_port_f; /* 8-bit output */ |
| 222 | devcb_resolved_write8 out_port_g; /* 8-bit output */ |
| 223 | devcb_resolved_write8 out_port_j; /* 8-bit output */ |
| 224 | devcb_resolved_write8 out_port_k; /* 8-bit output */ |
| 225 | devcb_resolved_write8 out_port_m; /* 8-bit output */ |
| 226 | |
| 227 | devcb_resolved_read8 in_port_a; /* 8-bit input */ |
| 228 | devcb_resolved_read8 in_port_b; /* 8-bit input */ |
| 229 | devcb_resolved_read8 in_port_c; /* 8-bit input */ |
| 230 | devcb_resolved_read8 in_port_d; /* 8-bit input */ |
| 231 | devcb_resolved_read8 in_port_e; /* 8-bit input */ |
| 232 | devcb_resolved_read8 in_port_f; /* 8-bit input */ |
| 233 | devcb_resolved_read8 in_port_g; /* 8-bit input */ |
| 234 | devcb_resolved_read8 in_port_j; /* 8-bit input */ |
| 235 | devcb_resolved_read8 in_port_k; /* 8-bit input */ |
| 236 | devcb_resolved_read8 in_port_m; /* 8-bit input */ |
| 237 | |
| 238 | devcb_resolved_write8 out_pwm; /* 1-bit output */ |
| 239 | |
| 240 | devcb_resolved_write16 out_spim; /* 16-bit output */ |
| 241 | devcb_resolved_read16 in_spim; /* 16-bit input */ |
| 242 | }; |
| 243 | |
| 244 | #define SCR_BETO 0x80 |
| 245 | #define SCR_WPV 0x40 |
| 246 | #define SCR_PRV 0x20 |
| 247 | #define SCR_BETEN 0x10 |
| 248 | #define SCR_SO 0x08 |
| 249 | #define SCR_DMAP 0x04 |
| 250 | #define SCR_WDTH8 0x01 |
| 251 | |
| 252 | #define ICR_POL6 0x0100 |
| 253 | #define ICR_POL3 0x0200 |
| 254 | #define ICR_POL2 0x0400 |
| 255 | #define ICR_POL1 0x0800 |
| 256 | #define ICR_ET6 0x1000 |
| 257 | #define ICR_ET3 0x2000 |
| 258 | #define ICR_ET2 0x4000 |
| 259 | #define ICR_ET1 0x8000 |
| 260 | |
| 261 | #define INT_SPIM 0x000001 |
| 262 | #define INT_TIMER2 0x000002 |
| 263 | #define INT_UART 0x000004 |
| 264 | #define INT_WDT 0x000008 |
| 265 | #define INT_RTC 0x000010 |
| 266 | #define INT_RESERVED 0x000020 |
| 267 | #define INT_KB 0x000040 |
| 268 | #define INT_PWM 0x000080 |
| 269 | #define INT_INT0 0x000100 |
| 270 | #define INT_INT1 0x000200 |
| 271 | #define INT_INT2 0x000400 |
| 272 | #define INT_INT3 0x000800 |
| 273 | #define INT_INT4 0x001000 |
| 274 | #define INT_INT5 0x002000 |
| 275 | #define INT_INT6 0x004000 |
| 276 | #define INT_INT7 0x008000 |
| 277 | #define INT_KBDINTS 0x00ff00 |
| 278 | #define INT_IRQ1 0x010000 |
| 279 | #define INT_IRQ2 0x020000 |
| 280 | #define INT_IRQ3 0x040000 |
| 281 | #define INT_IRQ6 0x080000 |
| 282 | #define INT_PEN 0x100000 |
| 283 | #define INT_SPIS 0x200000 |
| 284 | #define INT_TIMER1 0x400000 |
| 285 | #define INT_IRQ7 0x800000 |
| 286 | |
| 287 | #define INT_M68K_LINE1 (INT_IRQ1) |
| 288 | #define INT_M68K_LINE2 (INT_IRQ2) |
| 289 | #define INT_M68K_LINE3 (INT_IRQ3) |
| 290 | #define INT_M68K_LINE4 (INT_INT0 | INT_INT1 | INT_INT2 | INT_INT3 | INT_INT4 | INT_INT5 | INT_INT6 | INT_INT7 | \ |
| 291 | INT_PWM | INT_KB | INT_RTC | INT_WDT | INT_UART | INT_TIMER2 | INT_SPIM) |
| 292 | #define INT_M68K_LINE5 (INT_PEN) |
| 293 | #define INT_M68K_LINE6 (INT_IRQ6 | INT_TIMER1 | INT_SPIS) |
| 294 | #define INT_M68K_LINE7 (INT_IRQ7) |
| 295 | #define INT_M68K_LINE67 (INT_M68K_LINE6 | INT_M68K_LINE7) |
| 296 | #define INT_M68K_LINE567 (INT_M68K_LINE5 | INT_M68K_LINE6 | INT_M68K_LINE7) |
| 297 | #define INT_M68K_LINE4567 (INT_M68K_LINE4 | INT_M68K_LINE5 | INT_M68K_LINE6 | INT_M68K_LINE7) |
| 298 | #define INT_M68K_LINE34567 (INT_M68K_LINE3 | INT_M68K_LINE4 | INT_M68K_LINE5 | INT_M68K_LINE6 | INT_M68K_LINE7) |
| 299 | #define INT_M68K_LINE234567 (INT_M68K_LINE2 | INT_M68K_LINE3 | INT_M68K_LINE4 | INT_M68K_LINE5 | INT_M68K_LINE6 | INT_M68K_LINE7) |
| 300 | |
| 301 | #define INT_IRQ1_SHIFT 0x000001 |
| 302 | #define INT_IRQ2_SHIFT 0x000002 |
| 303 | #define INT_IRQ3_SHIFT 0x000004 |
| 304 | #define INT_IRQ6_SHIFT 0x000008 |
| 305 | #define INT_PEN_SHIFT 0x000010 |
| 306 | #define INT_SPIS_SHIFT 0x000020 |
| 307 | #define INT_TIMER1_SHIFT 0x000040 |
| 308 | #define INT_IRQ7_SHIFT 0x000080 |
| 309 | |
| 310 | #define INT_ACTIVE 1 |
| 311 | #define INT_INACTIVE 0 |
| 312 | |
| 313 | #define GRPBASE_BASE_ADDR 0xfff0 |
| 314 | #define GRPBASE_VALID 0x0001 |
| 315 | |
| 316 | #define GRPMASK_BASE_MASK 0xfff0 |
| 317 | |
| 318 | #define CSAB_COMPARE 0xff000000 |
| 319 | #define CSAB_BSW 0x00010000 |
| 320 | #define CSAB_MASK 0x0000ff00 |
| 321 | #define CSAB_RO 0x00000008 |
| 322 | #define CSAB_WAIT 0x00000007 |
| 323 | |
| 324 | #define CSCD_COMPARE 0xfff00000 |
| 325 | #define CSCD_BSW 0x00010000 |
| 326 | #define CSCD_MASK 0x0000fff0 |
| 327 | #define CSCD_RO 0x00000008 |
| 328 | #define CSCD_WAIT 0x00000007 |
| 329 | |
| 330 | #define PLLCR_PIXCLK_SEL 0x3800 |
| 331 | #define PLLCR_PIXCLK_SEL_DIV2 0x0000 |
| 332 | #define PLLCR_PIXCLK_SEL_DIV4 0x0800 |
| 333 | #define PLLCR_PIXCLK_SEL_DIV8 0x1000 |
| 334 | #define PLLCR_PIXCLK_SEL_DIV16 0x1800 |
| 335 | #define PLLCR_PIXCLK_SEL_DIV1_0 0x2000 |
| 336 | #define PLLCR_PIXCLK_SEL_DIV1_1 0x2800 |
| 337 | #define PLLCR_PIXCLK_SEL_DIV1_2 0x3000 |
| 338 | #define PLLCR_PIXCLK_SEL_DIV1_3 0x3800 |
| 339 | #define PLLCR_SYSCLK_SEL 0x0700 |
| 340 | #define PLLCR_SYSCLK_SEL_DIV2 0x0000 |
| 341 | #define PLLCR_SYSCLK_SEL_DIV4 0x0100 |
| 342 | #define PLLCR_SYSCLK_SEL_DIV8 0x0200 |
| 343 | #define PLLCR_SYSCLK_SEL_DIV16 0x0300 |
| 344 | #define PLLCR_SYSCLK_SEL_DIV1_0 0x0400 |
| 345 | #define PLLCR_SYSCLK_SEL_DIV1_1 0x0500 |
| 346 | #define PLLCR_SYSCLK_SEL_DIV1_2 0x0600 |
| 347 | #define PLLCR_SYSCLK_SEL_DIV1_3 0x0700 |
| 348 | #define PLLCR_CLKEN 0x0010 |
| 349 | #define PLLCR_DISPLL 0x0008 |
| 350 | |
| 351 | #define PLLFSR_CLK32 0x8000 |
| 352 | #define PLLFSR_PROT 0x4000 |
| 353 | #define PLLFSR_QCNT 0x0f00 |
| 354 | #define PLLFSR_PCNT 0x00ff |
| 355 | |
| 356 | #define PCTLR_PC_EN 0x80 |
| 357 | #define PCTLR_STOP 0x40 |
| 358 | #define PCTLR_WIDTH 0x1f |
| 359 | |
| 360 | #define CXP_CC 0xc000 |
| 361 | #define CXP_CC_XLU 0x0000 |
| 362 | #define CXP_CC_BLACK 0x4000 |
| 363 | #define CXP_CC_INVERSE 0x8000 |
| 364 | #define CXP_CC_INVALID 0xc000 |
| 365 | #define CXP_MASK 0x03ff |
| 366 | |
| 367 | #define CYP_MASK 0x01ff |
| 368 | |
| 369 | #define CWCH_CW 0x1f00 |
| 370 | #define CWCH_CH 0x001f |
| 371 | |
| 372 | #define BLKC_BKEN 0x80 |
| 373 | #define BLKC_BD 0x7f |
| 374 | |
| 375 | #define LPICF_PBSIZ 0x06 |
| 376 | #define LPICF_PBSIZ_1 0x00 |
| 377 | #define LPICF_PBSIZ_2 0x02 |
| 378 | #define LPICF_PBSIZ_4 0x04 |
| 379 | #define LPICF_PBSIZ_INVALID 0x06 |
| 380 | |
| 381 | #define LPOLCF_LCKPOL 0x08 |
| 382 | #define LPOLCF_FLMPOL 0x04 |
| 383 | #define LPOLCF_LPPOL 0x02 |
| 384 | #define LPOLCF_PIXPOL 0x01 |
| 385 | |
| 386 | #define LACDRC_MASK 0x0f |
| 387 | |
| 388 | #define LPXCD_MASK 0x3f |
| 389 | |
| 390 | #define LCKCON_LCDC_EN 0x80 |
| 391 | #define LCKCON_LCDON 0x80 |
| 392 | #define LCKCON_DMA16 0x40 |
| 393 | #define LCKCON_WS 0x30 |
| 394 | #define LCKCON_WS_1 0x00 |
| 395 | #define LCKCON_WS_2 0x10 |
| 396 | #define LCKCON_WS_3 0x20 |
| 397 | #define LCKCON_WS_4 0x30 |
| 398 | #define LCKCON_DWIDTH 0x02 |
| 399 | #define LCKCON_PCDS 0x01 |
| 400 | |
| 401 | #define LBAR_MASK 0x7f |
| 402 | |
| 403 | #define LPOSR_BOS 0x08 |
| 404 | #define LPOSR_POS 0x07 |
| 405 | |
| 406 | #define LFRCM_XMOD 0xf0 |
| 407 | #define LFRCM_YMOD 0x0f |
| 408 | |
| 409 | #define LGPMR_PAL1 0x7000 |
| 410 | #define LGPMR_PAL0 0x0700 |
| 411 | #define LGPMR_PAL3 0x0070 |
| 412 | #define LGPMR_PAL2 0x0007 |
| 413 | |
| 414 | #define RTCHMSR_HOURS 0x1f000000 |
| 415 | #define RTCHMSR_MINUTES 0x003f0000 |
| 416 | #define RTCHMSR_SECONDS 0x0000003f |
| 417 | |
| 418 | #define RTCCTL_38_4 0x0020 |
| 419 | #define RTCCTL_ENABLE 0x0080 |
| 420 | |
| 421 | #define RTCINT_STOPWATCH 0x0001 |
| 422 | #define RTCINT_MINUTE 0x0002 |
| 423 | #define RTCINT_ALARM 0x0004 |
| 424 | #define RTCINT_DAY 0x0008 |
| 425 | #define RTCINT_SECOND 0x0010 |
| 426 | |
| 427 | #define RTCSTPWTCH_MASK 0x003f |
| 428 | |
| 429 | #define TCTL_TEN 0x0001 |
| 430 | #define TCTL_TEN_ENABLE 0x0001 |
| 431 | #define TCTL_CLKSOURCE 0x000e |
| 432 | #define TCTL_CLKSOURCE_STOP 0x0000 |
| 433 | #define TCTL_CLKSOURCE_SYSCLK 0x0002 |
| 434 | #define TCTL_CLKSOURCE_SYSCLK16 0x0004 |
| 435 | #define TCTL_CLKSOURCE_TIN 0x0006 |
| 436 | #define TCTL_CLKSOURCE_32KHZ4 0x0008 |
| 437 | #define TCTL_CLKSOURCE_32KHZ5 0x000a |
| 438 | #define TCTL_CLKSOURCE_32KHZ6 0x000c |
| 439 | #define TCTL_CLKSOURCE_32KHZ7 0x000e |
| 440 | #define TCTL_IRQEN 0x0010 |
| 441 | #define TCTL_IRQEN_ENABLE 0x0010 |
| 442 | #define TCTL_OM 0x0020 |
| 443 | #define TCTL_OM_ACTIVELOW 0x0000 |
| 444 | #define TCTL_OM_TOGGLE 0x0020 |
| 445 | #define TCTL_CAPTURE 0x00c0 |
| 446 | #define TCTL_CAPTURE_NOINT 0x0000 |
| 447 | #define TCTL_CAPTURE_RISING 0x0040 |
| 448 | #define TCTL_CAPTURE_FALLING 0x0080 |
| 449 | #define TCTL_CAPTURE_BOTH 0x00c0 |
| 450 | #define TCTL_FRR 0x0100 |
| 451 | #define TCTL_FRR_RESTART 0x0000 |
| 452 | #define TCTL_FRR_FREERUN 0x0100 |
| 453 | |
| 454 | #define TSTAT_COMP 0x0001 |
| 455 | #define TSTAT_CAPT 0x0002 |
| 456 | |
| 457 | #define WCTLR_WDRST 0x0008 |
| 458 | #define WCTLR_LOCK 0x0004 |
| 459 | #define WCTLR_FI 0x0002 |
| 460 | #define WCTLR_WDEN 0x0001 |
| 461 | |
| 462 | #define USTCNT_UART_EN 0x8000 |
| 463 | #define USTCNT_RX_EN 0x4000 |
| 464 | #define USTCNT_TX_EN 0x2000 |
| 465 | #define USTCNT_RX_CLK_CONT 0x1000 |
| 466 | #define USTCNT_PARITY_EN 0x0800 |
| 467 | #define USTCNT_ODD_EVEN 0x0400 |
| 468 | #define USTCNT_STOP_BITS 0x0200 |
| 469 | #define USTCNT_8_7 0x0100 |
| 470 | #define USTCNT_GPIO_DELTA_EN 0x0080 |
| 471 | #define USTCNT_CTS_DELTA_EN 0x0040 |
| 472 | #define USTCNT_RX_FULL_EN 0x0020 |
| 473 | #define USTCNT_RX_HALF_EN 0x0010 |
| 474 | #define USTCNT_RX_RDY_EN 0x0008 |
| 475 | #define USTCNT_TX_EMPTY_EN 0x0004 |
| 476 | #define USTCNT_TX_HALF_EN 0x0002 |
| 477 | #define USTCNT_TX_AVAIL_EN 0x0001 |
| 478 | |
| 479 | #define UBAUD_GPIO_DELTA 0x8000 |
| 480 | #define UBAUD_GPIO 0x4000 |
| 481 | #define UBAUD_GPIO_DIR 0x2000 |
| 482 | #define UBAUD_GPIO_SRC 0x1000 |
| 483 | #define UBAUD_BAUD_SRC 0x0800 |
| 484 | #define UBAUD_DIVIDE 0x0700 |
| 485 | #define UBAUD_DIVIDE_1 0x0000 |
| 486 | #define UBAUD_DIVIDE_2 0x0100 |
| 487 | #define UBAUD_DIVIDE_4 0x0200 |
| 488 | #define UBAUD_DIVIDE_8 0x0300 |
| 489 | #define UBAUD_DIVIDE_16 0x0400 |
| 490 | #define UBAUD_DIVIDE_32 0x0500 |
| 491 | #define UBAUD_DIVIDE_64 0x0600 |
| 492 | #define UBAUD_DIVIDE_128 0x0700 |
| 493 | #define UBAUD_PRESCALER 0x00ff |
| 494 | |
| 495 | #define URX_FIFO_FULL 0x8000 |
| 496 | #define URX_FIFO_HALF 0x4000 |
| 497 | #define URX_DATA_READY 0x2000 |
| 498 | #define URX_OVRUN 0x0800 |
| 499 | #define URX_FRAME_ERROR 0x0400 |
| 500 | #define URX_BREAK 0x0200 |
| 501 | #define URX_PARITY_ERROR 0x0100 |
| 502 | |
| 503 | #define UTX_FIFO_EMPTY 0x8000 |
| 504 | #define UTX_FIFO_HALF 0x4000 |
| 505 | #define UTX_TX_AVAIL 0x2000 |
| 506 | #define UTX_SEND_BREAK 0x1000 |
| 507 | #define UTX_IGNORE_CTS 0x0800 |
| 508 | #define UTX_CTS_STATUS 0x0200 |
| 509 | #define UTX_CTS_DELTA 0x0100 |
| 510 | |
| 511 | #define UMISC_CLK_SRC 0x4000 |
| 512 | #define UMISC_FORCE_PERR 0x2000 |
| 513 | #define UMISC_LOOP 0x1000 |
| 514 | #define UMISC_RTS_CONT 0x0080 |
| 515 | #define UMISC_RTS 0x0040 |
| 516 | #define UMISC_IRDA_ENABLE 0x0020 |
| 517 | #define UMISC_IRDA_LOOP 0x0010 |
| 518 | |
| 519 | #define SPIS_SPIS_IRQ 0x8000 |
| 520 | #define SPIS_IRQEN 0x4000 |
| 521 | #define SPIS_ENPOL 0x2000 |
| 522 | #define SPIS_DATA_RDY 0x1000 |
| 523 | #define SPIS_OVRWR 0x0800 |
| 524 | #define SPIS_PHA 0x0400 |
| 525 | #define SPIS_POL 0x0200 |
| 526 | #define SPIS_SPISEN 0x0100 |
| 527 | |
| 528 | #define SPIM_CLOCK_COUNT 0x000f |
| 529 | #define SPIM_POL 0x0010 |
| 530 | #define SPIM_POL_HIGH 0x0000 |
| 531 | #define SPIM_POL_LOW 0x0010 |
| 532 | #define SPIM_PHA 0x0020 |
| 533 | #define SPIM_PHA_NORMAL 0x0000 |
| 534 | #define SPIM_PHA_OPPOSITE 0x0020 |
| 535 | #define SPIM_IRQEN 0x0040 |
| 536 | #define SPIM_SPIMIRQ 0x0080 |
| 537 | #define SPIM_XCH 0x0100 |
| 538 | #define SPIM_XCH_IDLE 0x0000 |
| 539 | #define SPIM_XCH_INIT 0x0100 |
| 540 | #define SPIM_SPMEN 0x0200 |
| 541 | #define SPIM_SPMEN_DISABLE 0x0000 |
| 542 | #define SPIM_SPMEN_ENABLE 0x0200 |
| 543 | #define SPIM_RATE 0xe000 |
| 544 | #define SPIM_RATE_4 0x0000 |
| 545 | #define SPIM_RATE_8 0x2000 |
| 546 | #define SPIM_RATE_16 0x4000 |
| 547 | #define SPIM_RATE_32 0x6000 |
| 548 | #define SPIM_RATE_64 0x8000 |
| 549 | #define SPIM_RATE_128 0xa000 |
| 550 | #define SPIM_RATE_256 0xc000 |
| 551 | #define SPIM_RATE_512 0xe000 |
| 552 | |
| 553 | #define PWMC_PWMIRQ 0x8000 |
| 554 | #define PWMC_IRQEN 0x4000 |
| 555 | #define PWMC_LOAD 0x0100 |
| 556 | #define PWMC_PIN 0x0080 |
| 557 | #define PWMC_POL 0x0040 |
| 558 | #define PWMC_PWMEN 0x0010 |
| 559 | #define PWMC_CLKSEL 0x0007 |
| 560 | |
| 561 | INLINE mc68328_t* mc68328_get_safe_token( device_t *device ) |
| 562 | { |
| 563 | assert( device != NULL ); |
| 564 | assert( device->type() == MC68328 ); |
| 565 | return (mc68328_t*) downcast<mc68328_device *>(device)->token(); |
| 566 | } |
| 567 | |
| 568 | #endif // __MC68328_PRIVATE_H_ |
trunk/src/mess/includes/mc68328.h
| r21686 | r21687 | |
| 1 | | /********************************************************************** |
| 2 | | |
| 3 | | Motorola 68328 ("DragonBall") System-on-a-Chip implementation |
| 4 | | |
| 5 | | By MooglyGuy |
| 6 | | contact mooglyguy@gmail.com with licensing and usage questions. |
| 7 | | |
| 8 | | **********************************************************************/ |
| 9 | | |
| 10 | | /***************************************************************************************************************** |
| 11 | | |
| 12 | | P P P P P P P P P P P P P P |
| 13 | | E E E E E E E J J J J J J J |
| 14 | | 1 2 3 4 5 6 7 0 1 2 3 4 5 6 |
| 15 | | D D D D D / / / / / / / / / / / / / / |
| 16 | | 3 4 5 6 7 ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! |
| 17 | | / / / / / ! ! C C C C C C C C C C C C C C C |
| 18 | | P V P P P P D D G D D D D T T L U V S S S S S S S S G S S S S S S S |
| 19 | | B C B B B B D D 1 1 N 1 1 1 1 M C W W C A A A A B B B B N C C C C D D D |
| 20 | | 3 C 4 5 6 7 8 9 0 1 D 2 3 4 5 S K E E C 0 1 2 3 0 1 2 3 D 0 1 2 3 0 1 2 |
| 21 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| 22 | | +-------------------------------------------------------------------------------+ |
| 23 | | | | |
| 24 | | | | |
| 25 | | | | |
| 26 | | | | |
| 27 | | | | |
| 28 | | D2/PB2--| |--PJ7/!CSD3 |
| 29 | | D1/PB1--| |--VCC |
| 30 | | D0/PB0--| |--PD0/!KBD0/!INT0 |
| 31 | | TDO--| |--PD1/!KBD1/!INT1 |
| 32 | | TDI--| |--PD2/!KBD2/!INT2 |
| 33 | | GND--| |--PD3/!KBD3/!INT3 |
| 34 | | !OE--| |--PD4/!KBD4/!INT4 |
| 35 | | !UDS/PC1--| |--PD5/!KBD5/!INT5 |
| 36 | | !AS--| |--PD6/!KBD6/!INT6 |
| 37 | | A0--| |--PD7/!KBD7/!INT7 |
| 38 | | !LDS--| |--GND |
| 39 | | R/!W--| |--LD0 |
| 40 | | !DTACK/PC5--| |--LD1 |
| 41 | | !RESET--| |--LD2 |
| 42 | | VCC--| |--LD3 |
| 43 | | !WE/PC6--| |--LFRM |
| 44 | | !JTAGRST--| |--LLP |
| 45 | | BBUSW--| MC68328PV |--LCLK |
| 46 | | A1--| TOP VIEW |--LACD |
| 47 | | A2--| |--VCC |
| 48 | | A3--| |--PK0/SPMTXD0 |
| 49 | | A4--| |--PK1/SPMRXD0 |
| 50 | | A5--| |--PK2/SPMCLK0 |
| 51 | | A6--| |--PK3/SPSEN |
| 52 | | GND--| |--PK4/SPSRXD1 |
| 53 | | A7--| |--PK5/SPSCLK1 |
| 54 | | A8--| |--PK6/!CE2 |
| 55 | | A9--| |--PK7/!CE1 |
| 56 | | A10--| |--GND |
| 57 | | A11--| |--PM0/!CTS |
| 58 | | A12--| |--PM1/!RTS |
| 59 | | A13--| |--PM2/!IRQ6 |
| 60 | | A14--| |--PM3/!IRQ3 |
| 61 | | VCC--| |--PM4/!IRQ2 |
| 62 | | A15--| |--PM5/!IRQ1 |
| 63 | | A16/PA0--| |--PM6/!PENIRQ |
| 64 | | | | |
| 65 | | | _ | |
| 66 | | | (_) | |
| 67 | | |\ | |
| 68 | | | \ | |
| 69 | | +-------------------------------------------------------------------------------+ |
| 70 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| 71 | | P P P P P G P P P P P P P P V P P P P P P P P G P P P V C G P P P E X P |
| 72 | | A A A A A N A A F F F F F F C F F G G G G G G N G G C C L N C M L X T L |
| 73 | | 1 2 3 4 5 D 6 7 0 1 2 3 4 5 C 6 7 7 6 5 4 3 2 D 1 0 0 C K D 4 7 L T A L |
| 74 | | / / / / / / / / / / / / / / / / / / / / / / / / O / / G A L V |
| 75 | | A A A A A A A A A A A A A A A R T ! T ! P R T M ! U N L C |
| 76 | | 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 T I T I T W X X O I A D C |
| 77 | | 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 C N O N O M D D C R R |
| 78 | | O 1 U 2 U O L Q T |
| 79 | | T T K 7 G |
| 80 | | 1 2 P |
| 81 | | I |
| 82 | | O |
| 83 | | |
| 84 | | Figure 12-1. MC68328 144-Lead Plastic Thin-Quad Flat Pack Pin Assignment |
| 85 | | |
| 86 | | Source: MC68328 (DragonBall)(tm) Integrated Processor User's Manual |
| 87 | | |
| 88 | | *****************************************************************************************************************/ |
| 89 | | |
| 90 | | #ifndef __MC68328_H_ |
| 91 | | #define __MC68328_H_ |
| 92 | | |
| 93 | | /*************************************************************************** |
| 94 | | TYPE DEFINITIONS |
| 95 | | ***************************************************************************/ |
| 96 | | |
| 97 | | struct mc68328_interface |
| 98 | | { |
| 99 | | const char *m68k_cpu_tag; |
| 100 | | |
| 101 | | devcb_write8 out_port_a_func; /* 8-bit output */ |
| 102 | | devcb_write8 out_port_b_func; /* 8-bit output */ |
| 103 | | devcb_write8 out_port_c_func; /* 8-bit output */ |
| 104 | | devcb_write8 out_port_d_func; /* 8-bit output */ |
| 105 | | devcb_write8 out_port_e_func; /* 8-bit output */ |
| 106 | | devcb_write8 out_port_f_func; /* 8-bit output */ |
| 107 | | devcb_write8 out_port_g_func; /* 8-bit output */ |
| 108 | | devcb_write8 out_port_j_func; /* 8-bit output */ |
| 109 | | devcb_write8 out_port_k_func; /* 8-bit output */ |
| 110 | | devcb_write8 out_port_m_func; /* 8-bit output */ |
| 111 | | |
| 112 | | devcb_read8 in_port_a_func; /* 8-bit input */ |
| 113 | | devcb_read8 in_port_b_func; /* 8-bit input */ |
| 114 | | devcb_read8 in_port_c_func; /* 8-bit input */ |
| 115 | | devcb_read8 in_port_d_func; /* 8-bit input */ |
| 116 | | devcb_read8 in_port_e_func; /* 8-bit input */ |
| 117 | | devcb_read8 in_port_f_func; /* 8-bit input */ |
| 118 | | devcb_read8 in_port_g_func; /* 8-bit input */ |
| 119 | | devcb_read8 in_port_j_func; /* 8-bit input */ |
| 120 | | devcb_read8 in_port_k_func; /* 8-bit input */ |
| 121 | | devcb_read8 in_port_m_func; /* 8-bit input */ |
| 122 | | |
| 123 | | devcb_write8 out_pwm_func; /* 1-bit output */ |
| 124 | | |
| 125 | | devcb_write16 out_spim_func; /* 16-bit output */ |
| 126 | | devcb_read16 in_spim_func; /* 16-bit input */ |
| 127 | | void (*spim_xch_trigger)( device_t *device ); /* SPIM exchange trigger */ |
| 128 | | }; |
| 129 | | #define MC68328_INTERFACE(name) const mc68328_interface (name)= |
| 130 | | |
| 131 | | #define MC68328_TAG "dragonball" |
| 132 | | |
| 133 | | /*************************************************************************** |
| 134 | | DEVICE CONFIGURATION MACROS |
| 135 | | ***************************************************************************/ |
| 136 | | |
| 137 | | #define MCFG_MC68328_ADD(_intrf) \ |
| 138 | | MCFG_DEVICE_ADD("dragonball", MC68328, 0) \ |
| 139 | | MCFG_DEVICE_CONFIG(_intrf) |
| 140 | | |
| 141 | | /*----------- defined in machine/mc68328.c -----------*/ |
| 142 | | |
| 143 | | /*************************************************************************** |
| 144 | | READ/WRITE HANDLERS |
| 145 | | ***************************************************************************/ |
| 146 | | |
| 147 | | DECLARE_WRITE16_DEVICE_HANDLER( mc68328_w ); |
| 148 | | DECLARE_READ16_DEVICE_HANDLER( mc68328_r ); |
| 149 | | |
| 150 | | |
| 151 | | /*************************************************************************** |
| 152 | | EXTERNAL I/O LINES |
| 153 | | ***************************************************************************/ |
| 154 | | |
| 155 | | void mc68328_set_penirq_line(device_t *device, int state); |
| 156 | | void mc68328_set_port_d_lines(device_t *device, UINT8 state, int bit); |
| 157 | | |
| 158 | | /*************************************************************************** |
| 159 | | DEVICE INTERFACE |
| 160 | | ***************************************************************************/ |
| 161 | | |
| 162 | | class mc68328_device : public device_t |
| 163 | | { |
| 164 | | public: |
| 165 | | mc68328_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 166 | | ~mc68328_device() { global_free(m_token); } |
| 167 | | |
| 168 | | // access to legacy token |
| 169 | | void *token() const { assert(m_token != NULL); return m_token; } |
| 170 | | protected: |
| 171 | | // device-level overrides |
| 172 | | virtual void device_config_complete(); |
| 173 | | virtual void device_start(); |
| 174 | | virtual void device_reset(); |
| 175 | | private: |
| 176 | | // internal state |
| 177 | | void *m_token; |
| 178 | | }; |
| 179 | | |
| 180 | | extern const device_type MC68328; |
| 181 | | |
| 182 | | |
| 183 | | /*----------- defined in video/mc68328.c -----------*/ |
| 184 | | |
| 185 | | /*************************************************************************** |
| 186 | | VIDEO INTERFACE |
| 187 | | ***************************************************************************/ |
| 188 | | |
| 189 | | PALETTE_INIT( mc68328 ); |
| 190 | | VIDEO_START( mc68328 ); |
| 191 | | SCREEN_UPDATE_IND16( mc68328 ); |
| 192 | | |
| 193 | | #endif // __MC68328_H_ |