* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: serial_mod.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 2004 by Sun Microsystems, Inc.
* @(#)serial_mod.h 1.3 04/08/04
#include "serial_props.h"
virtual void chars_send(char *str
, int portH
) = 0;
virtual int reg_access(char *buf
, uint64_t paddr
, bool wr
) = 0;
class Serial
: public Module
, public genericPciDev
,serialInterface
{
serialT
*allocation_obj();
void enq(channel_regs
* rcv_regs
, char c
);
char deq(channel_regs
* rcv_regs
);
void char_input(uint8_t c
, int portnum
);
char rd_port(int portnum
);
void wr_port(int portnum
, uint8_t c
);
uint8_t rd_control(int portnum
);
void transmit(int portnum
);
void channel_cmd(int portnum
);
void status(int portnum
);
void wr_control(int portnum
, unsigned char buf
);
const char * termAredirect
;
const char * termBredirect
;
int mapHandle2Port(int port
){
if(port
== portHandle
[0])
else if(port
== portHandle
[1])
debug_err("%s illegal serial port number\n");
void chars_send(char *str
, int portnum
);
int reg_access(char *buf
, uint64_t paddr
, bool wr
);
Serial(const char *modname
, const char *instance_name
);
public: // Module interface
bool parse_arg(const char *);
void module_added(mmi_instance_t
, const char*);
void module_deleted(mmi_instance_t
, const char*);
void *get_interface(const char*);
//override the genericPciDev virtual functions
mmi_instance_t
pciDev_getInstance();
const char * pciDev_getName();
void pciDev_confAccessCb(bool_t wr
, uint64_t offset
, uint8_t size
);
//override the pciTarget_mem32access function
pciXactnStatus
pciTarget_mem32access(uint64_t offset
, bool wr
,uint64_t * buf
, uint8_t size
);
void handleSerialIp(void *,char *, int);