Ticket #2897: 0004-tools-was-updated-to-reflect-the-changes-made-to-ter.patch

File 0004-tools-was-updated-to-reflect-the-changes-made-to-ter.patch, 2.3 KB (added by Kevin Kirspel, on Feb 2, 2017 at 11:02:12 PM)

Tool Updates

  • tools/cpu/sh/sci.c

    From eec9c28eb6d90aa14db103be501bfe21c381b4a5 Mon Sep 17 00:00:00 2001
    From: Kevin Kirspel <kevin-kirspel@idexx.com>
    Date: Thu, 2 Feb 2017 14:21:07 -0500
    Subject: [PATCH 4/4] tools was updated to reflect the changes made to termios
    
    ---
     tools/cpu/sh/sci.c | 29 ++++++++++++++++++++---------
     1 file changed, 20 insertions(+), 9 deletions(-)
     mode change 100644 => 100755 tools/cpu/sh/sci.c
    
    diff --git a/tools/cpu/sh/sci.c b/tools/cpu/sh/sci.c
    old mode 100644
    new mode 100755
    index a092bce..3a093c0
    a b static unsigned int bitrate [] = { 
    4343  9600,
    4444  19200,
    4545  38400,
     46  7200,
     47  14400,
     48  28800,
    4649  57600,
     50  76800,
    4751  115200,
    4852  230400,
    49   460800
     53  460800,
     54  921600
    5055};
    5156
    5257static sci_tab_t test_array[4] ;
    int shgen_gensci( 
    123128    "static struct sci_bitrate_t {\n"
    124129    "  unsigned char n ;\n"
    125130    "  unsigned char N ;\n"
     131    "  speed_t       B ;\n"
    126132    "} _sci_bitrates[] = {\n"
    127     "/*  n    N      error */\n" );
     133    "/*  n    N      B      error */\n" );
    128134
    129135  for ( i = 0 ; i < sizeof(bitrate)/sizeof(int) ; i++ )
    130136  {
    int shgen_gensci( 
    132138
    133139    if ( i > 0 )
    134140      fprintf( file, ",\n" );
    135     fprintf( file, "  { %1d, %3d } /* %+7.2f%% ; B%d ",
     141    fprintf( file, "  { %1d, %3d, %d } /* %+7.2f%% ; B%d ",
    136142      best->n,
    137143      best->N,
     144      best->B,
    138145      best->err,
    139146      best->B );
    140147    if ( best->n > 3 )
    int shgen_gensci( 
    146153
    147154  fprintf( file,
    148155    "int _sci_get_brparms( \n"
    149     "  tcflag_t      cflag,\n"
     156    "  speed_t        spd,\n"
    150157    "  unsigned char *smr,\n"
    151158    "  unsigned char *brr )\n"
    152159    "{\n"
    153     "  unsigned int offset ;\n\n"
    154     "  offset = ( cflag & ( CBAUD & ~CBAUDEX ) )\n"
    155     "    + ( ( cflag & CBAUDEX ) ? B38400 : 0 );\n"
    156     "  if ( offset == 0 ) return -1 ;\n"
    157     "  offset-- ;\n\n"
     160    "  int offset = -1;\n"
     161    "  int i;\n\n"
     162    "  for(i = 0; i < sizeof(_sci_bitrates)/sizeof(_sci_bitrates[0]); i++) {\n"
     163    "    if( _sci_bitrates[i].B == spd ) {\n"
     164    "      offset = i;\n"
     165    "      break;\n"
     166    "    }\n"
     167    "  }\n"
     168    "  if ( offset == -1 ) return -1 ;\n"
    158169    "  if ( _sci_bitrates[offset].n > 3 )  return -1;\n\n"
    159170    "  *smr &= ~0x03;\n"
    160171    "  *smr |= _sci_bitrates[offset].n;\n"