* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: serial_4v.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 ============================================
* Registers (8-bits only - 8byte addressing, upper bits read 0 write ignored)
* 0 R Input data register
* 0 W Output data register
* 1 RW Interrupt enable register
* 2 R Interrupt indentification register
* 2 W FIFO control register
* 3 RW Line control register
* 4 RW Modem control register
* 5 RW Line status register
* 6 RW Modem status register
* See 16550 data sheet p 14 - table M
int serial_4v_ui_cmd(void*, int argc
, char * argv
[]);
class serial4v
:public Module
{
bool raw
; // if the logging is enabled, whether it is buffered or not
bool append
; // if false, truncate the log file if it exists
static const int MaxBuf
= 256 * 1024;
static const int DS_LSTAT_DATA_READY
= 0x1;
static const int DS_LSTAT_OVERRUN
= 0x2;
static const int DS_LSTAT_PARTIY_ERR
= 0x4;
static const int DS_LSTAT_FRAMING_ERR
= 0x8;
static const int DS_LSTAT_BREAK
= 0x10;
static const int DS_LSTAT_TX_HOLD
= 0x20;
static const int DS_LSTAT_TX_EMPTY
= 0x40;
static const int DS_LSTAT_RCV_ERR
= 0x80;
DS_Output
= 0x0, /* WO */
DS_IntIdent
= 0x2, /* RO */
DS_FIFOCtrl
= 0x2, /* WO */
bool parse_arg(const char *);
void module_added(mmi_instance_t
, const char*){return; }
void module_deleted(mmi_instance_t
, const char*){return;}
fprintf(stderr
,"%s: sun4v serial module\n",getName());
fprintf(stderr
," logfile <%s> %s\n",logfile
? logfile
:"none",(log
&& raw
)?"raw mode":"");
fprintf(stderr
," for console tip %s\n",portConName
);
if(fg
) fprintf(stderr
," xterm fg set to %s\n",fg
);
if(bg
) fprintf(stderr
," xterm bg set to %s\n",bg
);
if(font
) fprintf(stderr
," xterm font set to %s\n",font
);
if(exec
) fprintf(stderr
," e set to %s\n",exec
);
void *get_interface(const char*){return 0;}
static void getConsoleIp(void *data
,unsigned char *ip
, int port
);
static int serial4v_physio_access(uint32_t cpuid
, void* obj
, uint64_t paddr
,
mmi_bool_t wr
, uint32_t size
, uint64_t* buf
, uint8_t bytemask
);
void serial4v_ld (uint64_t paddr
, uint64_t *buf
, int size
);
void serial4v_st(uint64_t paddr
, uint64_t *buf
, int size
);
serial4v(const char *, const char *);
fprintf(stderr
,"%s : closing xterm window\n", getName());
Console
->kill_term(portCon
);
bool dump(FILE *fp
){ Console
->dump(portCon
,fp
); return true; }
bool restore(FILE *fp
) { Console
->restore(portCon
,fp
); return true; }
void handle_ui(int argc
, char * argv
[]);
fprintf(stderr
,"ui format: %s <command> <command args> ... \n",getName());
fprintf(stderr
,"%s supports following UI commands\n",getName());
fprintf(stderr
," send <some char string>\n\
echo the character string appended with a new line to the console.\n");
fprintf(stderr
," sendfile <filename>\n\
echo the contents of \'filename\' to console\n");
fprintf(stderr
," Note1: the commands above simulate i/p from console\n\
hence, the o/p echoed on xterm depends upon Solaris/OBP serial driver\n");
fprintf(stderr
," debug [<level>]\n\
set the debug level for debug prints to 'level'\n\
if 'level' not provided, print current debug level\n\
pop up the xterm console if not already opened\n");
kill the xterm console if opened\n");
fprintf(stderr
," fg [<color>]\n\
set the foreground color of xterm to `color`, else report current\n");
fprintf(stderr
," bg [<color>]\n\
set the foreground color of xterm to `color`, else report current\n");
fprintf(stderr
," font [<font>]\n\
set the font of xterm to `font`, else report current\n");
fprintf(stderr
," Note2: user should make sure that fg,bg etc are valid\n\
inputs to xterm program. xterm should be `kill`ed and `pop`ed\n\
for new fg, bg, font values to take effect\n");
fprintf(stderr
," Note3: default fg=black, bg=gray90\n\
font=-dec-terminal-medium-r-normal-*-14-140-*-75-c-80-iso8859-1\n");