Changeset 229bcca8 in rtems


Ignore:
Timestamp:
Oct 18, 2011, 6:40:27 PM (8 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.11, master
Children:
9e162be9
Parents:
11f7aab
Message:

2011-10-18 Jennifer Averett <Jennifer.Averett@…>

PR 1917/bsps

  • libchip/serial/mc68681.c, libchip/serial/ns16550.c, libchip/serial/serial.h, libchip/serial/z85c30.c: Modifications to add dynamic tables for libchip serial drivers.
Location:
c/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • c/src/ChangeLog

    r11f7aab r229bcca8  
     12011-10-18      Jennifer Averett <Jennifer.Averett@OARcorp.com>
     2
     3        PR 1917/bsps
     4        * libchip/serial/mc68681.c, libchip/serial/ns16550.c,
     5        libchip/serial/serial.h, libchip/serial/z85c30.c: Modifications to
     6        add dynamic tables for libchip serial drivers.
     7
    182011-10-17      Ralf Corsépius <ralf.corsepius@rtems.org>
    29
  • c/src/libchip/serial/mc68681.c

    r11f7aab r229bcca8  
    100100  rtems_interrupt_level  Irql;
    101101
    102   pMC68681      = Console_Port_Tbl[minor].ulCtrlPort1;
    103   pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
    104   setReg        = Console_Port_Tbl[minor].setRegister;
     102  pMC68681      = Console_Port_Tbl[minor]->ulCtrlPort1;
     103  pMC68681_port = Console_Port_Tbl[minor]->ulCtrlPort2;
     104  setReg        = Console_Port_Tbl[minor]->setRegister;
    105105
    106106  /*
     
    196196  unsigned int pMC68681_port;
    197197
    198   pMC68681      = Console_Port_Tbl[minor].ulCtrlPort1;
    199   pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
     198  pMC68681      = Console_Port_Tbl[minor]->ulCtrlPort1;
     199  pMC68681_port = Console_Port_Tbl[minor]->ulCtrlPort2;
    200200
    201201  pmc68681Context->mate = -1;
    202202
    203203  for (port=0 ; port<Console_Port_Count ; port++ ) {
    204     if ( Console_Port_Tbl[port].ulCtrlPort1 == pMC68681 &&
    205          Console_Port_Tbl[port].ulCtrlPort2 != pMC68681_port ) {
     204    if ( Console_Port_Tbl[port]->ulCtrlPort1 == pMC68681 &&
     205         Console_Port_Tbl[port]->ulCtrlPort2 != pMC68681_port ) {
    206206      pmc68681Context->mate = port;
    207207      pmc68681Context->imr  = 0;
     
    231231  mc68681_initialize_context( minor, pmc68681Context );
    232232
    233   pMC68681      = Console_Port_Tbl[minor].ulCtrlPort1;
    234   pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
    235   setReg        = Console_Port_Tbl[minor].setRegister;
     233  pMC68681      = Console_Port_Tbl[minor]->ulCtrlPort1;
     234  pMC68681_port = Console_Port_Tbl[minor]->ulCtrlPort2;
     235  setReg        = Console_Port_Tbl[minor]->setRegister;
    236236
    237237  /*
     
    283283
    284284
    285   pMC68681      = Console_Port_Tbl[minor].ulCtrlPort1;
    286   pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
    287   setReg        = Console_Port_Tbl[minor].setRegister;
    288   vector        = Console_Port_Tbl[minor].ulIntVector;
     285  pMC68681      = Console_Port_Tbl[minor]->ulCtrlPort1;
     286  pMC68681_port = Console_Port_Tbl[minor]->ulCtrlPort2;
     287  setReg        = Console_Port_Tbl[minor]->setRegister;
     288  vector        = Console_Port_Tbl[minor]->ulIntVector;
    289289
    290290  /* XXX default baud rate should be from configuration table */
     
    333333  setRegister_f   setReg;
    334334
    335   pMC68681      = Console_Port_Tbl[minor].ulCtrlPort1;
    336   pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
    337   setReg        = Console_Port_Tbl[minor].setRegister;
     335  pMC68681      = Console_Port_Tbl[minor]->ulCtrlPort1;
     336  pMC68681_port = Console_Port_Tbl[minor]->ulCtrlPort2;
     337  setReg        = Console_Port_Tbl[minor]->setRegister;
    338338
    339339  /*
     
    366366  setRegister_f           setReg;
    367367
    368   pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
    369   getReg        = Console_Port_Tbl[minor].getRegister;
    370   setReg        = Console_Port_Tbl[minor].setRegister;
     368  pMC68681_port = Console_Port_Tbl[minor]->ulCtrlPort2;
     369  getReg        = Console_Port_Tbl[minor]->getRegister;
     370  setReg        = Console_Port_Tbl[minor]->setRegister;
    371371
    372372  /*
     
    416416
    417417  for(minor=0 ; minor<Console_Port_Count ; minor++) {
    418     if(Console_Port_Tbl[minor].ulIntVector == vector &&
    419        Console_Port_Tbl[minor].deviceType == SERIAL_MC68681 ) {
     418    if(Console_Port_Tbl[minor]->ulIntVector == vector &&
     419       Console_Port_Tbl[minor]->deviceType == SERIAL_MC68681 ) {
    420420      mc68681_process(minor);
    421421    }
     
    436436  Console_Port_Data[minor].bActive = FALSE;
    437437
    438   set_vector(mc68681_isr, Console_Port_Tbl[minor].ulIntVector, 1);
     438  set_vector(mc68681_isr, Console_Port_Tbl[minor]->ulIntVector, 1);
    439439
    440440  mc68681_enable_interrupts(minor,MC68681_IMR_ENABLE_ALL_EXCEPT_TX);
     
    457457  setRegister_f   setReg;
    458458
    459   pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
    460   setReg        = Console_Port_Tbl[minor].setRegister;
     459  pMC68681_port = Console_Port_Tbl[minor]->ulCtrlPort2;
     460  setReg        = Console_Port_Tbl[minor]->setRegister;
    461461
    462462  /*
     
    530530  getRegister_f        getReg;
    531531
    532   pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
    533   getReg        = Console_Port_Tbl[minor].getRegister;
     532  pMC68681_port = Console_Port_Tbl[minor]->ulCtrlPort2;
     533  getReg        = Console_Port_Tbl[minor]->getRegister;
    534534
    535535  ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS);
     
    565565  status = 0;
    566566
    567   if (Console_Port_Tbl[minor].ulDataPort & MC68681_DATA_BAUD_RATE_SET_2)
     567  if (Console_Port_Tbl[minor]->ulDataPort & MC68681_DATA_BAUD_RATE_SET_2)
    568568  {
    569569    acr_bit = 1;
     
    572572  is_extended = 0;
    573573
    574   switch (Console_Port_Tbl[minor].ulDataPort & MC68681_XBRG_MASK) {
     574  switch (Console_Port_Tbl[minor]->ulDataPort & MC68681_XBRG_MASK) {
    575575    case MC68681_XBRG_IGNORED:
    576576      *command = 0x00;
     
    592592
    593593  baud_tbl = (mc68681_baud_table_t *)
    594      ((uintptr_t)Console_Port_Tbl[minor].ulClock);
     594     ((uintptr_t)Console_Port_Tbl[minor]->ulClock);
    595595  if (!baud_tbl)
    596596    rtems_fatal_error_occurred(RTEMS_INVALID_ADDRESS);
     
    631631  setRegister_f           setReg;
    632632
    633   pMC68681      = Console_Port_Tbl[minor].ulCtrlPort1;
    634   pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2;
    635   getReg        = Console_Port_Tbl[minor].getRegister;
    636   setReg        = Console_Port_Tbl[minor].setRegister;
     633  pMC68681      = Console_Port_Tbl[minor]->ulCtrlPort1;
     634  pMC68681_port = Console_Port_Tbl[minor]->ulCtrlPort2;
     635  getReg        = Console_Port_Tbl[minor]->getRegister;
     636  setReg        = Console_Port_Tbl[minor]->setRegister;
    637637
    638638  /* Get ISR at the beginning of the IT routine */
     
    711711  mc68681_context *mateContext;
    712712
    713   pMC68681        = Console_Port_Tbl[minor].ulCtrlPort1;
    714   pMC68681_port   = Console_Port_Tbl[minor].ulCtrlPort2;
     713  pMC68681        = Console_Port_Tbl[minor]->ulCtrlPort1;
     714  pMC68681_port   = Console_Port_Tbl[minor]->ulCtrlPort2;
    715715  pmc68681Context = (mc68681_context *) Console_Port_Data[minor].pDeviceContext;
    716716  mate            = pmc68681Context->mate;
     
    736736   */
    737737
    738   if ( Console_Port_Tbl[minor].pDeviceFns->deviceOutputUsesInterrupts )
     738  if ( Console_Port_Tbl[minor]->pDeviceFns->deviceOutputUsesInterrupts )
    739739    mask = enable_flag;
    740740
     
    765765  setRegister_f         setReg;
    766766
    767   pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1;
    768   setReg   = Console_Port_Tbl[minor].setRegister;
     767  pMC68681 = Console_Port_Tbl[minor]->ulCtrlPort1;
     768  setReg   = Console_Port_Tbl[minor]->setRegister;
    769769
    770770  /*
  • c/src/libchip/serial/ns16550.c

    r11f7aab r229bcca8  
    114114  pns16550Context->ucModemCtrl=SP_MODEM_IRQ;
    115115
    116   pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1;
    117   setReg   = Console_Port_Tbl[minor].setRegister;
    118   getReg   = Console_Port_Tbl[minor].getRegister;
     116  pNS16550 = Console_Port_Tbl[minor]->ulCtrlPort1;
     117  setReg   = Console_Port_Tbl[minor]->setRegister;
     118  getReg   = Console_Port_Tbl[minor]->getRegister;
    119119
    120120  /* Clear the divisor latch, clear all interrupt enables,
     
    129129
    130130  ulBaudDivisor = NS16550_Baud(
    131     (uint32_t) Console_Port_Tbl[minor].ulClock,
    132     (uint32_t) ((uintptr_t)Console_Port_Tbl[minor].pDeviceParams)
     131    (uint32_t) Console_Port_Tbl[minor]->ulClock,
     132    (uint32_t) ((uintptr_t)Console_Port_Tbl[minor]->pDeviceParams)
    133133  );
    134134  ucDataByte = SP_LINE_DLAB;
     
    173173  rtems_libio_open_close_args_t *oc = (rtems_libio_open_close_args_t *) arg;
    174174  struct rtems_termios_tty *tty = (struct rtems_termios_tty *) oc->iop->data1;
    175   console_tbl *c = &Console_Port_Tbl [minor];
     175  console_tbl *c = Console_Port_Tbl [minor];
    176176  console_data *d = &Console_Port_Data [minor];
    177177
     
    227227NS16550_STATIC void ns16550_write_polled(int minor, char out)
    228228{
    229   console_tbl *c = &Console_Port_Tbl [minor];
     229  console_tbl *c = Console_Port_Tbl [minor];
    230230  uintptr_t port = c->ulCtrlPort1;
    231231  getRegister_f get = c->getRegister;
     
    284284  pns16550Context=(ns16550_context *) Console_Port_Data[minor].pDeviceContext;
    285285
    286   pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1;
    287   setReg   = Console_Port_Tbl[minor].setRegister;
     286  pNS16550 = Console_Port_Tbl[minor]->ulCtrlPort1;
     287  setReg   = Console_Port_Tbl[minor]->setRegister;
    288288
    289289  /*
     
    310310  pns16550Context=(ns16550_context *) Console_Port_Data[minor].pDeviceContext;
    311311
    312   pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1;
    313   setReg   = Console_Port_Tbl[minor].setRegister;
     312  pNS16550 = Console_Port_Tbl[minor]->ulCtrlPort1;
     313  setReg   = Console_Port_Tbl[minor]->setRegister;
    314314
    315315  /*
     
    341341  pns16550Context=(ns16550_context *) Console_Port_Data[minor].pDeviceContext;
    342342
    343   pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1;
    344   setReg   = Console_Port_Tbl[minor].setRegister;
     343  pNS16550 = Console_Port_Tbl[minor]->ulCtrlPort1;
     344  setReg   = Console_Port_Tbl[minor]->setRegister;
    345345
    346346  /*
     
    367367  pns16550Context=(ns16550_context *) Console_Port_Data[minor].pDeviceContext;
    368368
    369   pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1;
    370   setReg   = Console_Port_Tbl[minor].setRegister;
     369  pNS16550 = Console_Port_Tbl[minor]->ulCtrlPort1;
     370  setReg   = Console_Port_Tbl[minor]->setRegister;
    371371
    372372  /*
     
    400400  uint32_t                Irql;
    401401
    402   pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1;
    403   setReg   = Console_Port_Tbl[minor].setRegister;
    404   getReg   = Console_Port_Tbl[minor].getRegister;
     402  pNS16550 = Console_Port_Tbl[minor]->ulCtrlPort1;
     403  setReg   = Console_Port_Tbl[minor]->setRegister;
     404  getReg   = Console_Port_Tbl[minor]->getRegister;
    405405
    406406  /*
     
    413413
    414414  ulBaudDivisor = NS16550_Baud(
    415     (uint32_t) Console_Port_Tbl[minor].ulClock,
     415    (uint32_t) Console_Port_Tbl[minor]->ulClock,
    416416    rtems_termios_baud_to_number(baud_requested)
    417417  );
     
    486486NS16550_STATIC void ns16550_process( int minor)
    487487{
    488   console_tbl *c = &Console_Port_Tbl [minor];
     488  console_tbl *c = Console_Port_Tbl [minor];
    489489  console_data *d = &Console_Port_Data [minor];
    490490  ns16550_context *ctx = d->pDeviceContext;
     
    545545)
    546546{
    547   console_tbl *c = &Console_Port_Tbl [minor];
     547  console_tbl *c = Console_Port_Tbl [minor];
    548548  console_data *d = &Console_Port_Data [minor];
    549549  ns16550_context *ctx = d->pDeviceContext;
     
    579579  setRegister_f  setReg;
    580580
    581   pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1;
    582   setReg   = Console_Port_Tbl[minor].setRegister;
     581  pNS16550 = Console_Port_Tbl[minor]->ulCtrlPort1;
     582  setReg   = Console_Port_Tbl[minor]->setRegister;
    583583
    584584  (*setReg)(pNS16550, NS16550_INTERRUPT_ENABLE, mask);
     
    737737  getRegister_f        getReg;
    738738
    739   pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1;
    740   getReg   = Console_Port_Tbl[minor].getRegister;
     739  pNS16550 = Console_Port_Tbl[minor]->ulCtrlPort1;
     740  getReg   = Console_Port_Tbl[minor]->getRegister;
    741741
    742742  ucLineStatus = (*getReg)(pNS16550, NS16550_LINE_STATUS);
  • c/src/libchip/serial/serial.h

    r11f7aab r229bcca8  
     1/**
     2 * @file
     3 *
     4 * @brief  The generic libchip serial driver interface
     5 */
     6
     7
    18/*
    29 *  This file contains the TTY driver table definition
     
    2936 */
    3037
     38/**
     39 *  @typedef getRegister_f
     40 *
     41 *  This type function provides a hook for the bsp specific method
     42 *  that gets register data from the given port and register.
     43 */
    3144typedef uint8_t   (*getRegister_f)(uintptr_t port, uint8_t reg);
     45
     46/**
     47 *  @typedef setData_f
     48 *
     49 *  This type function provides a hook for the bsp specific method
     50 *  that sets register data from the given port and register to the
     51 *  given value.
     52 */
    3253typedef void      (*setRegister_f)(uintptr_t port, uint8_t reg, uint8_t  value);
     54
     55/**
     56 *  @typedef getData_f
     57 *
     58 *  This type function provides a hook for the bsp specific method
     59 *  that gets data from the specified port.
     60 */
    3361typedef uint8_t   (*getData_f)(uintptr_t port);
     62
     63/**
     64 *  @typedef setData_f
     65 *
     66 *  This type function provides a hook for the bsp specific method
     67 *  that writes value to the specified port.
     68 */
    3469typedef void      (*setData_f)(uintptr_t port, uint8_t value);
    3570
     71/**
     72 *  @typedef _console_fns
     73 *
     74 *  This type definition provides a structure of functions each
     75 *  methood provides an interfce to the serial por to do a specific
     76 *  function.
     77 */
    3678typedef struct _console_fns {
    3779  bool    (*deviceProbe)(int minor);
     
    4688} console_fns;
    4789
     90/**
     91 *  @typedef _console_flow
     92 *
     93 *  This type definition provides a structure of functions
     94 *  that provide flow control for the transmit buffer.
     95 */
    4896typedef struct _console_flow {
    4997  int (*deviceStopRemoteTx)(int minor);
     
    5199} console_flow;
    52100
     101
     102/**
     103 * This type defination provides an enumerated type of all
     104 * supported libchip console drivers.
     105 */
    53106typedef enum {
    54107  SERIAL_MC68681,              /* Motorola MC68681 or Exar 88681 */
     
    58111} console_devs;
    59112
    60 /*
    61  * Each field is interpreted thus:
    62  *
    63  * sDeviceName  This is the name of the device.
    64  *
    65  * deviceType   This indicates the chip type.  It is especially important when
    66  *              multiple devices share the same interrupt vector and must be
    67  *              distinguished.
    68  *
    69  * pDeviceFns   This is a pointer to the set of driver routines to use.
    70  *
    71  * pDeviceFlow  This is a pointer to the set of flow control routines to
    72  *              use. Serial device drivers will typically supply RTSCTS
    73  *              and DTRCTS handshake routines for DCE to DCE communication,
    74  *              however for DCE to DTE communication, no such routines
    75  *              should be necessary as RTS will be driven automatically
    76  *              when the transmitter is active.
    77  *
    78  * ulMargin     The high water mark in the input buffer is set to the buffer
    79  *              size less ulMargin. Once this level is reached, the driver's
    80  *              flow control routine used to stop the remote transmitter will
    81  *              be called. This figure should be greater than or equal to
    82  *              the number of stages of FIFO between the transmitter and
    83  *              receiver.
    84  *
    85  *              NOTE: At the current time, this parameter is hard coded
    86  *                    in termios and this number is ignored.
    87  *
    88  * ulHysteresis After the high water mark specified by ulMargin has been
    89  *              reached, the driver's routine to re-start the remote
    90  *              transmitter will be called once the level in the input
    91  *              buffer has fallen by ulHysteresis bytes.
    92  *
    93  *              NOTE: At the current time, this parameter is hard coded
    94  *                    in termios and this number is ignored.
    95  *
    96  * pDeviceParams This contains either device specific data or a pointer to a
    97  *              device specific structure containing additional information
    98  *              not provided in this table.
    99  *
    100  * ulCtrlPort1  This is the primary control port number for the device. This
    101  *              may be used to specify different instances of the same device
    102  *              type.
    103  *
    104  * ulCtrlPort2  This is the secondary control port number, of use when a given
    105  *              device has more than one available channel.
    106  *
    107  * ulDataPort   This is the port number for the data port of the device
    108  *
    109  * getRegister  This is the routine used to read register values.
    110  *
    111  * setRegister  This is the routine used to write register values.
    112  *
    113  * getData      This is the routine used to read the data register (RX).
    114  *
    115  * setData      This is the routine used to write the data register (TX).
    116  *
    117  * ulClock      This is the baud rate clock speed.
    118  *
    119  * ulIntVector  This encodes the interrupt vector of the device.
    120  */
    121 
     113/**
     114 * This type defination provides an structure that is used to
     115 * uniquely identify a specific serial port.
     116 */
    122117typedef struct _console_tbl {
     118  /**  This is the name of the device. */
    123119  char          *sDeviceName;
     120  /** This indicates the chip type.  It is especially important when
     121   *   multiple devices share the same interrupt vector and must be
     122   *   distinguished.
     123   */
    124124  console_devs   deviceType;
     125  /** pDeviceFns   This is a pointer to the set of driver routines to use. */
    125126  console_fns   *pDeviceFns;
     127  /** This value is passed to the serial device driver for use.  In termios
     128   *  itself the number is ignored.
     129   */
    126130  bool         (*deviceProbe)(int minor);
     131  /** This is a pointer to the set of flow control routines to
     132   *  use. Serial device drivers will typically supply RTSCTS
     133   *  and DTRCTS handshake routines for DCE to DCE communication,
     134   *  however for DCE to DTE communication, no such routines
     135   *  should be necessary as RTS will be driven automatically
     136   *  when the transmitter is active.
     137   */
    127138  console_flow  *pDeviceFlow;
     139  /** The high water mark in the input buffer is set to the buffer
     140   *  size less ulMargin. Once this level is reached, the driver's
     141   *  flow control routine used to stop the remote transmitter will
     142   *  be called. This figure should be greater than or equal to
     143   *  the number of stages of FIFO between the transmitter and
     144   *  receiver.
     145   *
     146   *  @note At the current time, this parameter is hard coded
     147   *        in termios and this number is ignored.
     148   */
    128149  uint32_t       ulMargin;
     150  /** After the high water mark specified by ulMargin has been
     151   *  reached, the driver's routine to re-start the remote
     152   *  transmitter will be called once the level in the input
     153   *  buffer has fallen by ulHysteresis bytes.
     154   *
     155   *  @note At the current time, this parameter is hard coded in termios.
     156   */
    129157  uint32_t       ulHysteresis;
     158  /** This contains either device specific data or a pointer to a
     159   *  device specific structure containing additional information
     160   *  not provided in this table.
     161   */
    130162  void          *pDeviceParams;
     163  /** This is the primary control port number for the device. This
     164   *  may be used to specify different instances of the same device type.
     165   */
    131166  uint32_t       ulCtrlPort1;
     167  /** This is the secondary control port number, of use when a given
     168   *  device has more than one available channel.
     169   */
    132170  uint32_t       ulCtrlPort2;
     171  /** This is the port number for the data port of the device */
    133172  uint32_t       ulDataPort;
     173  /** This is the routine used to read register values. */
    134174  getRegister_f  getRegister;
     175  /** This is the routine used to write register values. */
    135176  setRegister_f  setRegister;
     177  /** This is the routine used to read the data register (RX). */
    136178  getData_f      getData;
     179  /* This is the routine used to write the data register (TX). */
    137180  setData_f      setData;
     181  /** This is the baud rate clock speed.*/
    138182  uint32_t       ulClock;
     183  /** This encodes the interrupt vector of the device. */
    139184  unsigned int   ulIntVector;
    140185} console_tbl;
    141186
     187/**
     188 * This type defination provides data for the console port.
     189 */
    142190typedef struct _console_data {
    143191  void                   *termios_data;
    144192  volatile bool           bActive;
    145   /*
    146    * This field may be used for any purpose required by the driver
    147    */
     193  /** This field may be used for any purpose required by the driver  */
    148194  void                   *pDeviceContext;
    149195} console_data;
    150196
    151 extern console_tbl  Console_Port_Tbl[];
    152 extern console_data Console_Port_Data[];
    153 extern unsigned long  Console_Port_Count;
     197/**
     198 *  This is a dynamically sized set of tables containing the serial
     199 *  port information.
     200 */
     201extern console_tbl   **Console_Port_Tbl;
     202/**
     203 * This is the number of serial ports defined in the Console_Port_Tbl.
     204 */
     205extern unsigned long   Console_Port_Count;
     206
     207/**
     208 *  The statically configured serial port information tables which
     209 *  are used to initially populate the dynamic tables.
     210 */
     211extern console_tbl    Console_Configuration_Ports[];
     212/**
     213 * The number of serial ports defined in Console_Configuration_Ports
     214 * */
     215extern unsigned long  Console_Configuration_Count;
     216
     217/**
     218 *  This is an array of per port information.
     219 */
     220extern console_data  *Console_Port_Data;
    154221
    155222#ifdef __cplusplus
  • c/src/libchip/serial/z85c30.c

    r11f7aab r229bcca8  
    9797  setRegister_f   setReg;
    9898
    99   ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
    100   setReg   = Console_Port_Tbl[minor].setRegister;
     99  ulCtrlPort = Console_Port_Tbl[minor]->ulCtrlPort1;
     100  setReg   = Console_Port_Tbl[minor]->setRegister;
    101101
    102102  /*
     
    138138
    139139  ulBaudDivisor = Z85C30_Baud(
    140     (uint32_t) Console_Port_Tbl[minor].ulClock,
    141     (uint32_t) ((uintptr_t)Console_Port_Tbl[minor].pDeviceParams)
     140    (uint32_t) Console_Port_Tbl[minor]->ulClock,
     141    (uint32_t) ((uintptr_t)Console_Port_Tbl[minor]->pDeviceParams)
    142142  );
    143143
     
    220220   */
    221221
    222   if (Console_Port_Tbl[minor].pDeviceFlow !=&z85c30_flow_DTRCTS) {
     222  if (Console_Port_Tbl[minor]->pDeviceFlow !=&z85c30_flow_DTRCTS) {
    223223    z85c30_assert_DTR(minor);
    224224  }
     
    241241   */
    242242
    243   if (Console_Port_Tbl[minor].pDeviceFlow !=&z85c30_flow_DTRCTS) {
     243  if (Console_Port_Tbl[minor]->pDeviceFlow !=&z85c30_flow_DTRCTS) {
    244244    z85c30_negate_DTR(minor);
    245245  }
     
    259259  getRegister_f    getReg;
    260260
    261   setReg = Console_Port_Tbl[minor].setRegister;
    262   getReg   = Console_Port_Tbl[minor].getRegister;
     261  ulCtrlPort = Console_Port_Tbl[minor]->ulCtrlPort1;
     262  setReg     = Console_Port_Tbl[minor]->setRegister;
     263  getReg     = Console_Port_Tbl[minor]->getRegister;
    263264
    264265  pz85c30Context = (z85c30_context *)malloc(sizeof(z85c30_context));
     
    268269  pz85c30Context->ucModemCtrl = SCC_WR5_TX_8_BITS | SCC_WR5_TX_EN;
    269270
    270   ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
    271   if ( ulCtrlPort == Console_Port_Tbl[minor].ulCtrlPort2 ) {
     271  ulCtrlPort = Console_Port_Tbl[minor]->ulCtrlPort1;
     272  if ( ulCtrlPort == Console_Port_Tbl[minor]->ulCtrlPort2 ) {
    272273    /*
    273274     * This is channel A
     
    307308  setRegister_f          setReg;
    308309
    309   setReg = Console_Port_Tbl[minor].setRegister;
     310  setReg = Console_Port_Tbl[minor]->setRegister;
    310311
    311312  pz85c30Context = (z85c30_context *) Console_Port_Data[minor].pDeviceContext;
     
    318319    pz85c30Context->ucModemCtrl|=SCC_WR5_RTS;
    319320    (*setReg)(
    320       Console_Port_Tbl[minor].ulCtrlPort1,
     321      Console_Port_Tbl[minor]->ulCtrlPort1,
    321322      SCC_WR0_SEL_WR5,
    322323      pz85c30Context->ucModemCtrl
     
    336337  setRegister_f          setReg;
    337338
    338   setReg = Console_Port_Tbl[minor].setRegister;
     339  setReg = Console_Port_Tbl[minor]->setRegister;
    339340
    340341  pz85c30Context = (z85c30_context *) Console_Port_Data[minor].pDeviceContext;
     
    347348    pz85c30Context->ucModemCtrl&=~SCC_WR5_RTS;
    348349    (*setReg)(
    349       Console_Port_Tbl[minor].ulCtrlPort1,
     350      Console_Port_Tbl[minor]->ulCtrlPort1,
    350351      SCC_WR0_SEL_WR5,
    351352      pz85c30Context->ucModemCtrl
     
    370371  setRegister_f          setReg;
    371372
    372   setReg = Console_Port_Tbl[minor].setRegister;
     373  setReg = Console_Port_Tbl[minor]->setRegister;
    373374
    374375  pz85c30Context = (z85c30_context *) Console_Port_Data[minor].pDeviceContext;
     
    381382    pz85c30Context->ucModemCtrl|=SCC_WR5_DTR;
    382383    (*setReg)(
    383       Console_Port_Tbl[minor].ulCtrlPort1,
     384      Console_Port_Tbl[minor]->ulCtrlPort1,
    384385      SCC_WR0_SEL_WR5,
    385386      pz85c30Context->ucModemCtrl
     
    399400  setRegister_f          setReg;
    400401
    401   setReg = Console_Port_Tbl[minor].setRegister;
     402  setReg = Console_Port_Tbl[minor]->setRegister;
    402403
    403404  pz85c30Context = (z85c30_context *) Console_Port_Data[minor].pDeviceContext;
     
    410411    pz85c30Context->ucModemCtrl&=~SCC_WR5_DTR;
    411412    (*setReg)(
    412       Console_Port_Tbl[minor].ulCtrlPort1,
     413      Console_Port_Tbl[minor]->ulCtrlPort1,
    413414      SCC_WR0_SEL_WR5,
    414415      pz85c30Context->ucModemCtrl
     
    439440  rtems_interrupt_level  Irql;
    440441
    441   ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
    442   setReg     = Console_Port_Tbl[minor].setRegister;
     442  ulCtrlPort = Console_Port_Tbl[minor]->ulCtrlPort1;
     443  setReg     = Console_Port_Tbl[minor]->setRegister;
    443444
    444445  /*
     
    451452
    452453  ulBaudDivisor = Z85C30_Baud(
    453     (uint32_t) Console_Port_Tbl[minor].ulClock,
     454    (uint32_t) Console_Port_Tbl[minor]->ulClock,
    454455    (uint32_t) rtems_termios_baud_to_number( baud_requested )
    455456  );
     
    541542  getRegister_f       getReg;
    542543
    543   ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
    544   setReg     = Console_Port_Tbl[minor].setRegister;
    545   getReg     = Console_Port_Tbl[minor].getRegister;
     544  ulCtrlPort = Console_Port_Tbl[minor]->ulCtrlPort1;
     545  setReg     = Console_Port_Tbl[minor]->setRegister;
     546  getReg     = Console_Port_Tbl[minor]->getRegister;
    546547
    547548  /*
     
    605606    if (rtems_termios_dequeue_characters(
    606607         Console_Port_Data[minor].termios_data, 1)) {
    607       if (Console_Port_Tbl[minor].pDeviceFlow != &z85c30_flow_RTSCTS) {
     608      if (Console_Port_Tbl[minor]->pDeviceFlow != &z85c30_flow_RTSCTS) {
    608609        z85c30_negate_RTS(minor);
    609610      }
     
    647648
    648649  for (minor=0;minor<Console_Port_Count;minor++) {
    649     if(Console_Port_Tbl[minor].ulIntVector == vector &&
    650        Console_Port_Tbl[minor].deviceType == SERIAL_Z85C30 ) {
    651       ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort2;
    652       getReg     = Console_Port_Tbl[minor].getRegister;
     650    if(Console_Port_Tbl[minor]->ulIntVector == vector &&
     651       Console_Port_Tbl[minor]->deviceType == SERIAL_Z85C30 ) {
     652      ulCtrlPort = Console_Port_Tbl[minor]->ulCtrlPort2;
     653      getReg     = Console_Port_Tbl[minor]->getRegister;
    653654      do {
    654655        ucIntPend = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD3);
     
    658659           */
    659660
    660           if (ulCtrlPort == Console_Port_Tbl[minor].ulCtrlPort1) {
     661          if (ulCtrlPort == Console_Port_Tbl[minor]->ulCtrlPort1) {
    661662            ucIntPendPort = ucIntPend >> 3;
    662663            ucIntPendPort &= 7;
     
    687688  setRegister_f  setReg;
    688689
    689   ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
    690   setReg     = Console_Port_Tbl[minor].setRegister;
     690  ulCtrlPort = Console_Port_Tbl[minor]->ulCtrlPort1;
     691  setReg     = Console_Port_Tbl[minor]->setRegister;
    691692
    692693  (*setReg)(ulCtrlPort, SCC_WR0_SEL_WR1, interrupt_mask);
     
    707708  setRegister_f  setReg;
    708709
    709   ulCtrlPort1 = Console_Port_Tbl[minor].ulCtrlPort1;
    710   ulCtrlPort2 = Console_Port_Tbl[minor].ulCtrlPort2;
    711   setReg      = Console_Port_Tbl[minor].setRegister;
     710  ulCtrlPort1 = Console_Port_Tbl[minor]->ulCtrlPort1;
     711  ulCtrlPort2 = Console_Port_Tbl[minor]->ulCtrlPort2;
     712  setReg      = Console_Port_Tbl[minor]->setRegister;
    712713
    713714
     
    718719  z85c30_initialize_port( minor );
    719720
    720   if (Console_Port_Tbl[minor].pDeviceFlow != &z85c30_flow_RTSCTS) {
     721  if (Console_Port_Tbl[minor]->pDeviceFlow != &z85c30_flow_RTSCTS) {
    721722    z85c30_negate_RTS(minor);
    722723  }
    723724
    724   set_vector(z85c30_isr, Console_Port_Tbl[minor].ulIntVector, 1);
     725  set_vector(z85c30_isr, Console_Port_Tbl[minor]->ulIntVector, 1);
    725726
    726727  z85c30_enable_interrupts(minor, SCC_ENABLE_ALL_INTR_EXCEPT_TX);
     
    752753  setRegister_f  setReg;
    753754
    754   ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
    755   setReg     = Console_Port_Tbl[minor].setRegister;
     755  ulCtrlPort = Console_Port_Tbl[minor]->ulCtrlPort1;
     756  setReg     = Console_Port_Tbl[minor]->setRegister;
    756757
    757758  /*
     
    767768   */
    768769
    769   if (Console_Port_Tbl[minor].pDeviceFlow != &z85c30_flow_RTSCTS) {
     770  if (Console_Port_Tbl[minor]->pDeviceFlow != &z85c30_flow_RTSCTS) {
    770771    z85c30_assert_RTS(minor);
    771772  }
     
    795796  getRegister_f       getReg;
    796797
    797   ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
    798   getReg     = Console_Port_Tbl[minor].getRegister;
     798  ulCtrlPort = Console_Port_Tbl[minor]->ulCtrlPort1;
     799  getReg     = Console_Port_Tbl[minor]->getRegister;
    799800
    800801  /*
     
    857858  setRegister_f      setReg;
    858859
    859   ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1;
    860   getReg     = Console_Port_Tbl[minor].getRegister;
    861   setReg     = Console_Port_Tbl[minor].setRegister;
     860  ulCtrlPort = Console_Port_Tbl[minor]->ulCtrlPort1;
     861  getReg     = Console_Port_Tbl[minor]->getRegister;
     862  setReg     = Console_Port_Tbl[minor]->setRegister;
    862863
    863864  /*
Note: See TracChangeset for help on using the changeset viewer.