OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [devs/] [serial/] [v85x/] [v850/] [v2_0/] [src/] [v85x_v850_serial.h] - Blame information for rev 773

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_V85X_V850_SERIAL_H
2
#define CYGONCE_V85X_V850_SERIAL_H
3
 
4
// ====================================================================
5
//
6
//      v850_ceb_serial.h
7
//
8
//      Device I/O - Description of NEC V850 serial hardware
9
//
10
// ====================================================================
11
//####ECOSGPLCOPYRIGHTBEGIN####
12
// -------------------------------------------
13
// This file is part of eCos, the Embedded Configurable Operating System.
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under
17
// the terms of the GNU General Public License as published by the Free
18
// Software Foundation; either version 2 or (at your option) any later version.
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23
// for more details.
24
//
25
// You should have received a copy of the GNU General Public License along
26
// with eCos; if not, write to the Free Software Foundation, Inc.,
27
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28
//
29
// As a special exception, if other files instantiate templates or use macros
30
// or inline functions from this file, or you compile this file and link it
31
// with other works to produce a work based on this file, this file does not
32
// by itself cause the resulting work to be covered by the GNU General Public
33
// License. However the source code for this file must still be made available
34
// in accordance with section (3) of the GNU General Public License.
35
//
36
// This exception does not invalidate any other reasons why a work based on
37
// this file might be covered by the GNU General Public License.
38
//
39
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40
// at http://sources.redhat.com/ecos/ecos-license/
41
// -------------------------------------------
42
//####ECOSGPLCOPYRIGHTEND####
43
// ====================================================================
44
//#####DESCRIPTIONBEGIN####
45
//
46
// Author(s):    gthomas
47
// Contributors: gthomas,jlarmour
48
// Date:         2001-03-21
49
// Purpose:      Internal interfaces for serial I/O drivers
50
// Description:
51
//
52
//####DESCRIPTIONEND####
53
//
54
// ====================================================================
55
 
56
// Description of serial ports on NEC V850/SA1 & SB1
57
 
58
#include <pkgconf/system.h>
59
#include CYGBLD_HAL_TARGET_H
60
 
61
#include <cyg/hal/v850_common.h>
62
 
63
struct serial_port {
64
    unsigned char asim;        // Serial interface mode
65
    unsigned char _filler0;
66
    unsigned char asis;        // Serial interface status
67
    unsigned char _filler1;
68
    unsigned char brgc;        // Baud rate control
69
    unsigned char _filler2;
70
    unsigned char txs;         // Transmit shift register
71
    unsigned char _filler3;
72
    unsigned char rxs;         // Receive shift register
73
    unsigned char _filler4[5];
74
    unsigned char brgm;        // Baud rate mode
75
    unsigned char _filler5;
76
#if CYGINT_HAL_V850_VARIANT_SB1
77
    unsigned char _filler6[0x10];
78
    unsigned char brgm1;       // Baud rate overflow
79
#endif
80
};
81
 
82
// Relative interrupt numbers
83
#define INT_ERR 0              // Receive error condition
84
#define INT_Rx  1              // Receive data
85
#define INT_Tx  2              // Transmit data
86
 
87
// Serial interface mode
88
#define ASIM_TxRx_MASK     (3<<6)  // Receive & Transmit enables
89
#define ASIM_TxRx_Rx       (1<<6)  // Receive enable
90
#define ASIM_TxRx_Tx       (2<<6)  // Transmit enable
91
#define ASIM_Parity_MASK   (3<<4)  // Parity mode bits
92
#define ASIM_Parity_none   (0<<4)  // No parity
93
#define ASIM_Parity_space  (1<<4)  // Send zero bit, ignore errors
94
#define ASIM_Parity_odd    (2<<4)  // Odd parity
95
#define ASIM_Parity_even   (3<<4)  // Even parity
96
#define ASIM_Length_MASK   (1<<3)  // Character length select
97
#define ASIM_Length_7      (0<<3)  // 7 bit chars
98
#define ASIM_Length_8      (1<<3)  // 8 bit chars
99
#define ASIM_Stop_MASK     (1<<2)  // Stop bit select
100
#define ASIM_Stop_1        (0<<2)  // 1 stop bit
101
#define ASIM_Stop_2        (1<<2)  // 2 stop bits
102
#define ASIM_Error_MASK    (1<<1)  // Receive error select
103
#define ASIM_Error_enable  (0<<1)  // Issue interrupt on receive error
104
#define ASIM_Error_disable (1<<1)  // No interrupts on receive error
105
 
106
// Serial interface status (errors only)
107
#define ASIS_OVE           (1<<0)  // Overrun error
108
#define ASIS_FE            (1<<1)  // Framing error
109
#define ASIS_PE            (1<<2)  // Parity error
110
 
111
static unsigned char select_word_length[] = {
112
    0xFF,                         // 5 bits / word (char)
113
    0xFF,
114
    ASIM_Length_7,
115
    ASIM_Length_8
116
};
117
 
118
static unsigned char select_stop_bits[] = {
119
    0,
120
    ASIM_Stop_1,                  // 1 stop bit
121
    0xFF,                         // 1.5 stop bit
122
    ASIM_Stop_2                   // 2 stop bits
123
};
124
 
125
static unsigned char select_parity[] = {
126
    ASIM_Parity_none,             // No parity
127
    ASIM_Parity_even,             // Even parity
128
    ASIM_Parity_odd,              // Odd parity
129
    0xFF,                         // Mark parity
130
    ASIM_Parity_space,            // Space parity
131
};
132
 
133
static struct v850_baud {
134
    unsigned int count;
135
    unsigned int divisor;
136
} select_baud[] = {
137
// Baud rate values, using defined system clock
138
#define BAUDCOUNT(X) ((CYGHWR_HAL_V85X_CPU_FREQ/2)/(X))
139
      {0, 0},                  // Unused
140
      {0, 0},                  // 50
141
      {0, 0},                  // 75
142
      {0, 0},                  // 110
143
      {0, 0},                  // 134.5
144
      {0, 0},                  // 150
145
      {0, 0},                  // 200
146
      {0, 0},                  // 300
147
      {0, 0},                  // 600
148
      {BAUDCOUNT(1200), 1},    // 1200
149
      {0, 0},                  // 1800
150
      {BAUDCOUNT(2400), 1},    // 2400
151
      {0, 0},                  // 3600
152
      {BAUDCOUNT(4800), 1},    // 4800
153
      {0, 0},                  // 7200
154
      {BAUDCOUNT(9600), 1},    // 9600
155
      {0, 0},                  // 14400
156
      {BAUDCOUNT(19200), 1},   // 19200
157
      {BAUDCOUNT(38400), 1},   // 38400
158
      {0, 0},                  // 57600
159
      {0, 0},                  // 115200
160
      {0, 0},                  // 230400
161
};
162
 
163
#endif // CYGONCE_V85X_V850_SERIAL_H
164
 
165
// EOF v85x_v850_serial.h

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.