wdenk | 3953988 | 2004-07-01 16:30:44 +0000 | [diff] [blame^] | 1 | #ifndef __UART_H |
| 2 | #define __UART_H |
| 3 | |
| 4 | /* |
| 5 | * Copyright (c) 2004 Cucy Systems (http://www.cucy.com) |
| 6 | * Curt Brune <curt@cucy.com> |
| 7 | * |
| 8 | * See file CREDITS for list of people who contributed to this |
| 9 | * project. |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU General Public License as |
| 13 | * published by the Free Software Foundation; either version 2 of |
| 14 | * the License, or (at your option) any later version. |
| 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 24 | * MA 02111-1307 USA |
| 25 | * |
| 26 | * Description: S3C4510B UART register layout |
| 27 | */ |
| 28 | |
| 29 | /* UART LINE CONTROL register */ |
| 30 | typedef struct __BF_UART_LINE_CTRL { |
| 31 | u32 wordLen: 2; |
| 32 | u32 nStop: 1; |
| 33 | u32 parity: 3; |
| 34 | u32 clk: 1; |
| 35 | u32 infra_red: 1; |
| 36 | u32 unused:24; |
| 37 | } BF_UART_LINE_CTRL; |
| 38 | |
| 39 | typedef union _UART_LINE_CTRL { |
| 40 | u32 ui; |
| 41 | BF_UART_LINE_CTRL bf; |
| 42 | } UART_LINE_CTRL; |
| 43 | |
| 44 | /* UART CONTROL register */ |
| 45 | typedef struct __BF_UART_CTRL { |
| 46 | u32 rxMode: 2; |
| 47 | u32 rxIrq: 1; |
| 48 | u32 txMode: 2; |
| 49 | u32 DSR: 1; |
| 50 | u32 sendBreak: 1; |
| 51 | u32 loopBack: 1; |
| 52 | u32 unused:24; |
| 53 | } BF_UART_CTRL; |
| 54 | |
| 55 | typedef union _UART_CTRL { |
| 56 | u32 ui; |
| 57 | BF_UART_CTRL bf; |
| 58 | } UART_CTRL; |
| 59 | |
| 60 | /* UART STATUS register */ |
| 61 | typedef struct __BF_UART_STAT { |
| 62 | u32 overrun: 1; |
| 63 | u32 parity: 1; |
| 64 | u32 frame: 1; |
| 65 | u32 breakIrq: 1; |
| 66 | u32 DTR: 1; |
| 67 | u32 rxReady: 1; |
| 68 | u32 txBufEmpty: 1; |
| 69 | u32 txComplete: 1; |
| 70 | u32 unused:24; |
| 71 | } BF_UART_STAT; |
| 72 | |
| 73 | typedef union _UART_STAT { |
| 74 | u32 ui; |
| 75 | BF_UART_STAT bf; |
| 76 | } UART_STAT; |
| 77 | |
| 78 | /* UART BAUD_DIV register */ |
| 79 | typedef struct __BF_UART_BAUD_DIV { |
| 80 | u32 cnt1: 4; |
| 81 | u32 cnt0:12; |
| 82 | u32 unused:16; |
| 83 | } BF_UART_BAUD_DIV; |
| 84 | |
| 85 | typedef union _UART_BAUD_DIV { |
| 86 | u32 ui; |
| 87 | BF_UART_BAUD_DIV bf; |
| 88 | } UART_BAUD_DIV; |
| 89 | |
| 90 | /* UART register block */ |
| 91 | typedef struct __UART { |
| 92 | volatile UART_LINE_CTRL m_lineCtrl; |
| 93 | volatile UART_CTRL m_ctrl; |
| 94 | volatile UART_STAT m_stat; |
| 95 | volatile u32 m_tx; |
| 96 | volatile u32 m_rx; |
| 97 | volatile UART_BAUD_DIV m_baudDiv; |
| 98 | volatile u32 m_baudCnt; |
| 99 | volatile u32 m_baudClk; |
| 100 | } UART; |
| 101 | |
| 102 | #define NL 0x0A |
| 103 | #define CR 0x0D |
| 104 | #define BSP 0x08 |
| 105 | #define ESC 0x1B |
| 106 | #define CTRLZ 0x1A |
| 107 | #define RUBOUT 0x7F |
| 108 | |
| 109 | #endif |