diff options
author | Nao Pross <naopross@thearcway.org> | 2017-06-02 16:22:26 +0200 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2017-06-02 16:22:26 +0200 |
commit | 4a7f45ee28ac0799ba1ca93fd1683f7858efc54a (patch) | |
tree | 831487d939e15ba4c2fdb16b08240f1aeda843e5 /sw/z80/kernel/include/serial.h | |
parent | new file coding_rules.txt to have a consistent coding style (diff) | |
download | z80uPC-4a7f45ee28ac0799ba1ca93fd1683f7858efc54a.tar.gz z80uPC-4a7f45ee28ac0799ba1ca93fd1683f7858efc54a.zip |
add serial interface and a few std library functions
changes in usart:
- new functions to setup the serial comunication settings such as baudrate,
parity and stop bits
- init function with most common values
- transmit and receive functions each with a wrapper to send data blocks
changes in libc:
- new file stdio.c with basic implementation of putch, printf still a prototype
- new file string.c with memcpy() function
Diffstat (limited to '')
-rw-r--r-- | sw/z80/kernel/include/serial.h | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/sw/z80/kernel/include/serial.h b/sw/z80/kernel/include/serial.h deleted file mode 100644 index 03e2448..0000000 --- a/sw/z80/kernel/include/serial.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef __SERIAL_H__ -#define __SERIAL_H__ - -#include "types.h" -#include "devices.h" - -/* this structure is only for internal usage */ -struct _usart_device -{ - register_t buffer; // also used as LSB for divisor latch - - struct IER - { - volatile int received_data_interrupt :1; - volatile int transmitter_empty_interrupt :1; - volatile int receiver_line_status_interrupt :1; - volatile int modem_status_interrupt :1; - volatile int reserved :4; - } IER; - - struct IIR - { - volatile int interrupt_pending :1; - volatile int interrupt_id :3; - volatile int reserved :2; - volatile int fifos :2; - } IIR; - - struct FCR - { - volatile int fifo_enable :1; - volatile int receiver_fifo_rst :1; - } - - struct LCR - { - volatile int word_length :2; - volatile int stop_bits :1; - volatile int parity :1; - volatile int even_parity :1; - volatile int stick_parity :1; - volatile int break_control :1; - volatile int divisor_latch_access :1; - } LCR; - - struct MCR - { - volatile int data_terminal_ready :1; - volatile int request_to_send :1; - volatile int out1; - volatile int out2; - volatile int loop; - volatile int autoflow :1; - volatile int reserved :2; - } MCR; - - struct LSR - { - volatile int data_ready :1; - volatile int overrun_error :1; - volatile int parity_error :1; - volatile int framing_error :1; - volatile int break_interrupt :1; - volatile int transmitter_register :1; - volatile int transmitter_emtpy :1; - volatile int fifo_recv_error :1; - } LSR; - - struct MSR - { - volatile int delta_cts :1; - volatile int delta_data_set_ready :1; - volatile int trailing_edge_ring_indicator :1; - volatile int delta_data_carrier_detect :1; - volatile int clear_to_send :1; - volatile int data_set_ready :1; - volatile int ring_indicator :1; - volatile int data_carrier_detect :1; - } MSR; - - register_t scratch; -} *_usart = (_usart_device *) ADDR_DEV_USART; - - -#endif // __SERIAL__H__ |