trunk/src/mame/drivers/39in1.c
| r18599 | r18600 | |
| 79 | 79 | TIMER_CALLBACK_MEMBER(pxa255_dma_dma_end); |
| 80 | 80 | TIMER_CALLBACK_MEMBER(pxa255_ostimer_match); |
| 81 | 81 | TIMER_CALLBACK_MEMBER(pxa255_lcd_dma_eof); |
| 82 | void pxa255_dma_irq_check(); |
| 83 | void pxa255_dma_load_descriptor_and_start(int channel); |
| 84 | void pxa255_ostimer_irq_check(); |
| 85 | void pxa255_update_interrupts(); |
| 86 | void pxa255_set_irq_line(UINT32 line, int state); |
| 87 | void pxa255_lcd_load_dma_descriptor(address_space & space, UINT32 address, int channel); |
| 88 | void pxa255_lcd_irq_check(); |
| 89 | void pxa255_lcd_dma_kickoff(int channel); |
| 90 | void pxa255_lcd_check_load_next_branch(int channel); |
| 91 | void pxa255_start(); |
| 82 | 92 | }; |
| 83 | 93 | |
| 84 | 94 | |
| 85 | | static void pxa255_dma_irq_check(running_machine& machine); |
| 86 | | |
| 87 | | |
| 88 | | |
| 89 | | |
| 90 | | |
| 91 | | |
| 92 | | static void pxa255_ostimer_irq_check(running_machine& machine); |
| 93 | | |
| 94 | | |
| 95 | | |
| 96 | | |
| 97 | | static void pxa255_update_interrupts(running_machine& machine); |
| 98 | | static void pxa255_set_irq_line(running_machine& machine, UINT32 line, int state); |
| 99 | | |
| 100 | | |
| 101 | | |
| 102 | | |
| 103 | | |
| 104 | | |
| 105 | | static void pxa255_lcd_load_dma_descriptor(address_space & space, UINT32 address, int channel); |
| 106 | | static void pxa255_lcd_irq_check(running_machine& machine); |
| 107 | | static void pxa255_lcd_dma_kickoff(running_machine& machine, int channel); |
| 108 | | static void pxa255_lcd_check_load_next_branch(running_machine& machine, int channel); |
| 109 | | |
| 110 | | |
| 111 | | |
| 112 | 95 | #define VERBOSE_LEVEL ( 3 ) |
| 113 | 96 | |
| 114 | 97 | INLINE void ATTR_PRINTF(3,4) verboselog( running_machine& machine, int n_level, const char* s_fmt, ... ) |
| r18599 | r18600 | |
| 245 | 228 | |
| 246 | 229 | */ |
| 247 | 230 | |
| 248 | | static void pxa255_dma_irq_check(running_machine& machine) |
| 231 | void _39in1_state::pxa255_dma_irq_check() |
| 249 | 232 | { |
| 250 | | _39in1_state *state = machine.driver_data<_39in1_state>(); |
| 251 | | PXA255_DMA_Regs *dma_regs = &state->m_dma_regs; |
| 233 | PXA255_DMA_Regs *dma_regs = &m_dma_regs; |
| 252 | 234 | int channel = 0; |
| 253 | 235 | int set_intr = 0; |
| 254 | 236 | |
| r18599 | r18600 | |
| 265 | 247 | } |
| 266 | 248 | } |
| 267 | 249 | |
| 268 | | pxa255_set_irq_line(machine, PXA255_INT_DMA, set_intr); |
| 250 | pxa255_set_irq_line(PXA255_INT_DMA, set_intr); |
| 269 | 251 | } |
| 270 | 252 | |
| 271 | | static void pxa255_dma_load_descriptor_and_start(running_machine& machine, int channel) |
| 253 | void _39in1_state::pxa255_dma_load_descriptor_and_start(int channel) |
| 272 | 254 | { |
| 273 | | _39in1_state *state = machine.driver_data<_39in1_state>(); |
| 274 | | PXA255_DMA_Regs *dma_regs = &state->m_dma_regs; |
| 255 | PXA255_DMA_Regs *dma_regs = &m_dma_regs; |
| 275 | 256 | attotime period; |
| 276 | 257 | |
| 277 | 258 | // Shut down any transfers that are currently going on, software should be smart enough to check if a |
| r18599 | r18600 | |
| 283 | 264 | |
| 284 | 265 | // Load the next descriptor |
| 285 | 266 | |
| 286 | | address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM); |
| 267 | address_space &space = machine().device<pxa255_device>("maincpu")->space(AS_PROGRAM); |
| 287 | 268 | dma_regs->dsadr[channel] = space.read_dword(dma_regs->ddadr[channel] + 0x4); |
| 288 | 269 | dma_regs->dtadr[channel] = space.read_dword(dma_regs->ddadr[channel] + 0x8); |
| 289 | 270 | dma_regs->dcmd[channel] = space.read_dword(dma_regs->ddadr[channel] + 0xc); |
| r18599 | r18600 | |
| 293 | 274 | switch(channel) |
| 294 | 275 | { |
| 295 | 276 | case 3: |
| 296 | | period = attotime::from_hz((147600000 / state->m_i2s_regs.sadiv) / (4 * 64)) * (dma_regs->dcmd[channel] & 0x00001fff); |
| 277 | period = attotime::from_hz((147600000 / m_i2s_regs.sadiv) / (4 * 64)) * (dma_regs->dcmd[channel] & 0x00001fff); |
| 297 | 278 | break; |
| 298 | 279 | default: |
| 299 | 280 | period = attotime::from_hz(100000000) * (dma_regs->dcmd[channel] & 0x00001fff); |
| r18599 | r18600 | |
| 405 | 386 | { |
| 406 | 387 | if(dma_regs->dcsr[param] & PXA255_DCSR_RUN) |
| 407 | 388 | { |
| 408 | | pxa255_dma_load_descriptor_and_start(machine(), param); |
| 389 | pxa255_dma_load_descriptor_and_start(param); |
| 409 | 390 | } |
| 410 | 391 | else |
| 411 | 392 | { |
| r18599 | r18600 | |
| 418 | 399 | dma_regs->dcsr[param] &= ~PXA255_DCSR_RUN; |
| 419 | 400 | dma_regs->dcsr[param] |= PXA255_DCSR_STOPSTATE; |
| 420 | 401 | } |
| 421 | | pxa255_dma_irq_check(machine()); |
| 402 | pxa255_dma_irq_check(); |
| 422 | 403 | } |
| 423 | 404 | |
| 424 | 405 | READ32_MEMBER(_39in1_state::pxa255_dma_r) |
| r18599 | r18600 | |
| 502 | 483 | break; |
| 503 | 484 | } |
| 504 | 485 | |
| 505 | | pxa255_dma_load_descriptor_and_start(machine(), offset); |
| 486 | pxa255_dma_load_descriptor_and_start(offset); |
| 506 | 487 | } |
| 507 | 488 | else if(!(data & PXA255_DCSR_RUN)) |
| 508 | 489 | { |
| 509 | 490 | dma_regs->dcsr[offset] &= ~PXA255_DCSR_RUN; |
| 510 | 491 | } |
| 511 | 492 | |
| 512 | | pxa255_dma_irq_check(machine()); |
| 493 | pxa255_dma_irq_check(); |
| 513 | 494 | break; |
| 514 | 495 | case PXA255_DINT: |
| 515 | 496 | verboselog( machine(), 3, "pxa255_dma_w: DMA Interrupt Register: %08x & %08x\n", data, mem_mask ); |
| r18599 | r18600 | |
| 570 | 551 | |
| 571 | 552 | */ |
| 572 | 553 | |
| 573 | | static void pxa255_ostimer_irq_check(running_machine& machine) |
| 554 | void _39in1_state::pxa255_ostimer_irq_check() |
| 574 | 555 | { |
| 575 | | _39in1_state *state = machine.driver_data<_39in1_state>(); |
| 576 | | PXA255_OSTMR_Regs *ostimer_regs = &state->m_ostimer_regs; |
| 556 | PXA255_OSTMR_Regs *ostimer_regs = &m_ostimer_regs; |
| 577 | 557 | |
| 578 | | pxa255_set_irq_line(machine, PXA255_INT_OSTIMER0, (ostimer_regs->oier & PXA255_OIER_E0) ? ((ostimer_regs->ossr & PXA255_OSSR_M0) ? 1 : 0) : 0); |
| 579 | | //pxa255_set_irq_line(machine, PXA255_INT_OSTIMER1, (ostimer_regs->oier & PXA255_OIER_E1) ? ((ostimer_regs->ossr & PXA255_OSSR_M1) ? 1 : 0) : 0); |
| 580 | | //pxa255_set_irq_line(machine, PXA255_INT_OSTIMER2, (ostimer_regs->oier & PXA255_OIER_E2) ? ((ostimer_regs->ossr & PXA255_OSSR_M2) ? 1 : 0) : 0); |
| 581 | | //pxa255_set_irq_line(machine, PXA255_INT_OSTIMER3, (ostimer_regs->oier & PXA255_OIER_E3) ? ((ostimer_regs->ossr & PXA255_OSSR_M3) ? 1 : 0) : 0); |
| 558 | pxa255_set_irq_line(PXA255_INT_OSTIMER0, (ostimer_regs->oier & PXA255_OIER_E0) ? ((ostimer_regs->ossr & PXA255_OSSR_M0) ? 1 : 0) : 0); |
| 559 | //pxa255_set_irq_line(PXA255_INT_OSTIMER1, (ostimer_regs->oier & PXA255_OIER_E1) ? ((ostimer_regs->ossr & PXA255_OSSR_M1) ? 1 : 0) : 0); |
| 560 | //pxa255_set_irq_line(PXA255_INT_OSTIMER2, (ostimer_regs->oier & PXA255_OIER_E2) ? ((ostimer_regs->ossr & PXA255_OSSR_M2) ? 1 : 0) : 0); |
| 561 | //pxa255_set_irq_line(PXA255_INT_OSTIMER3, (ostimer_regs->oier & PXA255_OIER_E3) ? ((ostimer_regs->ossr & PXA255_OSSR_M3) ? 1 : 0) : 0); |
| 582 | 562 | } |
| 583 | 563 | |
| 584 | 564 | TIMER_CALLBACK_MEMBER(_39in1_state::pxa255_ostimer_match) |
| r18599 | r18600 | |
| 588 | 568 | if (0) verboselog(machine(), 3, "pxa255_ostimer_match channel %d\n", param); |
| 589 | 569 | ostimer_regs->ossr |= (1 << param); |
| 590 | 570 | ostimer_regs->oscr = ostimer_regs->osmr[param]; |
| 591 | | pxa255_ostimer_irq_check(machine()); |
| 571 | pxa255_ostimer_irq_check(); |
| 592 | 572 | } |
| 593 | 573 | |
| 594 | 574 | READ32_MEMBER(_39in1_state::pxa255_ostimer_r) |
| r18599 | r18600 | |
| 684 | 664 | case PXA255_OSSR: |
| 685 | 665 | if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Status Register: %08x & %08x\n", data, mem_mask ); |
| 686 | 666 | ostimer_regs->ossr &= ~data; |
| 687 | | pxa255_ostimer_irq_check(machine()); |
| 667 | pxa255_ostimer_irq_check(); |
| 688 | 668 | break; |
| 689 | 669 | case PXA255_OWER: |
| 690 | 670 | if (0) verboselog( machine(), 3, "pxa255_ostimer_w: OS Timer Watchdog Enable Register: %08x & %08x\n", data, mem_mask ); |
| r18599 | r18600 | |
| 721 | 701 | |
| 722 | 702 | */ |
| 723 | 703 | |
| 724 | | static void pxa255_update_interrupts(running_machine& machine) |
| 704 | void _39in1_state::pxa255_update_interrupts() |
| 725 | 705 | { |
| 726 | | _39in1_state *state = machine.driver_data<_39in1_state>(); |
| 727 | | PXA255_INTC_Regs *intc_regs = &state->m_intc_regs; |
| 706 | PXA255_INTC_Regs *intc_regs = &m_intc_regs; |
| 728 | 707 | |
| 729 | 708 | intc_regs->icfp = (intc_regs->icpr & intc_regs->icmr) & intc_regs->iclr; |
| 730 | 709 | intc_regs->icip = (intc_regs->icpr & intc_regs->icmr) & (~intc_regs->iclr); |
| 731 | | machine.device("maincpu")->execute().set_input_line(ARM7_FIRQ_LINE, intc_regs->icfp ? ASSERT_LINE : CLEAR_LINE); |
| 732 | | machine.device("maincpu")->execute().set_input_line(ARM7_IRQ_LINE, intc_regs->icip ? ASSERT_LINE : CLEAR_LINE); |
| 710 | machine().device("maincpu")->execute().set_input_line(ARM7_FIRQ_LINE, intc_regs->icfp ? ASSERT_LINE : CLEAR_LINE); |
| 711 | machine().device("maincpu")->execute().set_input_line(ARM7_IRQ_LINE, intc_regs->icip ? ASSERT_LINE : CLEAR_LINE); |
| 733 | 712 | } |
| 734 | 713 | |
| 735 | | static void pxa255_set_irq_line(running_machine& machine, UINT32 line, int irq_state) |
| 714 | void _39in1_state::pxa255_set_irq_line(UINT32 line, int irq_state) |
| 736 | 715 | { |
| 737 | | _39in1_state *state = machine.driver_data<_39in1_state>(); |
| 738 | | PXA255_INTC_Regs *intc_regs = &state->m_intc_regs; |
| 716 | PXA255_INTC_Regs *intc_regs = &m_intc_regs; |
| 739 | 717 | |
| 740 | 718 | intc_regs->icpr &= ~line; |
| 741 | 719 | intc_regs->icpr |= irq_state ? line : 0; |
| 742 | 720 | //printf( "Setting IRQ line %08x to %d\n", line, irq_state ); |
| 743 | | pxa255_update_interrupts(machine); |
| 721 | pxa255_update_interrupts(); |
| 744 | 722 | } |
| 745 | 723 | |
| 746 | 724 | READ32_MEMBER(_39in1_state::pxa255_intc_r) |
| r18599 | r18600 | |
| 1061 | 1039 | |
| 1062 | 1040 | */ |
| 1063 | 1041 | |
| 1064 | | static void pxa255_lcd_load_dma_descriptor(address_space & space, UINT32 address, int channel) |
| 1042 | void _39in1_state::pxa255_lcd_load_dma_descriptor(address_space & space, UINT32 address, int channel) |
| 1065 | 1043 | { |
| 1066 | | _39in1_state *state = space.machine().driver_data<_39in1_state>(); |
| 1067 | | PXA255_LCD_Regs *lcd_regs = &state->m_lcd_regs; |
| 1044 | PXA255_LCD_Regs *lcd_regs = &m_lcd_regs; |
| 1068 | 1045 | |
| 1069 | 1046 | lcd_regs->dma[channel].fdadr = space.read_dword(address); |
| 1070 | 1047 | lcd_regs->dma[channel].fsadr = space.read_dword(address + 0x04); |
| r18599 | r18600 | |
| 1077 | 1054 | verboselog( space.machine(), 4, " DMA Command: %08x\n", lcd_regs->dma[channel].ldcmd ); |
| 1078 | 1055 | } |
| 1079 | 1056 | |
| 1080 | | static void pxa255_lcd_irq_check(running_machine& machine) |
| 1057 | void _39in1_state::pxa255_lcd_irq_check() |
| 1081 | 1058 | { |
| 1082 | | _39in1_state *state = machine.driver_data<_39in1_state>(); |
| 1083 | | PXA255_LCD_Regs *lcd_regs = &state->m_lcd_regs; |
| 1059 | PXA255_LCD_Regs *lcd_regs = &m_lcd_regs; |
| 1084 | 1060 | |
| 1085 | 1061 | if(((lcd_regs->lcsr & PXA255_LCSR_BS) != 0 && (lcd_regs->lccr0 & PXA255_LCCR0_BM) == 0) || |
| 1086 | 1062 | ((lcd_regs->lcsr & PXA255_LCSR_EOF) != 0 && (lcd_regs->lccr0 & PXA255_LCCR0_EFM) == 0) || |
| 1087 | 1063 | ((lcd_regs->lcsr & PXA255_LCSR_SOF) != 0 && (lcd_regs->lccr0 & PXA255_LCCR0_SFM) == 0)) |
| 1088 | 1064 | { |
| 1089 | | pxa255_set_irq_line(machine, PXA255_INT_LCD, 1); |
| 1065 | pxa255_set_irq_line(PXA255_INT_LCD, 1); |
| 1090 | 1066 | } |
| 1091 | 1067 | else |
| 1092 | 1068 | { |
| 1093 | | pxa255_set_irq_line(machine, PXA255_INT_LCD, 0); |
| 1069 | pxa255_set_irq_line(PXA255_INT_LCD, 0); |
| 1094 | 1070 | } |
| 1095 | 1071 | } |
| 1096 | 1072 | |
| 1097 | | static void pxa255_lcd_dma_kickoff(running_machine& machine, int channel) |
| 1073 | void _39in1_state::pxa255_lcd_dma_kickoff(int channel) |
| 1098 | 1074 | { |
| 1099 | | _39in1_state *state = machine.driver_data<_39in1_state>(); |
| 1100 | | PXA255_LCD_Regs *lcd_regs = &state->m_lcd_regs; |
| 1075 | PXA255_LCD_Regs *lcd_regs = &m_lcd_regs; |
| 1101 | 1076 | |
| 1102 | 1077 | if(lcd_regs->dma[channel].fdadr != 0) |
| 1103 | 1078 | { |
| r18599 | r18600 | |
| 1109 | 1084 | { |
| 1110 | 1085 | lcd_regs->liidr = lcd_regs->dma[channel].fidr; |
| 1111 | 1086 | lcd_regs->lcsr |= PXA255_LCSR_SOF; |
| 1112 | | pxa255_lcd_irq_check(machine); |
| 1087 | pxa255_lcd_irq_check(); |
| 1113 | 1088 | } |
| 1114 | 1089 | |
| 1115 | 1090 | if(lcd_regs->dma[channel].ldcmd & PXA255_LDCMD_PAL) |
| 1116 | 1091 | { |
| 1117 | | address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM); |
| 1092 | address_space &space = machine().device<pxa255_device>("maincpu")->space(AS_PROGRAM); |
| 1118 | 1093 | int length = lcd_regs->dma[channel].ldcmd & 0x000fffff; |
| 1119 | 1094 | int index = 0; |
| 1120 | 1095 | for(index = 0; index < length; index += 2) |
| 1121 | 1096 | { |
| 1122 | 1097 | UINT16 color = space.read_word((lcd_regs->dma[channel].fsadr &~ 1) + index); |
| 1123 | | state->m_pxa255_lcd_palette[index >> 1] = (((((color >> 11) & 0x1f) << 3) | (color >> 13)) << 16) | (((((color >> 5) & 0x3f) << 2) | ((color >> 9) & 0x3)) << 8) | (((color & 0x1f) << 3) | ((color >> 2) & 0x7)); |
| 1124 | | palette_set_color_rgb(machine, index >> 1, (((color >> 11) & 0x1f) << 3) | (color >> 13), (((color >> 5) & 0x3f) << 2) | ((color >> 9) & 0x3), ((color & 0x1f) << 3) | ((color >> 2) & 0x7)); |
| 1098 | m_pxa255_lcd_palette[index >> 1] = (((((color >> 11) & 0x1f) << 3) | (color >> 13)) << 16) | (((((color >> 5) & 0x3f) << 2) | ((color >> 9) & 0x3)) << 8) | (((color & 0x1f) << 3) | ((color >> 2) & 0x7)); |
| 1099 | palette_set_color_rgb(machine(), index >> 1, (((color >> 11) & 0x1f) << 3) | (color >> 13), (((color >> 5) & 0x3f) << 2) | ((color >> 9) & 0x3), ((color & 0x1f) << 3) | ((color >> 2) & 0x7)); |
| 1125 | 1100 | } |
| 1126 | 1101 | } |
| 1127 | 1102 | else |
| 1128 | 1103 | { |
| 1129 | | address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM); |
| 1104 | address_space &space = machine().device<pxa255_device>("maincpu")->space(AS_PROGRAM); |
| 1130 | 1105 | int length = lcd_regs->dma[channel].ldcmd & 0x000fffff; |
| 1131 | 1106 | int index = 0; |
| 1132 | 1107 | for(index = 0; index < length; index++) |
| 1133 | 1108 | { |
| 1134 | | state->m_pxa255_lcd_framebuffer[index] = space.read_byte(lcd_regs->dma[channel].fsadr + index); |
| 1109 | m_pxa255_lcd_framebuffer[index] = space.read_byte(lcd_regs->dma[channel].fsadr + index); |
| 1135 | 1110 | } |
| 1136 | 1111 | } |
| 1137 | 1112 | } |
| 1138 | 1113 | } |
| 1139 | 1114 | |
| 1140 | | static void pxa255_lcd_check_load_next_branch(running_machine& machine, int channel) |
| 1115 | void _39in1_state::pxa255_lcd_check_load_next_branch(int channel) |
| 1141 | 1116 | { |
| 1142 | | _39in1_state *state = machine.driver_data<_39in1_state>(); |
| 1143 | | PXA255_LCD_Regs *lcd_regs = &state->m_lcd_regs; |
| 1117 | PXA255_LCD_Regs *lcd_regs = &m_lcd_regs; |
| 1144 | 1118 | |
| 1145 | 1119 | if(lcd_regs->fbr[channel] & 1) |
| 1146 | 1120 | { |
| 1147 | | verboselog( machine, 4, "pxa255_lcd_check_load_next_branch: Taking branch\n" ); |
| 1121 | verboselog( machine(), 4, "pxa255_lcd_check_load_next_branch: Taking branch\n" ); |
| 1148 | 1122 | lcd_regs->fbr[channel] &= ~1; |
| 1149 | | address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM); |
| 1123 | address_space &space = machine().device<pxa255_device>("maincpu")->space(AS_PROGRAM); |
| 1150 | 1124 | //lcd_regs->fbr[channel] = (space.read_dword(lcd_regs->fbr[channel] & 0xfffffff0) & 0xfffffff0) | (lcd_regs->fbr[channel] & 0x00000003); |
| 1151 | 1125 | //printf( "%08x\n", lcd_regs->fbr[channel] ); |
| 1152 | 1126 | pxa255_lcd_load_dma_descriptor(space, lcd_regs->fbr[channel] & 0xfffffff0, 0); |
| 1153 | 1127 | lcd_regs->fbr[channel] = (space.read_dword(lcd_regs->fbr[channel] & 0xfffffff0) & 0xfffffff0) | (lcd_regs->fbr[channel] & 0x00000003); |
| 1154 | | pxa255_lcd_dma_kickoff(machine, 0); |
| 1128 | pxa255_lcd_dma_kickoff(0); |
| 1155 | 1129 | if(lcd_regs->fbr[channel] & 2) |
| 1156 | 1130 | { |
| 1157 | 1131 | lcd_regs->fbr[channel] &= ~2; |
| r18599 | r18600 | |
| 1163 | 1137 | } |
| 1164 | 1138 | else |
| 1165 | 1139 | { |
| 1166 | | if (0) verboselog( machine, 3, "pxa255_lcd_check_load_next_branch: Not taking branch\n" ); |
| 1140 | if (0) verboselog( machine(), 3, "pxa255_lcd_check_load_next_branch: Not taking branch\n" ); |
| 1167 | 1141 | } |
| 1168 | 1142 | } |
| 1169 | 1143 | |
| r18599 | r18600 | |
| 1177 | 1151 | lcd_regs->liidr = lcd_regs->dma[param].fidr; |
| 1178 | 1152 | lcd_regs->lcsr |= PXA255_LCSR_EOF; |
| 1179 | 1153 | } |
| 1180 | | pxa255_lcd_check_load_next_branch(machine(), param); |
| 1181 | | pxa255_lcd_irq_check(machine()); |
| 1154 | pxa255_lcd_check_load_next_branch(param); |
| 1155 | pxa255_lcd_irq_check(); |
| 1182 | 1156 | } |
| 1183 | 1157 | |
| 1184 | 1158 | READ32_MEMBER(_39in1_state::pxa255_lcd_r) |
| r18599 | r18600 | |
| 1276 | 1250 | if(!lcd_regs->dma[0].eof->enabled()) |
| 1277 | 1251 | { |
| 1278 | 1252 | if (0) verboselog( machine(), 3, "ch0 EOF timer is not enabled, taking branch now\n" ); |
| 1279 | | pxa255_lcd_check_load_next_branch(machine(), 0); |
| 1280 | | pxa255_lcd_irq_check(machine()); |
| 1253 | pxa255_lcd_check_load_next_branch(0); |
| 1254 | pxa255_lcd_irq_check(); |
| 1281 | 1255 | } |
| 1282 | 1256 | break; |
| 1283 | 1257 | case PXA255_FBR1: // 0x44000024 |
| r18599 | r18600 | |
| 1286 | 1260 | if(!lcd_regs->dma[1].eof->enabled()) |
| 1287 | 1261 | { |
| 1288 | 1262 | verboselog( machine(), 3, "ch1 EOF timer is not enabled, taking branch now\n" ); |
| 1289 | | pxa255_lcd_check_load_next_branch(machine(), 1); |
| 1290 | | pxa255_lcd_irq_check(machine()); |
| 1263 | pxa255_lcd_check_load_next_branch(1); |
| 1264 | pxa255_lcd_irq_check(); |
| 1291 | 1265 | } |
| 1292 | 1266 | break; |
| 1293 | 1267 | case PXA255_LCSR: // 0x44000038 |
| 1294 | 1268 | verboselog( machine(), 4, "pxa255_lcd_w: LCD Controller Status Register: %08x & %08x\n", data, mem_mask ); |
| 1295 | 1269 | lcd_regs->lcsr &= ~data; |
| 1296 | | pxa255_lcd_irq_check(machine()); |
| 1270 | pxa255_lcd_irq_check(); |
| 1297 | 1271 | break; |
| 1298 | 1272 | case PXA255_LIIDR: // 0x4400003c |
| 1299 | 1273 | verboselog( machine(), 3, "pxa255_lcd_w: LCD Controller Interrupt ID Register: %08x & %08x\n", data, mem_mask ); |
| r18599 | r18600 | |
| 1536 | 1510 | } |
| 1537 | 1511 | |
| 1538 | 1512 | /* To be moved to DEVICE_START( pxa255 ) upon completion */ |
| 1539 | | static void pxa255_start(running_machine& machine) |
| 1513 | void _39in1_state::pxa255_start() |
| 1540 | 1514 | { |
| 1541 | | _39in1_state *state = machine.driver_data<_39in1_state>(); |
| 1542 | 1515 | int index = 0; |
| 1543 | 1516 | |
| 1544 | 1517 | //pxa255_t* pxa255 = pxa255_get_safe_token( device ); |
| r18599 | r18600 | |
| 1547 | 1520 | |
| 1548 | 1521 | for(index = 0; index < 16; index++) |
| 1549 | 1522 | { |
| 1550 | | state->m_dma_regs.dcsr[index] = 0x00000008; |
| 1551 | | state->m_dma_regs.timer[index] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_dma_dma_end),state)); |
| 1523 | m_dma_regs.dcsr[index] = 0x00000008; |
| 1524 | m_dma_regs.timer[index] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_dma_dma_end),this)); |
| 1552 | 1525 | } |
| 1553 | 1526 | |
| 1554 | | memset(&state->m_ostimer_regs, 0, sizeof(state->m_ostimer_regs)); |
| 1527 | memset(&m_ostimer_regs, 0, sizeof(m_ostimer_regs)); |
| 1555 | 1528 | for(index = 0; index < 4; index++) |
| 1556 | 1529 | { |
| 1557 | | state->m_ostimer_regs.osmr[index] = 0; |
| 1558 | | state->m_ostimer_regs.timer[index] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_ostimer_match),state)); |
| 1530 | m_ostimer_regs.osmr[index] = 0; |
| 1531 | m_ostimer_regs.timer[index] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_ostimer_match),this)); |
| 1559 | 1532 | } |
| 1560 | 1533 | |
| 1561 | | memset(&state->m_intc_regs, 0, sizeof(state->m_intc_regs)); |
| 1534 | memset(&m_intc_regs, 0, sizeof(m_intc_regs)); |
| 1562 | 1535 | |
| 1563 | | memset(&state->m_lcd_regs, 0, sizeof(state->m_lcd_regs)); |
| 1564 | | state->m_lcd_regs.dma[0].eof = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_lcd_dma_eof),state)); |
| 1565 | | state->m_lcd_regs.dma[1].eof = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_lcd_dma_eof),state)); |
| 1566 | | state->m_lcd_regs.trgbr = 0x00aa5500; |
| 1567 | | state->m_lcd_regs.tcr = 0x0000754f; |
| 1536 | memset(&m_lcd_regs, 0, sizeof(m_lcd_regs)); |
| 1537 | m_lcd_regs.dma[0].eof = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_lcd_dma_eof),this)); |
| 1538 | m_lcd_regs.dma[1].eof = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_lcd_dma_eof),this)); |
| 1539 | m_lcd_regs.trgbr = 0x00aa5500; |
| 1540 | m_lcd_regs.tcr = 0x0000754f; |
| 1568 | 1541 | |
| 1569 | 1542 | //pxa255_register_state_save(device); |
| 1570 | 1543 | } |
| r18599 | r18600 | |
| 1585 | 1558 | // } |
| 1586 | 1559 | } |
| 1587 | 1560 | |
| 1588 | | pxa255_start(machine()); |
| 1561 | pxa255_start(); |
| 1589 | 1562 | } |
| 1590 | 1563 | |
| 1591 | 1564 | static MACHINE_CONFIG_START( 39in1, _39in1_state ) |