trunk/src/emu/machine/s3c2440.c
r17613 | r17614 | |
71 | 71 | s3c24xx_video_start( device, device->machine()); |
72 | 72 | } |
73 | 73 | |
74 | | DEVICE_GET_INFO( s3c2440 ) |
| 74 | const device_type S3C2440 = &device_creator<s3c2440_device>; |
| 75 | |
| 76 | s3c2440_device::s3c2440_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 77 | : device_t(mconfig, S3C2440, "Samsung S3C2440", tag, owner, clock) |
75 | 78 | { |
76 | | switch ( state ) |
77 | | { |
78 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
79 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(s3c2440); break; |
80 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
81 | | case DEVINFO_STR_NAME: strcpy(info->s, "Samsung S3C2440"); break; |
82 | | /* --- default --- */ |
83 | | default: DEVICE_GET_INFO_CALL(s3c24xx); break; |
84 | | } |
| 79 | m_token = global_alloc_array_clear(UINT8, sizeof(s3c24xx_t)); |
85 | 80 | } |
86 | 81 | |
| 82 | //------------------------------------------------- |
| 83 | // device_config_complete - perform any |
| 84 | // operations now that the configuration is |
| 85 | // complete |
| 86 | //------------------------------------------------- |
| 87 | |
| 88 | void s3c2440_device::device_config_complete() |
| 89 | { |
| 90 | } |
| 91 | |
| 92 | //------------------------------------------------- |
| 93 | // device_start - device-specific startup |
| 94 | //------------------------------------------------- |
| 95 | |
| 96 | void s3c2440_device::device_start() |
| 97 | { |
| 98 | DEVICE_START_NAME( s3c2440 )(this); |
| 99 | } |
| 100 | |
| 101 | //------------------------------------------------- |
| 102 | // device_reset - device-specific reset |
| 103 | //------------------------------------------------- |
| 104 | |
| 105 | void s3c2440_device::device_reset() |
| 106 | { |
| 107 | DEVICE_RESET_NAME( s3c24xx )(this); |
| 108 | } |
| 109 | |
| 110 | |
87 | 111 | void s3c2440_uart_fifo_w( device_t *device, int uart, UINT8 data) |
88 | 112 | { |
89 | 113 | s3c24xx_uart_fifo_w( device, uart, data); |
r17613 | r17614 | |
108 | 132 | { |
109 | 133 | s3c24xx_pin_frnb_w( device, state); |
110 | 134 | } |
111 | | |
112 | | s3c2440_device::s3c2440_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock) |
113 | | : legacy_device_base(mconfig, type, tag, owner, clock, DEVICE_GET_INFO_NAME(s3c2440)) |
114 | | { |
115 | | } |
116 | | |
117 | | const device_type S3C2440 = &legacy_device_creator<s3c2440_device>; |
trunk/src/emu/machine/s3c2440.h
r17613 | r17614 | |
40 | 40 | S3C2440_CORE_PIN_OM1 |
41 | 41 | }; |
42 | 42 | |
43 | | DEVICE_GET_INFO( s3c2440 ); |
44 | | |
45 | | class s3c2440_device : public legacy_device_base |
| 43 | class s3c2440_device : public device_t |
46 | 44 | { |
47 | 45 | public: |
48 | | s3c2440_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock); |
49 | | |
| 46 | s3c2440_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 47 | ~s3c2440_device() { global_free(m_token); } |
| 48 | |
| 49 | // access to legacy token |
| 50 | void *token() const { assert(m_token != NULL); return m_token; } |
| 51 | protected: |
| 52 | // device-level overrides |
| 53 | virtual void device_config_complete(); |
| 54 | virtual void device_start(); |
| 55 | virtual void device_reset(); |
| 56 | private: |
| 57 | // internal state |
| 58 | void *m_token; |
| 59 | public: |
50 | 60 | UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
51 | 61 | }; |
52 | 62 | |
trunk/src/emu/machine/s3c24xx.c
r17613 | r17614 | |
110 | 110 | INLINE s3c24xx_t *get_token( device_t *device) |
111 | 111 | { |
112 | 112 | assert(device != NULL); |
113 | | return (s3c24xx_t *)downcast<legacy_device_base *>(device)->token(); |
| 113 | #if defined(DEVICE_S3C2400) |
| 114 | return (s3c24xx_t *)downcast<s3c2400_device *>(device)->token(); |
| 115 | #elif defined(DEVICE_S3C2410) |
| 116 | return (s3c24xx_t *)downcast<s3c2410_device *>(device)->token(); |
| 117 | #elif defined(DEVICE_S3C2440) |
| 118 | return (s3c24xx_t *)downcast<s3c2440_device *>(device)->token(); |
| 119 | #endif |
114 | 120 | } |
115 | 121 | |
116 | 122 | /*************************************************************************** |
r17613 | r17614 | |
3701 | 3707 | } |
3702 | 3708 | #endif |
3703 | 3709 | } |
3704 | | |
3705 | | static DEVICE_GET_INFO( s3c24xx ) |
3706 | | { |
3707 | | switch ( state ) |
3708 | | { |
3709 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
3710 | | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(s3c24xx_t); break; |
3711 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
3712 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(s3c24xx); break; |
3713 | | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(s3c24xx); break; |
3714 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
3715 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "S3C24XX"); break; |
3716 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.00"); break; |
3717 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
3718 | | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
3719 | | } |
3720 | | } |
trunk/src/emu/machine/s3c2400.c
r17613 | r17614 | |
66 | 66 | s3c24xx_video_start( device, device->machine()); |
67 | 67 | } |
68 | 68 | |
69 | | DEVICE_GET_INFO( s3c2400 ) |
| 69 | const device_type S3C2400 = &device_creator<s3c2400_device>; |
| 70 | |
| 71 | s3c2400_device::s3c2400_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 72 | : device_t(mconfig, S3C2400, "Samsung S3C2400", tag, owner, clock) |
70 | 73 | { |
71 | | switch ( state ) |
72 | | { |
73 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
74 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(s3c2400); break; |
75 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
76 | | case DEVINFO_STR_NAME: strcpy(info->s, "Samsung S3C2400"); break; |
77 | | /* --- default --- */ |
78 | | default: DEVICE_GET_INFO_CALL(s3c24xx); break; |
79 | | } |
| 74 | m_token = global_alloc_array_clear(UINT8, sizeof(s3c24xx_t)); |
80 | 75 | } |
81 | 76 | |
82 | | void s3c2400_uart_fifo_w( device_t *device, int uart, UINT8 data) |
| 77 | //------------------------------------------------- |
| 78 | // device_config_complete - perform any |
| 79 | // operations now that the configuration is |
| 80 | // complete |
| 81 | //------------------------------------------------- |
| 82 | |
| 83 | void s3c2400_device::device_config_complete() |
83 | 84 | { |
84 | | s3c24xx_uart_fifo_w( device, uart, data); |
85 | 85 | } |
86 | 86 | |
87 | | s3c2400_device::s3c2400_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock) |
88 | | : legacy_device_base(mconfig, type, tag, owner, clock, DEVICE_GET_INFO_NAME(s3c2400)) |
| 87 | //------------------------------------------------- |
| 88 | // device_start - device-specific startup |
| 89 | //------------------------------------------------- |
| 90 | |
| 91 | void s3c2400_device::device_start() |
89 | 92 | { |
| 93 | DEVICE_START_NAME( s3c2400 )(this); |
90 | 94 | } |
91 | 95 | |
92 | | const device_type S3C2400 = &legacy_device_creator<s3c2400_device>; |
| 96 | //------------------------------------------------- |
| 97 | // device_reset - device-specific reset |
| 98 | //------------------------------------------------- |
| 99 | |
| 100 | void s3c2400_device::device_reset() |
| 101 | { |
| 102 | DEVICE_RESET_NAME( s3c24xx )(this); |
| 103 | } |
| 104 | |
| 105 | void s3c2400_uart_fifo_w( device_t *device, int uart, UINT8 data) |
| 106 | { |
| 107 | s3c24xx_uart_fifo_w( device, uart, data); |
| 108 | } |
| 109 | |
trunk/src/emu/machine/s3c2400.h
r17613 | r17614 | |
33 | 33 | S3C2400_GPIO_PORT_G |
34 | 34 | }; |
35 | 35 | |
36 | | DEVICE_GET_INFO( s3c2400 ); |
37 | | |
38 | | class s3c2400_device : public legacy_device_base |
| 36 | class s3c2400_device : public device_t |
39 | 37 | { |
40 | 38 | public: |
41 | | s3c2400_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock); |
| 39 | s3c2400_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 40 | ~s3c2400_device() { global_free(m_token); } |
| 41 | |
| 42 | // access to legacy token |
| 43 | void *token() const { assert(m_token != NULL); return m_token; } |
42 | 44 | |
| 45 | // device-level overrides |
| 46 | virtual void device_config_complete(); |
| 47 | virtual void device_start(); |
| 48 | virtual void device_reset(); |
| 49 | private: |
| 50 | // internal state |
| 51 | void *m_token; |
| 52 | public: |
43 | 53 | UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
44 | 54 | }; |
45 | 55 | |
trunk/src/emu/machine/s3c2410.c
r17613 | r17614 | |
69 | 69 | s3c24xx_video_start( device, device->machine()); |
70 | 70 | } |
71 | 71 | |
72 | | DEVICE_GET_INFO( s3c2410 ) |
| 72 | const device_type S3C2410 = &device_creator<s3c2410_device>; |
| 73 | |
| 74 | s3c2410_device::s3c2410_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 75 | : device_t(mconfig, S3C2410, "Samsung S3C2410", tag, owner, clock) |
73 | 76 | { |
74 | | switch ( state ) |
75 | | { |
76 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
77 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(s3c2410); break; |
78 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
79 | | case DEVINFO_STR_NAME: strcpy(info->s, "Samsung S3C2410"); break; |
80 | | /* --- default --- */ |
81 | | default: DEVICE_GET_INFO_CALL(s3c24xx); break; |
82 | | } |
| 77 | m_token = global_alloc_array_clear(UINT8, sizeof(s3c24xx_t)); |
83 | 78 | } |
84 | 79 | |
| 80 | //------------------------------------------------- |
| 81 | // device_config_complete - perform any |
| 82 | // operations now that the configuration is |
| 83 | // complete |
| 84 | //------------------------------------------------- |
| 85 | |
| 86 | void s3c2410_device::device_config_complete() |
| 87 | { |
| 88 | } |
| 89 | |
| 90 | //------------------------------------------------- |
| 91 | // device_start - device-specific startup |
| 92 | //------------------------------------------------- |
| 93 | |
| 94 | void s3c2410_device::device_start() |
| 95 | { |
| 96 | DEVICE_START_NAME( s3c2410 )(this); |
| 97 | } |
| 98 | |
| 99 | //------------------------------------------------- |
| 100 | // device_reset - device-specific reset |
| 101 | //------------------------------------------------- |
| 102 | |
| 103 | void s3c2410_device::device_reset() |
| 104 | { |
| 105 | DEVICE_RESET_NAME( s3c24xx )(this); |
| 106 | } |
| 107 | |
85 | 108 | void s3c2410_uart_fifo_w( device_t *device, int uart, UINT8 data) |
86 | 109 | { |
87 | 110 | s3c24xx_uart_fifo_w( device, uart, data); |
r17613 | r17614 | |
108 | 131 | s3c24xx_request_eint( device, number); |
109 | 132 | } |
110 | 133 | |
111 | | s3c2410_device::s3c2410_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock) |
112 | | : legacy_device_base(mconfig, type, tag, owner, clock, DEVICE_GET_INFO_NAME(s3c2410)) |
113 | | { |
114 | | } |
115 | | |
116 | | const device_type S3C2410 = &legacy_device_creator<s3c2410_device>; |
trunk/src/emu/machine/s3c2410.h
r17613 | r17614 | |
41 | 41 | S3C2410_CORE_PIN_OM1 |
42 | 42 | }; |
43 | 43 | |
44 | | DEVICE_GET_INFO( s3c2410 ); |
45 | | |
46 | | class s3c2410_device : public legacy_device_base |
| 44 | class s3c2410_device : public device_t |
47 | 45 | { |
48 | 46 | public: |
49 | | s3c2410_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock); |
50 | | |
| 47 | s3c2410_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 48 | ~s3c2410_device() { global_free(m_token); } |
| 49 | |
| 50 | // access to legacy token |
| 51 | void *token() const { assert(m_token != NULL); return m_token; } |
| 52 | // device-level overrides |
| 53 | virtual void device_config_complete(); |
| 54 | virtual void device_start(); |
| 55 | virtual void device_reset(); |
| 56 | private: |
| 57 | // internal state |
| 58 | void *m_token; |
| 59 | public: |
51 | 60 | UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
52 | 61 | }; |
53 | 62 | |