Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / devices / serial / include / serial_impl.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: serial_impl.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
*
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
*
* The above named program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ========== Copyright Header End ============================================
*/
/*
* Copyright (C) 1991, 2001 Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "@(#)1.2 01/08/27 serial_impl.h"
#ifndef _SERIAL_IMPL_H
#define _SERIAL_IMPL_H
#include <synch.h>
#include "decl_macros.h"
#include "serial_common.h"
#include "serial_registers.h"
#define SERIAL_REGS 16
typedef struct queuex {
uint8_t c;
struct queuex *next;
} squeue;
typedef struct channel_regs {
uint8_t wr[SERIAL_REGS]; /* Write Registers 0-15 - Transmit buffer WR8 */
uint8_t rr[SERIAL_REGS]; /* Only 0-3,6-8,10,12,13 and 15 are used */
/* Receive buffer RR8 */
uint8_t rcv_buf[3]; /* Additional receive buffers */
uint8_t tr_shft_reg[3]; /* Transmiter shift reg. Only 20 bits */
int qcnt; /* # chars queued up on channel */
squeue q; /* head of queue - contains 1st char as well */
mutex_t serial_lock;
} channel_regs;
#define PORT_A 0
#define PORT_B 1
#define PORT_C 2
#define PORT_D 3
#define NUM_PORTS 2
typedef struct AB_regs {
channel_regs port[NUM_PORTS];
} AB_Regs_t;
typedef struct serial_struct {
FLDDECL(int, device_no,,dump,);
FLDDECL(struct AB_regs, scc,,dump,); /* Serial Communications Controller */
} serial_structT;
#endif /* _SERIAL_IMPL_H */