src/mess/machine/6551.c
| r3715 | r3716 | |
| 3 | 3 | #include "includes/serial.h" |
| 4 | 4 | |
| 5 | 5 | |
| 6 | | static void acia_6551_receive_char(unsigned char ch); |
| 7 | | static void acia_6551_refresh_ints(void); |
| 6 | /*************************************************************************** |
| 7 | TYPE DEFINITIONS |
| 8 | ***************************************************************************/ |
| 8 | 9 | |
| 9 | | struct acia6551 |
| 10 | typedef struct _acia6551 acia6551; |
| 11 | struct _acia6551 |
| 10 | 12 | { |
| 11 | 13 | unsigned char transmit_data_register; |
| 12 | 14 | unsigned char receive_data_register; |
| r3715 | r3716 | |
| 15 | 17 | unsigned char control_register; |
| 16 | 18 | |
| 17 | 19 | /* internal baud rate timer */ |
| 18 | | void *timer; |
| 20 | emu_timer *timer; |
| 19 | 21 | /* callback for internal baud rate timer */ |
| 20 | 22 | void (*acia_updated_callback)(int id, unsigned long State); |
| 21 | 23 | |
| r3715 | r3716 | |
| 32 | 34 | }; |
| 33 | 35 | |
| 34 | 36 | |
| 35 | | static struct acia6551 acia; |
| 37 | /*************************************************************************** |
| 38 | FUNCTION PROTOTYPES |
| 39 | ***************************************************************************/ |
| 36 | 40 | |
| 41 | static void acia_6551_receive_char(unsigned char ch); |
| 42 | static void acia_6551_refresh_ints(void); |
| 43 | |
| 44 | static acia6551 acia; |
| 45 | |
| 46 | |
| 47 | /*************************************************************************** |
| 48 | IMPLEMENTATION |
| 49 | ***************************************************************************/ |
| 50 | |
| 37 | 51 | /* |
| 38 | 52 | A1 A0 Write Read |
| 39 | 53 | 0 0 Transmit Data Register Receiver Data Register |
| r3715 | r3716 | |
| 87 | 101 | { |
| 88 | 102 | serial_helper_setup(); |
| 89 | 103 | |
| 90 | | memset(&acia, 0, sizeof(struct acia6551)); |
| 104 | memset(&acia, 0, sizeof(acia)); |
| 91 | 105 | /* transmit data reg is empty */ |
| 92 | 106 | acia.status_register |= (1<<4); |
| 93 | 107 | acia.timer = timer_alloc(acia_6551_timer_callback, NULL); |
src/mess/machine/6551.h
| r3715 | r3716 | |
| 1 | | /***************************************************************************** |
| 2 | | * |
| 3 | | * machine/6551.h |
| 4 | | * |
| 5 | | * 6551 ACIA |
| 6 | | * |
| 7 | | ****************************************************************************/ |
| 1 | /********************************************************************* |
| 8 | 2 | |
| 9 | | #ifndef _6551_H_ |
| 10 | | #define _6551_H_ |
| 3 | 6551.h |
| 11 | 4 | |
| 5 | MOS Technology 6551 Asynchronous Communications Interface Adapter |
| 12 | 6 | |
| 13 | | /*----------- defined in machine/6551.c -----------*/ |
| 7 | *********************************************************************/ |
| 14 | 8 | |
| 9 | #ifndef __6551_H__ |
| 10 | #define __6551_H__ |
| 11 | |
| 12 | |
| 13 | /*************************************************************************** |
| 14 | FUNCTION PROTOTYPES |
| 15 | ***************************************************************************/ |
| 16 | |
| 15 | 17 | WRITE8_HANDLER(acia_6551_w); |
| 16 | | READ8_HANDLER(acia_6551_r); |
| 18 | READ8_HANDLER(acia_6551_r); |
| 17 | 19 | |
| 18 | 20 | void acia_6551_init(void); |
| 19 | 21 | void acia_6551_set_irq_callback(void (*callback)(int)); |
| r3715 | r3716 | |
| 21 | 23 | void acia_6551_connect_to_serial_device(const device_config *image); |
| 22 | 24 | |
| 23 | 25 | |
| 24 | | #endif /* _6551_H_ */ |
| 26 | #endif /* __6551_H__ */ |