src/mess/drivers/gp32.c
| r6543 | r6544 | |
| 107 | 107 | |
| 108 | 108 | static UINT32 s3c240x_clkpow_regs[0x18/4]; |
| 109 | 109 | |
| 110 | #define MPLLCON 1 |
| 111 | #define UPLLCON 2 |
| 112 | |
| 110 | 113 | static UINT32 s3c240x_get_fclk( int reg) |
| 111 | 114 | { |
| 112 | 115 | UINT32 data, mdiv, pdiv, sdiv; |
| r6543 | r6544 | |
| 152 | 155 | { |
| 153 | 156 | // logerror( "(CLKPOW) %08X <- %08X\n", 0x14800000 + (offset << 2), data); |
| 154 | 157 | COMBINE_DATA(&s3c240x_clkpow_regs[offset]); |
| 158 | switch (offset) |
| 159 | { |
| 160 | // MPLLCON |
| 161 | case 0x04 / 4 : |
| 162 | { |
| 163 | cputag_set_clock( space->machine, "maincpu", s3c240x_get_fclk( MPLLCON)); |
| 164 | } |
| 165 | break; |
| 166 | } |
| 155 | 167 | } |
| 156 | 168 | |
| 157 | 169 | // INTERRUPT CONTROLLER |
| r6543 | r6544 | |
| 227 | 239 | logerror( "starting timer %d\n", timer); |
| 228 | 240 | prescaler = (s3c240x_timer_regs[0] >> prescaler_shift[timer]) & 0xFF; |
| 229 | 241 | mux = (s3c240x_timer_regs[1] >> mux_shift[timer]) & 0x0F; |
| 230 | | freq = s3c240x_get_pclk( 1) / (prescaler + 1) / mux_table[mux]; |
| 242 | freq = s3c240x_get_pclk( MPLLCON) / (prescaler + 1) / mux_table[mux]; |
| 231 | 243 | cnt = s3c240x_timer_regs[count_reg+0] & 0xFFFF; |
| 232 | 244 | if (timer != 4) |
| 233 | 245 | cmp = s3c240x_timer_regs[count_reg+1] & 0xFFFF; |
| 234 | 246 | else |
| 235 | 247 | cmp = 0; |
| 236 | 248 | hz = (double)((prescaler + 1) * mux_table[mux]) / (cnt - cmp + 1); |
| 237 | | // logerror( "TIMER %d - FCLK=%d HCLK=%d PCLK=%d prescaler=%d div=%d freq=%d cnt=%d cmp=%d hz=%f\n", timer, s3c240x_get_fclk( 1), s3c240x_get_hclk( 1), s3c240x_get_pclk( 1), prescaler, mux_table[mux], freq, cnt, cmp, hz); |
| 249 | // logerror( "TIMER %d - FCLK=%d HCLK=%d PCLK=%d prescaler=%d div=%d freq=%d cnt=%d cmp=%d hz=%f\n", timer, s3c240x_get_fclk( MPLLCON), s3c240x_get_hclk( MPLLCON), s3c240x_get_pclk( MPLLCON), prescaler, mux_table[mux], freq, cnt, cmp, hz); |
| 238 | 250 | if (ctrl_bits & 8) // auto reload |
| 239 | 251 | { |
| 240 | 252 | timer_adjust_periodic( s3c240x_timers[timer], ATTOTIME_IN_HZ( hz), timer, ATTOTIME_IN_HZ( hz)); |