source: rtems/c/src/lib/libchip/serial/mc68681.c @ c68b990

4.104.114.84.95
Last change on this file since c68b990 was c68b990, checked in by Joel Sherrill <joel.sherrill@…>, on 07/25/98 at 14:51:57

Changed to utilize return status from rtems_termios_dequeue_characters()
and to correctly set the TX active indicator.

  • Property mode set to 100644
File size: 18.9 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 <libchip/mc68681.h>
27#include "sersupp.h"
28#include "mc68681_p.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    if ( Console_Port_Data[minor].bActive == FALSE ) {
490      Console_Port_Data[minor].bActive = TRUE;
491      mc68681_enable_interrupts(minor, MC68681_IMR_ENABLE_ALL);
492    }
493    (*setReg)(pMC68681_port, MC68681_TX_BUFFER, *buf);
494  rtems_interrupt_enable(Irql);
495  return 1;
496}
497
498/*
499 *  mc68681_write_support_polled
500 *
501 *  Console Termios output entry point when using polled output.
502 *
503 */
504
505MC68681_STATIC int mc68681_write_support_polled(
506  int         minor,
507  const char *buf,
508  int         len
509)
510{
511  int nwrite = 0;
512
513  /*
514   * poll each byte in the string out of the port.
515   */
516  while (nwrite < len) {
517    /*
518     * transmit character
519     */
520    mc68681_write_polled(minor, *buf++);
521    nwrite++;
522  }
523
524  /*
525   * return the number of bytes written.
526   */
527  return nwrite;
528}
529
530/*
531 *  mc68681_inbyte_nonblocking_polled
532 *
533 *  Console Termios polling input entry point.
534 */
535
536MC68681_STATIC int mc68681_inbyte_nonblocking_polled(
537  int minor
538)
539{
540  unsigned32           pMC68681_port;
541  unsigned char        ucLineStatus;
542  unsigned char        cChar;
543  getRegister_f        getReg;
544
545  pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
546  getReg        = Console_Port_Tbl[minor].getRegister;
547
548  ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS);
549  if(ucLineStatus & MC68681_RX_READY) {
550    cChar = (*getReg)(pMC68681_port, MC68681_RX_BUFFER);
551    return (int)cChar;
552  } else {
553    return -1;
554  }
555}
556
557MC68681_STATIC int mc68681_baud_rate(
558  int           minor,
559  int           baud,
560  unsigned int *baud_mask_p,
561  unsigned int *acr_bit_p,
562  unsigned int *command
563)
564{
565  unsigned int           baud_mask;
566  unsigned int           acr_bit;
567  int                    status;
568  int                    is_extended;
569  int                    baud_requested;
570  mc68681_baud_table_t  *baud_tbl;
571
572  baud_mask = 0;
573  acr_bit = 0;
574  status = 0;
575
576  if ( !(Console_Port_Tbl[minor].ulDataPort & MC68681_DATA_BAUD_RATE_SET_1) )
577    acr_bit = 1;
578
579  is_extended = 0;
580
581  switch (Console_Port_Tbl[minor].ulDataPort & MC68681_XBRG_MASK) {
582    case MC68681_XBRG_IGNORED:
583      *command = 0x00;
584      break;
585    case MC68681_XBRG_ENABLED:
586      *command = 0x80;
587      is_extended = 1;
588      break;
589    case MC68681_XBRG_DISABLED:
590      *command = 0x90;
591      break;
592  }
593
594  baud_requested = baud & CBAUD;
595  if (!baud_requested)
596    baud_requested = B9600;              /* default to 9600 baud */
597 
598  baud_requested = termios_baud_to_index( baud_requested );
599
600  baud_tbl = (mc68681_baud_table_t *) Console_Port_Tbl[minor].ulClock;
601  if (!baud_tbl)
602    rtems_fatal_error_occurred(RTEMS_INVALID_ADDRESS);
603
604  if ( is_extended )
605    baud_mask = (unsigned int)baud_tbl[ acr_bit + 2 ][ baud_requested ];
606  else
607    baud_mask = baud_tbl[ acr_bit ][ baud_requested ];
608
609  if ( baud_mask == MC68681_BAUD_NOT_VALID )
610    status = -1;
611
612  /*
613   *  upper nibble is receiver and lower nibble is transmitter
614   */
615
616  *baud_mask_p = (baud_mask << 4) | baud_mask;
617  *acr_bit_p   = acr_bit;
618  return status;
619}
620
621/*
622 *  mc68681_process
623 *
624 *  This routine is the per port console interrupt handler.
625 */
626
627MC68681_STATIC void mc68681_process(
628  int  minor
629)
630{
631  unsigned32              pMC68681;
632  unsigned32              pMC68681_port;
633  volatile unsigned8      ucLineStatus;
634  char                    cChar;
635  getRegister_f           getReg;
636  setRegister_f           setReg;
637
638  pMC68681      = Console_Port_Tbl[minor].ulCtrlPort1;
639  pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
640  getReg        = Console_Port_Tbl[minor].getRegister;
641  setReg        = Console_Port_Tbl[minor].setRegister;
642
643  /*
644   * Deal with any received characters
645   */
646  while(TRUE) {
647    ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS);
648    if(!(ucLineStatus & MC68681_RX_READY)) {
649      break;
650    }
651    /*
652     *  If there is a RX error, then dump all the data.
653     */
654    if ( ucLineStatus & MC68681_RX_ERRORS ) {
655      do {
656        cChar = (*getReg)(pMC68681_port, MC68681_RX_BUFFER);
657        ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS);
658      } while ( ucLineStatus & MC68681_RX_READY );
659      continue;
660    }
661    cChar = (*getReg)(pMC68681_port, MC68681_RX_BUFFER);
662    rtems_termios_enqueue_raw_characters(
663      Console_Port_Data[minor].termios_data,
664      &cChar,
665      1
666    );
667  }
668
669  /*
670   *  Deal with the transmitter
671   */
672
673  ucLineStatus = (*getReg)(pMC68681, MC68681_INTERRUPT_STATUS_REG);
674  if (pMC68681 != pMC68681_port)
675    ucLineStatus >>= 4;
676
677  if(ucLineStatus & MC68681_IR_TX_READY) {
678    if (!rtems_termios_dequeue_characters(
679                Console_Port_Data[minor].termios_data, 1)) {
680      Console_Port_Data[minor].bActive = FALSE;
681      mc68681_enable_interrupts(minor, MC68681_IMR_ENABLE_ALL_EXCEPT_TX);
682    }
683  }
684
685}
686
687/*
688 *  mc68681_build_imr
689 *
690 *  This function returns the value for the interrupt mask register for this
691 *  DUART.  Since this is a shared register, we must look at the other port
692 *  on this chip to determine whether or not it is using interrupts.
693 */
694
695MC68681_STATIC unsigned int mc68681_build_imr(
696  int  minor,
697  int  enable_flag
698)
699{
700  int              mate;
701  int              is_a;
702  unsigned int     mask;
703  unsigned int     mate_mask;
704  unsigned int     pMC68681;
705  unsigned int     pMC68681_port;
706  mc68681_context *pmc68681Context;
707  mc68681_context *mateContext;
708 
709  pMC68681        = Console_Port_Tbl[minor].ulCtrlPort1;
710  pMC68681_port   = Console_Port_Tbl[minor].ulCtrlPort2;
711  pmc68681Context = (mc68681_context *) Console_Port_Data[minor].pDeviceContext;
712  mate            = pmc68681Context->mate;
713
714  mask = 0;
715  mate_mask = 0;
716
717  is_a = (pMC68681 == pMC68681_port);
718 
719  /*
720   *  If there is a mate for this port, get its IMR mask.
721   */
722
723  if ( mate != -1 ) {
724    mateContext = Console_Port_Data[mate].pDeviceContext;
725   
726    if (mateContext)
727      mate_mask = mateContext->imr;
728  }
729
730  /*
731   *  Calculate this port's IMR mask and save it in the context area.
732   */
733
734  if ( Console_Port_Tbl[minor].pDeviceFns->deviceOutputUsesInterrupts )
735    mask = enable_flag;
736
737  pmc68681Context->imr = mask;
738
739  /*
740   *  Now return the full IMR value
741   */
742
743  if (is_a)
744    return (mate_mask << 4) | mask;
745
746  return (mask << 4) | mate_mask;
747}
748
749/*
750 *  mc68681_enable_interrupts
751 *
752 *  This function initializes the hardware for this port to use interrupts.
753 */
754
755MC68681_STATIC void mc68681_enable_interrupts(
756  int minor,
757  int imr_mask
758)
759{
760  unsigned32            pMC68681;
761  setRegister_f         setReg;
762
763  pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1;
764  setReg   = Console_Port_Tbl[minor].setRegister;
765
766  /*
767   *  Enable interrupts on RX and TX -- not break
768   */
769
770  (*setReg)(
771     pMC68681,
772     MC68681_INTERRUPT_MASK_REG,
773     mc68681_build_imr(minor, imr_mask)
774  );
775}
776
Note: See TracBrowser for help on using the repository browser.