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