source: rtems/c/src/lib/libcpu/mips/mongoosev/duart/mg5uart.c @ acdb6558

4.104.114.84.9
Last change on this file since acdb6558 was acdb6558, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 14, 2001 at 12:49:17 AM

2001-03-13 Joel Sherrill <joel@…>

  • Added mongoose-v, mongoose-v/include, and mongoose-v/vectorisrs directories.
  • mongoosev/.cvsignore, mongoosev/Makefile.am, mongoosev/README, mongoosev/duart/.cvsignore, mongoosev/duart/Makefile.am, mongoosev/duart/README.mguart, mongoosev/duart/mg5uart.c, mongoosev/duart/mg5uart.h, mongoosev/duart/mg5uart_reg.c, mongoosev/include/.cvsignore, mongoosev/include/Makefile.am, mongoosev/include/mongoose-v.h, mongoosev/vectorisrs/.cvsignore, mongoosev/vectorisrs/Makefile.am, mongoosev/vectorisrs/vectorisrs.c: New files.
  • Makefile.am, configure.in, shared/interrupts/Makefile.am, shared/interrupts/maxvectors.c: Added support for mongoosev.
  • tx39/vectorisrs/vectorisrs.c: Corrected warning.
  • Property mode set to 100644
File size: 17.7 KB
Line 
1/*
2 *  This file contains the termios TTY driver for the UART found
3 *  on the Synova Mongoose-V.
4 *
5 *  COPYRIGHT (c) 1989-2001.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <rtems.h>
16#include <rtems/libio.h>
17#include <stdlib.h>
18
19#include <libchip/serial.h>
20#include <libchip/mg5uart.h>
21#include <libchip/sersupp.h>
22#include <libcpu/mongoose-v.h>
23
24extern void set_vector( rtems_isr_entry, rtems_vector_number, int );
25
26/*
27 *  Indices of registers
28 */
29
30/*
31 *  Per chip context control
32 */
33
34typedef struct _mg5uart_context
35{
36  int            mate;
37} mg5uart_context;
38
39/*
40 *  Define MG5UART_STATIC to nothing while debugging so the entry points
41 *  will show up in the symbol table.
42 */
43
44#define MG5UART_STATIC
45
46/* #define MG5UART_STATIC static */
47
48#define MG5UART_SETREG( _base, _register, _value ) \
49        MONGOOSEV_WRITE_REGISTER( _base, _register, _value )
50
51#define MG5UART_GETREG( _base, _register ) \
52        MONGOOSEV_READ_REGISTER( _base, _register )
53
54/*
55 *  Console Device Driver Support Functions
56 */
57
58MG5UART_STATIC int mg5uart_baud_rate(
59  int           minor,
60  int           baud,
61  unsigned int *code
62);
63
64MG5UART_STATIC void mg5uart_enable_interrupts(
65  int minor,
66  int mask
67);
68
69/*
70 *  mg5uart_set_attributes
71 *
72 *  This function sets the UART channel to reflect the requested termios
73 *  port settings.
74 */
75
76MG5UART_STATIC int mg5uart_set_attributes( 
77  int minor,
78  const struct termios *t
79)
80{
81  unsigned32             pMG5UART_port;
82  unsigned32             pMG5UART;
83  unsigned int           cmd;
84  unsigned int           baudcmd;
85  unsigned int           portshift;
86  rtems_interrupt_level  Irql;
87
88  pMG5UART      = Console_Port_Tbl[minor].ulCtrlPort1;
89  pMG5UART_port = Console_Port_Tbl[minor].ulCtrlPort2;
90
91  /*
92   *  Set the baud rate
93   */
94
95  if (mg5uart_baud_rate( minor, t->c_cflag, &baudcmd ) == -1)
96    return -1;
97
98  /*
99   *  Base settings
100   */
101
102  /*
103   *  Base settings
104   */
105
106  cmd = MONGOOSEV_UART_CMD_TX_ENABLE | MONGOOSEV_UART_CMD_TX_ENABLE;
107
108  /*
109   *  Parity
110   */
111
112  if (t->c_cflag & PARENB) {
113    cmd |= MONGOOSEV_UART_CMD_PARITY_ENABLE;
114    if (t->c_cflag & PARODD)
115      cmd |= MONGOOSEV_UART_CMD_PARITY_ODD;
116    else
117      cmd |= MONGOOSEV_UART_CMD_PARITY_EVEN;
118  } else {
119    cmd |= MONGOOSEV_UART_CMD_PARITY_DISABLE;
120  }
121
122  /*
123   *  Character Size
124   */
125
126  if (t->c_cflag & CSIZE) {
127    switch (t->c_cflag & CSIZE) {
128      case CS5: 
129      case CS6: 
130      case CS7: 
131        return -1;
132        break;
133      case CS8:
134        /* Mongoose-V only supports CS8 */
135        break;
136 
137    }
138  } /* else default to CS8 */
139
140  /*
141   *  Stop Bits
142   */
143 
144#if 0
145  if (t->c_cflag & CSTOPB) {
146    /* 2 stop bits not supported by Mongoose-V uart */
147    return -1;
148  }
149#endif
150
151  /*
152   *  XXX what about CTS/RTS
153   */
154
155  /* XXX */
156
157  /*
158   *  Now write the registers
159   */
160
161  if ( Console_Port_Tbl[minor].ulDataPort == MG5UART_UART0 )
162    portshift = MONGOOSEV_UART0_CMD_SHIFT;
163  else
164    portshift = MONGOOSEV_UART1_CMD_SHIFT;
165
166  rtems_interrupt_disable(Irql);
167    MG5UART_SETREG( pMG5UART, MG5UART_COMMAND_REGISTER, cmd << portshift );
168    MG5UART_SETREG( pMG5UART_port, MG5UART_BAUD_RATE, baudcmd );
169  rtems_interrupt_enable(Irql);
170  return 0;
171}
172
173/*
174 *  mg5uart_initialize_context
175 *
176 *  This function sets the default values of the per port context structure.
177 */
178
179MG5UART_STATIC void mg5uart_initialize_context(
180  int               minor,
181  mg5uart_context  *pmg5uartContext
182)
183{
184  int          port;
185  unsigned int pMG5UART;
186  unsigned int pMG5UART_port;
187 
188  pMG5UART      = Console_Port_Tbl[minor].ulCtrlPort1;
189  pMG5UART_port = Console_Port_Tbl[minor].ulCtrlPort2;
190
191  pmg5uartContext->mate = -1;
192
193  for (port=0 ; port<Console_Port_Count ; port++ ) {
194    if ( Console_Port_Tbl[port].ulCtrlPort1 == pMG5UART && 
195         Console_Port_Tbl[port].ulCtrlPort2 != pMG5UART_port ) {
196      pmg5uartContext->mate = port;
197      break;
198    }
199  }
200
201}
202
203/*
204 *  mg5uart_init
205 *
206 *  This function initializes the DUART to a quiecsent state.
207 */
208
209MG5UART_STATIC void mg5uart_init(int minor)
210{
211  unsigned32              pMG5UART_port;
212  unsigned32              pMG5UART;
213  mg5uart_context        *pmg5uartContext;
214
215  pmg5uartContext = (mg5uart_context *) malloc(sizeof(mg5uart_context));
216
217  Console_Port_Data[minor].pDeviceContext = (void *)pmg5uartContext;
218
219  mg5uart_initialize_context( minor, pmg5uartContext );
220
221  pMG5UART      = Console_Port_Tbl[minor].ulCtrlPort1;
222  pMG5UART_port = Console_Port_Tbl[minor].ulCtrlPort2;
223
224  /*
225   *  Reset everything and leave this port disabled.
226   */
227
228  MG5UART_SETREG( pMG5UART, 0, MONGOOSEV_UART_CMD_RESET_BOTH_PORTS );
229
230  /*
231   *  Disable interrupts on RX and TX for this port
232   */
233
234  mg5uart_enable_interrupts( minor, MG5UART_DISABLE_ALL );
235}
236
237/*
238 *  mg5uart_open
239 *
240 *  This function opens a port for communication.
241 *
242 *  Default state is 9600 baud, 8 bits, No parity, and 1 stop bit.
243 */
244
245MG5UART_STATIC int mg5uart_open(
246  int      major,
247  int      minor,
248  void    *arg
249)
250{
251  unsigned32             pMG5UART;
252  unsigned32             pMG5UART_port;
253  unsigned int           vector;
254  unsigned int           cmd;
255  unsigned int           baudcmd;
256  unsigned int           portshift;
257  rtems_interrupt_level  Irql;
258
259  pMG5UART      = Console_Port_Tbl[minor].ulCtrlPort1;
260  pMG5UART_port = Console_Port_Tbl[minor].ulCtrlPort2;
261  vector        = Console_Port_Tbl[minor].ulIntVector;
262
263  /* XXX default baud rate could be from configuration table */
264
265  (void) mg5uart_baud_rate( minor, B9600, &baudcmd );
266
267  /*
268   *  Set the DUART channel to a default useable state
269   *  B9600, 8Nx since there is no stop bit control.
270   */
271
272  cmd = MONGOOSEV_UART_CMD_TX_ENABLE | MONGOOSEV_UART_CMD_RX_ENABLE;
273
274  if ( Console_Port_Tbl[minor].ulDataPort == MG5UART_UART0 )
275    portshift = MONGOOSEV_UART0_CMD_SHIFT;
276  else
277    portshift = MONGOOSEV_UART1_CMD_SHIFT;
278
279  rtems_interrupt_disable(Irql);
280    MG5UART_SETREG( pMG5UART, MG5UART_COMMAND_REGISTER, cmd << portshift );
281    MG5UART_SETREG( pMG5UART_port, MG5UART_BAUD_RATE, baudcmd );
282  rtems_interrupt_enable(Irql);
283
284  return RTEMS_SUCCESSFUL;
285}
286
287/*
288 *  mg5uart_close
289 *
290 *  This function shuts down the requested port.
291 */
292
293MG5UART_STATIC int mg5uart_close(
294  int      major,
295  int      minor,
296  void    *arg
297)
298{
299  unsigned32      pMG5UART;
300  unsigned32      pMG5UART_port;
301  unsigned int    cmd;
302  unsigned int    portshift;
303
304  pMG5UART      = Console_Port_Tbl[minor].ulCtrlPort1;
305  pMG5UART_port = Console_Port_Tbl[minor].ulCtrlPort2;
306
307  /*
308   *  Disable interrupts from this channel and then disable it totally.
309   */
310
311  /* XXX interrupts */
312
313  cmd = MONGOOSEV_UART_CMD_TX_DISABLE | MONGOOSEV_UART_CMD_RX_DISABLE;
314
315  if ( Console_Port_Tbl[minor].ulDataPort == MG5UART_UART0 )
316    portshift = MONGOOSEV_UART0_CMD_SHIFT;
317  else
318    portshift = MONGOOSEV_UART1_CMD_SHIFT;
319
320  MG5UART_SETREG( pMG5UART, MG5UART_COMMAND_REGISTER, cmd << portshift );
321
322  return(RTEMS_SUCCESSFUL);
323}
324
325/*
326 *  mg5uart_write_polled
327 *
328 *  This routine polls out the requested character.
329 */
330
331MG5UART_STATIC void mg5uart_write_polled(
332  int   minor, 
333  char  c
334)
335{
336  unsigned32              pMG5UART;
337  unsigned32              pMG5UART_port;
338  unsigned32              status;
339  int                     shift;
340  int                     timeout;
341
342  pMG5UART      = Console_Port_Tbl[minor].ulCtrlPort1;
343  pMG5UART_port = Console_Port_Tbl[minor].ulCtrlPort2;
344
345  if ( Console_Port_Tbl[minor].ulDataPort == MG5UART_UART0 )
346    shift = MONGOOSEV_UART0_IRQ_SHIFT;
347  else
348    shift = MONGOOSEV_UART1_IRQ_SHIFT;
349
350  /*
351   * wait for transmitter holding register to be empty
352   */
353  timeout = 1000;
354  status = MG5UART_GETREG(pMG5UART, MG5UART_STATUS_REGISTER);
355  while ( 1 ) {
356    status = MG5UART_GETREG(pMG5UART, MG5UART_STATUS_REGISTER) >> shift;
357   
358    if ( (status & (MONGOOSEV_UART_TX_READY|MONGOOSEV_UART_TX_EMPTY_0)) ==
359            (MONGOOSEV_UART_TX_READY|MONGOOSEV_UART_TX_EMPTY_0) )
360      break;
361
362    /*
363     * Yield while we wait
364     */
365
366#if 0
367     if(_System_state_Is_up(_System_state_Get())) {
368       rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
369     }
370#endif
371     if(!--timeout) {
372       break;
373     }
374  }
375
376  /*
377   * transmit character
378   */
379
380  MG5UART_SETREG(pMG5UART_port, MG5UART_TX_BUFFER, c);
381}
382
383/*
384 *  mg5uart_isr_XXX
385 *
386 *  This is the single interrupt entry point which parcels interrupts
387 *  out to the handlers for specific sources and makes sure that the
388 *  shared handler gets the right arguments.
389 *
390 *  NOTE: Yes .. this is ugly but it provides 5 interrupt source
391 *  wrappers which are nearly functionally identical.
392 */
393
394
395#define __ISR(_TYPE, _OFFSET) \
396  MG5UART_STATIC void mg5uart_process_isr_ ## _TYPE ( \
397    int  minor \
398  ); \
399  \
400  MG5UART_STATIC rtems_isr mg5uart_isr_ ## _TYPE ( \
401    rtems_vector_number vector \
402  ) \
403  { \
404    int     minor; \
405   \
406    for(minor=0 ; minor<Console_Port_Count ; minor++) { \
407      if( Console_Port_Tbl[minor].deviceType == SERIAL_MG5UART && \
408          vector == Console_Port_Tbl[minor].ulIntVector + _OFFSET ) { \
409        mg5uart_process_isr_ ## _TYPE (minor); \
410      } \
411    } \
412  }
413
414__ISR(rx_frame_error, MG5UART_IRQ_RX_FRAME_ERROR)
415__ISR(rx_overrun_error, MG5UART_IRQ_RX_OVERRUN_ERROR)
416__ISR(tx_empty, MG5UART_IRQ_TX_EMPTY)
417__ISR(tx_ready, MG5UART_IRQ_TX_READY)
418__ISR(rx_ready, MG5UART_IRQ_RX_READY)
419 
420
421MG5UART_STATIC void mg5uart_process_isr_rx_frame_error(
422  int  minor
423)
424{
425  unsigned32              pMG5UART;
426  int                     shift;
427
428  pMG5UART      = Console_Port_Tbl[minor].ulCtrlPort1;
429
430  if ( Console_Port_Tbl[minor].ulDataPort == MG5UART_UART0 )
431    shift = MONGOOSEV_UART0_IRQ_SHIFT;
432  else
433    shift = MONGOOSEV_UART1_IRQ_SHIFT;
434
435  /* now clear the error */
436
437  MG5UART_SETREG(
438    pMG5UART,
439    MG5UART_STATUS_REGISTER, 
440    MONGOOSEV_UART_RX_FRAME_ERROR << shift
441  );
442}
443
444MG5UART_STATIC void mg5uart_process_isr_rx_overrun_error(
445  int  minor
446)
447{
448  unsigned32              pMG5UART;
449  int                     shift;
450
451  pMG5UART      = Console_Port_Tbl[minor].ulCtrlPort1;
452
453  if ( Console_Port_Tbl[minor].ulDataPort == MG5UART_UART0 )
454    shift = MONGOOSEV_UART0_IRQ_SHIFT;
455  else
456    shift = MONGOOSEV_UART1_IRQ_SHIFT;
457
458  /* now clear the error */
459
460  MG5UART_SETREG(
461    pMG5UART,
462    MG5UART_STATUS_REGISTER,
463    MONGOOSEV_UART_RX_OVERRUN_ERROR << shift
464  );
465}
466
467MG5UART_STATIC void mg5uart_process_tx_isr(
468  int        minor,
469  unsigned32 source_mask
470);
471
472MG5UART_STATIC void mg5uart_process_isr_tx_empty(
473  int  minor
474)
475{
476  mg5uart_process_tx_isr( minor, MONGOOSEV_UART_TX_EMPTY );
477}
478
479MG5UART_STATIC void mg5uart_process_isr_tx_ready(
480  int  minor
481)
482{
483  mg5uart_process_tx_isr( minor, MONGOOSEV_UART_TX_READY );
484}
485
486MG5UART_STATIC void mg5uart_process_tx_isr(
487  int        minor,
488  unsigned32 source_mask
489)
490{
491  unsigned32              pMG5UART;
492  int                     shift;
493
494  pMG5UART      = Console_Port_Tbl[minor].ulCtrlPort1;
495
496  if (!rtems_termios_dequeue_characters(
497       Console_Port_Data[minor].termios_data, 1))
498    return;
499
500
501  /*
502   *  There are no more characters to transmit so clear the interrupt
503   *  source and disable TX interrupts.
504   */
505
506  Console_Port_Data[minor].bActive = FALSE;
507
508  if ( Console_Port_Tbl[minor].ulDataPort == MG5UART_UART0 )
509    shift = MONGOOSEV_UART0_IRQ_SHIFT;
510  else
511    shift = MONGOOSEV_UART1_IRQ_SHIFT;
512
513  /* now clear the interrupt source */
514
515  MG5UART_SETREG(
516    pMG5UART,
517    MG5UART_STATUS_REGISTER,
518    source_mask << shift
519  );
520
521  mg5uart_enable_interrupts(minor, MG5UART_ENABLE_ALL_EXCEPT_TX);
522
523}
524
525MG5UART_STATIC void mg5uart_process_isr_rx_ready(
526  int  minor
527)
528{
529  unsigned32              pMG5UART_port;
530  unsigned char           c;
531
532  pMG5UART_port = Console_Port_Tbl[minor].ulCtrlPort2;
533
534  c = (unsigned char) MG5UART_GETREG(pMG5UART_port, MG5UART_RX_BUFFER);
535  rtems_termios_enqueue_raw_characters(
536    Console_Port_Data[minor].termios_data,
537    &c,
538    1
539  );
540
541  /* reading the RX buffer automatically resets the error */ 
542}
543
544/*
545 *  mg5uart_initialize_interrupts
546 *
547 *  This routine initializes the console's receive and transmit
548 *  ring buffers and loads the appropriate vectors to handle the interrupts.
549 */
550
551MG5UART_STATIC void mg5uart_initialize_interrupts(int minor)
552{
553  unsigned long v;
554  mg5uart_init(minor);
555
556  Console_Port_Data[minor].bActive = FALSE;
557  v = Console_Port_Tbl[minor].ulIntVector;
558
559  set_vector(mg5uart_isr_rx_frame_error,   v + MG5UART_IRQ_RX_FRAME_ERROR, 1);
560  set_vector(mg5uart_isr_rx_overrun_error, v + MG5UART_IRQ_RX_OVERRUN_ERROR, 1);
561  set_vector(mg5uart_isr_tx_empty,         v + MG5UART_IRQ_TX_EMPTY, 1);
562  set_vector(mg5uart_isr_tx_ready,         v + MG5UART_IRQ_TX_READY, 1);
563  set_vector(mg5uart_isr_rx_ready,         v + MG5UART_IRQ_RX_READY, 1);
564
565  mg5uart_enable_interrupts(minor, MG5UART_ENABLE_ALL_EXCEPT_TX);
566}
567
568/*
569 *  mg5uart_write_support_int
570 *
571 *  Console Termios output entry point when using interrupt driven output.
572 */
573
574MG5UART_STATIC int mg5uart_write_support_int(
575  int         minor, 
576  const char *buf, 
577  int         len
578)
579{
580  unsigned32      Irql;
581  unsigned32      pMG5UART_port;
582
583  pMG5UART_port = Console_Port_Tbl[minor].ulCtrlPort2;
584
585  /*
586   *  We are using interrupt driven output and termios only sends us
587   *  one character at a time.
588   */
589
590  if ( !len )
591    return 0;
592
593  /*
594   *  Put the character out and enable interrupts if necessary.
595   */
596
597  rtems_interrupt_disable(Irql);
598    if ( Console_Port_Data[minor].bActive == FALSE ) {
599      Console_Port_Data[minor].bActive = TRUE;
600      mg5uart_enable_interrupts(minor, MG5UART_ENABLE_ALL);
601    }
602    MG5UART_SETREG(pMG5UART_port, MG5UART_TX_BUFFER, *buf);
603  rtems_interrupt_enable(Irql);
604
605  return 1;
606}
607
608/*
609 *  mg5uart_write_support_polled
610 *
611 *  Console Termios output entry point when using polled output.
612 *
613 */
614
615MG5UART_STATIC int mg5uart_write_support_polled(
616  int         minor, 
617  const char *buf, 
618  int         len
619)
620{
621  int nwrite = 0;
622
623  /*
624   * poll each byte in the string out of the port.
625   */
626  while (nwrite < len) {
627    /*
628     * transmit character
629     */
630    mg5uart_write_polled(minor, *buf++);
631    nwrite++;
632  }
633
634  /*
635   * return the number of bytes written.
636   */
637  return nwrite;
638}
639
640/*
641 *  mg5uart_inbyte_nonblocking_polled
642 *
643 *  Console Termios polling input entry point.
644 */
645
646MG5UART_STATIC int mg5uart_inbyte_nonblocking_polled( 
647  int minor
648)
649{
650  unsigned32              pMG5UART;
651  unsigned32              pMG5UART_port;
652  unsigned32              status;
653  int                     shift;
654
655  pMG5UART      = Console_Port_Tbl[minor].ulCtrlPort1;
656  pMG5UART_port = Console_Port_Tbl[minor].ulCtrlPort2;
657
658  if ( Console_Port_Tbl[minor].ulDataPort == MG5UART_UART0 )
659    shift = MONGOOSEV_UART0_IRQ_SHIFT;
660  else
661    shift = MONGOOSEV_UART1_IRQ_SHIFT;
662
663  status = MG5UART_GETREG(pMG5UART, MG5UART_STATUS_REGISTER) >> shift;
664  if ( status & MONGOOSEV_UART_RX_READY ) {
665    return (int) MG5UART_GETREG(pMG5UART_port, MG5UART_RX_BUFFER);
666  } else {
667    return -1;
668  }
669}
670
671/*
672 *  mg5uart_baud_rate
673 */
674
675MG5UART_STATIC int mg5uart_baud_rate(
676  int           minor,
677  int           baud,
678  unsigned int *code
679)
680{
681  rtems_unsigned32 clock;
682  rtems_unsigned32 tmp_code;
683  rtems_unsigned32 baud_requested;
684
685  baud_requested = baud & CBAUD;
686  if (!baud_requested)
687    baud_requested = B9600;              /* default to 9600 baud */
688 
689  baud_requested = termios_baud_to_number( B9600 );
690
691  clock = (rtems_unsigned32) Console_Port_Tbl[minor].ulClock;
692  if (!clock)
693    rtems_fatal_error_occurred(RTEMS_INVALID_NUMBER);
694
695  /*
696   *  Formula is Code = round(ClockFrequency / Baud - 1).
697   *
698   *  Since this is integer math, we will divide by twice the baud and
699   *  check the remaining odd bit.
700   */
701
702  tmp_code = (clock / (baud_requested * 2));
703  if ( tmp_code & 0x01 )
704    tmp_code = (tmp_code >> 1) + 1;
705  else
706    tmp_code = (tmp_code >> 1);
707
708  /*
709   *  From section 12.7, "Keep C>100 for best receiver operation."
710   *  That is 100 cycles which is not a lot of instructions.  It is
711   *  reasonable to think that the Mongoose-V could not keep
712   *  up with C < 200. 
713   */
714
715  if ( tmp_code < 100 )
716    return RTEMS_INVALID_NUMBER;
717
718  /*
719   *  upper word is receiver baud and lower word is transmitter baud
720   */
721
722  *code = (tmp_code << 16) | tmp_code;
723  return 0;
724}
725
726/*
727 *  mg5uart_enable_interrupts
728 *
729 *  This function enables specific interrupt sources on the DUART.
730 */
731
732MG5UART_STATIC void mg5uart_enable_interrupts(
733  int minor,
734  int mask
735)
736{
737  unsigned32            pMG5UART;
738  unsigned int          shift;
739
740  pMG5UART = Console_Port_Tbl[minor].ulCtrlPort1;
741
742  /*
743   *  Enable interrupts on RX and TX -- not break
744   */
745
746  if ( Console_Port_Tbl[minor].ulDataPort == MG5UART_UART0 )
747    shift = MONGOOSEV_UART0_IRQ_SHIFT;
748  else
749    shift = MONGOOSEV_UART1_IRQ_SHIFT;
750
751  MG5UART_SETREG(
752     pMG5UART,
753     MG5UART_INTERRUPT_MASK_REGISTER,
754     mask << shift
755  );
756}
757
758/*
759 * Flow control is only supported when using interrupts
760 */
761
762console_fns mg5uart_fns =
763{
764  libchip_serial_default_probe,   /* deviceProbe */
765  mg5uart_open,                   /* deviceFirstOpen */
766  NULL,                           /* deviceLastClose */
767  NULL,                           /* deviceRead */
768  mg5uart_write_support_int,      /* deviceWrite */
769  mg5uart_initialize_interrupts,  /* deviceInitialize */
770  mg5uart_write_polled,           /* deviceWritePolled */
771  mg5uart_set_attributes,         /* deviceSetAttributes */
772  TRUE                            /* deviceOutputUsesInterrupts */
773};
774
775console_fns mg5uart_fns_polled =
776{
777  libchip_serial_default_probe,        /* deviceProbe */
778  mg5uart_open,                        /* deviceFirstOpen */
779  mg5uart_close,                       /* deviceLastClose */
780  mg5uart_inbyte_nonblocking_polled,   /* deviceRead */
781  mg5uart_write_support_polled,        /* deviceWrite */
782  mg5uart_init,                        /* deviceInitialize */
783  mg5uart_write_polled,                /* deviceWritePolled */
784  mg5uart_set_attributes,              /* deviceSetAttributes */
785  FALSE,                               /* deviceOutputUsesInterrupts */
786};
787
Note: See TracBrowser for help on using the repository browser.