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