Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / devices / serial / include / serial_impl.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: serial_impl.h
5* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
7*
8* The above named program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public
10* License version 2 as published by the Free Software Foundation.
11*
12* The above named program is distributed in the hope that it will be
13* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15* General Public License for more details.
16*
17* You should have received a copy of the GNU General Public
18* License along with this work; if not, write to the Free Software
19* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20*
21* ========== Copyright Header End ============================================
22*/
23/*
24 * Copyright (C) 1991, 2001 Sun Microsystems, Inc.
25 * All rights reserved.
26 */
27#pragma ident "@(#)1.2 01/08/27 serial_impl.h"
28
29#ifndef _SERIAL_IMPL_H
30#define _SERIAL_IMPL_H
31
32#include <synch.h>
33#include "decl_macros.h"
34#include "serial_common.h"
35#include "serial_registers.h"
36
37#define SERIAL_REGS 16
38
39typedef struct queuex {
40 uint8_t c;
41 struct queuex *next;
42} squeue;
43
44typedef struct channel_regs {
45 uint8_t wr[SERIAL_REGS]; /* Write Registers 0-15 - Transmit buffer WR8 */
46 uint8_t rr[SERIAL_REGS]; /* Only 0-3,6-8,10,12,13 and 15 are used */
47 /* Receive buffer RR8 */
48 uint8_t rcv_buf[3]; /* Additional receive buffers */
49 uint8_t tr_shft_reg[3]; /* Transmiter shift reg. Only 20 bits */
50 int qcnt; /* # chars queued up on channel */
51 squeue q; /* head of queue - contains 1st char as well */
52
53 mutex_t serial_lock;
54} channel_regs;
55
56#define PORT_A 0
57#define PORT_B 1
58#define PORT_C 2
59#define PORT_D 3
60#define NUM_PORTS 2
61
62typedef struct AB_regs {
63 channel_regs port[NUM_PORTS];
64} AB_Regs_t;
65
66typedef struct serial_struct {
67 FLDDECL(int, device_no,,dump,);
68
69 FLDDECL(struct AB_regs, scc,,dump,); /* Serial Communications Controller */
70} serial_structT;
71
72#endif /* _SERIAL_IMPL_H */