source: rtems/c/src/lib/libcpu/sh/sh7750/include/sh4uart.h @ 59e73f37

4.104.114.84.95
Last change on this file since 59e73f37 was ba71076, checked in by Joel Sherrill <joel.sherrill@…>, on Oct 12, 2001 at 1:19:08 PM

2001-10-11 Alexandra Kossovsky <sasha@…>

  • clock/Makefile.am, clock/ckinit.c, clock/.cvsignore, Makefile.am, include/Makefile.am, include/iosh7750.h, include/ipl.h, include/ispsh7750.h, include/sh4_regs.h, include/sh4uart.h, include/sh7750_regs.h, include/.cvsignore, sci/Makefile.am, sci/console.c, sci/sh4uart.c, sci/.cvsignore, score/Makefile.am, score/cpu_asm.c, score/ispsh7750.c, score/.cvsignore, timer/Makefile.am, timer/timer.c, timer/.cvsignore, configure.ac, .cvsignore, ChangeLog?: New files. Reviewed and updated to latest automake and autoconf standards by Ralf Corsepius <corsepiu@…>.
  • Property mode set to 100644
File size: 5.4 KB
Line 
1/*
2 * Generic UART Serial driver for SH-4 processors definitions
3 *
4 * Copyright (C) 2000 OKTET Ltd., St.-Petersburg, Russian Fed.
5 * Author: Alexandra Kossovsky <sasha@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 __SH4UART_H__
17#define __SH4UART_H__
18
19#include "bsp.h"
20#include "rtems/score/sh7750_regs.h"
21
22
23/*
24 * Define this to work from gdb stub
25 */
26#define SH4_WITH_IPL
27
28#define SH4_SCI     1   /* Serial Communication Interface - SCI */
29#define SH4_SCIF    2   /* Serial Communication Interface with FIFO - SCIF */
30#define TRANSMIT_TRIGGER_VALUE(ttrg) ((ttrg) == SH7750_SCFCR2_RTRG_1 ? 1 : \
31        (ttrg) == SH7750_SCFCR2_RTRG_4 ? 4 : \
32        (ttrg) == SH7750_SCFCR2_RTRG_8 ? 8 : 14)
33
34/*
35 * Macros to call UART registers
36 */
37#define SCRDR(n) (*(volatile rtems_unsigned8 *)SH7750_SCRDR(n))
38#define SCRDR1 SCRDR(1)
39#define SCRDR2 SCRDR(2)
40#define SCTDR(n) (*(volatile rtems_unsigned8 *)SH7750_SCTDR(n))
41#define SCTDR1 SCTDR(1)
42#define SCTDR2 SCTDR(2)
43#define SCSMR(n) ((n) == 1 ? *(volatile rtems_unsigned8 *)SH7750_SCSMR1 : \
44        *(volatile rtems_unsigned16 *)SH7750_SCSMR2)
45#define SCSMR1 SCSMR(1)
46#define SCSMR2 SCSMR(2)
47#define SCSCR(n) ((n) == 1 ? *(volatile rtems_unsigned8 *)SH7750_SCSCR1 : \
48        *(volatile rtems_unsigned16 *)SH7750_SCSCR2)
49#define SCSCR1 SCSCR(1)
50#define SCSCR2 SCSCR(2)
51#define SCSSR(n) ((n) == 1 ? *(volatile rtems_unsigned8 *)SH7750_SCSSR1 : \
52        *(volatile rtems_unsigned16 *)SH7750_SCSSR2)
53#define SCSSR1 SCSSR(1)
54#define SCSSR2 SCSSR(2)
55#define SCSPTR1 (*(volatile rtems_unsigned8 *)SH7750_SCSPTR1)
56#define SCSPTR2 (*(volatile rtems_unsigned16 *)SH7750_SCSPTR2)
57#define SCBRR(n) (*(volatile rtems_unsigned8 *)SH7750_SCBRR(n))
58#define SCBRR1 SCBRR(1)
59#define SCBRR2 SCBRR(2)
60#define SCFCR2 (*(volatile rtems_unsigned16 *)SH7750_SCFCR2)
61#define SCFDR2 (*(volatile rtems_unsigned16 *)SH7750_SCFDR2)
62#define SCLSR2 (*(volatile rtems_unsigned16 *)SH7750_SCLSR2)
63
64#define IPRB (*(volatile rtems_unsigned16 *)SH7750_IPRB)
65#define IPRC (*(volatile rtems_unsigned16 *)SH7750_IPRC)
66
67/*
68 * The following structure is a descriptor of single UART channel.
69 * It contains the initialization information about channel and
70 * current operating values
71 */
72typedef struct sh4uart {
73   rtems_unsigned8      chn;        /* UART channel number */
74   rtems_unsigned8      int_driven; /* UART interrupt vector number, or
75                                       0 if polled I/O */
76   void                *tty;        /* termios channel descriptor */
77
78   volatile const char         *tx_buf;     /* Transmit buffer from termios */
79   volatile rtems_unsigned32    tx_buf_len; /* Transmit buffer length */
80   volatile rtems_unsigned32    tx_ptr;     /* Index of next char to transmit*/
81
82   rtems_isr_entry      old_handler_transmit;   /* Saved interrupt handlers */
83   rtems_isr_entry      old_handler_receive;
84
85   tcflag_t             c_iflag;            /* termios input mode flags */
86   rtems_boolean        parerr_mark_flag;   /* Parity error processing state */
87} sh4uart;
88
89/*
90 * Functions from sh4uart.c
91 */
92
93/* sh4uart_init --
94 *     This function verifies the input parameters and perform initialization
95 *     of the Motorola Coldfire on-chip UART descriptor structure.
96 *
97 */
98rtems_status_code
99sh4uart_init(sh4uart *uart, void *tty, int chn, int int_driven);
100
101/* sh4uart_reset --
102 *     This function perform the hardware initialization of Motorola
103 *     Coldfire processor on-chip UART controller using parameters
104 *     filled by the sh4uart_init function.
105 */
106rtems_status_code
107sh4uart_reset(sh4uart *uart);
108
109/* sh4uart_disable --
110 *     This function disable the operations on Motorola Coldfire UART
111 *     controller
112 */
113rtems_status_code
114sh4uart_disable(sh4uart *uart);
115
116/* sh4uart_set_attributes --
117 *     This function parse the termios attributes structure and perform
118 *     the appropriate settings in hardware.
119 */
120rtems_status_code
121sh4uart_set_attributes(sh4uart *mcf, const struct termios *t);
122
123/* sh4uart_poll_read --
124 *     This function tried to read character from MCF UART and perform
125 *     error handling.
126 */
127int
128sh4uart_poll_read(sh4uart *uart);
129
130#ifdef SH4_WITH_IPL
131/* ipl_console_poll_read --
132 *     This function tried to read character from MCF UART over SH-IPL.
133 */
134int
135ipl_console_poll_read(int minor);
136
137/* sh4uart_interrupt_write --
138 *     This function initiate transmitting of the buffer in interrupt mode.
139 */
140rtems_status_code
141sh4uart_interrupt_write(sh4uart *uart, const char *buf, int len);
142
143/* sh4uart_poll_write --
144 *     This function transmit buffer byte-by-byte in polling mode.
145 */
146int
147sh4uart_poll_write(sh4uart *uart, const char *buf, int len);
148
149/* ipl_console_poll_write --
150 *     This function transmit buffer byte-by-byte in polling mode over SH-IPL.
151 */
152int
153ipl_console_poll_write(int minor, const char *buf, int len);
154
155/*
156 * ipl_finish --
157 *     Says gdb that program finished to get out from it.
158 */
159extern void ipl_finish(void);
160#endif
161
162/* sh4uart_stop_remote_tx --
163 *     This function stop data flow from remote device.
164 */
165rtems_status_code
166sh4uart_stop_remote_tx(sh4uart *uart);
167
168/* sh4uart_start_remote_tx --
169 *     This function resume data flow from remote device.
170 */
171rtems_status_code
172sh4uart_start_remote_tx(sh4uart *uart);
173
174/* Descriptor structures for two on-chip UART channels */
175extern sh4uart sh4_uarts[2];
176
177#endif
178
Note: See TracBrowser for help on using the repository browser.