1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 prtdim_write:
27 procedure (arg_sdb_ptr, wkspptr, offset, nelem, nelemt, iostatus);
28
29 dcl arg_sdb_ptr ptr,
30 wkspptr ptr,
31 offset fixed bin (24),
32 nelem fixed bin (24),
33 nelemt fixed bin (24),
34 iostatus bit (72) aligned;
35
36 dcl rcode fixed bin (35),
37 cur_page fixed bin,
38 lp ptr,
39 prev_lp ptr,
40 dp ptr,
41 lth fixed bin (18),
42 inptr ptr,
43 char_cnt fixed bin (18),
44 word_cnt fixed bin (18),
45 temp_iom_stat bit (72) aligned,
46 errmess char (256) var,
47 tra bit (36) aligned;
48
49 dcl last_iom_stat bit (72) aligned;
50 dcl max_err_stat_count fixed bin init (10) int static options (constant);
51 dcl same_err_stat_count fixed bin;
52
53 dcl (paper_low_flag init ("000000000000000001"b),
54 image_flag init ("000000000000000010"b),
55 vfc_flag init ("000000000000000100"b),
56 slew_error init ("000000000000001000"b),
57 power_fault_flag init ("000000000000010000"b))
58 bit (18) aligned static options (constant);
59
60 dcl dev_stat_bits bit (72) aligned int static options (constant)
61 init ("377700770000"b3 || (12) "0"b3);
62
63 %page;
64 dcl prt_conv_ entry (ptr, fixed bin (18), ptr, fixed bin (18), ptr),
65 ioi_$connect entry (fixed bin, fixed bin (18), fixed bin (35)),
66 ipc_$block entry (ptr, ptr, fixed bin (35)),
67 convert_ipc_code_ entry (fixed bin (35)),
68 analyze_device_stat_$rs entry (char (*) var, ptr, bit (72) aligned, bit (18) aligned),
69 analyze_system_fault_ entry (char (*) aligned, bit (72) aligned),
70 prtdim_util$load_image entry (ptr, fixed bin (35)),
71 prtdim_util$load_vfc entry (ptr, fixed bin (35)),
72 com_err_ entry options (variable);
73
74 dcl prt_status_table_$prt_status_table_ ext;
75
76 dcl wseg (0:1023) bit (36) aligned based (wsegp);
77
78 dcl wksp char (1) based unal;
79
80 dcl error_table_$net_timeout ext fixed bin (35);
81 dcl error_table_$request_pending fixed bin (35) ext static;
82
83 dcl 1 dcws aligned based (lp),
84 2 idcw bit (36),
85 2 ddcw bit (36),
86 2 tdcw bit (36),
87 2 data;
88
89 dcl 1 ipc_message aligned,
90 2 chname fixed bin (71),
91 2 message fixed bin (71),
92 2 sender bit (36),
93 2 origin,
94 3 devsignal bit (18),
95 3 ring bit (18),
96 2 channel_index fixed bin;
97
98 dcl (addr, addrel, bin, bit, divide, rel, string, substr, unspec) builtin;
99 %page;
100 % include prt_sdb;
101 %page;
102 % include prt_info;
103 %page;
104 % include prt_conv_info;
105
106
107 % include ioi_stat;
108 % include status_flags;
109 ^L
110 % include iom_pcw;
111 % include iom_dcw;
112 %page;
113 iostatus = "0"b;
114
115 sdb_ptr = arg_sdb_ptr;
116 pip = addr (sdb.info);
117 pcip = addr (sdb.conv_info);
118 last_iom_stat = ""b;
119 same_err_stat_count = 0;
120
121 rcode = 0;
122 nelemt = 0;
123 lth = nelem;
124 inptr = addr (substr (wkspptr -> wksp, offset+1, 1));
125
126 do while (lth > 0);
127 cur_page = pci.page_count;
128
129 if sdb.stop > sdb.bgin then
130 call set_io;
131 else if sdb.stop + 68 < sdb.bgin then
132 call set_io;
133 else if sdb.prev = sdb.bgin then
134 call set_io;
135
136 else
137 call wait_io;
138
139 if rcode ^= 0 then do;
140 substr (iostatus, 1, 36) = unspec (rcode);
141 substr (iostatus, 41, 1) = "1"b;
142 sdb.chars_printed = sdb.chars_printed + nelem - lth;
143 return;
144 end;
145
146 if cur_page ^= pci.page_count then do;
147 sdb.stop_counter = sdb.stop_counter + 1;
148
149 if sdb.single_page | (sdb.stop_every ^= 0 & sdb.stop_counter >= sdb.stop_every) then do;
150 sdb.stop_counter = 0;
151 sdb.chars_printed = sdb.chars_printed + nelem - lth;
152 substr (iostatus, 1, 36) = unspec (error_table_$request_pending);
153 return;
154 end;
155 end;
156 end;
157
158 sdb.chars_printed = sdb.chars_printed + nelem - lth;
159 return;
160 %page;
161 set_io: proc;
162
163
164 lp = addr (wseg (sdb.stop));
165 dp = addr (lp -> dcws.data);
166
167 call prt_conv_ (inptr, lth, dp, char_cnt, pcip);
168 word_cnt = divide (char_cnt + 3, 4, 18, 0);
169 nelemt = nelem - lth;
170
171 if sdb.noprint then return;
172
173 dcws.tdcw = prt_info.term_idcw;
174
175 dcwp = addr (dcws.ddcw);
176 string (dcw) = "0"b;
177 dcw.address = rel (dp);
178 dcw.tally = bit (bin (word_cnt, 12));
179
180 dcws.idcw = prt_info.print_idcw;
181
182 if sdb.running then do;
183 sdb.marker_count = sdb.marker_count + word_cnt;
184 if sdb.marker_count > 512 then do;
185 idcwp = addr (dcws.idcw);
186 idcw.control = "11"b;
187 sdb.marker_count = 0;
188 end;
189 end;
190
191 if sdb.prev ^= sdb.stop then do;
192 tdcwp = addr (tra);
193 tra = "0"b;
194 tdcw.address = bit (bin (sdb.stop, 18));
195 tdcw.type = "10"b;
196
197 prev_lp = addr (wseg (sdb.prev));
198 prev_lp -> dcws.tdcw = tra;
199 end;
200
201 sdb.prev = sdb.stop;
202 sdb.stop = sdb.stop + word_cnt + 3;
203 if sdb.stop + 68 >= 1024 then sdb.stop = 0;
204
205 if ^sdb.running then call start_io;
206
207 return;
208
209
210 end set_io;
211 %page;
212 start_io: proc;
213
214 if ^sdb.wait_flag then if sdb.prev ^= sdb.stop then do;
215 sdb.marker_count = 0;
216 sdb.running = "1"b;
217
218 call ioi_$connect (prt_info.devx, sdb.bgin, rcode);
219
220 end;
221
222 return;
223
224
225 end start_io;
226
227
228
229 wait_io: proc;
230
231
232 if ^sdb.running then
233 call start_io;
234
235 call ipc_$block (addr (sdb.ev_list), addr (ipc_message), rcode);
236 if rcode ^= 0 then do;
237 call convert_ipc_code_ (rcode);
238 return;
239 end;
240
241 call stat_check;
242
243 return;
244
245
246 end wait_io;
247 %page;
248 stat_check: proc;
249
250 dcl flags bit (18) aligned,
251 found_dcw bit (1) aligned,
252 lx fixed bin (18);
253
254 flags = "0"b;
255
256 imp = addr (ipc_message.message);
257 if imess.level = "111"b then do;
258 sdb.wait_flag = "0"b;
259 if sdb.reload_vfc_train_after_special then do;
260 call prtdim_util$load_image (sdb_ptr, (0));
261 call prtdim_util$load_vfc (sdb_ptr, (0));
262 sdb.reload_vfc_train_after_special = "0"b;
263 end;
264 return;
265 end;
266
267 if imess.st then do;
268 if imess.time_out then do;
269 rcode = error_table_$net_timeout;
270 sdb.running = "0"b;
271 return;
272 end;
273
274 if bin (imess.level) <= 5 then do;
275 temp_iom_stat = imess.status;
276 lx = bin (imess.offset);
277
278 if imess.er then do;
279 if imess.level = "001"b then do;
280 call analyze_system_fault_ (prt_info.devname, temp_iom_stat);
281 sdb.wait_flag = "1"b;
282 sdb.error_count = sdb.error_count + 1;
283 end;
284 else do;
285 call analyze_device_stat_$rs (errmess, addr (prt_status_table_$prt_status_table_),
286 temp_iom_stat, flags);
287
288 if flags & paper_low_flag then
289 if pci.overflow_off then
290 flags = flags | report_flag | halt_flag;
291
292 else if ^sdb.paper_low then do;
293 sdb.paper_low = "1"b;
294 flags = flags | report_flag;
295 end;
296
297 if flags & power_fault_flag then
298 sdb.reload_vfc_train_after_special = "1"b;
299
300 if flags & report_flag then do;
301 sdb.error_count = sdb.error_count + 1;
302
303 if (temp_iom_stat & dev_stat_bits) ^= last_iom_stat then do;
304 last_iom_stat = (temp_iom_stat & dev_stat_bits);
305 same_err_stat_count = 1;
306 call com_err_ (0, prt_info.devname, errmess);
307 end;
308 else do;
309 same_err_stat_count = same_err_stat_count + 1;
310
311
312
313 if same_err_stat_count >= max_err_stat_count | (flags&halt_flag) ^= "0"b
314 then do;
315 sdb.wait_flag = "1"b;
316 call com_err_ (0, prt_info.devname, errmess);
317 end;
318 end;
319 end;
320 sdb.wait_flag = ((flags & halt_flag) ^= "0"b) | sdb.wait_flag;
321
322
323 if flags & image_flag then do;
324 call prtdim_util$load_image (sdb_ptr, rcode);
325 if rcode ^= 0 then return;
326 end;
327
328 if flags & vfc_flag then do;
329 call prtdim_util$load_vfc (sdb_ptr, rcode);
330 if rcode ^= 0 then return;
331 end;
332 end;
333
334 if sdb.wait_flag then do;
335 same_err_stat_count = 0;
336 call com_err_ (0, prt_info.devname, "***** OPERATOR INTERVENTION REQUIRED^/");
337 end;
338
339 end;
340
341 else
342 sdb.paper_low = "0"b;
343
344 idcwp = addr (wseg (lx));
345 found_dcw = "0"b;
346
347 if flags & backup_flag then do while (idcw.code ^= "111"b);
348 lx = lx - 1;
349 idcwp = addrel (idcwp, -1);
350 end;
351
352 else if bin (imess.level) <= 3 then
353 do while (^found_dcw);
354 if string (idcw) = prt_info.term_idcw then do;
355 lx, sdb.prev = sdb.stop;
356 found_dcw = "1"b;
357 end;
358 else if idcw.code = "111"b then do;
359 found_dcw = "1"b;
360 end;
361 else if idcwp -> tdcw.type = "10"b then do;
362 lx = bin (idcwp -> tdcw.address, 18);
363 found_dcw = "1"b;
364 end;
365 else do;
366 lx = lx + 1;
367 idcwp = addrel (idcwp, 1);
368 end;
369 end;
370 else;
371
372 sdb.bgin = lx;
373 sdb.running = imess.run;
374 end;
375
376 end;
377
378 return;
379
380 end stat_check;
381 %page;
382 prtdim_resetwrite: entry (arg_sdb_ptr, iostatus);
383
384
385 iostatus = "0"b;
386
387 sdb_ptr = arg_sdb_ptr;
388 pip = addr (sdb.info);
389 pcip = addr (sdb.conv_info);
390
391 rcode = 0;
392
393 do while (sdb.running);
394 call wait_io;
395 if rcode ^= 0 then do;
396 substr (iostatus, 1, 36) = unspec (rcode);
397 return;
398 end;
399 end;
400
401 sdb.prev,
402 sdb.bgin,
403 sdb.stop = 0;
404
405 return;
406 %page;
407 runout: entry (arg_sdb_ptr, iostatus);
408
409
410 iostatus = "0"b;
411
412 sdb_ptr = arg_sdb_ptr;
413 pip = addr (sdb.info);
414 pcip = addr (sdb.conv_info);
415
416 rcode = 0;
417
418 do while (sdb.prev ^= sdb.stop);
419 call wait_io;
420 if rcode ^= 0 then do;
421 substr (iostatus, 1, 36) = unspec (rcode);
422 return;
423 end;
424 end;
425
426 return;
427
428
429
430 end prtdim_write;