source: rtems/c/src/libchip/serial/mc68681.c @ dd5d2f04

4.104.114.84.95
Last change on this file since dd5d2f04 was dd5d2f04, checked in by Joel Sherrill <joel.sherrill@…>, on 07/16/98 at 00:03:01

Split default baud rate table into its own file. This shrinks the
size of the minimum mc68681 driver. The clock speed field can not
now be configured as NULL but must instead specify the address of
the default table.

  • Property mode set to 100644
File size: 18.8 KB
Line 
1/*
2 *  This file contains the termios TTY driver for the Motorola MC68681.
3 *
4 *  This part is available from a number of secondary sources.
5 *  In particular, we know about the following:
6 *
7 *     + Exar 88c681 and 68c681
8 *
9 *  COPYRIGHT (c) 1989-1998.
10 *  On-Line Applications Research Corporation (OAR).
11 *  Copyright assigned to U.S. Government, 1994.
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.OARcorp.com/rtems/license.html.
16 *
17 *  $Id$
18 */
19
20#include <rtems.h>
21#include <rtems/libio.h>
22#include <stdlib.h>
23#include <ringbuf.h>
24
25#include <libchip/serial.h>
26#include "sersupp.h"
27#include "mc68681_p.h"
28#include "mc68681.h"
29
30/*
31 * Flow control is only supported when using interrupts
32 */
33
34console_fns mc68681_fns =
35{
36  libchip_serial_default_probe,   /* deviceProbe */
37  mc68681_open,                   /* deviceFirstOpen */
38  NULL,                           /* deviceLastClose */
39  NULL,                           /* deviceRead */
40  mc68681_write_support_int,      /* deviceWrite */
41  mc68681_initialize_interrupts,  /* deviceInitialize */
42  mc68681_write_polled,           /* deviceWritePolled */
43  mc68681_set_attributes,         /* deviceSetAttributes */
44  TRUE                            /* deviceOutputUsesInterrupts */
45};
46
47console_fns mc68681_fns_polled =
48{
49  libchip_serial_default_probe,        /* deviceProbe */
50  mc68681_open,                        /* deviceFirstOpen */
51  mc68681_close,                       /* deviceLastClose */
52  mc68681_inbyte_nonblocking_polled,   /* deviceRead */
53  mc68681_write_support_polled,        /* deviceWrite */
54  mc68681_init,                        /* deviceInitialize */
55  mc68681_write_polled,                /* deviceWritePolled */
56  mc68681_set_attributes,              /* deviceSetAttributes */
57  FALSE,                               /* deviceOutputUsesInterrupts */
58};
59
60extern void set_vector( rtems_isr_entry, rtems_vector_number, int );
61
62/*
63 *  Console Device Driver Entry Points
64 */
65
66/*
67 *  mc68681_baud_rate
68 *
69 *  This routine returns the proper ACR bit and baud rate field values
70 *  based on the requested baud rate.  The baud rate set to be used
71 *  must be configured by the user.
72 */
73
74MC68681_STATIC int mc68681_baud_rate(
75  int           minor,
76  int           baud,
77  unsigned int *baud_mask_p,
78  unsigned int *acr_bit_p,
79  unsigned int *command
80);
81
82/*
83 *  mc68681_set_attributes
84 *
85 *  This function sets the DUART channel to reflect the requested termios
86 *  port settings.
87 */
88
89MC68681_STATIC int mc68681_set_attributes(
90  int minor,
91  const struct termios *t
92)
93{
94  unsigned32             pMC68681_port;
95  unsigned32             pMC68681;
96  unsigned int           mode1;
97  unsigned int           mode2;
98  unsigned int           baud_mask;
99  unsigned int           acr_bit;
100  unsigned int           cmd;
101  setRegister_f          setReg;
102  rtems_interrupt_level  Irql;
103
104  pMC68681      = Console_Port_Tbl[minor].ulCtrlPort1;
105  pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
106  setReg        = Console_Port_Tbl[minor].setRegister;
107
108  /*
109   *  Set the baud rate
110   */
111
112  if (mc68681_baud_rate( minor, t->c_cflag, &baud_mask, &acr_bit, &cmd ) == -1)
113    return -1;
114
115  baud_mask |=  baud_mask << 4;
116  acr_bit   <<= 7;
117
118  /*
119   *  Parity
120   */
121
122  mode1 = 0;
123  mode2 = 0;
124
125  if (t->c_cflag & PARENB) {
126    if (t->c_cflag & PARODD)
127      mode1 |= 0x04;
128    else
129      mode1 |= 0x04;
130  } else {
131   mode1 |= 0x10;
132  }
133
134  /*
135   *  Character Size
136   */
137
138  if (t->c_cflag & CSIZE) {
139    switch (t->c_cflag & CSIZE) {
140      case CS5:  break;
141      case CS6:  mode1 |= 0x01;  break;
142      case CS7:  mode1 |= 0x02;  break;
143      case CS8:  mode1 |= 0x03;  break;
144    }
145  } else {
146    mode1 |= 0x03;       /* default to 9600,8,N,1 */
147  }
148
149  /*
150   *  Stop Bits
151   */
152 
153  if (t->c_cflag & CSTOPB) {
154    mode2 |= 0x07;                      /* 2 stop bits */
155  } else {
156    if ((t->c_cflag & CSIZE) == CS5)    /* CS5 and 2 stop bits not supported */
157      return -1;
158    mode2 |= 0x0F;                      /* 1 stop bit */
159  }
160
161  rtems_interrupt_disable(Irql);
162    (*setReg)( pMC68681, MC68681_AUX_CTRL_REG, acr_bit );
163    (*setReg)( pMC68681_port, MC68681_CLOCK_SELECT, baud_mask );
164    if ( cmd ) {
165      (*setReg)( pMC68681_port, MC68681_COMMAND, cmd );         /* RX */
166      (*setReg)( pMC68681_port, MC68681_COMMAND, cmd | 0x20 );  /* TX */
167    }
168    (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_MR_PTR );
169    (*setReg)( pMC68681_port, MC68681_MODE, mode1 );
170    (*setReg)( pMC68681_port, MC68681_MODE, mode2 );
171  rtems_interrupt_enable(Irql);
172  return 0;
173}
174
175/*
176 *  mc68681_initialize_context
177 *
178 *  This function sets the default values of the per port context structure.
179 */
180
181MC68681_STATIC void mc68681_initialize_context(
182  int               minor,
183  mc68681_context  *pmc68681Context
184)
185{
186  int          port;
187  unsigned int pMC68681;
188  unsigned int pMC68681_port;
189 
190  pMC68681      = Console_Port_Tbl[minor].ulCtrlPort1;
191  pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
192
193  pmc68681Context->mate = -1;
194
195  for (port=0 ; port<Console_Port_Count ; port++ ) {
196    if ( Console_Port_Tbl[port].ulCtrlPort1 == pMC68681 &&
197         Console_Port_Tbl[port].ulCtrlPort2 != pMC68681_port ) {
198      pmc68681Context->mate = port;
199      pmc68681Context->imr  = 0;
200      break;
201    }
202  }
203
204}
205
206/*
207 *  mc68681_init
208 *
209 *  This function initializes the DUART to a quiecsent state.
210 */
211
212MC68681_STATIC void mc68681_init(int minor)
213{
214  unsigned32              pMC68681_port;
215  unsigned32              pMC68681;
216  mc68681_context        *pmc68681Context;
217  setRegister_f           setReg;
218  getRegister_f           getReg;
219
220  pmc68681Context = (mc68681_context *) malloc(sizeof(mc68681_context));
221
222  Console_Port_Data[minor].pDeviceContext = (void *)pmc68681Context;
223
224  mc68681_initialize_context( minor, pmc68681Context );
225
226  pMC68681      = Console_Port_Tbl[minor].ulCtrlPort1;
227  pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
228  setReg        = Console_Port_Tbl[minor].setRegister;
229  getReg        = Console_Port_Tbl[minor].getRegister;
230
231  /*
232   *  Reset everything and leave this port disabled.
233   */
234
235  (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_RX );
236  (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_TX );
237  (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_ERROR );
238  (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_BREAK );
239  (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_STOP_BREAK );
240  (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_DISABLE_TX );
241  (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_DISABLE_RX );
242
243
244  (*setReg)( pMC68681_port, MC68681_MODE_REG_1A, 0x00 );
245  (*setReg)( pMC68681_port, MC68681_MODE_REG_2A, 0x02 );
246
247  /*
248   *  Disable interrupts on RX and TX for this port
249   */
250
251  mc68681_enable_interrupts( minor, MC68681_IMR_DISABLE_ALL );
252}
253
254/*
255 *  mc68681_open
256 *
257 *  This function opens a port for communication.
258 *
259 *  Default state is 9600 baud, 8 bits, No parity, and 1 stop bit.
260 */
261
262MC68681_STATIC int mc68681_open(
263  int      major,
264  int      minor,
265  void    *arg
266)
267{
268  unsigned32             pMC68681;
269  unsigned32             pMC68681_port;
270  unsigned int           baud;
271  unsigned int           acr;
272  unsigned int           vector;
273  unsigned int           command;
274  rtems_interrupt_level  Irql;
275  setRegister_f          setReg;
276
277  pMC68681      = Console_Port_Tbl[minor].ulCtrlPort1;
278  pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
279  setReg        = Console_Port_Tbl[minor].setRegister;
280  vector        = Console_Port_Tbl[minor].ulIntVector;
281
282  /* XXX default baud rate should be from configuration table */
283
284  (void) mc68681_baud_rate( minor, B9600, &baud, &acr, &command );
285
286  /*
287   *  Set the DUART channel to a default useable state
288   */
289
290  rtems_interrupt_disable(Irql);
291    (*setReg)( pMC68681, MC68681_AUX_CTRL_REG, acr );
292    (*setReg)( pMC68681_port, MC68681_CLOCK_SELECT, baud );
293    if ( command ) {
294      (*setReg)( pMC68681_port, MC68681_COMMAND, command );         /* RX */
295      (*setReg)( pMC68681_port, MC68681_COMMAND, command | 0x20 );  /* TX */
296    }
297    (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_MR_PTR );
298    (*setReg)( pMC68681_port, MC68681_MODE, 0x13 );
299    (*setReg)( pMC68681_port, MC68681_MODE, 0x07 );
300  rtems_interrupt_enable(Irql);
301
302  (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_ENABLE_TX );
303  (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_ENABLE_RX );
304
305  (*setReg)( pMC68681, MC68681_INTERRUPT_VECTOR_REG, vector );
306
307  return RTEMS_SUCCESSFUL;
308}
309
310/*
311 *  mc68681_close
312 *
313 *  This function shuts down the requested port.
314 */
315
316MC68681_STATIC int mc68681_close(
317  int      major,
318  int      minor,
319  void    *arg
320)
321{
322  unsigned32      pMC68681;
323  unsigned32      pMC68681_port;
324  setRegister_f   setReg;
325
326  pMC68681      = Console_Port_Tbl[minor].ulCtrlPort1;
327  pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
328  setReg        = Console_Port_Tbl[minor].setRegister;
329
330  /*
331   *  Disable interrupts from this channel and then disable it totally.
332   */
333
334  (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_DISABLE_TX );
335  (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_DISABLE_RX );
336
337  return(RTEMS_SUCCESSFUL);
338}
339
340/*
341 *  mc68681_write_polled
342 *
343 *  This routine polls out the requested character.
344 */
345
346MC68681_STATIC void mc68681_write_polled(
347  int   minor,
348  char  cChar
349)
350{
351  unsigned32              pMC68681_port;
352  unsigned char           ucLineStatus;
353  int                     iTimeout;
354  getRegister_f           getReg;
355  setRegister_f           setReg;
356
357  pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
358  getReg        = Console_Port_Tbl[minor].getRegister;
359  setReg        = Console_Port_Tbl[minor].setRegister;
360
361  /*
362   * wait for transmitter holding register to be empty
363   */
364  iTimeout = 1000;
365  ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS);
366  while ((ucLineStatus & (MC68681_TX_READY|MC68681_TX_EMPTY)) == 0) {
367
368    if ((ucLineStatus & 0xF0))
369      (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_ERROR );
370
371    /*
372     * Yield while we wait
373     */
374
375     if(_System_state_Is_up(_System_state_Get())) {
376       rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
377     }
378     ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS);
379     if(!--iTimeout) {
380       break;
381     }
382  }
383
384  /*
385   * transmit character
386   */
387
388  (*setReg)(pMC68681_port, MC68681_TX_BUFFER, cChar);
389}
390
391/*
392 *  mc68681_isr
393 *
394 *  This is the single interrupt entry point which parcels interrupts
395 *  out to the various ports.
396 */
397
398MC68681_STATIC rtems_isr mc68681_isr(
399  rtems_vector_number vector
400)
401{
402  int     minor;
403
404  for(minor=0 ; minor<Console_Port_Count ; minor++) {
405    if(Console_Port_Tbl[minor].ulIntVector == vector &&
406       Console_Port_Tbl[minor].deviceType == SERIAL_MC68681 ) {
407      mc68681_process(minor);
408    }
409  }
410}
411
412/*
413 *  mc68681_flush
414 *
415 *  This routine waits before all output is completed before closing
416 *  the requested port.
417 *
418 *  NOTE:  This is the "interrupt mode" close entry point.
419 */
420
421/* XXX remove me */
422MC68681_STATIC int mc68681_flush(int major, int minor, void *arg)
423{
424#if 0
425  while(!Ring_buffer_Is_empty(&Console_Port_Data[minor].TxBuffer)) {
426    /*
427     * Yield while we wait
428     */
429    if(_System_state_Is_up(_System_state_Get())) {
430      rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
431    }
432  }
433
434  mc68681_close(major, minor, arg);
435
436#endif
437  return(RTEMS_SUCCESSFUL);
438}
439
440/*
441 *  mc68681_initialize_interrupts
442 *
443 *  This routine initializes the console's receive and transmit
444 *  ring buffers and loads the appropriate vectors to handle the interrupts.
445 */
446
447MC68681_STATIC void mc68681_initialize_interrupts(int minor)
448{
449  mc68681_init(minor);
450
451  Console_Port_Data[minor].bActive = FALSE;
452
453  set_vector(mc68681_isr, Console_Port_Tbl[minor].ulIntVector, 1);
454
455  mc68681_enable_interrupts(minor,MC68681_IMR_ENABLE_ALL_EXCEPT_TX);
456}
457
458/*
459 *  mc68681_write_support_int
460 *
461 *  Console Termios output entry point when using interrupt driven output.
462 */
463
464MC68681_STATIC int mc68681_write_support_int(
465  int         minor,
466  const char *buf,
467  int         len
468)
469{
470  unsigned32      Irql;
471  unsigned32      pMC68681_port;
472  setRegister_f   setReg;
473
474  pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
475  setReg        = Console_Port_Tbl[minor].setRegister;
476
477  /*
478   *  We are using interrupt driven output and termios only sends us one character
479   *  at a time.
480   */
481
482  if ( !len )
483    return 0;
484
485  /*
486   * Wake up the device
487   */
488  rtems_interrupt_disable(Irql);
489    Console_Port_Data[minor].bActive = TRUE;
490    (*setReg)(pMC68681_port, MC68681_TX_BUFFER, *buf);
491    mc68681_enable_interrupts(minor, MC68681_IMR_ENABLE_ALL);
492  rtems_interrupt_enable(Irql);
493  return 1;
494}
495
496/*
497 *  mc68681_write_support_polled
498 *
499 *  Console Termios output entry point when using polled output.
500 *
501 */
502
503MC68681_STATIC int mc68681_write_support_polled(
504  int         minor,
505  const char *buf,
506  int         len
507)
508{
509  int nwrite = 0;
510
511  /*
512   * poll each byte in the string out of the port.
513   */
514  while (nwrite < len) {
515    /*
516     * transmit character
517     */
518    mc68681_write_polled(minor, *buf++);
519    nwrite++;
520  }
521
522  /*
523   * return the number of bytes written.
524   */
525  return nwrite;
526}
527
528/*
529 *  mc68681_inbyte_nonblocking_polled
530 *
531 *  Console Termios polling input entry point.
532 */
533
534MC68681_STATIC int mc68681_inbyte_nonblocking_polled(
535  int minor
536)
537{
538  unsigned32           pMC68681_port;
539  unsigned char        ucLineStatus;
540  unsigned char        cChar;
541  getRegister_f        getReg;
542
543  pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
544  getReg        = Console_Port_Tbl[minor].getRegister;
545
546  ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS);
547  if(ucLineStatus & MC68681_RX_READY) {
548    cChar = (*getReg)(pMC68681_port, MC68681_RX_BUFFER);
549    return (int)cChar;
550  } else {
551    return -1;
552  }
553}
554
555MC68681_STATIC int mc68681_baud_rate(
556  int           minor,
557  int           baud,
558  unsigned int *baud_mask_p,
559  unsigned int *acr_bit_p,
560  unsigned int *command
561)
562{
563  unsigned int           baud_mask;
564  unsigned int           acr_bit;
565  int                    status;
566  int                    is_extended;
567  int                    baud_requested;
568  mc68681_baud_table_t  *baud_tbl;
569
570  baud_mask = 0;
571  acr_bit = 0;
572  status = 0;
573
574  if ( !(Console_Port_Tbl[minor].ulDataPort & MC68681_DATA_BAUD_RATE_SET_1) )
575    acr_bit = 1;
576
577  is_extended = 0;
578
579  switch (Console_Port_Tbl[minor].ulDataPort & MC68681_XBRG_MASK) {
580    case MC68681_XBRG_IGNORED:
581      *command = 0x00;
582      break;
583    case MC68681_XBRG_ENABLED:
584      *command = 0x80;
585      is_extended = 1;
586      break;
587    case MC68681_XBRG_DISABLED:
588      *command = 0x90;
589      break;
590  }
591
592  baud_requested = baud & CBAUD;
593  if (!baud_requested)
594    baud_requested = B9600;              /* default to 9600 baud */
595 
596  baud_requested = termios_baud_to_index( baud_requested );
597
598  baud_tbl = (mc68681_baud_table_t *) Console_Port_Tbl[minor].ulClock;
599  if (!baud_tbl)
600    rtems_fatal_error_occured(RTEMS_INVALID_ADDRESS);
601
602  if ( is_extended )
603    baud_mask = (unsigned int)baud_tbl[ acr_bit + 2 ][ baud_requested ];
604  else
605    baud_mask = baud_tbl[ acr_bit ][ baud_requested ];
606
607  if ( baud_mask == MC68681_BAUD_NOT_VALID )
608    status = -1;
609
610  /*
611   *  upper nibble is receiver and lower nibble is transmitter
612   */
613
614  *baud_mask_p = (baud_mask << 4) | baud_mask;
615  *acr_bit_p   = acr_bit;
616  return status;
617}
618
619/*
620 *  mc68681_process
621 *
622 *  This routine is the per port console interrupt handler.
623 */
624
625MC68681_STATIC void mc68681_process(
626  int  minor
627)
628{
629  unsigned32              pMC68681;
630  unsigned32              pMC68681_port;
631  volatile unsigned8      ucLineStatus;
632  char                    cChar;
633  getRegister_f           getReg;
634  setRegister_f           setReg;
635
636  pMC68681      = Console_Port_Tbl[minor].ulCtrlPort1;
637  pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
638  getReg        = Console_Port_Tbl[minor].getRegister;
639  setReg        = Console_Port_Tbl[minor].setRegister;
640
641  /*
642   * Deal with any received characters
643   */
644  while(TRUE) {
645    ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS);
646    if(!(ucLineStatus & MC68681_RX_READY)) {
647      break;
648    }
649    /*
650     *  If there is a RX error, then dump all the data.
651     */
652    if ( ucLineStatus & MC68681_RX_ERRORS ) {
653      do {
654        cChar = (*getReg)(pMC68681_port, MC68681_RX_BUFFER);
655        ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS);
656      } while ( ucLineStatus & MC68681_RX_READY );
657      continue;
658    }
659    cChar = (*getReg)(pMC68681_port, MC68681_RX_BUFFER);
660    rtems_termios_enqueue_raw_characters(
661      Console_Port_Data[minor].termios_data,
662      &cChar,
663      1
664    );
665  }
666
667  /*
668   *  Deal with the transmitter
669   */
670
671  ucLineStatus = (*getReg)(pMC68681, MC68681_INTERRUPT_STATUS_REG);
672  if (pMC68681 != pMC68681_port)
673    ucLineStatus >>= 4;
674
675  if(ucLineStatus & MC68681_IR_TX_READY) {
676    mc68681_enable_interrupts(minor, MC68681_IMR_ENABLE_ALL_EXCEPT_TX);
677    rtems_termios_dequeue_characters(Console_Port_Data[minor].termios_data, 1);
678  }
679
680}
681
682/*
683 *  mc68681_build_imr
684 *
685 *  This function returns the value for the interrupt mask register for this
686 *  DUART.  Since this is a shared register, we must look at the other port
687 *  on this chip to determine whether or not it is using interrupts.
688 */
689
690MC68681_STATIC unsigned int mc68681_build_imr(
691  int  minor,
692  int  enable_flag
693)
694{
695  int              mate;
696  int              is_a;
697  unsigned int     mask;
698  unsigned int     mate_mask;
699  unsigned int     pMC68681;
700  unsigned int     pMC68681_port;
701  mc68681_context *pmc68681Context;
702  mc68681_context *mateContext;
703 
704  pMC68681        = Console_Port_Tbl[minor].ulCtrlPort1;
705  pMC68681_port   = Console_Port_Tbl[minor].ulCtrlPort2;
706  pmc68681Context = (mc68681_context *) Console_Port_Data[minor].pDeviceContext;
707  mate            = pmc68681Context->mate;
708
709  mask = 0;
710  mate_mask = 0;
711
712  is_a = (pMC68681 == pMC68681_port);
713 
714  /*
715   *  If there is a mate for this port, get its IMR mask.
716   */
717
718  if ( mate != -1 ) {
719    mateContext = Console_Port_Data[mate].pDeviceContext;
720   
721    if (mateContext)
722      mate_mask = mateContext->imr;
723  }
724
725  /*
726   *  Calculate this port's IMR mask and save it in the context area.
727   */
728
729  if ( Console_Port_Tbl[minor].pDeviceFns->deviceOutputUsesInterrupts )
730    mask = enable_flag;
731
732  pmc68681Context->imr = mask;
733
734  /*
735   *  Now return the full IMR value
736   */
737
738  if (is_a)
739    return (mate_mask << 4) | mask;
740
741  return (mask << 4) | mate_mask;
742}
743
744/*
745 *  mc68681_enable_interrupts
746 *
747 *  This function initializes the hardware for this port to use interrupts.
748 */
749
750MC68681_STATIC void mc68681_enable_interrupts(
751  int minor,
752  int imr_mask
753)
754{
755  unsigned32            pMC68681;
756  setRegister_f         setReg;
757
758  pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1;
759  setReg   = Console_Port_Tbl[minor].setRegister;
760
761  /*
762   *  Enable interrupts on RX and TX -- not break
763   */
764
765  (*setReg)(
766     pMC68681,
767     MC68681_INTERRUPT_MASK_REG,
768     mc68681_build_imr(minor, imr_mask)
769  );
770}
771
Note: See TracBrowser for help on using the repository browser.