trunk/src/mess/drivers/gp32.c
| r21000 | r21001 | |
| 17 | 17 | #include "emu.h" |
| 18 | 18 | #include "cpu/arm7/arm7.h" |
| 19 | 19 | #include "cpu/arm7/arm7core.h" |
| 20 | | #include "machine/smartmed.h" |
| 21 | 20 | #include "includes/gp32.h" |
| 22 | | #include "sound/dac.h" |
| 23 | 21 | #include "rendlay.h" |
| 24 | | #include "machine/nvram.h" |
| 25 | 22 | |
| 26 | 23 | #define VERBOSE_LEVEL ( 0 ) |
| 27 | 24 | |
| r21000 | r21001 | |
| 892 | 889 | |
| 893 | 890 | // SMARTMEDIA |
| 894 | 891 | |
| 895 | | static void smc_reset( running_machine &machine) |
| 892 | void gp32_state::smc_reset() |
| 896 | 893 | { |
| 897 | | gp32_state *state = machine.driver_data<gp32_state>(); |
| 898 | | verboselog( machine, 5, "smc_reset\n"); |
| 899 | | state->m_smc.add_latch = 0; |
| 900 | | state->m_smc.chip = 0; |
| 901 | | state->m_smc.cmd_latch = 0; |
| 902 | | state->m_smc.do_read = 0; |
| 903 | | state->m_smc.do_write = 0; |
| 904 | | state->m_smc.read = 0; |
| 905 | | state->m_smc.wp = 0; |
| 906 | | state->m_smc.busy = 0; |
| 894 | verboselog( machine(), 5, "smc_reset\n"); |
| 895 | m_smc.add_latch = 0; |
| 896 | m_smc.chip = 0; |
| 897 | m_smc.cmd_latch = 0; |
| 898 | m_smc.do_read = 0; |
| 899 | m_smc.do_write = 0; |
| 900 | m_smc.read = 0; |
| 901 | m_smc.wp = 0; |
| 902 | m_smc.busy = 0; |
| 907 | 903 | } |
| 908 | 904 | |
| 909 | | static void smc_init( running_machine &machine) |
| 905 | void gp32_state::smc_init() |
| 910 | 906 | { |
| 911 | | verboselog( machine, 5, "smc_init\n"); |
| 912 | | smc_reset( machine); |
| 907 | verboselog( machine(), 5, "smc_init\n"); |
| 908 | smc_reset(); |
| 913 | 909 | } |
| 914 | 910 | |
| 915 | | static UINT8 smc_read( running_machine &machine) |
| 911 | UINT8 gp32_state::smc_read() |
| 916 | 912 | { |
| 917 | | smartmedia_image_device *smartmedia = machine.device<smartmedia_image_device>( "smartmedia"); |
| 918 | 913 | UINT8 data; |
| 919 | | data = smartmedia->data_r(); |
| 920 | | verboselog( machine, 5, "smc_read %08X\n", data); |
| 914 | data = m_smartmedia->data_r(); |
| 915 | verboselog( machine(), 5, "smc_read %08X\n", data); |
| 921 | 916 | return data; |
| 922 | 917 | } |
| 923 | 918 | |
| 924 | | static void smc_write( running_machine &machine, UINT8 data) |
| 919 | void gp32_state::smc_write(UINT8 data) |
| 925 | 920 | { |
| 926 | | gp32_state *state = machine.driver_data<gp32_state>(); |
| 927 | | verboselog( machine, 5, "smc_write %08X\n", data); |
| 928 | | if ((state->m_smc.chip) && (!state->m_smc.read)) |
| 921 | verboselog( machine(), 5, "smc_write %08X\n", data); |
| 922 | if ((m_smc.chip) && (!m_smc.read)) |
| 929 | 923 | { |
| 930 | | smartmedia_image_device *smartmedia = machine.device<smartmedia_image_device>( "smartmedia"); |
| 931 | | if (state->m_smc.cmd_latch) |
| 924 | if (m_smc.cmd_latch) |
| 932 | 925 | { |
| 933 | | verboselog( machine, 5, "smartmedia_command_w %08X\n", data); |
| 934 | | smartmedia->command_w(data); |
| 926 | verboselog( machine(), 5, "smartmedia_command_w %08X\n", data); |
| 927 | m_smartmedia->command_w(data); |
| 935 | 928 | } |
| 936 | | else if (state->m_smc.add_latch) |
| 929 | else if (m_smc.add_latch) |
| 937 | 930 | { |
| 938 | | verboselog( machine, 5, "smartmedia_address_w %08X\n", data); |
| 939 | | smartmedia->address_w(data); |
| 931 | verboselog( machine(), 5, "smartmedia_address_w %08X\n", data); |
| 932 | m_smartmedia->address_w(data); |
| 940 | 933 | } |
| 941 | 934 | else |
| 942 | 935 | { |
| 943 | | verboselog( machine, 5, "smartmedia_data_w %08X\n", data); |
| 944 | | smartmedia->data_w(data); |
| 936 | verboselog( machine(), 5, "smartmedia_data_w %08X\n", data); |
| 937 | m_smartmedia->data_w(data); |
| 945 | 938 | } |
| 946 | 939 | } |
| 947 | 940 | } |
| 948 | 941 | |
| 949 | | static void smc_update( running_machine &machine) |
| 942 | void gp32_state::smc_update() |
| 950 | 943 | { |
| 951 | | gp32_state *state = machine.driver_data<gp32_state>(); |
| 952 | | if (!state->m_smc.chip) |
| 944 | if (!m_smc.chip) |
| 953 | 945 | { |
| 954 | | smc_reset( machine); |
| 946 | smc_reset(); |
| 955 | 947 | } |
| 956 | 948 | else |
| 957 | 949 | { |
| 958 | | if ((state->m_smc.do_write) && (!state->m_smc.read)) |
| 950 | if ((m_smc.do_write) && (!m_smc.read)) |
| 959 | 951 | { |
| 960 | | smc_write( machine, state->m_smc.datatx); |
| 952 | smc_write(m_smc.datatx); |
| 961 | 953 | } |
| 962 | | else if ((!state->m_smc.do_write) && (state->m_smc.do_read) && (state->m_smc.read) && (!state->m_smc.cmd_latch) && (!state->m_smc.add_latch)) |
| 954 | else if ((!m_smc.do_write) && (m_smc.do_read) && (m_smc.read) && (!m_smc.cmd_latch) && (!m_smc.add_latch)) |
| 963 | 955 | { |
| 964 | | state->m_smc.datarx = smc_read( machine); |
| 956 | m_smc.datarx = smc_read(); |
| 965 | 957 | } |
| 966 | 958 | } |
| 967 | 959 | } |
| r21000 | r21001 | |
| 972 | 964 | #define I2S_L3M ( 2 ) |
| 973 | 965 | #define I2S_L3D ( 3 ) |
| 974 | 966 | |
| 975 | | static void i2s_reset( running_machine &machine) |
| 967 | void gp32_state::i2s_reset() |
| 976 | 968 | { |
| 977 | | gp32_state *state = machine.driver_data<gp32_state>(); |
| 978 | | verboselog( machine, 5, "i2s_reset\n"); |
| 979 | | state->m_i2s.l3d = 0; |
| 980 | | state->m_i2s.l3m = 0; |
| 981 | | state->m_i2s.l3c = 0; |
| 969 | verboselog( machine(), 5, "i2s_reset\n"); |
| 970 | m_i2s.l3d = 0; |
| 971 | m_i2s.l3m = 0; |
| 972 | m_i2s.l3c = 0; |
| 982 | 973 | } |
| 983 | 974 | |
| 984 | | static void i2s_init( running_machine &machine) |
| 975 | void gp32_state::i2s_init() |
| 985 | 976 | { |
| 986 | | verboselog( machine, 5, "i2s_init\n"); |
| 987 | | i2s_reset( machine); |
| 977 | verboselog( machine(), 5, "i2s_init\n"); |
| 978 | i2s_reset(); |
| 988 | 979 | } |
| 989 | 980 | |
| 990 | | static void i2s_write( running_machine &machine, int line, int data) |
| 981 | void gp32_state::i2s_write(int line, int data) |
| 991 | 982 | { |
| 992 | | gp32_state *state = machine.driver_data<gp32_state>(); |
| 993 | 983 | switch (line) |
| 994 | 984 | { |
| 995 | 985 | case I2S_L3C : |
| 996 | 986 | { |
| 997 | | if (data != state->m_i2s.l3c) |
| 987 | if (data != m_i2s.l3c) |
| 998 | 988 | { |
| 999 | | verboselog( machine, 5, "I2S L3C %d\n", data); |
| 1000 | | state->m_i2s.l3c = data; |
| 989 | verboselog( machine(), 5, "I2S L3C %d\n", data); |
| 990 | m_i2s.l3c = data; |
| 1001 | 991 | } |
| 1002 | 992 | } |
| 1003 | 993 | break; |
| 1004 | 994 | case I2S_L3M : |
| 1005 | 995 | { |
| 1006 | | if (data != state->m_i2s.l3m) |
| 996 | if (data != m_i2s.l3m) |
| 1007 | 997 | { |
| 1008 | | verboselog( machine, 5, "I2S L3M %d\n", data); |
| 1009 | | state->m_i2s.l3m = data; |
| 998 | verboselog( machine(), 5, "I2S L3M %d\n", data); |
| 999 | m_i2s.l3m = data; |
| 1010 | 1000 | } |
| 1011 | 1001 | } |
| 1012 | 1002 | break; |
| 1013 | 1003 | case I2S_L3D : |
| 1014 | 1004 | { |
| 1015 | | if (data != state->m_i2s.l3d) |
| 1005 | if (data != m_i2s.l3d) |
| 1016 | 1006 | { |
| 1017 | | verboselog( machine, 5, "I2S L3D %d\n", data); |
| 1018 | | state->m_i2s.l3d = data; |
| 1007 | verboselog( machine(), 5, "I2S L3D %d\n", data); |
| 1008 | m_i2s.l3d = data; |
| 1019 | 1009 | } |
| 1020 | 1010 | } |
| 1021 | 1011 | break; |
| r21000 | r21001 | |
| 1044 | 1034 | // smartmedia |
| 1045 | 1035 | data = (data & ~0x000000FF) | (m_smc.datarx & 0xFF); |
| 1046 | 1036 | // buttons |
| 1047 | | data = (data & ~0x0000FF00) | (ioport( "IN0")->read() & 0x0000FF00); |
| 1037 | data = (data & ~0x0000FF00) | (m_io_in0->read() & 0x0000FF00); |
| 1048 | 1038 | } |
| 1049 | 1039 | break; |
| 1050 | 1040 | // PDDAT |
| 1051 | 1041 | case 0x24 / 4 : |
| 1052 | 1042 | { |
| 1053 | | smartmedia_image_device *smartmedia = machine().device<smartmedia_image_device>( "smartmedia"); |
| 1054 | 1043 | // smartmedia |
| 1055 | 1044 | data = (data & ~0x000003C0); |
| 1056 | 1045 | if (!m_smc.busy) data = data | 0x00000200; |
| 1057 | 1046 | if (!m_smc.do_read) data = data | 0x00000100; |
| 1058 | 1047 | if (!m_smc.chip) data = data | 0x00000080; |
| 1059 | | if (!smartmedia->is_protected()) data = data | 0x00000040; |
| 1048 | if (!m_smartmedia->is_protected()) data = data | 0x00000040; |
| 1060 | 1049 | } |
| 1061 | 1050 | break; |
| 1062 | 1051 | // PEDAT |
| 1063 | 1052 | case 0x30 / 4 : |
| 1064 | 1053 | { |
| 1065 | | smartmedia_image_device *smartmedia = machine().device<smartmedia_image_device>( "smartmedia"); |
| 1066 | 1054 | // smartmedia |
| 1067 | 1055 | data = (data & ~0x0000003C); |
| 1068 | 1056 | if (m_smc.cmd_latch) data = data | 0x00000020; |
| 1069 | 1057 | if (m_smc.add_latch) data = data | 0x00000010; |
| 1070 | 1058 | if (!m_smc.do_write) data = data | 0x00000008; |
| 1071 | | if (!smartmedia->is_present()) data = data | 0x00000004; |
| 1059 | if (!m_smartmedia->is_present()) data = data | 0x00000004; |
| 1072 | 1060 | // buttons |
| 1073 | | data = (data & ~0x000000C0) | (ioport( "IN1")->read() & 0x000000C0); |
| 1061 | data = (data & ~0x000000C0) | (m_io_in1->read() & 0x000000C0); |
| 1074 | 1062 | } |
| 1075 | 1063 | break; |
| 1076 | 1064 | } |
| r21000 | r21001 | |
| 1089 | 1077 | { |
| 1090 | 1078 | // smartmedia |
| 1091 | 1079 | m_smc.read = ((data & 0x00000001) == 0); |
| 1092 | | smc_update( machine()); |
| 1080 | smc_update(); |
| 1093 | 1081 | } |
| 1094 | 1082 | break; |
| 1095 | 1083 | // PBDAT |
| r21000 | r21001 | |
| 1106 | 1094 | m_smc.do_read = ((data & 0x00000100) == 0); |
| 1107 | 1095 | m_smc.chip = ((data & 0x00000080) == 0); |
| 1108 | 1096 | m_smc.wp = ((data & 0x00000040) == 0); |
| 1109 | | smc_update( machine()); |
| 1097 | smc_update(); |
| 1110 | 1098 | } |
| 1111 | 1099 | break; |
| 1112 | 1100 | // PEDAT |
| r21000 | r21001 | |
| 1116 | 1104 | m_smc.cmd_latch = ((data & 0x00000020) != 0); |
| 1117 | 1105 | m_smc.add_latch = ((data & 0x00000010) != 0); |
| 1118 | 1106 | m_smc.do_write = ((data & 0x00000008) == 0); |
| 1119 | | smc_update( machine()); |
| 1107 | smc_update(); |
| 1120 | 1108 | // sound |
| 1121 | | i2s_write( machine(), I2S_L3D, (data & 0x00000800) ? 1 : 0); |
| 1122 | | i2s_write( machine(), I2S_L3M, (data & 0x00000400) ? 1 : 0); |
| 1123 | | i2s_write( machine(), I2S_L3C, (data & 0x00000200) ? 1 : 0); |
| 1109 | i2s_write(I2S_L3D, (data & 0x00000800) ? 1 : 0); |
| 1110 | i2s_write(I2S_L3M, (data & 0x00000400) ? 1 : 0); |
| 1111 | i2s_write(I2S_L3C, (data & 0x00000200) ? 1 : 0); |
| 1124 | 1112 | } |
| 1125 | 1113 | break; |
| 1126 | 1114 | #if 0 |
| r21000 | r21001 | |
| 1251 | 1239 | |
| 1252 | 1240 | // EEPROM |
| 1253 | 1241 | |
| 1254 | | static UINT8 eeprom_read( running_machine &machine, UINT16 address) |
| 1242 | UINT8 gp32_state::eeprom_read(UINT16 address) |
| 1255 | 1243 | { |
| 1256 | | gp32_state *state = machine.driver_data<gp32_state>(); |
| 1257 | 1244 | UINT8 data; |
| 1258 | | data = state->m_eeprom_data[address]; |
| 1259 | | verboselog( machine, 5, "EEPROM %04X -> %02X\n", address, data); |
| 1245 | data = m_eeprom_data[address]; |
| 1246 | verboselog( machine(), 5, "EEPROM %04X -> %02X\n", address, data); |
| 1260 | 1247 | return data; |
| 1261 | 1248 | } |
| 1262 | 1249 | |
| 1263 | | static void eeprom_write( running_machine &machine, UINT16 address, UINT8 data) |
| 1250 | void gp32_state::eeprom_write(UINT16 address, UINT8 data) |
| 1264 | 1251 | { |
| 1265 | | gp32_state *state = machine.driver_data<gp32_state>(); |
| 1266 | | verboselog( machine, 5, "EEPROM %04X <- %02X\n", address, data); |
| 1267 | | state->m_eeprom_data[address] = data; |
| 1252 | verboselog( machine(), 5, "EEPROM %04X <- %02X\n", address, data); |
| 1253 | m_eeprom_data[address] = data; |
| 1268 | 1254 | } |
| 1269 | 1255 | |
| 1270 | 1256 | // IIC |
| r21000 | r21001 | |
| 1325 | 1311 | } |
| 1326 | 1312 | #endif |
| 1327 | 1313 | |
| 1328 | | static void iic_start( running_machine &machine) |
| 1314 | void gp32_state::iic_start() |
| 1329 | 1315 | { |
| 1330 | | gp32_state *state = machine.driver_data<gp32_state>(); |
| 1331 | | verboselog( machine, 1, "IIC start\n"); |
| 1332 | | state->m_s3c240x_iic.data_index = 0; |
| 1333 | | state->m_s3c240x_iic_timer->adjust( attotime::from_msec( 1)); |
| 1316 | verboselog( machine(), 1, "IIC start\n"); |
| 1317 | m_s3c240x_iic.data_index = 0; |
| 1318 | m_s3c240x_iic_timer->adjust( attotime::from_msec( 1)); |
| 1334 | 1319 | } |
| 1335 | 1320 | |
| 1336 | | static void iic_stop( running_machine &machine) |
| 1321 | void gp32_state::iic_stop() |
| 1337 | 1322 | { |
| 1338 | | gp32_state *state = machine.driver_data<gp32_state>(); |
| 1339 | | verboselog( machine, 1, "IIC stop\n"); |
| 1340 | | state->m_s3c240x_iic_timer->adjust( attotime::never); |
| 1323 | verboselog( machine(), 1, "IIC stop\n"); |
| 1324 | m_s3c240x_iic_timer->adjust( attotime::never); |
| 1341 | 1325 | } |
| 1342 | 1326 | |
| 1343 | | static void iic_resume( running_machine &machine) |
| 1327 | void gp32_state::iic_resume() |
| 1344 | 1328 | { |
| 1345 | | gp32_state *state = machine.driver_data<gp32_state>(); |
| 1346 | | verboselog( machine, 1, "IIC resume\n"); |
| 1347 | | state->m_s3c240x_iic_timer->adjust( attotime::from_msec( 1)); |
| 1329 | verboselog( machine(), 1, "IIC resume\n"); |
| 1330 | m_s3c240x_iic_timer->adjust( attotime::from_msec( 1)); |
| 1348 | 1331 | } |
| 1349 | 1332 | |
| 1350 | 1333 | READ32_MEMBER(gp32_state::s3c240x_iic_r) |
| r21000 | r21001 | |
| 1389 | 1372 | start_stop_condition = BIT( m_s3c240x_iic_regs[1], 5); |
| 1390 | 1373 | if (start_stop_condition != 0) |
| 1391 | 1374 | { |
| 1392 | | iic_resume( machine()); |
| 1375 | iic_resume(); |
| 1393 | 1376 | } |
| 1394 | 1377 | } |
| 1395 | 1378 | } |
| r21000 | r21001 | |
| 1401 | 1384 | start_stop_condition = BIT( data, 5); |
| 1402 | 1385 | if (start_stop_condition != 0) |
| 1403 | 1386 | { |
| 1404 | | iic_start( machine()); |
| 1387 | iic_start(); |
| 1405 | 1388 | } |
| 1406 | 1389 | else |
| 1407 | 1390 | { |
| 1408 | | iic_stop( machine()); |
| 1391 | iic_stop(); |
| 1409 | 1392 | } |
| 1410 | 1393 | } |
| 1411 | 1394 | break; |
| r21000 | r21001 | |
| 1429 | 1412 | } |
| 1430 | 1413 | else |
| 1431 | 1414 | { |
| 1432 | | UINT8 data_shift = eeprom_read( machine(), m_s3c240x_iic.address); |
| 1415 | UINT8 data_shift = eeprom_read(m_s3c240x_iic.address); |
| 1433 | 1416 | verboselog( machine(), 5, "IIC read %02X\n", data_shift); |
| 1434 | 1417 | m_s3c240x_iic_regs[3] = (m_s3c240x_iic_regs[3] & ~0xFF) | data_shift; |
| 1435 | 1418 | } |
| r21000 | r21001 | |
| 1448 | 1431 | } |
| 1449 | 1432 | if ((m_s3c240x_iic.data_index == 4) && (m_s3c240x_iic.data[0] == 0xA0)) |
| 1450 | 1433 | { |
| 1451 | | eeprom_write( machine(), m_s3c240x_iic.address, data_shift); |
| 1434 | eeprom_write(m_s3c240x_iic.address, data_shift); |
| 1452 | 1435 | } |
| 1453 | 1436 | } |
| 1454 | 1437 | break; |
| r21000 | r21001 | |
| 1539 | 1522 | } |
| 1540 | 1523 | if (m_s3c240x_iis.fifo_index == 2) |
| 1541 | 1524 | { |
| 1542 | | dac_device *dac[2]; |
| 1543 | | dac[0] = machine().device<dac_device>("dac1"); |
| 1544 | | dac[1] = machine().device<dac_device>("dac2"); |
| 1545 | 1525 | m_s3c240x_iis.fifo_index = 0; |
| 1546 | | dac[0]->write_signed16(m_s3c240x_iis.fifo[0] + 0x8000); |
| 1547 | | dac[1]->write_signed16(m_s3c240x_iis.fifo[1] + 0x8000); |
| 1526 | m_dac1->write_signed16(m_s3c240x_iis.fifo[0] + 0x8000); |
| 1527 | m_dac2->write_signed16(m_s3c240x_iis.fifo[1] + 0x8000); |
| 1548 | 1528 | } |
| 1549 | 1529 | } |
| 1550 | 1530 | break; |
| r21000 | r21001 | |
| 1623 | 1603 | |
| 1624 | 1604 | // ... |
| 1625 | 1605 | |
| 1626 | | static void s3c240x_machine_start( running_machine &machine) |
| 1606 | void gp32_state::s3c240x_machine_start() |
| 1627 | 1607 | { |
| 1628 | | gp32_state *state = machine.driver_data<gp32_state>(); |
| 1629 | | state->m_s3c240x_pwm_timer[0] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),state), (void *)(FPTR)0); |
| 1630 | | state->m_s3c240x_pwm_timer[1] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),state), (void *)(FPTR)1); |
| 1631 | | state->m_s3c240x_pwm_timer[2] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),state), (void *)(FPTR)2); |
| 1632 | | state->m_s3c240x_pwm_timer[3] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),state), (void *)(FPTR)3); |
| 1633 | | state->m_s3c240x_pwm_timer[4] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),state), (void *)(FPTR)4); |
| 1634 | | state->m_s3c240x_dma_timer[0] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),state), (void *)(FPTR)0); |
| 1635 | | state->m_s3c240x_dma_timer[1] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),state), (void *)(FPTR)1); |
| 1636 | | state->m_s3c240x_dma_timer[2] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),state), (void *)(FPTR)2); |
| 1637 | | state->m_s3c240x_dma_timer[3] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),state), (void *)(FPTR)3); |
| 1638 | | state->m_s3c240x_iic_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_iic_timer_exp),state), (void *)(FPTR)0); |
| 1639 | | state->m_s3c240x_iis_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_iis_timer_exp),state), (void *)(FPTR)0); |
| 1640 | | state->m_s3c240x_lcd_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_lcd_timer_exp),state), (void *)(FPTR)0); |
| 1641 | | state->m_eeprom_data = auto_alloc_array( machine, UINT8, 0x2000); |
| 1642 | | machine.device<nvram_device>("nvram")->set_base(state->m_eeprom_data, 0x2000); |
| 1643 | | smc_init( machine); |
| 1644 | | i2s_init( machine); |
| 1608 | m_s3c240x_pwm_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this), (void *)(FPTR)0); |
| 1609 | m_s3c240x_pwm_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this), (void *)(FPTR)1); |
| 1610 | m_s3c240x_pwm_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this), (void *)(FPTR)2); |
| 1611 | m_s3c240x_pwm_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this), (void *)(FPTR)3); |
| 1612 | m_s3c240x_pwm_timer[4] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_pwm_timer_exp),this), (void *)(FPTR)4); |
| 1613 | m_s3c240x_dma_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this), (void *)(FPTR)0); |
| 1614 | m_s3c240x_dma_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this), (void *)(FPTR)1); |
| 1615 | m_s3c240x_dma_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this), (void *)(FPTR)2); |
| 1616 | m_s3c240x_dma_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_dma_timer_exp),this), (void *)(FPTR)3); |
| 1617 | m_s3c240x_iic_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_iic_timer_exp),this), (void *)(FPTR)0); |
| 1618 | m_s3c240x_iis_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_iis_timer_exp),this), (void *)(FPTR)0); |
| 1619 | m_s3c240x_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gp32_state::s3c240x_lcd_timer_exp),this), (void *)(FPTR)0); |
| 1620 | m_eeprom_data = auto_alloc_array( machine(), UINT8, 0x2000); |
| 1621 | m_nvram->set_base(m_eeprom_data, 0x2000); |
| 1622 | smc_init(); |
| 1623 | i2s_init(); |
| 1645 | 1624 | } |
| 1646 | 1625 | |
| 1647 | | static void s3c240x_machine_reset( running_machine &machine) |
| 1626 | void gp32_state::s3c240x_machine_reset() |
| 1648 | 1627 | { |
| 1649 | | gp32_state *state = machine.driver_data<gp32_state>(); |
| 1650 | | smc_reset( machine); |
| 1651 | | i2s_reset( machine); |
| 1652 | | state->m_s3c240x_iis.fifo_index = 0; |
| 1653 | | state->m_s3c240x_iic.data_index = 0; |
| 1628 | smc_reset(); |
| 1629 | i2s_reset(); |
| 1630 | m_s3c240x_iis.fifo_index = 0; |
| 1631 | m_s3c240x_iic.data_index = 0; |
| 1654 | 1632 | } |
| 1655 | 1633 | |
| 1656 | 1634 | static ADDRESS_MAP_START( gp32_map, AS_PROGRAM, 32, gp32_state ) |
| r21000 | r21001 | |
| 1694 | 1672 | |
| 1695 | 1673 | void gp32_state::machine_start() |
| 1696 | 1674 | { |
| 1697 | | s3c240x_machine_start(machine()); |
| 1675 | s3c240x_machine_start(); |
| 1698 | 1676 | } |
| 1699 | 1677 | |
| 1700 | 1678 | void gp32_state::machine_reset() |
| 1701 | 1679 | { |
| 1702 | | s3c240x_machine_reset(machine()); |
| 1680 | s3c240x_machine_reset(); |
| 1703 | 1681 | } |
| 1704 | 1682 | |
| 1705 | 1683 | static MACHINE_CONFIG_START( gp32, gp32_state ) |