/[VMELinux]/vmeutils/vmeutils.cpp
ViewVC logotype

Contents of /vmeutils/vmeutils.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Mon Jun 18 14:57:44 2001 UTC (18 years, 9 months ago) by astro
Branch: MAIN
CVS Tags: vmelinux-1_1_2, Linux2_4_x
Changes since 1.1: +2 -6 lines
Changed the device number from 70 to 221 as assigned by the Linux authorities.
1 //------------------------------------------------------------------------------
2 //title: VME Debugger for XVME-655
3 //version: Linux 0.7
4 //programmer: Michael Wyrick
5 //project: VMELinux Project in association with Chesapeake Research
6 //------------------------------------------------------------------------------
7 // Purpose:
8 // Docs:
9 //------------------------------------------------------------------------------
10 // $Id: vmeutils.cpp,v 1.2 2001/06/18 14:57:44 astro Exp $
11 //------------------------------------------------------------------------------
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <ctype.h>
15 #include <string.h>
16
17 #include "unilib.h"
18 #include "universe.h"
19 #include "commands.h"
20 #include "vmeutils.h"
21
22 char buffer[255];
23 char oldbuffer[255];
24 int bufpointer = 0;
25 int oldbufpointer = 0;
26
27 // Command Line Registers
28 int quiet = 0;
29 int verb_para = 1;
30 int which_img = 0;
31 int default_mode = 1;
32 int binary = 0;
33
34 /*-----------------------------------------------------------------------------
35 *
36 *
37 *------------------------------------------------------------------------mjw-*/
38 void initvme(void)
39 {
40 }
41
42 /*-----------------------------------------------------------------------------
43 * addchar
44 * add a char to the command buffer and check to see if we have the whole
45 * buffer (if the char is a return)
46 *------------------------------------------------------------------------mjw-*/
47 void addchar(char c)
48 {
49 int x;
50 // if (c == 0x08) { // Back Space
51 // if (bufpointer != 0) {
52 // bufpointer--;
53 // if (!quiet)
54 // printf("%c",c);
55 // if (!quiet)
56 // printf(" ");
57 // if (!quiet)
58 // printf("%c",c);
59 // }
60 // } else if (c == 0x48) { // We have gotten the entire command
61 // memcpy(buffer,oldbuffer,sizeof(buffer));
62 // bufpointer = oldbufpointer; // Clear Buffer Pointer
63 // if (!quiet)
64 // printf("%s",buffer);
65 // } else if (c == 0x50) { // We have gotten the entire command
66 // if (!quiet)
67 // for(x=0;x<bufpointer;x++)
68 // printf("%c %c",0x08,0x08); // print BackSpace
69 // bufpointer = 0;
70 // } else if (c != 0x0A) { // We have gotten the entire command
71 if (c != 0x0A) { // We have gotten the entire command
72 buffer[bufpointer++] = toupper(c);
73 // printf("%c",c);
74 } else {
75 buffer[bufpointer] = 0; // Null Term the String
76 memcpy(oldbuffer,buffer,sizeof(buffer));
77 oldbufpointer = bufpointer; // Clear Buffer Pointer
78 if(!quiet)
79 printf("\n");
80 ProcessCommand(buffer,bufpointer);
81 bufpointer = 0; // Clear Buffer Pointer
82 if (!quiet)
83 printf("\n> ");
84 }
85 }
86
87 /*-----------------------------------------------------------------------------
88 *
89 *
90 *------------------------------------------------------------------------mjw-*/
91 void readprompt(void)
92 {
93 int i;
94
95 while(1) {
96 i = getchar();
97 if (i > 0) {
98 addchar(char(i & 0xFF));
99 }
100 }
101 }
102
103 /*-----------------------------------------------------------------------------
104 * ParseCmdLine
105 *
106 *------------------------------------------------------------------------mjw-*/
107 int ParseCmdLine(int argc,char **argv)
108 {
109 int i,j;
110 char *p,c;
111
112 if (argc == 1)
113 return(1);
114
115 for(i=0;i<argc;i++) {
116 p = argv[i];
117 if (p[0] == '-') {
118 j = 1;
119 while(c = p[j++]) {
120 switch(c) {
121 case 'V' :
122 verb_para = 0;
123 printf("VMEUtils Verbose Parameters Mode on\n");
124 break;
125 case 'v' :
126 verb_para = 1;
127 if (!verb_para)
128 printf(" Verbose Parameters Mode off\n");
129 break;
130 case 'q' :
131 quiet = 1;
132 if (!verb_para)
133 printf(" Quiet Mode\n");
134 break;
135 case 'Q' :
136 quiet = 0;
137 if (!verb_para)
138 printf(" Non Quiet Mode\n");
139 break;
140 case 'b' :
141 binary = 0;
142 if (!verb_para)
143 printf(" Binary Mode off\n");
144 break;
145 case 'B' :
146 binary = 1;
147 if (!verb_para)
148 printf(" Binary Mode on\n");
149 break;
150 case 'D' :
151 case 'd' :
152 default_mode = MODE_DMA;
153 if (!verb_para)
154 printf(" Default mode Changed to DMA\n");
155 break;
156 case 'P' :
157 case 'p' :
158 default_mode = MODE_PROGRAMMED;
159 if (!verb_para)
160 printf(" Default mode Changed to PROGRAMMED\n");
161 break;
162 case '0' :
163 which_img = 0;
164 if (!verb_para)
165 printf(" Image Changed to 0\n");
166 break;
167 case '1' :
168 which_img = 1;
169 if (!verb_para)
170 printf(" Image Changed to 1\n");
171 break;
172 case '2' :
173 which_img = 2;
174 if (!verb_para)
175 printf(" Image Changed to 2\n");
176 break;
177 case '3' :
178 which_img = 3;
179 if (!verb_para)
180 printf(" Image Changed to 3\n");
181 break;
182 }
183 }
184 }
185 }
186 }
187
188 /*-----------------------------------------------------------------------------
189 * main
190 *
191 *------------------------------------------------------------------------mjw-*/
192 void main(int argc,char **argv)
193 {
194 ParseCmdLine(argc,argv);
195
196 if (!quiet) {
197 printf("\nVME Debugger Linux Version 0.9b 990330\n");
198 printf("Copyright 1998, Michael J. Wyrick, VMELinux Project\n");
199
200 printf("> ");
201 }
202
203 init_vmelib();
204 readprompt();
205 }

  ViewVC Help
Powered by ViewVC 1.2-dev