Changeset 2c5ea01 in rtems


Ignore:
Timestamp:
Jul 9, 1998, 10:16:27 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
e78c474
Parents:
e3c59dd
Message:

Properly handle extended baud rate set commands.

Temporarily "if 0" of code which enables interrupts.

Moved setting of command registers at open but the current implementation
is questionable.

Added reset of RX errors while polling TX.

Read polled character as unsigned.

Baud rate mask must be in upper and lower nibble.

Location:
c/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libchip/serial/mc68681.c

    re3c59dd r2c5ea01  
    274274    (*setReg)( pMC68681, MC68681_AUX_CTRL_REG, acr_bit );
    275275    (*setReg)( pMC68681_port, MC68681_CLOCK_SELECT, baud_mask );
    276     (*setReg)( pMC68681_port, MC68681_COMMAND, cmd );
     276    if ( cmd ) {
     277      (*setReg)( pMC68681_port, MC68681_COMMAND, cmd );         /* RX */
     278      (*setReg)( pMC68681_port, MC68681_COMMAND, cmd | 0x20 );  /* TX */
     279    }
    277280    (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_MR_PTR );
    278281    (*setReg)( pMC68681_port, MC68681_MODE, mode1 );
     
    366369  }
    367370
     371#if 0
    368372  return mask | mate_mask;
     373#endif
     374
     375  return 0;
    369376}
    370377
     
    452459
    453460  rtems_interrupt_disable(Irql);
     461    (*setReg)( pMC68681, MC68681_COMMAND, command );
    454462    (*setReg)( pMC68681, MC68681_AUX_CTRL_REG, acr );
    455463    (*setReg)( pMC68681_port, MC68681_CLOCK_SELECT, baud );
    456464    (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_MR_PTR );
    457     (*setReg)( pMC68681, MC68681_COMMAND, command );
    458465    (*setReg)( pMC68681_port, MC68681_MODE, 0x13 );
    459466    (*setReg)( pMC68681_port, MC68681_MODE, 0x07 );
     
    524531  iTimeout = 1000;
    525532  ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS);
    526   while ((ucLineStatus & MC68681_TX_READY) == 0) {
     533  while ((ucLineStatus & (MC68681_TX_READY|MC68681_TX_EMPTY)) == 0) {
     534
     535    if ((ucLineStatus & 0xF0))
     536      (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_ERROR );
    527537
    528538    /*
     
    817827  unsigned32           pMC68681_port;
    818828  unsigned char        ucLineStatus;
    819   char                 cChar;
     829  unsigned char        cChar;
    820830  getRegister_f        getReg;
    821831
     
    843853  unsigned int     acr_bit;
    844854  int              status;
    845   int              is_a;
    846855  int              is_extended;
    847856  int              baud_requested;
     
    852861  status = 0;
    853862
    854   if (Console_Port_Tbl[minor].ulCtrlPort1 ==
    855       Console_Port_Tbl[minor].ulCtrlPort2)
    856     is_a = 1;
    857   else
    858     is_a = 0;
    859    
    860863  if ( !(Console_Port_Tbl[minor].ulDataPort & MC68681_DATA_BAUD_RATE_SET_1) )
    861864    acr_bit = 1;
     
    868871      break;
    869872    case MC68681_XBRG_ENABLED:
    870       *command = (is_a) ? 0x08 : 0x09;
     873      *command = 0x80;
    871874      is_extended = 1;
    872875      break;
    873876    case MC68681_XBRG_DISABLED:
    874       *command = (is_a) ? 0x0A : 0x0B;
     877      *command = 0x90;
    875878      break;
    876879  }
     
    878881  baud_requested = baud & CBAUD;
    879882  if (!baud_requested)
    880     baud_requested = B9600;
     883    baud_requested = B9600;              /* default to 9600 baud */
    881884 
    882885  baud_requested = termios_baud_to_index( baud_requested );
     
    894897    status = -1;
    895898
    896   *baud_mask_p = baud_mask;     /* default to 9600 baud */
     899  /*
     900   *  upper nibble is receiver and lower nibble is transmitter
     901   */
     902
     903  *baud_mask_p = (baud_mask << 4) | baud_mask;
    897904  *acr_bit_p   = acr_bit;
    898905  return status;
  • c/src/libchip/serial/mc68681.c

    re3c59dd r2c5ea01  
    274274    (*setReg)( pMC68681, MC68681_AUX_CTRL_REG, acr_bit );
    275275    (*setReg)( pMC68681_port, MC68681_CLOCK_SELECT, baud_mask );
    276     (*setReg)( pMC68681_port, MC68681_COMMAND, cmd );
     276    if ( cmd ) {
     277      (*setReg)( pMC68681_port, MC68681_COMMAND, cmd );         /* RX */
     278      (*setReg)( pMC68681_port, MC68681_COMMAND, cmd | 0x20 );  /* TX */
     279    }
    277280    (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_MR_PTR );
    278281    (*setReg)( pMC68681_port, MC68681_MODE, mode1 );
     
    366369  }
    367370
     371#if 0
    368372  return mask | mate_mask;
     373#endif
     374
     375  return 0;
    369376}
    370377
     
    452459
    453460  rtems_interrupt_disable(Irql);
     461    (*setReg)( pMC68681, MC68681_COMMAND, command );
    454462    (*setReg)( pMC68681, MC68681_AUX_CTRL_REG, acr );
    455463    (*setReg)( pMC68681_port, MC68681_CLOCK_SELECT, baud );
    456464    (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_MR_PTR );
    457     (*setReg)( pMC68681, MC68681_COMMAND, command );
    458465    (*setReg)( pMC68681_port, MC68681_MODE, 0x13 );
    459466    (*setReg)( pMC68681_port, MC68681_MODE, 0x07 );
     
    524531  iTimeout = 1000;
    525532  ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS);
    526   while ((ucLineStatus & MC68681_TX_READY) == 0) {
     533  while ((ucLineStatus & (MC68681_TX_READY|MC68681_TX_EMPTY)) == 0) {
     534
     535    if ((ucLineStatus & 0xF0))
     536      (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_ERROR );
    527537
    528538    /*
     
    817827  unsigned32           pMC68681_port;
    818828  unsigned char        ucLineStatus;
    819   char                 cChar;
     829  unsigned char        cChar;
    820830  getRegister_f        getReg;
    821831
     
    843853  unsigned int     acr_bit;
    844854  int              status;
    845   int              is_a;
    846855  int              is_extended;
    847856  int              baud_requested;
     
    852861  status = 0;
    853862
    854   if (Console_Port_Tbl[minor].ulCtrlPort1 ==
    855       Console_Port_Tbl[minor].ulCtrlPort2)
    856     is_a = 1;
    857   else
    858     is_a = 0;
    859    
    860863  if ( !(Console_Port_Tbl[minor].ulDataPort & MC68681_DATA_BAUD_RATE_SET_1) )
    861864    acr_bit = 1;
     
    868871      break;
    869872    case MC68681_XBRG_ENABLED:
    870       *command = (is_a) ? 0x08 : 0x09;
     873      *command = 0x80;
    871874      is_extended = 1;
    872875      break;
    873876    case MC68681_XBRG_DISABLED:
    874       *command = (is_a) ? 0x0A : 0x0B;
     877      *command = 0x90;
    875878      break;
    876879  }
     
    878881  baud_requested = baud & CBAUD;
    879882  if (!baud_requested)
    880     baud_requested = B9600;
     883    baud_requested = B9600;              /* default to 9600 baud */
    881884 
    882885  baud_requested = termios_baud_to_index( baud_requested );
     
    894897    status = -1;
    895898
    896   *baud_mask_p = baud_mask;     /* default to 9600 baud */
     899  /*
     900   *  upper nibble is receiver and lower nibble is transmitter
     901   */
     902
     903  *baud_mask_p = (baud_mask << 4) | baud_mask;
    897904  *acr_bit_p   = acr_bit;
    898905  return status;
Note: See TracChangeset for help on using the changeset viewer.