Previous 199869 Revisions Next

r29290 Saturday 5th April, 2014 at 07:03:01 UTC by Osso
mc68328_device: converted to devcb2 (nw)
[src/emu/machine]mc68328.c mc68328.h
[src/mess/drivers]palm.c

trunk/src/emu/machine/mc68328.c
r29289r29290
3131
3232
3333mc68328_device::mc68328_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
34            : device_t(mconfig, MC68328, "Motorola MC68328 (DragonBall) Integrated Processor", tag, owner, clock, "mc68328", __FILE__)
34            : device_t(mconfig, MC68328, "Motorola MC68328 (DragonBall) Integrated Processor", tag, owner, clock, "mc68328", __FILE__),
35            m_out_port_a_cb(*this),
36            m_out_port_b_cb(*this),
37            m_out_port_c_cb(*this),
38            m_out_port_d_cb(*this),
39            m_out_port_e_cb(*this),
40            m_out_port_f_cb(*this),
41            m_out_port_g_cb(*this),
42            m_out_port_j_cb(*this),
43            m_out_port_k_cb(*this),
44            m_out_port_m_cb(*this),
45            m_in_port_a_cb(*this),
46            m_in_port_b_cb(*this),
47            m_in_port_c_cb(*this),
48            m_in_port_d_cb(*this),
49            m_in_port_e_cb(*this),
50            m_in_port_f_cb(*this),
51            m_in_port_g_cb(*this),
52            m_in_port_j_cb(*this),
53            m_in_port_k_cb(*this),
54            m_in_port_m_cb(*this),
55            m_out_pwm_cb(*this),
56            m_out_spim_cb(*this),
57            m_in_spim_cb(*this),
58            m_spim_xch_trigger_cb(*this),
59            m_cpu(*this)
3560{
3661}
3762
3863//-------------------------------------------------
39//  device_config_complete - perform any
40//  operations now that the configuration is
41//  complete
42//-------------------------------------------------
43
44void mc68328_device::device_config_complete()
45{
46   // inherit a copy of the static data
47   const mc68328_interface *intf = reinterpret_cast<const mc68328_interface *>(static_config());
48   if (intf != NULL)
49      *static_cast<mc68328_interface *>(this) = *intf;
50
51   // or initialize to defaults if none provided
52   else
53   {
54      memset(&m_out_port_a_func, 0, sizeof(m_out_port_a_func));
55      memset(&m_out_port_b_func, 0, sizeof(m_out_port_b_func));
56      memset(&m_out_port_c_func, 0, sizeof(m_out_port_c_func));
57      memset(&m_out_port_d_func, 0, sizeof(m_out_port_d_func));
58      memset(&m_out_port_e_func, 0, sizeof(m_out_port_e_func));
59      memset(&m_out_port_f_func, 0, sizeof(m_out_port_f_func));
60      memset(&m_out_port_g_func, 0, sizeof(m_out_port_g_func));
61      memset(&m_out_port_j_func, 0, sizeof(m_out_port_j_func));
62      memset(&m_out_port_k_func, 0, sizeof(m_out_port_k_func));
63      memset(&m_out_port_m_func, 0, sizeof(m_out_port_m_func));
64      memset(&m_in_port_a_func, 0, sizeof(m_in_port_a_func));
65      memset(&m_in_port_b_func, 0, sizeof(m_in_port_b_func));
66      memset(&m_in_port_c_func, 0, sizeof(m_in_port_c_func));
67      memset(&m_in_port_d_func, 0, sizeof(m_in_port_d_func));
68      memset(&m_in_port_e_func, 0, sizeof(m_in_port_e_func));
69      memset(&m_in_port_f_func, 0, sizeof(m_in_port_f_func));
70      memset(&m_in_port_g_func, 0, sizeof(m_in_port_g_func));
71      memset(&m_in_port_j_func, 0, sizeof(m_in_port_j_func));
72      memset(&m_in_port_k_func, 0, sizeof(m_in_port_k_func));
73      memset(&m_in_port_m_func, 0, sizeof(m_in_port_m_func));
74      memset(&m_out_pwm_func, 0, sizeof(m_out_pwm_func));
75      memset(&m_out_spim_func, 0, sizeof(m_out_spim_func));
76      memset(&m_in_spim_func, 0, sizeof(m_in_spim_func));
77      memset(&m_spim_xch_trigger_func, 0, sizeof(m_spim_xch_trigger_func));
78      m68k_cpu_tag = "";
79   }
80}
81
82//-------------------------------------------------
8364//  device_start - device-specific startup
8465//-------------------------------------------------
8566
8667void mc68328_device::device_start()
8768{
88   m_out_port_a.resolve(m_out_port_a_func, *this);
89   m_out_port_b.resolve(m_out_port_b_func, *this);
90   m_out_port_c.resolve(m_out_port_c_func, *this);
91   m_out_port_d.resolve(m_out_port_d_func, *this);
92   m_out_port_e.resolve(m_out_port_e_func, *this);
93   m_out_port_f.resolve(m_out_port_f_func, *this);
94   m_out_port_g.resolve(m_out_port_g_func, *this);
95   m_out_port_j.resolve(m_out_port_j_func, *this);
96   m_out_port_k.resolve(m_out_port_k_func, *this);
97   m_out_port_m.resolve(m_out_port_m_func, *this);
69   m_out_port_a_cb.resolve();
70   m_out_port_b_cb.resolve();
71   m_out_port_c_cb.resolve();
72   m_out_port_d_cb.resolve();
73   m_out_port_e_cb.resolve();
74   m_out_port_f_cb.resolve();
75   m_out_port_g_cb.resolve();
76   m_out_port_j_cb.resolve();
77   m_out_port_k_cb.resolve();
78   m_out_port_m_cb.resolve();
9879
99   m_in_port_a.resolve(m_in_port_a_func, *this);
100   m_in_port_b.resolve(m_in_port_b_func, *this);
101   m_in_port_c.resolve(m_in_port_c_func, *this);
102   m_in_port_d.resolve(m_in_port_d_func, *this);
103   m_in_port_e.resolve(m_in_port_e_func, *this);
104   m_in_port_f.resolve(m_in_port_f_func, *this);
105   m_in_port_g.resolve(m_in_port_g_func, *this);
106   m_in_port_j.resolve(m_in_port_j_func, *this);
107   m_in_port_k.resolve(m_in_port_k_func, *this);
108   m_in_port_m.resolve(m_in_port_m_func, *this);
80   m_in_port_a_cb.resolve();
81   m_in_port_b_cb.resolve();
82   m_in_port_c_cb.resolve();
83   m_in_port_d_cb.resolve();
84   m_in_port_e_cb.resolve();
85   m_in_port_f_cb.resolve();
86   m_in_port_g_cb.resolve();
87   m_in_port_j_cb.resolve();
88   m_in_port_k_cb.resolve();
89   m_in_port_m_cb.resolve();
10990
110   m_out_pwm.resolve(m_out_pwm_func, *this);
91   m_out_pwm_cb.resolve();
11192
112   m_out_spim.resolve(m_out_spim_func, *this);
113   m_in_spim.resolve(m_in_spim_func, *this);
93   m_out_spim_cb.resolve();
94   m_in_spim_cb.resolve();
11495
115   m_spim_xch_trigger.resolve(m_spim_xch_trigger_func, *this);
96   m_spim_xch_trigger_cb.resolve();
11697
117   m_cpu = machine().device<cpu_device>(m68k_cpu_tag);
118
11998   m_gptimer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc68328_device::timer1_hit),this));
12099   m_gptimer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc68328_device::timer2_hit),this));
121100   m_rtc = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc68328_device::rtc_tick),this));
r29289r29290
534513
535514   m_regs.pwmc ^= PWMC_PIN;
536515
537   if (!m_out_pwm.isnull())
516   if (!m_out_pwm_cb.isnull())
538517   {
539      m_out_pwm(0, (m_regs.pwmc & PWMC_PIN) ? 1 : 0);
518      m_out_pwm_cb((offs_t)0, (m_regs.pwmc & PWMC_PIN) ? 1 : 0);
540519   }
541520}
542521
r29289r29290
990969         {
991970            verboselog(machine(), 2, "mc68328_w: PADATA = %02x\n", data & 0x00ff);
992971            m_regs.padata = data & 0x00ff;
993            if (!m_out_port_a.isnull())
972            if (!m_out_port_a_cb.isnull())
994973            {
995               m_out_port_a(0, data & 0x00ff);
974               m_out_port_a_cb((offs_t)0, data & 0x00ff);
996975            }
997976         }
998977         else
r29289r29290
1019998         {
1020999            verboselog(machine(), 2, "mc68328_w: PBDATA = %02x\n", data & 0x00ff);
10211000            m_regs.pbdata = data & 0x00ff;
1022            if (!m_out_port_b.isnull())
1001            if (!m_out_port_b_cb.isnull())
10231002            {
1024               m_out_port_b(0, data & 0x00ff);
1003               m_out_port_b_cb((offs_t)0, data & 0x00ff);
10251004            }
10261005         }
10271006         else
r29289r29290
10481027         {
10491028            verboselog(machine(), 2, "mc68328_w: PCDATA = %02x\n", data & 0x00ff);
10501029            m_regs.pcdata = data & 0x00ff;
1051            if (!m_out_port_c.isnull())
1030            if (!m_out_port_c_cb.isnull())
10521031            {
1053               m_out_port_c(0, data & 0x00ff);
1032               m_out_port_c_cb((offs_t)0, data & 0x00ff);
10541033            }
10551034         }
10561035         else
r29289r29290
11311110         {
11321111            verboselog(machine(), 2, "mc68328_w: PEDATA = %02x\n", data & 0x00ff);
11331112            m_regs.pedata = data & 0x00ff;
1134            if (!m_out_port_e.isnull())
1113            if (!m_out_port_e_cb.isnull())
11351114            {
1136               m_out_port_e(0, data & 0x00ff);
1115               m_out_port_e_cb((offs_t)0, data & 0x00ff);
11371116            }
11381117         }
11391118         else
r29289r29290
11621141         {
11631142            verboselog(machine(), 2, "mc68328_w: PFDATA = %02x\n", data & 0x00ff);
11641143            m_regs.pfdata = data & 0x00ff;
1165            if (!m_out_port_f.isnull())
1144            if (!m_out_port_f_cb.isnull())
11661145            {
1167               m_out_port_f(0, data & 0x00ff);
1146               m_out_port_f_cb((offs_t)0, data & 0x00ff);
11681147            }
11691148         }
11701149         else
r29289r29290
11921171         {
11931172            verboselog(machine(), 2, "mc68328_w: PGDATA = %02x\n", data & 0x00ff);
11941173            m_regs.pgdata = data & 0x00ff;
1195            if (!m_out_port_g.isnull())
1174            if (!m_out_port_g_cb.isnull())
11961175            {
1197               m_out_port_g(0, data & 0x00ff);
1176               m_out_port_g_cb((offs_t)0, data & 0x00ff);
11981177            }
11991178         }
12001179         else
r29289r29290
12221201         {
12231202            verboselog(machine(), 2, "mc68328_w: PJDATA = %02x\n", data & 0x00ff);
12241203            m_regs.pjdata = data & 0x00ff;
1225            if (!m_out_port_j.isnull())
1204            if (!m_out_port_j_cb.isnull())
12261205            {
1227               m_out_port_j(0, data & 0x00ff);
1206               m_out_port_j_cb((offs_t)0, data & 0x00ff);
12281207            }
12291208         }
12301209         else
r29289r29290
12511230         {
12521231            verboselog(machine(), 2, "mc68328_w: PKDATA = %02x\n", data & 0x00ff);
12531232            m_regs.pkdata = data & 0x00ff;
1254            if (!m_out_port_k.isnull())
1233            if (!m_out_port_k_cb.isnull())
12551234            {
1256               m_out_port_k(0, data & 0x00ff);
1235               m_out_port_k_cb((offs_t)0, data & 0x00ff);
12571236            }
12581237         }
12591238         else
r29289r29290
12811260         {
12821261            verboselog(machine(), 2, "mc68328_w: PMDATA = %02x\n", data & 0x00ff);
12831262            m_regs.pmdata = data & 0x00ff;
1284            if (!m_out_port_m.isnull())
1263            if (!m_out_port_m_cb.isnull())
12851264            {
1286               m_out_port_m(0, data & 0x00ff);
1265               m_out_port_m_cb((offs_t)0, data & 0x00ff);
12871266            }
12881267         }
12891268         else
r29289r29290
14601439
14611440      case 0x800:
14621441         verboselog(machine(), 2, "mc68328_w: SPIMDATA = %04x\n", data);
1463         if (!m_out_spim.isnull())
1442         if (!m_out_spim_cb.isnull())
14641443         {
1465            m_out_spim(0, data, 0xffff);
1444            m_out_spim_cb(0, data, 0xffff);
14661445         }
14671446         else
14681447         {
r29289r29290
14851464         if (data & SPIM_XCH)
14861465         {
14871466            m_regs.spimcont &= ~SPIM_XCH;
1488            if (!m_spim_xch_trigger.isnull())
1467            if (!m_spim_xch_trigger_cb.isnull())
14891468            {
1490               m_spim_xch_trigger(0);
1469               m_spim_xch_trigger_cb(0);
14911470            }
14921471            if (data & SPIM_IRQEN)
14931472            {
r29289r29290
20642043         if (mem_mask & 0x00ff)
20652044         {
20662045            verboselog(machine(), 2, "mc68328_r (%04x): PADATA = %02x\n", mem_mask, m_regs.padata);
2067            if (!m_in_port_a.isnull())
2046            if (!m_in_port_a_cb.isnull())
20682047            {
2069               return m_in_port_a(0);
2048               return m_in_port_a_cb(0);
20702049            }
20712050            else
20722051            {
r29289r29290
20962075         if (mem_mask & 0x00ff)
20972076         {
20982077            verboselog(machine(), 2, "mc68328_r (%04x): PBDATA = %02x\n", mem_mask, m_regs.pbdata);
2099            if (!m_in_port_b.isnull())
2078            if (!m_in_port_b_cb.isnull())
21002079            {
2101               return m_in_port_b(0);
2080               return m_in_port_b_cb(0);
21022081            }
21032082            else
21042083            {
r29289r29290
21282107         if (mem_mask & 0x00ff)
21292108         {
21302109            verboselog(machine(), 2, "mc68328_r (%04x): PCDATA = %02x\n", mem_mask, m_regs.pcdata);
2131            if (!m_in_port_c.isnull())
2110            if (!m_in_port_c_cb.isnull())
21322111            {
2133               return m_in_port_c(0);
2112               return m_in_port_c_cb(0);
21342113            }
21352114            else
21362115            {
r29289r29290
21602139         if (mem_mask & 0x00ff)
21612140         {
21622141            verboselog(machine(), 2, "mc68328_r (%04x): PDDATA = %02x\n", mem_mask, m_regs.pddata);
2163            if (!m_in_port_d.isnull())
2142            if (!m_in_port_d_cb.isnull())
21642143            {
2165               return m_in_port_d(0);
2144               return m_in_port_d_cb(0);
21662145            }
21672146            else
21682147            {
r29289r29290
22172196         if (mem_mask & 0x00ff)
22182197         {
22192198            verboselog(machine(), 2, "mc68328_r (%04x): PEDATA = %02x\n", mem_mask, m_regs.pedata);
2220            if (!m_in_port_e.isnull())
2199            if (!m_in_port_e_cb.isnull())
22212200            {
2222               return m_in_port_e(0);
2201               return m_in_port_e_cb(0);
22232202            }
22242203            else
22252204            {
r29289r29290
22502229         if (mem_mask & 0x00ff)
22512230         {
22522231            verboselog(machine(), 2, "mc68328_r (%04x): PFDATA = %02x\n", mem_mask, m_regs.pfdata);
2253            if (!m_in_port_f.isnull())
2232            if (!m_in_port_f_cb.isnull())
22542233            {
2255               return m_in_port_f(0);
2234               return m_in_port_f_cb(0);
22562235            }
22572236            else
22582237            {
r29289r29290
22832262         if (mem_mask & 0x00ff)
22842263         {
22852264            verboselog(machine(), 2, "mc68328_r (%04x): PGDATA = %02x\n", mem_mask, m_regs.pgdata);
2286            if (!m_in_port_g.isnull())
2265            if (!m_in_port_g_cb.isnull())
22872266            {
2288               return m_in_port_g(0);
2267               return m_in_port_g_cb(0);
22892268            }
22902269            else
22912270            {
r29289r29290
23162295         if (mem_mask & 0x00ff)
23172296         {
23182297            verboselog(machine(), 2, "mc68328_r (%04x): PJDATA = %02x\n", mem_mask, m_regs.pjdata);
2319            if (!m_in_port_j.isnull())
2298            if (!m_in_port_j_cb.isnull())
23202299            {
2321               return m_in_port_j(0);
2300               return m_in_port_j_cb(0);
23222301            }
23232302            else
23242303            {
r29289r29290
23482327         if (mem_mask & 0x00ff)
23492328         {
23502329            verboselog(machine(), 2, "mc68328_r (%04x): PKDATA = %02x\n", mem_mask, m_regs.pkdata);
2351            if (!m_in_port_k.isnull())
2330            if (!m_in_port_k_cb.isnull())
23522331            {
2353               return m_in_port_k(0);
2332               return m_in_port_k_cb(0);
23542333            }
23552334            else
23562335            {
r29289r29290
23812360         if (mem_mask & 0x00ff)
23822361         {
23832362            verboselog(machine(), 2, "mc68328_r (%04x): PMDATA = %02x\n", mem_mask, m_regs.pmdata);
2384            if (!m_in_port_m.isnull())
2363            if (!m_in_port_m_cb.isnull())
23852364            {
2386               return m_in_port_m(0);
2365               return m_in_port_m_cb(0);
23872366            }
23882367            else
23892368            {
r29289r29290
25002479
25012480      case 0x800:
25022481         verboselog(machine(), 2, "mc68328_r (%04x): SPIMDATA = %04x\n", mem_mask, m_regs.spimdata);
2503         if (!m_in_spim.isnull())
2482         if (!m_in_spim_cb.isnull())
25042483         {
2505            return m_in_spim(0, 0xffff);
2484            return m_in_spim_cb(0, 0xffff);
25062485         }
25072486         return m_regs.spimdata;
25082487
trunk/src/emu/machine/mc68328.h
r29289r29290
408408#define PWMC_PWMEN              0x0010
409409#define PWMC_CLKSEL             0x0007
410410
411
412struct mc68328_interface
413{
414   const char *m68k_cpu_tag;
415
416   devcb_write8  m_out_port_a_func;    /* 8-bit output */
417   devcb_write8  m_out_port_b_func;    /* 8-bit output */
418   devcb_write8  m_out_port_c_func;    /* 8-bit output */
419   devcb_write8  m_out_port_d_func;    /* 8-bit output */
420   devcb_write8  m_out_port_e_func;    /* 8-bit output */
421   devcb_write8  m_out_port_f_func;    /* 8-bit output */
422   devcb_write8  m_out_port_g_func;    /* 8-bit output */
423   devcb_write8  m_out_port_j_func;    /* 8-bit output */
424   devcb_write8  m_out_port_k_func;    /* 8-bit output */
425   devcb_write8  m_out_port_m_func;    /* 8-bit output */
426
427   devcb_read8   m_in_port_a_func;     /* 8-bit input */
428   devcb_read8   m_in_port_b_func;     /* 8-bit input */
429   devcb_read8   m_in_port_c_func;     /* 8-bit input */
430   devcb_read8   m_in_port_d_func;     /* 8-bit input */
431   devcb_read8   m_in_port_e_func;     /* 8-bit input */
432   devcb_read8   m_in_port_f_func;     /* 8-bit input */
433   devcb_read8   m_in_port_g_func;     /* 8-bit input */
434   devcb_read8   m_in_port_j_func;     /* 8-bit input */
435   devcb_read8   m_in_port_k_func;     /* 8-bit input */
436   devcb_read8   m_in_port_m_func;     /* 8-bit input */
437
438   devcb_write8  m_out_pwm_func;       /* 1-bit output */
439
440   devcb_write16 m_out_spim_func;      /* 16-bit output */
441   devcb_read16  m_in_spim_func;       /* 16-bit input */
442
443   devcb_write_line m_spim_xch_trigger_func;    /* SPIM exchange trigger */
444};
445
446
447411struct mc68328_regs_t
448412{
449413   // $(FF)FFF000
r29289r29290
638602};
639603
640604
641class mc68328_device : public device_t,
642                  public mc68328_interface
605class mc68328_device : public device_t
643606{
644607public:
645608   mc68328_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
646609   ~mc68328_device() {}
647610
611   static void static_set_cpu_tag(device_t &device, const char *tag) { downcast<mc68328_device &>(device).m_cpu.set_tag(tag); }
612   template<class _Object> static devcb2_base &set_out_port_a_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_out_port_a_cb.set_callback(object); }
613   template<class _Object> static devcb2_base &set_out_port_b_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_out_port_b_cb.set_callback(object); }
614   template<class _Object> static devcb2_base &set_out_port_c_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_out_port_c_cb.set_callback(object); }
615   template<class _Object> static devcb2_base &set_out_port_d_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_out_port_d_cb.set_callback(object); }
616   template<class _Object> static devcb2_base &set_out_port_e_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_out_port_e_cb.set_callback(object); }
617   template<class _Object> static devcb2_base &set_out_port_f_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_out_port_f_cb.set_callback(object); }
618   template<class _Object> static devcb2_base &set_out_port_g_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_out_port_g_cb.set_callback(object); }
619   template<class _Object> static devcb2_base &set_out_port_j_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_out_port_j_cb.set_callback(object); }
620   template<class _Object> static devcb2_base &set_out_port_k_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_out_port_k_cb.set_callback(object); }
621   template<class _Object> static devcb2_base &set_out_port_m_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_out_port_m_cb.set_callback(object); }
622   template<class _Object> static devcb2_base &set_in_port_a_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_in_port_a_cb.set_callback(object); }
623   template<class _Object> static devcb2_base &set_in_port_b_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_in_port_b_cb.set_callback(object); }
624   template<class _Object> static devcb2_base &set_in_port_c_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_in_port_c_cb.set_callback(object); }
625   template<class _Object> static devcb2_base &set_in_port_d_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_in_port_d_cb.set_callback(object); }
626   template<class _Object> static devcb2_base &set_in_port_e_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_in_port_e_cb.set_callback(object); }
627   template<class _Object> static devcb2_base &set_in_port_f_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_in_port_f_cb.set_callback(object); }
628   template<class _Object> static devcb2_base &set_in_port_g_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_in_port_g_cb.set_callback(object); }
629   template<class _Object> static devcb2_base &set_in_port_j_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_in_port_j_cb.set_callback(object); }
630   template<class _Object> static devcb2_base &set_in_port_k_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_in_port_k_cb.set_callback(object); }
631   template<class _Object> static devcb2_base &set_in_port_m_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_in_port_m_cb.set_callback(object); }
632   template<class _Object> static devcb2_base &set_out_pwm_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_out_pwm_cb.set_callback(object); }
633   template<class _Object> static devcb2_base &set_out_spim_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_out_spim_cb.set_callback(object); }
634   template<class _Object> static devcb2_base &set_in_spim_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_in_spim_cb.set_callback(object); }
635   template<class _Object> static devcb2_base &set_spim_xch_trigger_callback(device_t &device, _Object object) { return downcast<mc68328_device &>(device).m_spim_xch_trigger_cb.set_callback(object); }
636   
637   
648638   DECLARE_WRITE16_MEMBER(write);
649639   DECLARE_READ16_MEMBER(read);
650640   DECLARE_WRITE_LINE_MEMBER(set_penirq_line);
r29289r29290
654644
655645protected:
656646   // device-level overrides
657   virtual void device_config_complete();
658647   virtual void device_start();
659648   virtual void device_reset();
660649
r29289r29290
679668   emu_timer *m_rtc;
680669   emu_timer *m_pwm;
681670
682   devcb_resolved_write8  m_out_port_a;    /* 8-bit output */
683   devcb_resolved_write8  m_out_port_b;    /* 8-bit output */
684   devcb_resolved_write8  m_out_port_c;    /* 8-bit output */
685   devcb_resolved_write8  m_out_port_d;    /* 8-bit output */
686   devcb_resolved_write8  m_out_port_e;    /* 8-bit output */
687   devcb_resolved_write8  m_out_port_f;    /* 8-bit output */
688   devcb_resolved_write8  m_out_port_g;    /* 8-bit output */
689   devcb_resolved_write8  m_out_port_j;    /* 8-bit output */
690   devcb_resolved_write8  m_out_port_k;    /* 8-bit output */
691   devcb_resolved_write8  m_out_port_m;    /* 8-bit output */
671   devcb2_write8  m_out_port_a_cb;    /* 8-bit output */
672   devcb2_write8  m_out_port_b_cb;    /* 8-bit output */
673   devcb2_write8  m_out_port_c_cb;    /* 8-bit output */
674   devcb2_write8  m_out_port_d_cb;    /* 8-bit output */
675   devcb2_write8  m_out_port_e_cb;    /* 8-bit output */
676   devcb2_write8  m_out_port_f_cb;    /* 8-bit output */
677   devcb2_write8  m_out_port_g_cb;    /* 8-bit output */
678   devcb2_write8  m_out_port_j_cb;    /* 8-bit output */
679   devcb2_write8  m_out_port_k_cb;    /* 8-bit output */
680   devcb2_write8  m_out_port_m_cb;    /* 8-bit output */
692681
693   devcb_resolved_read8   m_in_port_a;     /* 8-bit input */
694   devcb_resolved_read8   m_in_port_b;     /* 8-bit input */
695   devcb_resolved_read8   m_in_port_c;     /* 8-bit input */
696   devcb_resolved_read8   m_in_port_d;     /* 8-bit input */
697   devcb_resolved_read8   m_in_port_e;     /* 8-bit input */
698   devcb_resolved_read8   m_in_port_f;     /* 8-bit input */
699   devcb_resolved_read8   m_in_port_g;     /* 8-bit input */
700   devcb_resolved_read8   m_in_port_j;     /* 8-bit input */
701   devcb_resolved_read8   m_in_port_k;     /* 8-bit input */
702   devcb_resolved_read8   m_in_port_m;     /* 8-bit input */
682   devcb2_read8   m_in_port_a_cb;     /* 8-bit input */
683   devcb2_read8   m_in_port_b_cb;     /* 8-bit input */
684   devcb2_read8   m_in_port_c_cb;     /* 8-bit input */
685   devcb2_read8   m_in_port_d_cb;     /* 8-bit input */
686   devcb2_read8   m_in_port_e_cb;     /* 8-bit input */
687   devcb2_read8   m_in_port_f_cb;     /* 8-bit input */
688   devcb2_read8   m_in_port_g_cb;     /* 8-bit input */
689   devcb2_read8   m_in_port_j_cb;     /* 8-bit input */
690   devcb2_read8   m_in_port_k_cb;     /* 8-bit input */
691   devcb2_read8   m_in_port_m_cb;     /* 8-bit input */
703692
704   devcb_resolved_write8  m_out_pwm;       /* 1-bit output */
693   devcb2_write8  m_out_pwm_cb;       /* 1-bit output */
705694
706   devcb_resolved_write16 m_out_spim;      /* 16-bit output */
707   devcb_resolved_read16  m_in_spim;       /* 16-bit input */
695   devcb2_write16 m_out_spim_cb;      /* 16-bit output */
696   devcb2_read16  m_in_spim_cb;       /* 16-bit input */
708697
709   devcb_resolved_write_line m_spim_xch_trigger;   // not really a write_line, fix when converting to devcb2!
698   devcb2_write_line m_spim_xch_trigger_cb;    /* SPIM exchange trigger */ /*todo: not really a write line, fix*/
710699
711   cpu_device *m_cpu;
700   required_device<cpu_device> m_cpu;
712701};
702   
713703
704extern const device_type MC68328;
714705
715#define MC68328_INTERFACE(name) const mc68328_interface (name)=
706#define MCFG_MC68328_CPU(_tag) \
707   mc68328_device::static_set_cpu_tag(*device, "^"_tag);
708   
709#define MCFG_MC68328_OUT_PORT_A_CB(_devcb) \
710   devcb = &mc68328_device::set_out_port_a_callback(*device, DEVCB2_##_devcb);
711   
712#define MCFG_MC68328_OUT_PORT_B_CB(_devcb) \
713   devcb = &mc68328_device::set_out_port_b_callback(*device, DEVCB2_##_devcb);
714   
715#define MCFG_MC68328_OUT_PORT_C_CB(_devcb) \
716   devcb = &mc68328_device::set_out_port_c_callback(*device, DEVCB2_##_devcb);
717   
718#define MCFG_MC68328_OUT_PORT_D_CB(_devcb) \
719   devcb = &mc68328_device::set_out_port_d_callback(*device, DEVCB2_##_devcb);
720   
721#define MCFG_MC68328_OUT_PORT_E_CB(_devcb) \
722   devcb = &mc68328_device::set_out_port_e_callback(*device, DEVCB2_##_devcb);
723   
724#define MCFG_MC68328_OUT_PORT_F_CB(_devcb) \
725   devcb = &mc68328_device::set_out_port_f_callback(*device, DEVCB2_##_devcb);
726   
727#define MCFG_MC68328_OUT_PORT_G_CB(_devcb) \
728   devcb = &mc68328_device::set_out_port_g_callback(*device, DEVCB2_##_devcb);
729   
730#define MCFG_MC68328_OUT_PORT_J_CB(_devcb) \
731   devcb = &mc68328_device::set_out_port_j_callback(*device, DEVCB2_##_devcb);
732   
733#define MCFG_MC68328_OUT_PORT_K_CB(_devcb) \
734   devcb = &mc68328_device::set_out_port_k_callback(*device, DEVCB2_##_devcb);
735   
736#define MCFG_MC68328_OUT_PORT_M_CB(_devcb) \
737   devcb = &mc68328_device::set_out_port_m_callback(*device, DEVCB2_##_devcb);
738   
739#define MCFG_MC68328_IN_PORT_A_CB(_devcb) \
740   devcb = &mc68328_device::set_in_port_a_callback(*device, DEVCB2_##_devcb);
741   
742#define MCFG_MC68328_IN_PORT_B_CB(_devcb) \
743   devcb = &mc68328_device::set_in_port_b_callback(*device, DEVCB2_##_devcb);
744   
745#define MCFG_MC68328_IN_PORT_C_CB(_devcb) \
746   devcb = &mc68328_device::set_in_port_c_callback(*device, DEVCB2_##_devcb);
747   
748#define MCFG_MC68328_IN_PORT_D_CB(_devcb) \
749   devcb = &mc68328_device::set_in_port_d_callback(*device, DEVCB2_##_devcb);
750   
751#define MCFG_MC68328_IN_PORT_E_CB(_devcb) \
752   devcb = &mc68328_device::set_in_port_e_callback(*device, DEVCB2_##_devcb);
753   
754#define MCFG_MC68328_IN_PORT_F_CB(_devcb) \
755   devcb = &mc68328_device::set_in_port_f_callback(*device, DEVCB2_##_devcb);
756   
757#define MCFG_MC68328_IN_PORT_G_CB(_devcb) \
758   devcb = &mc68328_device::set_in_port_g_callback(*device, DEVCB2_##_devcb);
759   
760#define MCFG_MC68328_IN_PORT_J_CB(_devcb) \
761   devcb = &mc68328_device::set_in_port_j_callback(*device, DEVCB2_##_devcb);
762   
763#define MCFG_MC68328_IN_PORT_K_CB(_devcb) \
764   devcb = &mc68328_device::set_in_port_k_callback(*device, DEVCB2_##_devcb);
765   
766#define MCFG_MC68328_IN_PORT_M_CB(_devcb) \
767   devcb = &mc68328_device::set_in_port_m_callback(*device, DEVCB2_##_devcb);
768   
769#define MCFG_MC68328_OUT_PWM_CB(_devcb) \
770   devcb = &mc68328_device::set_out_pwm_callback(*device, DEVCB2_##_devcb);
771   
772#define MCFG_MC68328_OUT_SPIM_CB(_devcb) \
773   devcb = &mc68328_device::set_out_spim_callback(*device, DEVCB2_##_devcb);
774   
775#define MCFG_MC68328_IN_SPIM_CB(_devcb) \
776   devcb = &mc68328_device::set_in_spim_callback(*device, DEVCB2_##_devcb);
777   
778#define MCFG_MC68328_SPIM_XCH_TRIGGER_CB(_devcb) \
779   devcb = &mc68328_device::set_spim_xch_trigger_callback(*device, DEVCB2_##_devcb);
716780
717781
718#define MCFG_MC68328_ADD(_tag, _intrf) \
719   MCFG_DEVICE_ADD(_tag, MC68328, 0) \
720   MCFG_DEVICE_CONFIG(_intrf)
721
722extern const device_type MC68328;
723
724
725782#endif
trunk/src/mess/drivers/palm.c
r29289r29290
185185    MACHINE DRIVERS
186186***************************************************************************/
187187
188
189static MC68328_INTERFACE(palm_dragonball_iface)
190{
191   "maincpu",
192
193   DEVCB_NULL,                   // Port A Output
194   DEVCB_NULL,                   // Port B Output
195   DEVCB_NULL,                   // Port C Output
196   DEVCB_NULL,                   // Port D Output
197   DEVCB_NULL,                   // Port E Output
198   DEVCB_DRIVER_MEMBER(palm_state,palm_port_f_out),// Port F Output
199   DEVCB_NULL,                   // Port G Output
200   DEVCB_NULL,                   // Port J Output
201   DEVCB_NULL,                   // Port K Output
202   DEVCB_NULL,                   // Port M Output
203
204   DEVCB_NULL,                   // Port A Input
205   DEVCB_NULL,                   // Port B Input
206   DEVCB_DRIVER_MEMBER(palm_state,palm_port_c_in),// Port C Input
207   DEVCB_NULL,                   // Port D Input
208   DEVCB_NULL,                   // Port E Input
209   DEVCB_DRIVER_MEMBER(palm_state,palm_port_f_in),// Port F Input
210   DEVCB_NULL,                   // Port G Input
211   DEVCB_NULL,                   // Port J Input
212   DEVCB_NULL,                   // Port K Input
213   DEVCB_NULL,                   // Port M Input
214
215   DEVCB_DRIVER_MEMBER(palm_state,palm_dac_transition),
216
217   DEVCB_DRIVER_MEMBER16(palm_state,palm_spim_out),
218   DEVCB_DRIVER_MEMBER16(palm_state,palm_spim_in),
219   DEVCB_DRIVER_LINE_MEMBER(palm_state, palm_spim_exchange)
220};
221
222
223188static MACHINE_CONFIG_START( palm, palm_state )
224189   /* basic machine hardware */
225190   MCFG_CPU_ADD( "maincpu", M68000, 32768*506 )        /* 16.580608 MHz */
r29289r29290
246211   MCFG_SOUND_ADD("dac", DAC, 0)
247212   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
248213
249   MCFG_MC68328_ADD( MC68328_TAG, palm_dragonball_iface ) // lsi device
214   MCFG_DEVICE_ADD( MC68328_TAG, MC68328, 0 ) // lsi device
215   MCFG_MC68328_CPU("maincpu")
216   MCFG_MC68328_OUT_PORT_F_CB(WRITE8(palm_state, palm_port_f_out)) // Port F Output
217   MCFG_MC68328_IN_PORT_C_CB(READ8(palm_state, palm_port_c_in)) // Port C Input
218   MCFG_MC68328_IN_PORT_F_CB(READ8(palm_state, palm_port_f_in)) // Port F Input
219   MCFG_MC68328_OUT_PWM_CB(WRITE8(palm_state, palm_dac_transition))
220   MCFG_MC68328_OUT_SPIM_CB(WRITE16(palm_state, palm_spim_out))
221   MCFG_MC68328_IN_SPIM_CB(READ16(palm_state, palm_spim_in))
222   MCFG_MC68328_SPIM_XCH_TRIGGER_CB(WRITELINE(palm_state, palm_spim_exchange))
250223MACHINE_CONFIG_END
251224
252225static INPUT_PORTS_START( palm )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team