Changeset fb32356b in rtems


Ignore:
Timestamp:
Jul 9, 1998, 11:32:07 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
8555ddb
Parents:
abd8c82
Message:

Added set attributes routine but did not hook it in to the table.

Switched to shared default probe.

Location:
c/src
Files:
4 edited

Legend:

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

    rabd8c82 rfb32356b  
    3838#include <libchip/serial.h>
    3939#include "z85c30_p.h"
     40#include "sersupp.h"
    4041
    4142/*
     
    6162console_fns z85c30_fns =
    6263{
    63   z85c30_probe,                  /* deviceProbe */
     64  libchip_serial_default_probe,  /* deviceProbe */
    6465  z85c30_open,                   /* deviceFirstOpen */
    6566  z85c30_flush,                  /* deviceLastClose */
     
    7475console_fns z85c30_fns_polled =
    7576{
    76   z85c30_probe,                      /* deviceProbe */
     77  libchip_serial_default_probe,      /* deviceProbe */
    7778  z85c30_open,                       /* deviceFirstOpen */
    7879  z85c30_close,                      /* deviceLastClose */
     
    290291 */
    291292
    292 Z85C30_STATIC boolean z85c30_probe(int minor)
    293 {
    294   /*
    295    * If the configuration dependent probe has located the device then
    296    * assume it is there
    297    */
    298 
    299   return(TRUE);
    300 }
    301 
    302293Z85C30_STATIC void z85c30_init(int minor)
    303294{
     
    466457  );
    467458  rtems_interrupt_enable(Irql);
     459  return 0;
     460}
     461
     462/*
     463 *  z85c30_set_attributes
     464 *
     465 *  This function sets the SCC channel to reflect the requested termios
     466 *  port settings.
     467 */
     468
     469Z85C30_STATIC int z85c30_set_attributes(
     470  int                   minor,
     471  const struct termios *t
     472)
     473{
     474  unsigned32             ulCtrlPort;
     475  unsigned32             ulBaudDivisor;
     476  unsigned32             wr3;
     477  unsigned32             wr4;
     478  unsigned32             wr5;
     479  int                    baud_requested;
     480  setRegister_f          setReg;
     481  rtems_interrupt_level  Irql;
     482
     483  ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
     484  setReg     = Console_Port_Tbl[minor].setRegister;
     485
     486  /*
     487   *  Calculate the baud rate divisor
     488   */
     489
     490  baud_requested = t->c_cflag & CBAUD;
     491  if (!baud_requested)
     492    baud_requested = B9600;              /* default to 9600 baud */
     493
     494  ulBaudDivisor = Z85C30_Baud(
     495    (unsigned32) Console_Port_Tbl[minor].ulClock,
     496    (unsigned32) termios_baud_to_number( baud_requested )
     497  );
     498
     499  wr3 = SCC_WR3_RX_EN;
     500  wr4 = SCC_WR4_16_CLOCK;
     501  wr5 = SCC_WR5_TX_EN;
     502
     503  /*
     504   *  Parity
     505   */
     506
     507  if (t->c_cflag & PARENB) {
     508    wr4 |= SCC_WR4_PAR_EN;
     509    if (!(t->c_cflag & PARODD))
     510      wr4 |= SCC_WR4_PAR_EVEN;
     511  }
     512
     513  /*
     514   *  Character Size
     515   */
     516
     517  if (t->c_cflag & CSIZE) {
     518    switch (t->c_cflag & CSIZE) {
     519      case CS5:   break;
     520      case CS6:  wr3 |= SCC_WR3_RX_6_BITS;  wr5 |= SCC_WR5_TX_6_BITS;  break;
     521      case CS7:  wr3 |= SCC_WR3_RX_7_BITS;  wr5 |= SCC_WR5_TX_7_BITS;  break;
     522      case CS8:  wr3 |= SCC_WR3_RX_8_BITS;  wr5 |= SCC_WR5_TX_8_BITS;  break;
     523    }
     524  } else {
     525    wr3 |= SCC_WR3_RX_8_BITS;       /* default to 9600,8,N,1 */
     526    wr5 |= SCC_WR5_TX_8_BITS;       /* default to 9600,8,N,1 */
     527  }
     528
     529  /*
     530   *  Stop Bits
     531   */
     532
     533  if (t->c_cflag & CSTOPB) {
     534    wr4 |= SCC_WR4_2_STOP;                      /* 2 stop bits */
     535  } else {
     536    wr4 |= SCC_WR4_1_STOP;                      /* 1 stop bits */
     537  }
     538
     539  rtems_interrupt_disable(Irql);
     540    (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR4, wr4 );
     541    (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR3, wr3 );
     542    (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR5, wr5 );
     543
     544    /*
     545     * Setup the lower 8 bits time constants=1E.
     546     * If the time constans=1E, then the desire
     547     * baud rate will be equilvalent to 9600, via register 12.
     548     */
     549
     550    (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR12, ulBaudDivisor & 0xff );
     551
     552    /*
     553     * using register 13
     554     * Setup the upper 8 bits time constant
     555     */
     556
     557    (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR13, (ulBaudDivisor>>8) & 0xff );
     558
     559  rtems_interrupt_enable(Irql);
     560
    468561  return 0;
    469562}
  • c/src/lib/libchip/serial/z85c30_p.h

    rabd8c82 rfb32356b  
    332332 * Private routines
    333333 */
    334 Z85C30_STATIC boolean z85c30_probe(int minor);
    335334
    336335Z85C30_STATIC void z85c30_init(int minor);
     336
     337Z85C30_STATIC int z85c30_set_attributes(
     338  int                   minor,
     339  const struct termios *t
     340);
    337341
    338342Z85C30_STATIC int z85c30_open(
  • c/src/libchip/serial/z85c30.c

    rabd8c82 rfb32356b  
    3838#include <libchip/serial.h>
    3939#include "z85c30_p.h"
     40#include "sersupp.h"
    4041
    4142/*
     
    6162console_fns z85c30_fns =
    6263{
    63   z85c30_probe,                  /* deviceProbe */
     64  libchip_serial_default_probe,  /* deviceProbe */
    6465  z85c30_open,                   /* deviceFirstOpen */
    6566  z85c30_flush,                  /* deviceLastClose */
     
    7475console_fns z85c30_fns_polled =
    7576{
    76   z85c30_probe,                      /* deviceProbe */
     77  libchip_serial_default_probe,      /* deviceProbe */
    7778  z85c30_open,                       /* deviceFirstOpen */
    7879  z85c30_close,                      /* deviceLastClose */
     
    290291 */
    291292
    292 Z85C30_STATIC boolean z85c30_probe(int minor)
    293 {
    294   /*
    295    * If the configuration dependent probe has located the device then
    296    * assume it is there
    297    */
    298 
    299   return(TRUE);
    300 }
    301 
    302293Z85C30_STATIC void z85c30_init(int minor)
    303294{
     
    466457  );
    467458  rtems_interrupt_enable(Irql);
     459  return 0;
     460}
     461
     462/*
     463 *  z85c30_set_attributes
     464 *
     465 *  This function sets the SCC channel to reflect the requested termios
     466 *  port settings.
     467 */
     468
     469Z85C30_STATIC int z85c30_set_attributes(
     470  int                   minor,
     471  const struct termios *t
     472)
     473{
     474  unsigned32             ulCtrlPort;
     475  unsigned32             ulBaudDivisor;
     476  unsigned32             wr3;
     477  unsigned32             wr4;
     478  unsigned32             wr5;
     479  int                    baud_requested;
     480  setRegister_f          setReg;
     481  rtems_interrupt_level  Irql;
     482
     483  ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
     484  setReg     = Console_Port_Tbl[minor].setRegister;
     485
     486  /*
     487   *  Calculate the baud rate divisor
     488   */
     489
     490  baud_requested = t->c_cflag & CBAUD;
     491  if (!baud_requested)
     492    baud_requested = B9600;              /* default to 9600 baud */
     493
     494  ulBaudDivisor = Z85C30_Baud(
     495    (unsigned32) Console_Port_Tbl[minor].ulClock,
     496    (unsigned32) termios_baud_to_number( baud_requested )
     497  );
     498
     499  wr3 = SCC_WR3_RX_EN;
     500  wr4 = SCC_WR4_16_CLOCK;
     501  wr5 = SCC_WR5_TX_EN;
     502
     503  /*
     504   *  Parity
     505   */
     506
     507  if (t->c_cflag & PARENB) {
     508    wr4 |= SCC_WR4_PAR_EN;
     509    if (!(t->c_cflag & PARODD))
     510      wr4 |= SCC_WR4_PAR_EVEN;
     511  }
     512
     513  /*
     514   *  Character Size
     515   */
     516
     517  if (t->c_cflag & CSIZE) {
     518    switch (t->c_cflag & CSIZE) {
     519      case CS5:   break;
     520      case CS6:  wr3 |= SCC_WR3_RX_6_BITS;  wr5 |= SCC_WR5_TX_6_BITS;  break;
     521      case CS7:  wr3 |= SCC_WR3_RX_7_BITS;  wr5 |= SCC_WR5_TX_7_BITS;  break;
     522      case CS8:  wr3 |= SCC_WR3_RX_8_BITS;  wr5 |= SCC_WR5_TX_8_BITS;  break;
     523    }
     524  } else {
     525    wr3 |= SCC_WR3_RX_8_BITS;       /* default to 9600,8,N,1 */
     526    wr5 |= SCC_WR5_TX_8_BITS;       /* default to 9600,8,N,1 */
     527  }
     528
     529  /*
     530   *  Stop Bits
     531   */
     532
     533  if (t->c_cflag & CSTOPB) {
     534    wr4 |= SCC_WR4_2_STOP;                      /* 2 stop bits */
     535  } else {
     536    wr4 |= SCC_WR4_1_STOP;                      /* 1 stop bits */
     537  }
     538
     539  rtems_interrupt_disable(Irql);
     540    (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR4, wr4 );
     541    (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR3, wr3 );
     542    (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR5, wr5 );
     543
     544    /*
     545     * Setup the lower 8 bits time constants=1E.
     546     * If the time constans=1E, then the desire
     547     * baud rate will be equilvalent to 9600, via register 12.
     548     */
     549
     550    (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR12, ulBaudDivisor & 0xff );
     551
     552    /*
     553     * using register 13
     554     * Setup the upper 8 bits time constant
     555     */
     556
     557    (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR13, (ulBaudDivisor>>8) & 0xff );
     558
     559  rtems_interrupt_enable(Irql);
     560
    468561  return 0;
    469562}
  • c/src/libchip/serial/z85c30_p.h

    rabd8c82 rfb32356b  
    332332 * Private routines
    333333 */
    334 Z85C30_STATIC boolean z85c30_probe(int minor);
    335334
    336335Z85C30_STATIC void z85c30_init(int minor);
     336
     337Z85C30_STATIC int z85c30_set_attributes(
     338  int                   minor,
     339  const struct termios *t
     340);
    337341
    338342Z85C30_STATIC int z85c30_open(
Note: See TracChangeset for help on using the changeset viewer.