/*++ Copyright (c) 1998-2001 Klaus P. Gerlicher Module Name: termínal.c Abstract: serial terminal for pICE headless mode Environment: User mode only Author: Klaus P. Gerlicher Revision History: 23-Jan-2001: created Copyright notice: This file may be distributed under the terms of the GNU Public License. --*/ #if 0 //ei not ready #include "stdinc.h" #include #define CONSOLE_WIDTH (80) #define CONSOLE_HEIGHT (25) USHORT major_version=0xFFFF,minor_version=0xFFFF,build_number=0xFFFF; USHORT g_attr = 0; USHORT usCurX,usCurY,xSize,ySize; USHORT foreground_color_map[]= { }; USHORT background_color_map[]= { }; int fd_comm; struct termios oldtio; //************************************************************************ // CheckSum() // //************************************************************************ UCHAR CheckSum(LPSTR p,ULONG Len) { UCHAR ucCheckSum = 0; ULONG i; for(i=0;i 0); } ///************************************************************************ // SendByte() // ///************************************************************************ BOOLEAN SendByte(UCHAR c) { return (write(fd_comm,&c,1) > 0); } ///************************************************************************ // ReadPacket() // ///************************************************************************ PSERIAL_PACKET ReadPacket(void) { ULONG i; PSERIAL_PACKET p; SERIAL_PACKET_HEADER header; PUCHAR pHeaderRaw,pData; char temp[256]; ULONG ulCheckSum; // read a packet header pHeaderRaw = (PUCHAR)&header; for(i=0;iheader.packet_size; switch(pData->type) { case PACKET_TYPE_CONNECT: { PSERIAL_DATA_PACKET_CONNECT pDataConnect = (PSERIAL_DATA_PACKET_CONNECT)pData; UCHAR i; for(i=0;ixsize,pDataConnect->ysize); xSize = pDataConnect->xsize; ySize = pDataConnect->ysize; } break; case PACKET_TYPE_CLRLINE: { PSERIAL_DATA_PACKET_CLRLINE pDataClrLine = (PSERIAL_DATA_PACKET_CLRLINE)pData; ClrLine(pDataClrLine->line); } break; case PACKET_TYPE_INVERTLINE: { PSERIAL_DATA_PACKET_INVERTLINE pDataInvertLine = (PSERIAL_DATA_PACKET_INVERTLINE)pData; InvertLine(pDataInvertLine->line); } break; case PACKET_TYPE_PRINT: { PSERIAL_DATA_PACKET_PRINT pDataPrint = (PSERIAL_DATA_PACKET_PRINT)pData; Print(pDataPrint->string,pDataPrint->x,pDataPrint->y); } break; case PACKET_TYPE_CURSOR: { PSERIAL_DATA_PACKET_CURSOR pDataCursor = (PSERIAL_DATA_PACKET_CURSOR)pData; SetCursorPosition(pDataCursor->x,pDataCursor->y); SetCursorState(pDataCursor->state); } break; case PACKET_TYPE_POLL: { PSERIAL_DATA_PACKET_POLL pDataPoll= (PSERIAL_DATA_PACKET_POLL)pData; if( (major_version != pDataPoll->major_version) || (minor_version != pDataPoll->minor_version) || (build_number != pDataPoll->build_number) ) { major_version = pDataPoll->major_version; minor_version = pDataPoll->minor_version; build_number = pDataPoll->build_number; // SetAppTitle(); } } break; default: //printf("UNHANDLED\n"); break; } } //************************************************************************ // DebuggerShell() // //************************************************************************ void DebuggerShell(void) { PSERIAL_PACKET p; //printf("DebuggerShell()\n"); for(;;) { p = ReadPacket(); if(p) { ProcessPacket(p); DeletePacket(p); } else { usleep(100*1000); } } } #endif