Changeset 028aa06 in rtems


Ignore:
Timestamp:
Jul 1, 2010, 2:35:54 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
f938d598
Parents:
7424c3ee
Message:

2010-07-01 Joel Sherrill <joel.sherrill@…>

  • termios04/termios_testdriver_intr.c: Task driven IO now works.
Location:
testsuites/libtests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/ChangeLog

    r7424c3ee r028aa06  
     12010-07-01      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * termios04/termios_testdriver_intr.c: Task driven IO now works.
     4
    152010-07-01      Joel Sherrill <joel.sherrill@oarcorp.com>
    26
  • testsuites/libtests/termios04/termios_testdriver_intr.c

    r7424c3ee r028aa06  
    2020#include "termios_testdriver_intr.h"
    2121
    22 rtems_id Timer;
     22rtems_id Rx_Timer;
     23rtems_id Tx_Timer;
    2324
    2425#define TX_MAX 1024
    25 uint8_t Tx_Buffer[TX_MAX];
    26 int     Tx_Index = 0;
     26uint8_t                   Tx_Buffer[TX_MAX];
     27int                       Tx_Index = 0;
    2728struct rtems_termios_tty *Ttyp;
    2829
     30void termios_test_driver_wait_for_tx_to_complete(void)
     31{
     32  rtems_task_wake_after( 2 * rtems_clock_get_ticks_per_second() );
     33}
     34
    2935void termios_test_driver_dump_tx(const char *c)
    3036{
     37  termios_test_driver_wait_for_tx_to_complete();
     38
    3139  printf( "%s %d characters\n", c, Tx_Index );
    3240  rtems_print_buffer( Tx_Buffer, Tx_Index );
     
    4048bool           Rx_EnqueueNow = false;
    4149
     50#if defined(TASK_DRIVEN)
     51  int termios_test_driver_inbyte_nonblocking( int port )
     52  {
     53    if ( Rx_FirstTime == true ) {
     54      Rx_FirstTime = false;
     55      return -1;
     56    }
     57    if ( Rx_Index >= Rx_Length )
     58      return -1;
     59    return Rx_Buffer[ Rx_Index++ ];
     60  }
     61#endif
     62
    4263rtems_timer_service_routine Rx_ISR(
    4364  rtems_id  ignored_id,
     
    5273  ch = Rx_Buffer[ Rx_Index++ ];
    5374  rtems_termios_enqueue_raw_characters (Ttyp, (char *)&ch, 1);
    54 
    55   (void) rtems_timer_fire_after( Timer, 10, Rx_ISR, NULL );
     75  #if defined(TASK_DRIVEN)
     76    rtems_termios_rxirq_occured(Ttyp);
     77  #endif
     78
     79  (void) rtems_timer_fire_after( Rx_Timer, 10, Rx_ISR, NULL );
     80}
     81
     82rtems_timer_service_routine Tx_ISR(
     83  rtems_id  ignored_id,
     84  void     *ignored_address
     85)
     86{
     87  rtems_termios_dequeue_characters (Ttyp, 1);
     88
     89  (void) rtems_timer_fire_after( Tx_Timer, 10, Tx_ISR, NULL );
    5690}
    5791
     
    73107
    74108  if ( Rx_EnqueueNow == false) {
    75     (void) rtems_timer_fire_after( Timer, 10, Rx_ISR, NULL );
     109    (void) rtems_timer_fire_after( Rx_Timer, 10, Rx_ISR, NULL );
    76110    return;
    77111  }
     
    90124)
    91125{
    92   size_t  i;
    93 
    94   for (i=0 ; i<len ; i++ )
    95     Tx_Buffer[Tx_Index++] = (uint8_t) buf[i];
    96 
    97   return len;
     126  Tx_Buffer[Tx_Index++] = buf[0];
     127  (void) rtems_timer_fire_after( Tx_Timer, 10, Tx_ISR, NULL );
     128  return 1;
    98129}
    99130
     
    127158  (void) rtems_io_register_name( TERMIOS_TEST_DRIVER_DEVICE_NAME, major, 0 );
    128159
    129   status = rtems_timer_create( rtems_build_name('T', 'M', '0', '1'), &Timer );
     160  status = rtems_timer_create(rtems_build_name('T', 'M', 'R', 'X'), &Rx_Timer);
     161  if ( status )
     162    rtems_fatal_error_occurred(1);;
     163
     164  status = rtems_timer_create(rtems_build_name('T', 'M', 'T', 'X'), &Tx_Timer);
    130165  if ( status )
    131166    rtems_fatal_error_occurred(1);;
     
    145180    NULL,                                    /* firstOpen */
    146181    NULL,                                    /* lastClose */
    147     NULL,                                    /* pollRead */
     182    #if defined(TASK_DRIVEN)
     183      termios_test_driver_inbyte_nonblocking,/* pollRead */
     184    #else
     185      NULL,                                  /* pollRead */
     186    #endif
    148187    termios_test_driver_write_helper,        /* write */
    149188    termios_test_driver_set_attributes,      /* setAttributes */
    150189    NULL,                                    /* stopRemoteTx */
    151190    NULL,                                    /* startRemoteTx */
    152     0                                        /* outputUsesInterrupts */
     191    #if defined(TASK_DRIVEN)
     192      TERMIOS_TASK_DRIVEN                    /* outputUsesInterrupts */
     193    #else
     194      0                                      /* outputUsesInterrupts */
     195    #endif
    153196  };
    154197
Note: See TracChangeset for help on using the changeset viewer.