[00717a3] | 1 | /* |
---|
| 2 | * Generic UART Serial driver for Motorola Coldfire processors definitions |
---|
| 3 | * |
---|
| 4 | * Copyright (C) 2000 OKTET Ltd., St.-Petersburg, Russian Fed. |
---|
| 5 | * Author: Victor V. Vengerov <vvv@oktet.ru> |
---|
| 6 | * |
---|
| 7 | * The license and distribution terms for this file may be |
---|
| 8 | * found in the file LICENSE in this distribution or at |
---|
| 9 | * |
---|
| 10 | * http://www.OARcorp.com/rtems/license.html. |
---|
| 11 | * |
---|
| 12 | * @(#) $Id$ |
---|
| 13 | * |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | #ifndef __MCFUART_H__ |
---|
| 17 | #define __MCFUART_H__ |
---|
| 18 | |
---|
| 19 | #include <termios.h> |
---|
| 20 | #include "bsp.h" |
---|
| 21 | #include "mcf5206e.h" |
---|
| 22 | |
---|
| 23 | /* |
---|
| 24 | * The MCF5206e System Clock Frequency; 54MHz default |
---|
| 25 | */ |
---|
| 26 | #ifndef SYSTEM_CLOCK_FREQUENCY |
---|
| 27 | #define SYSTEM_CLOCK_FREQUENCY BSP_SYSTEM_FREQUENCY |
---|
| 28 | #endif |
---|
| 29 | |
---|
| 30 | /* |
---|
| 31 | * The following structure is a descriptor of single UART channel. |
---|
| 32 | * It contains the initialization information about channel and |
---|
| 33 | * current operating values |
---|
| 34 | */ |
---|
| 35 | typedef struct mcfuart { |
---|
| 36 | rtems_unsigned32 chn; /* UART channel number */ |
---|
| 37 | rtems_unsigned8 intvec; /* UART interrupt vector number, or |
---|
| 38 | 0 if polled I/O */ |
---|
| 39 | void *tty; /* termios channel descriptor */ |
---|
| 40 | |
---|
| 41 | volatile const char *tx_buf; /* Transmit buffer from termios */ |
---|
| 42 | volatile rtems_unsigned32 tx_buf_len;/* Transmit buffer length */ |
---|
| 43 | volatile rtems_unsigned32 tx_ptr; /* Index of next char to transmit*/ |
---|
| 44 | rtems_isr_entry old_handler;/* Saved interrupt handler */ |
---|
| 45 | |
---|
| 46 | tcflag_t c_iflag; /* termios input mode flags */ |
---|
| 47 | rtems_boolean parerr_mark_flag; /* Parity error processing |
---|
| 48 | state */ |
---|
| 49 | } mcfuart; |
---|
| 50 | |
---|
| 51 | /* mcfuart_init -- |
---|
| 52 | * This function verifies the input parameters and perform initialization |
---|
| 53 | * of the Motorola Coldfire on-chip UART descriptor structure. |
---|
| 54 | * |
---|
| 55 | */ |
---|
| 56 | rtems_status_code |
---|
| 57 | mcfuart_init(mcfuart *uart, void *tty, rtems_unsigned8 intvec, |
---|
| 58 | rtems_unsigned32 chn); |
---|
| 59 | |
---|
| 60 | /* mcfuart_reset -- |
---|
| 61 | * This function perform the hardware initialization of Motorola |
---|
| 62 | * Coldfire processor on-chip UART controller using parameters |
---|
| 63 | * filled by the mcfuart_init function. |
---|
| 64 | */ |
---|
| 65 | rtems_status_code |
---|
| 66 | mcfuart_reset(mcfuart *uart); |
---|
| 67 | |
---|
| 68 | /* mcfuart_disable -- |
---|
| 69 | * This function disable the operations on Motorola Coldfire UART |
---|
| 70 | * controller |
---|
| 71 | */ |
---|
| 72 | rtems_status_code |
---|
| 73 | mcfuart_disable(mcfuart *uart); |
---|
| 74 | |
---|
| 75 | /* mcfuart_set_attributes -- |
---|
| 76 | * This function parse the termios attributes structure and perform |
---|
| 77 | * the appropriate settings in hardware. |
---|
| 78 | */ |
---|
| 79 | int |
---|
| 80 | mcfuart_set_attributes(mcfuart *mcf, const struct termios *t); |
---|
| 81 | |
---|
| 82 | /* mcfuart_poll_read -- |
---|
| 83 | * This function tried to read character from MCF UART and perform |
---|
| 84 | * error handling. |
---|
| 85 | */ |
---|
| 86 | int |
---|
| 87 | mcfuart_poll_read(mcfuart *uart); |
---|
| 88 | |
---|
| 89 | /* mcfuart_interrupt_write -- |
---|
| 90 | * This function initiate transmitting of the buffer in interrupt mode. |
---|
| 91 | */ |
---|
| 92 | int |
---|
| 93 | mcfuart_interrupt_write(mcfuart *uart, const char *buf, int len); |
---|
| 94 | |
---|
| 95 | /* mcfuart_poll_write -- |
---|
| 96 | * This function transmit buffer byte-by-byte in polling mode. |
---|
| 97 | */ |
---|
| 98 | int |
---|
| 99 | mcfuart_poll_write(mcfuart *uart, const char *buf, int len); |
---|
| 100 | |
---|
| 101 | /* mcfuart_stop_remote_tx -- |
---|
| 102 | * This function stop data flow from remote device. |
---|
| 103 | */ |
---|
| 104 | int |
---|
| 105 | mcfuart_stop_remote_tx(mcfuart *uart); |
---|
| 106 | |
---|
| 107 | /* mcfuart_start_remote_tx -- |
---|
| 108 | * This function resume data flow from remote device. |
---|
| 109 | */ |
---|
| 110 | int |
---|
| 111 | mcfuart_start_remote_tx(mcfuart *uart); |
---|
| 112 | |
---|
| 113 | #endif |
---|