source: rtems/c/src/lib/libbsp/m68k/mvme167/console/console-recording.c @ df49c60

4.104.114.84.95
Last change on this file since df49c60 was df49c60, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 12, 2000 at 3:00:15 PM

Merged from 4.5.0-beta3a

  • Property mode set to 100644
File size: 21.8 KB
Line 
1/*
2 *  Copyright (c) 2000, National Research Council of Canada
3 *
4 *  The license and distribution terms for this file may be
5 *  found in the file LICENSE in this distribution or at
6 *  http://www.OARcorp.com/rtems/license.html.
7 */
8 
9/* CD2401 CONSOLE DRIVER DEBUG INFO RECORDING */
10
11#ifdef CD2401_RECORD_DEBUG_INFO
12
13/* Control individual recording here. That way, we don't clutter console.c */
14#define CD2401_RECORD_WRITE
15#define CD2401_RECORD_TX_ISR
16#define CD2401_RECORD_RX_ISR
17#define CD2401_RECORD_RE_ISR
18#define CD2401_RECORD_MODEM_ISR
19#define CD2401_RECORD_SET_ATTRIBUTE
20#define CD2401_RECORD_FIRST_OPEN
21#define CD2401_RECORD_LAST_CLOSE
22#define CD2401_RECORD_START_REMOTE_TX
23#define CD2401_RECORD_STOP_REMOTE_TX
24#define CD2401_RECORD_DRAIN_OUTPUT
25#define CD2401_RECORD_DELAY
26
27
28/* Call the data recording functions */
29#ifdef CD2401_RECORD_WRITE
30#define CD2401_RECORD_WRITE_INFO( args )              cd2401_record_write_info args
31#else
32#define CD2401_RECORD_WRITE_INFO( args )
33#endif
34
35#ifdef CD2401_RECORD_TX_ISR
36#define CD2401_RECORD_TX_ISR_INFO( args )             cd2401_record_tx_isr_info args
37#define CD2401_RECORD_TX_ISR_SPURIOUS_INFO( args )    cd2401_record_tx_isr_spurious_info args
38#define CD2401_RECORD_TX_ISR_BUSERR_INFO( args )      cd2401_record_tx_isr_buserr_info args
39#else
40#define CD2401_RECORD_TX_ISR_INFO( args )
41#define CD2401_RECORD_TX_ISR_SPURIOUS_INFO( args )
42#define CD2401_RECORD_TX_ISR_BUSERR_INFO( args )
43#endif
44
45#ifdef CD2401_RECORD_RX_ISR
46#define CD2401_RECORD_RX_ISR_INFO( args )             cd2401_record_rx_isr_info args
47#define CD2401_RECORD_RX_ISR_SPURIOUS_INFO( args )    cd2401_record_rx_isr_spurious_info args
48#else
49#define CD2401_RECORD_RX_ISR_INFO( args )
50#define CD2401_RECORD_RX_ISR_SPURIOUS_INFO( args )
51#endif
52
53#ifdef CD2401_RECORD_RE_ISR
54#define CD2401_RECORD_RE_ISR_SPURIOUS_INFO( args )    cd2401_record_re_isr_spurious_info args
55#else
56#define CD2401_RECORD_RE_ISR_SPURIOUS_INFO( args )
57#endif
58
59#ifdef CD2401_RECORD_MODEM_ISR
60#define CD2401_RECORD_MODEM_ISR_SPURIOUS_INFO( args ) cd2401_record_modem_isr_spurious_info args
61#else
62#define CD2401_RECORD_MODEM_ISR_SPURIOUS_INFO( args )
63#endif
64
65#ifdef CD2401_RECORD_SET_ATTRIBUTES
66#define CD2401_RECORD_SET_ATTRIBUTES_INFO( args )     cd2401_record_set_attributes_info args
67#else
68#define CD2401_RECORD_SET_ATTRIBUTES_INFO( args )
69#endif
70
71#ifdef CD2401_RECORD_FIRST_OPEN
72#define CD2401_RECORD_FIRST_OPEN_INFO( args )         cd2401_record_first_open_info args
73#else
74#define CD2401_RECORD_FIRST_OPEN_INFO( args )
75#endif
76
77#ifdef CD2401_RECORD_LAST_CLOSE
78#define CD2401_RECORD_LAST_CLOSE_INFO( args )         cd2401_record_last_close_info args
79#else
80#define CD2401_RECORD_LAST_CLOSE_INFO( args )
81#endif
82
83#ifdef CD2401_RECORD_START_REMOTE_TX
84#define CD2401_RECORD_START_REMOTE_TX_INFO( args )    cd2401_record_start_remote_tx_info args
85#else
86#define CD2401_RECORD_START_REMOTE_TX_INFO( args )
87#endif
88
89#ifdef CD2401_RECORD_STOP_REMOTE_TX
90#define CD2401_RECORD_STOP_REMOTE_TX_INFO( args )     cd2401_record_stop_remote_tx_info args
91#else
92#define CD2401_RECORD_STOP_REMOTE_TX_INFO( args )
93#endif
94
95#ifdef CD2401_RECORD_DRAIN_OUTPUT
96#define CD2401_RECORD_DRAIN_OUTPUT_INFO( args )       cd2401_record_drain_output_info args
97#else
98#define CD2401_RECORD_DRAIN_OUTPUT_INFO( args )
99#endif
100
101#ifdef CD2401_RECORD_DELAY
102#define CD2401_RECORD_DELAY_INFO( args )              cd2401_record_delay_info args
103#else
104#define CD2401_RECORD_DELAY_INFO( args )
105#endif
106
107
108/* Define the data and the recording functions */
109#define CD2401_DEBUG_BUFFER_SIZE     256
110#define CD2401_DEBUG_CHAR_BUFSIZE     64
111#define CD2401_WRITE_INFO              1
112#define CD2401_TX_ISR_INFO             2
113#define CD2401_TX_ISR_SPURIOUS_INFO    3
114#define CD2401_TX_ISR_BUSERR_INFO      4
115#define CD2401_RX_ISR_INFO             5
116#define CD2401_RX_ISR_SPURIOUS_INFO    6
117#define CD2401_RE_ISR_SPURIOUS_INFO    7
118#define CD2401_MODEM_ISR_SPURIOUS_INFO 8
119#define CD2401_FIRST_OPEN_INFO         9
120#define CD2401_LAST_CLOSE_INFO        10
121#define CD2401_START_REMOTE_TX_INFO   11
122#define CD2401_STOP_REMOTE_TX_INFO    12
123#define CD2401_SET_ATTRIBUTE_INFO     13
124#define CD2401_DRAIN_OUTPUT_INFO      14
125#define CD2401_DELAY_INFO             15
126
127
128struct cd2401_debug_info {
129  short discriminant;
130  short record_size;
131  union {
132    struct cd2401_write_info {
133      int length;
134      char buffer[CD2401_DEBUG_CHAR_BUFSIZE];
135      char dmabuf;
136    } write_info;
137    struct cd2401_tx_isr_info {
138      unsigned char channel;
139      unsigned char status;
140      unsigned char initial_ier;
141      unsigned char final_ier;
142      rtems_unsigned8 txEmpty;
143    } tx_isr_info;
144    struct cd2401_tx_isr_spurious_info {
145      unsigned char channel;
146      unsigned char status;
147      unsigned char initial_ier;
148      unsigned char final_ier;
149      unsigned long spurdev;
150      unsigned long spurcount;
151    } tx_isr_spurious_info;
152    struct cd2401_tx_isr_buserr_info {
153      unsigned char channel;
154      unsigned char status;
155      unsigned char initial_ier;
156      unsigned char buserr;
157      unsigned long type;
158      unsigned long addr;
159    } tx_isr_buserr_info;
160    struct cd2401_rx_isr_info {
161      unsigned char channel;
162      int length;
163      char buffer[CD2401_DEBUG_CHAR_BUFSIZE];
164    } rx_isr_info;
165    struct cd2401_rx_isr_spurious_info {
166      unsigned char channel;
167      unsigned char status;
168      unsigned long spurdev;
169      unsigned long spurcount;
170    } rx_isr_spurious_info;
171    struct cd2401_re_isr_spurious_info {
172      unsigned char channel;
173      unsigned long spurdev;
174      unsigned long spurcount;
175    } re_isr_spurious_info;
176    struct cd2401_modem_isr_spurious_info {
177      unsigned char channel;
178      unsigned long spurdev;
179      unsigned long spurcount;
180    } modem_isr_spurious_info;
181    struct cd2401_first_open_info {
182      unsigned char channel;
183      rtems_unsigned8 init_count;
184    } first_open_info;
185    struct cd2401_last_close_info {
186      unsigned char channel;
187      rtems_unsigned8 init_count;
188    } last_close_info;
189    struct cd2401_start_remote_tx_info {
190      unsigned char channel;
191    } start_remote_tx_info;
192    struct cd2401_stop_remote_tx_info {
193      unsigned char channel;
194    } stop_remote_tx_info;
195    struct cd2401_set_attribute_info {
196      int minor;
197      rtems_unsigned8 need_reinit;
198      rtems_unsigned8 txEmpty;
199      rtems_unsigned8 csize;
200      rtems_unsigned8 cstopb;
201      rtems_unsigned8 parodd;
202      rtems_unsigned8 parenb;
203      rtems_unsigned8 ignpar;
204      rtems_unsigned8 inpck;
205      rtems_unsigned8 hw_flow_ctl;
206      rtems_unsigned8 sw_flow_ctl;
207      rtems_unsigned8 extra_flow_ctl;
208      rtems_unsigned8 icrnl;
209      rtems_unsigned8 igncr;
210      rtems_unsigned8 inlcr;
211      rtems_unsigned8 brkint;
212      rtems_unsigned8 ignbrk;
213      rtems_unsigned8 parmrk;
214      rtems_unsigned8 istrip;
215      rtems_unsigned16 tx_period;
216      rtems_unsigned16 rx_period;
217      rtems_unsigned32 out_baud;
218      rtems_unsigned32 in_baud;
219    } set_attribute_info;
220    struct cd2401_drain_output_info {
221      rtems_unsigned8 txEmpty;
222      rtems_unsigned8 own_buf_A;
223      rtems_unsigned8 own_buf_B;
224    } drain_output_info;
225    struct cd2401_delay_info {
226      rtems_interval start;
227      rtems_interval end;
228      rtems_interval current;
229      unsigned long loop_count;
230    } delay_info;
231  } u;
232};
233
234struct cd2401_debug_info cd2401_debug_buffer[CD2401_DEBUG_BUFFER_SIZE];
235int cd2401_debug_index = 0;
236
237#include <string.h>
238
239int cd2401_get_record_size(
240  int size
241)
242{
243  /* Not the best way to do this */
244  return size + 4;
245}
246 
247 
248void cd2401_record_write_info(
249  int len,
250  const char * buf,
251  char dmabuf
252)
253{
254  int max_length;
255 
256  max_length = (len < CD2401_DEBUG_CHAR_BUFSIZE ) ? len : CD2401_DEBUG_CHAR_BUFSIZE;
257 
258  memset( &(cd2401_debug_buffer[cd2401_debug_index]), '\0', sizeof( struct cd2401_debug_info )  );
259  cd2401_debug_buffer[cd2401_debug_index].discriminant = CD2401_WRITE_INFO;
260  cd2401_debug_buffer[cd2401_debug_index].record_size =
261      cd2401_get_record_size( sizeof( struct cd2401_write_info ) );
262  cd2401_debug_buffer[cd2401_debug_index].u.write_info.length = len;
263  memcpy ( &(cd2401_debug_buffer[cd2401_debug_index].u.write_info.buffer), buf, max_length );
264  cd2401_debug_buffer[cd2401_debug_index].u.write_info.dmabuf = dmabuf;
265   
266  cd2401_debug_index = (cd2401_debug_index + 1 ) % CD2401_DEBUG_BUFFER_SIZE;
267}
268
269
270void cd2401_record_tx_isr_info(
271  unsigned char ch,
272  unsigned char status,
273  unsigned char initial_ier,
274  unsigned char final_ier,
275  rtems_unsigned8 txEmpty
276)
277{ 
278  memset( &(cd2401_debug_buffer[cd2401_debug_index]), '\0', sizeof( struct cd2401_debug_info )  );
279  cd2401_debug_buffer[cd2401_debug_index].discriminant = CD2401_TX_ISR_INFO;
280  cd2401_debug_buffer[cd2401_debug_index].record_size =
281      cd2401_get_record_size( sizeof( struct cd2401_tx_isr_info ) );
282  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_info.channel = ch;
283  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_info.status = status;
284  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_info.initial_ier = initial_ier;
285  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_info.final_ier = final_ier;
286  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_info.txEmpty = txEmpty;
287 
288  cd2401_debug_index = (cd2401_debug_index + 1 ) % CD2401_DEBUG_BUFFER_SIZE;
289}
290
291
292void cd2401_record_tx_isr_spurious_info(
293  unsigned char ch,
294  unsigned char status,
295  unsigned char initial_ier,
296  unsigned char final_ier,
297  unsigned char spur_dev,
298  unsigned char spur_cnt
299)
300{
301  memset( &(cd2401_debug_buffer[cd2401_debug_index]), '\0', sizeof( struct cd2401_debug_info )  );
302  cd2401_debug_buffer[cd2401_debug_index].discriminant = CD2401_TX_ISR_SPURIOUS_INFO;
303  cd2401_debug_buffer[cd2401_debug_index].record_size =
304      cd2401_get_record_size( sizeof( struct cd2401_tx_isr_spurious_info ) );
305  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_spurious_info.channel = ch;
306  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_spurious_info.status = status;
307  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_spurious_info.initial_ier = initial_ier;
308  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_spurious_info.final_ier = final_ier;
309  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_spurious_info.spurdev = spur_dev;
310  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_spurious_info.spurcount = spur_cnt;
311 
312  cd2401_debug_index = (cd2401_debug_index + 1 ) % CD2401_DEBUG_BUFFER_SIZE;
313}
314
315
316void cd2401_record_tx_isr_buserr_info(
317  unsigned char ch,
318  unsigned char status,
319  unsigned char initial_ier,
320  unsigned char buserr,
321  unsigned long buserr_type,
322  unsigned long buserr_addr
323)
324{
325  memset( &(cd2401_debug_buffer[cd2401_debug_index]), '\0', sizeof( struct cd2401_debug_info )  );
326  cd2401_debug_buffer[cd2401_debug_index].discriminant = CD2401_TX_ISR_BUSERR_INFO;
327  cd2401_debug_buffer[cd2401_debug_index].record_size =
328    cd2401_get_record_size( sizeof( struct cd2401_tx_isr_buserr_info ) );
329  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_buserr_info.channel = ch;
330  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_buserr_info.status = status;
331  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_buserr_info.initial_ier = initial_ier;
332  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_buserr_info.buserr = buserr;
333  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_buserr_info.type = buserr_type;
334  cd2401_debug_buffer[cd2401_debug_index].u.tx_isr_buserr_info.addr = buserr_addr;
335 
336  cd2401_debug_index = (cd2401_debug_index + 1 ) % CD2401_DEBUG_BUFFER_SIZE;
337}
338
339
340void cd2401_record_rx_isr_info(
341  unsigned char ch,
342  unsigned char total,
343  char * buffer
344)
345{
346  int max_length;
347 
348  max_length = (total < CD2401_DEBUG_CHAR_BUFSIZE ) ? total : CD2401_DEBUG_CHAR_BUFSIZE;
349 
350  memset( &(cd2401_debug_buffer[cd2401_debug_index]), '\0', sizeof( struct cd2401_debug_info )  );
351  cd2401_debug_buffer[cd2401_debug_index].discriminant = CD2401_RX_ISR_INFO;
352  cd2401_debug_buffer[cd2401_debug_index].record_size =
353      cd2401_get_record_size( sizeof( struct cd2401_rx_isr_info ) );
354  cd2401_debug_buffer[cd2401_debug_index].u.rx_isr_info.length = max_length;
355 memcpy ( &(cd2401_debug_buffer[cd2401_debug_index].u.rx_isr_info.buffer), buffer, max_length );
356   
357  cd2401_debug_index = (cd2401_debug_index + 1 ) % CD2401_DEBUG_BUFFER_SIZE;
358}
359
360
361void cd2401_record_rx_isr_spurious_info(
362  unsigned char ch,
363  unsigned char status,
364  rtems_unsigned32 spur_dev,
365  rtems_unsigned32 spur_cnt
366)
367{
368  memset( &(cd2401_debug_buffer[cd2401_debug_index]), '\0', sizeof( struct cd2401_debug_info )  );
369  cd2401_debug_buffer[cd2401_debug_index].discriminant = CD2401_RX_ISR_SPURIOUS_INFO;
370  cd2401_debug_buffer[cd2401_debug_index].record_size =
371      cd2401_get_record_size( sizeof( struct cd2401_rx_isr_spurious_info ) );
372  cd2401_debug_buffer[cd2401_debug_index].u.rx_isr_spurious_info.channel = ch;
373  cd2401_debug_buffer[cd2401_debug_index].u.rx_isr_spurious_info.status = status;
374  cd2401_debug_buffer[cd2401_debug_index].u.rx_isr_spurious_info.spurdev = spur_dev;
375  cd2401_debug_buffer[cd2401_debug_index].u.rx_isr_spurious_info.spurcount = spur_cnt;
376   
377  cd2401_debug_index = (cd2401_debug_index + 1 ) % CD2401_DEBUG_BUFFER_SIZE;
378}
379
380
381void cd2401_record_re_isr_spurious_info(
382  unsigned char ch,
383  rtems_unsigned32 spur_dev,
384  rtems_unsigned32 spur_cnt
385)
386{
387  memset( &(cd2401_debug_buffer[cd2401_debug_index]), '\0', sizeof( struct cd2401_debug_info )  );
388  cd2401_debug_buffer[cd2401_debug_index].discriminant = CD2401_RE_ISR_SPURIOUS_INFO;
389  cd2401_debug_buffer[cd2401_debug_index].record_size =
390      cd2401_get_record_size( sizeof( struct cd2401_re_isr_spurious_info ) );
391  cd2401_debug_buffer[cd2401_debug_index].u.re_isr_spurious_info.channel = ch;
392  cd2401_debug_buffer[cd2401_debug_index].u.re_isr_spurious_info.spurdev = spur_dev;
393  cd2401_debug_buffer[cd2401_debug_index].u.re_isr_spurious_info.spurcount = spur_cnt;
394   
395  cd2401_debug_index = (cd2401_debug_index + 1 ) % CD2401_DEBUG_BUFFER_SIZE;
396}
397
398
399void cd2401_record_modem_isr_spurious_info(
400  unsigned char ch,
401  rtems_unsigned32 spur_dev,
402  rtems_unsigned32 spur_cnt
403)
404{
405  memset( &(cd2401_debug_buffer[cd2401_debug_index]), '\0', sizeof( struct cd2401_debug_info )  );
406  cd2401_debug_buffer[cd2401_debug_index].discriminant = CD2401_MODEM_ISR_SPURIOUS_INFO;
407  cd2401_debug_buffer[cd2401_debug_index].record_size =
408      cd2401_get_record_size( sizeof( struct cd2401_modem_isr_spurious_info ) );
409  cd2401_debug_buffer[cd2401_debug_index].u.modem_isr_spurious_info.channel = ch;
410  cd2401_debug_buffer[cd2401_debug_index].u.modem_isr_spurious_info.spurdev = spur_dev;
411  cd2401_debug_buffer[cd2401_debug_index].u.modem_isr_spurious_info.spurcount = spur_cnt;
412   
413  cd2401_debug_index = (cd2401_debug_index + 1 ) % CD2401_DEBUG_BUFFER_SIZE;
414}
415
416
417void cd2401_record_first_open_info(
418  unsigned char ch,
419  rtems_unsigned8 init_count
420)
421{
422  memset( &(cd2401_debug_buffer[cd2401_debug_index]), '\0', sizeof( struct cd2401_debug_info )  );
423  cd2401_debug_buffer[cd2401_debug_index].discriminant = CD2401_FIRST_OPEN_INFO;
424  cd2401_debug_buffer[cd2401_debug_index].record_size =
425      cd2401_get_record_size( sizeof( struct cd2401_first_open_info ) );
426  cd2401_debug_buffer[cd2401_debug_index].u.first_open_info.channel = ch;
427  cd2401_debug_buffer[cd2401_debug_index].u.first_open_info.init_count = init_count;
428   
429  cd2401_debug_index = (cd2401_debug_index + 1 ) % CD2401_DEBUG_BUFFER_SIZE;
430}
431
432
433void cd2401_record_last_close_info(
434  unsigned char ch,
435  rtems_unsigned8 init_count
436)
437{
438  memset( &(cd2401_debug_buffer[cd2401_debug_index]), '\0', sizeof( struct cd2401_debug_info )  );
439  cd2401_debug_buffer[cd2401_debug_index].discriminant = CD2401_LAST_CLOSE_INFO;
440  cd2401_debug_buffer[cd2401_debug_index].record_size =
441      cd2401_get_record_size( sizeof( struct cd2401_last_close_info ) );
442  cd2401_debug_buffer[cd2401_debug_index].u.last_close_info.channel = ch;
443  cd2401_debug_buffer[cd2401_debug_index].u.last_close_info.init_count = init_count;
444   
445  cd2401_debug_index = (cd2401_debug_index + 1 ) % CD2401_DEBUG_BUFFER_SIZE;
446}
447
448
449void cd2401_record_start_remote_tx_info(
450  unsigned char ch
451)
452{
453  memset( &(cd2401_debug_buffer[cd2401_debug_index]), '\0', sizeof( struct cd2401_debug_info )  );
454  cd2401_debug_buffer[cd2401_debug_index].discriminant = CD2401_START_REMOTE_TX_INFO;
455  cd2401_debug_buffer[cd2401_debug_index].record_size =
456      cd2401_get_record_size( sizeof( struct cd2401_start_remote_tx_info ) );
457  cd2401_debug_buffer[cd2401_debug_index].u.start_remote_tx_info.channel = ch;
458   
459  cd2401_debug_index = (cd2401_debug_index + 1 ) % CD2401_DEBUG_BUFFER_SIZE;
460}
461
462
463void cd2401_record_stop_remote_tx_info(
464  unsigned char ch
465)
466{
467  memset( &(cd2401_debug_buffer[cd2401_debug_index]), '\0', sizeof( struct cd2401_debug_info )  );
468  cd2401_debug_buffer[cd2401_debug_index].discriminant = CD2401_STOP_REMOTE_TX_INFO;
469  cd2401_debug_buffer[cd2401_debug_index].record_size =
470      cd2401_get_record_size( sizeof( struct cd2401_stop_remote_tx_info ) );
471  cd2401_debug_buffer[cd2401_debug_index].u.stop_remote_tx_info.channel = ch;
472   
473  cd2401_debug_index = (cd2401_debug_index + 1 ) % CD2401_DEBUG_BUFFER_SIZE;
474}
475
476
477void cd2401_record_set_attributes_info( 
478  int minor,
479  rtems_unsigned8 need_reinit,
480  rtems_unsigned8 csize,
481  rtems_unsigned8 cstopb,
482  rtems_unsigned8 parodd,
483  rtems_unsigned8 parenb,
484  rtems_unsigned8 ignpar,
485  rtems_unsigned8 inpck,
486  rtems_unsigned8 hw_flow_ctl,
487  rtems_unsigned8 sw_flow_ctl,
488  rtems_unsigned8 extra_flow_ctl,
489  rtems_unsigned8 icrnl,
490  rtems_unsigned8 igncr,
491  rtems_unsigned8 inlcr,
492  rtems_unsigned8 brkint,
493  rtems_unsigned8 ignbrk,
494  rtems_unsigned8 parmrk,
495  rtems_unsigned8 istrip,
496  rtems_unsigned16 tx_period,
497  rtems_unsigned16 rx_period,
498  rtems_unsigned32 out_baud,
499  rtems_unsigned32 in_baud
500)
501{
502  memset( &(cd2401_debug_buffer[cd2401_debug_index]), '\0', sizeof( struct cd2401_debug_info )  );
503  cd2401_debug_buffer[cd2401_debug_index].discriminant = CD2401_SET_ATTRIBUTE_INFO;
504  cd2401_debug_buffer[cd2401_debug_index].record_size =
505  cd2401_get_record_size( sizeof( struct cd2401_set_attribute_info ) );
506  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.minor = minor;
507  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.need_reinit = need_reinit;
508  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.txEmpty = CD2401_Channel_Info[minor].txEmpty;
509  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.csize = csize;
510  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.cstopb = cstopb;
511  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.parodd = parodd;
512  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.parenb = parenb;
513  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.ignpar = ignpar;
514  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.inpck = inpck;
515  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.hw_flow_ctl = hw_flow_ctl;
516  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.sw_flow_ctl = sw_flow_ctl;
517  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.extra_flow_ctl = extra_flow_ctl;
518  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.icrnl = icrnl;
519  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.igncr = igncr;
520  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.inlcr = inlcr;
521  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.brkint = brkint;
522  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.ignbrk = ignbrk;
523  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.parmrk = parmrk;
524  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.istrip = istrip;
525  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.tx_period = tx_period;
526  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.rx_period = rx_period;
527  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.out_baud = out_baud;
528  cd2401_debug_buffer[cd2401_debug_index].u.set_attribute_info.in_baud = in_baud;
529 
530  cd2401_debug_index = (cd2401_debug_index + 1 ) % CD2401_DEBUG_BUFFER_SIZE;
531}
532
533
534void cd2401_record_drain_output_info(
535  rtems_unsigned8 txEmpty,
536  rtems_unsigned8 own_buf_A,
537  rtems_unsigned8 own_buf_B
538)
539{
540  memset( &(cd2401_debug_buffer[cd2401_debug_index]), '\0', sizeof( struct cd2401_debug_info )  );
541  cd2401_debug_buffer[cd2401_debug_index].discriminant = CD2401_DRAIN_OUTPUT_INFO;
542  cd2401_debug_buffer[cd2401_debug_index].record_size =
543      cd2401_get_record_size( sizeof( struct cd2401_drain_output_info ) );
544  cd2401_debug_buffer[cd2401_debug_index].u.drain_output_info.txEmpty = txEmpty;
545  cd2401_debug_buffer[cd2401_debug_index].u.drain_output_info.own_buf_A = own_buf_A;
546  cd2401_debug_buffer[cd2401_debug_index].u.drain_output_info.own_buf_B = own_buf_B;
547 
548  cd2401_debug_index = (cd2401_debug_index + 1 ) % CD2401_DEBUG_BUFFER_SIZE;
549}
550
551
552void cd2401_record_delay_info(
553  rtems_interval start,
554  rtems_interval end,
555  rtems_interval current,
556  unsigned long loop_count
557)
558{
559  memset( &(cd2401_debug_buffer[cd2401_debug_index]), '\0', sizeof( struct cd2401_debug_info )  );
560  cd2401_debug_buffer[cd2401_debug_index].discriminant = CD2401_DELAY_INFO;
561  cd2401_debug_buffer[cd2401_debug_index].record_size =
562      cd2401_get_record_size( sizeof( struct cd2401_delay_info ) );
563  cd2401_debug_buffer[cd2401_debug_index].u.delay_info.start = start;
564  cd2401_debug_buffer[cd2401_debug_index].u.delay_info.end = end;
565  cd2401_debug_buffer[cd2401_debug_index].u.delay_info.current = current;
566  cd2401_debug_buffer[cd2401_debug_index].u.delay_info.loop_count = loop_count;
567 
568  cd2401_debug_index = (cd2401_debug_index + 1 ) % CD2401_DEBUG_BUFFER_SIZE;
569}
570
571
572#else
573
574/* Do not call the data recording functions */
575#define CD2401_RECORD_WRITE_INFO( args )
576#define CD2401_RECORD_TX_ISR_INFO( args )
577#define CD2401_RECORD_TX_ISR_SPURIOUS_INFO( args )
578#define CD2401_RECORD_TX_ISR_BUSERR_INFO( args )
579#define CD2401_RECORD_RX_ISR_INFO( args )
580#define CD2401_RECORD_RX_ISR_SPURIOUS_INFO( args )
581#define CD2401_RECORD_RE_ISR_SPURIOUS_INFO( args )
582#define CD2401_RECORD_MODEM_ISR_SPURIOUS_INFO( args )
583#define CD2401_RECORD_FIRST_OPEN_INFO( args )
584#define CD2401_RECORD_LAST_CLOSE_INFO( args )
585#define CD2401_RECORD_START_REMOTE_TX_INFO( args )
586#define CD2401_RECORD_STOP_REMOTE_TX_INFO( args )
587#define CD2401_RECORD_SET_ATTRIBUTES_INFO( args )
588#define CD2401_RECORD_DRAIN_OUTPUT_INFO( args )
589#define CD2401_RECORD_DELAY_INFO( args )
590
591#endif
Note: See TracBrowser for help on using the repository browser.