Changeset a830cb8 in rtems


Ignore:
Timestamp:
Oct 7, 2014, 2:27:51 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
7fd5e89
Parents:
ff7217b
Message:

termios: Separate flow control from normal handler

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/tms570/console/tms570-sci.c

    rff7217b ra830cb8  
    104104        minor,
    105105        handler,
     106        NULL,
    106107        (void *) ctx
    107108    );
     
    537538  .write = tms570_sci_poll_write,
    538539  .set_attributes = tms570_sci_set_attributes,
    539   .stop_remote_tx = NULL,
    540   .start_remote_tx = NULL,
    541540  .mode = TERMIOS_POLLED
    542541};
     
    554553  .write = tms570_sci_interrupt_write,
    555554  .set_attributes = tms570_sci_set_attributes,
    556   .stop_remote_tx = NULL,
    557   .start_remote_tx = NULL,
    558555  .mode = TERMIOS_IRQ_DRIVEN
    559556};
  • c/src/lib/libbsp/sparc/leon3/console/console.c

    rff7217b ra830cb8  
    132132      minor,
    133133      handler,
     134      NULL,
    134135      leon3_console_get_uart(syscon_uart_index)
    135136    );
     
    148149      minor,
    149150      handler,
     151      NULL,
    150152      leon3_console_get_uart(syscon_uart_index)
    151153    );
  • cpukit/libcsupport/include/rtems/termiostypes.h

    rff7217b ra830cb8  
    145145
    146146  /**
    147    * @brief Indicate to stop remote transmitter.
    148    *
    149    * @param[in] tty The Termios control.
    150    *
    151    * @see rtems_termios_get_device_context().
    152    */
    153   void (*stop_remote_tx)(struct rtems_termios_tty *tty);
    154 
    155   /**
    156    * @brief Indicate to start remote transmitter.
    157    *
    158    * @param[in] tty The Termios control.
    159    *
    160    * @see rtems_termios_get_device_context().
    161    */
    162   void (*start_remote_tx)(struct rtems_termios_tty *tty);
    163 
    164   /**
    165147   * @brief Termios device mode.
    166148   */
    167149  rtems_termios_device_mode mode;
    168150} rtems_termios_device_handler;
     151
     152/**
     153 * @brief Termios device flow control handler.
     154 *
     155 * @see rtems_termios_device_install().
     156 */
     157typedef struct {
     158  /**
     159   * @brief Indicate to stop remote transmitter.
     160   *
     161   * @param[in] tty The Termios control.
     162   *
     163   * @see rtems_termios_get_device_context().
     164   */
     165  void (*stop_remote_tx)(struct rtems_termios_tty *tty);
     166
     167  /**
     168   * @brief Indicate to start remote transmitter.
     169   *
     170   * @param[in] tty The Termios control.
     171   *
     172   * @see rtems_termios_get_device_context().
     173   */
     174  void (*start_remote_tx)(struct rtems_termios_tty *tty);
     175} rtems_termios_device_flow;
    169176
    170177/**
     
    178185  rtems_device_minor_number           minor;
    179186  const rtems_termios_device_handler *handler;
     187  const rtems_termios_device_flow    *flow;
    180188  void                               *context;
    181189  struct rtems_termios_tty           *tty;
     
    255263  rtems_termios_device_handler handler;
    256264
     265  /**
     266   * @brief The device flow control handler.
     267   */
     268  rtems_termios_device_flow flow;
     269
    257270  volatile unsigned int    flow_ctrl;
    258271  unsigned int             lowwater,highwater;
     
    296309 *
    297310 * @param[in] device_file If not @c NULL, then a device file for the specified
    298  * major and minor number will be created.
     311 *   major and minor number will be created.
    299312 * @param[in] major The device major number of the corresponding device driver.
    300313 * @param[in] minor The device minor number of the corresponding device driver.
    301314 * @param[in] handler The device handler.  It must be persistent throughout the
    302315 *   installed time of the device.
     316 * @param[in] flow The device flow control handler.  The device flow control
     317 *   handler are optional and may be @c NULL.  If present must be persistent
     318 *   throughout the installed time of the device.
    303319 * @param[in] context The device context.  It must be persistent throughout the
    304320 *   installed time of the device.
     
    308324 * @retval RTEMS_UNSATISFIED Creation of the device file failed.
    309325 * @retval RTEMS_RESOURCE_IN_USE There exists a device node for this major and
    310  * minor number pair.
     326 *   minor number pair.
    311327 * @retval RTEMS_INCORRECT_STATE Termios is not initialized.
    312328 *
    313329 * @see rtems_termios_device_remove(), rtems_termios_device_open(),
    314  * rtems_termios_device_close() and rtems_termios_get_device_context().
     330 *   rtems_termios_device_close() and rtems_termios_get_device_context().
    315331 */
    316332rtems_status_code rtems_termios_device_install(
     
    319335  rtems_device_minor_number           minor,
    320336  const rtems_termios_device_handler *handler,
     337  const rtems_termios_device_flow    *flow,
    321338  void                               *context
    322339);
  • cpukit/libcsupport/src/termios.c

    rff7217b ra830cb8  
    134134  rtems_device_minor_number           minor,
    135135  const rtems_termios_device_handler *handler,
     136  const rtems_termios_device_flow    *flow,
    136137  void                               *context
    137138)
     
    149150  new_device_node->minor = minor;
    150151  new_device_node->handler = handler;
     152  new_device_node->flow = flow;
    151153  new_device_node->context = context;
    152154  new_device_node->tty = NULL;
     
    459461      device_node->tty = tty;
    460462      tty->handler = *device_node->handler;
     463
     464      if (device_node->flow != NULL) {
     465        tty->flow = *device_node->flow;
     466      }
     467
    461468      tty->device_node = device_node;
    462469      tty->device_context = device_node->context;
     
    473480      tty->handler.set_attributes = callbacks->setAttributes != NULL ?
    474481        rtems_termios_callback_setAttributes : NULL;
    475       tty->handler.stop_remote_tx = callbacks->stopRemoteTx != NULL ?
     482      tty->flow.stop_remote_tx = callbacks->stopRemoteTx != NULL ?
    476483        rtems_termios_callback_stopRemoteTx : NULL;
    477       tty->handler.start_remote_tx = callbacks->startRemoteTx != NULL ?
     484      tty->flow.start_remote_tx = callbacks->startRemoteTx != NULL ?
    478485        rtems_termios_callback_startRemoteTx : NULL;
    479486      tty->handler.mode = callbacks->outputUsesInterrupts;
     
    819826    /* restart remote Tx, if it was stopped */
    820827    if ((tty->flow_ctrl & FL_IRTSOFF) &&
    821         (tty->handler.start_remote_tx != NULL)) {
    822       tty->handler.start_remote_tx(tty);
     828        (tty->flow.start_remote_tx != NULL)) {
     829      tty->flow.start_remote_tx(tty);
    823830    }
    824831    tty->flow_ctrl &= ~(FL_IRTSOFF);
     
    14451452          tty->flow_ctrl &= ~FL_IRTSOFF;
    14461453          /* activate RTS line */
    1447           if (tty->handler.start_remote_tx != NULL) {
    1448             tty->handler.start_remote_tx(tty);
     1454          if (tty->flow.start_remote_tx != NULL) {
     1455            tty->flow.start_remote_tx(tty);
    14491456          }
    14501457        }
     
    16251632          tty->flow_ctrl |= FL_IRTSOFF;
    16261633          /* deactivate RTS line */
    1627           if (tty->handler.stop_remote_tx != NULL) {
    1628             tty->handler.stop_remote_tx(tty);
     1634          if (tty->flow.stop_remote_tx != NULL) {
     1635            tty->flow.stop_remote_tx(tty);
    16291636          }
    16301637        }
  • doc/bsp_howto/console.t

    rff7217b ra830cb8  
    490490      minor,
    491491      handler,
     492      NULL,
    492493      ctx
    493494    );
  • testsuites/libtests/termios01/init.c

    rff7217b ra830cb8  
    561561  greedy = rtems_heap_greedy_allocate( NULL, 0 );
    562562
    563   sc = rtems_termios_device_install( "/", major, minor, &handler, NULL );
     563  sc = rtems_termios_device_install( "/", major, minor, &handler, NULL, NULL );
    564564  rtems_test_assert( sc == RTEMS_NO_MEMORY );
    565565
     
    568568  rtems_test_assert( rtems_resource_snapshot_check( &snapshot ) );
    569569
    570   sc = rtems_termios_device_install( NULL, major, minor, &handler, NULL );
    571   rtems_test_assert( sc == RTEMS_SUCCESSFUL );
    572 
    573   sc = rtems_termios_device_install( NULL, major, minor, &handler, NULL );
     570  sc = rtems_termios_device_install(
     571    NULL,
     572    major,
     573    minor,
     574    &handler,
     575    NULL,
     576    NULL
     577  );
     578  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
     579
     580  sc = rtems_termios_device_install(
     581    NULL,
     582    major,
     583    minor,
     584    &handler,
     585    NULL,
     586    NULL
     587  );
    574588  rtems_test_assert( sc == RTEMS_RESOURCE_IN_USE );
    575589
     
    579593  rtems_test_assert( rtems_resource_snapshot_check( &snapshot ) );
    580594
    581   sc = rtems_termios_device_install( "/", major, minor, &handler, NULL );
     595  sc = rtems_termios_device_install( "/", major, minor, &handler, NULL, NULL );
    582596  rtems_test_assert( sc == RTEMS_UNSATISFIED );
    583597
     
    587601  rtems_test_assert( sc == RTEMS_INVALID_ID );
    588602
    589   sc = rtems_termios_device_install( &dev[0], major, minor, &handler, NULL );
     603  sc = rtems_termios_device_install(
     604    &dev[0],
     605    major,
     606    minor,
     607    &handler,
     608    NULL,
     609    NULL
     610  );
    590611  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
    591612
     
    639660  rtems_resource_snapshot_take( &snapshot );
    640661
    641   sc = rtems_termios_device_install( &dev[0], major, minor, &handler, &done );
     662  sc = rtems_termios_device_install(
     663    &dev[0],
     664    major,
     665    minor,
     666    &handler,
     667    NULL,
     668    &done
     669  );
    642670  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
    643671
     
    690718  rtems_resource_snapshot_take( &snapshot );
    691719
    692   sc = rtems_termios_device_install( &dev[0], major, minor, &handler, &done );
     720  sc = rtems_termios_device_install(
     721    &dev[0],
     722    major,
     723    minor,
     724    &handler,
     725    NULL,
     726    &done
     727  );
    693728  rtems_test_assert( sc == RTEMS_SUCCESSFUL );
    694729
Note: See TracChangeset for help on using the changeset viewer.