Changeset 69f7221 in multiio


Ignore:
Timestamp:
Jul 21, 2009, 11:27:42 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
master
Children:
9175425
Parents:
9fec0a5
Message:

2009-07-21 Joel Sherrill <joel.sherrill@…>

  • Makefile, README, main_pcmmio_dac.c, main_pcmmio_dout.c: Added string2XXX routines to RTEMS so we have ability to do heavy error checking on numeric inputs.
Location:
pcmmio/original
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • pcmmio/original/ChangeLog

    r9fec0a5 r69f7221  
     12009-07-21      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * Makefile, README, main_pcmmio_dac.c, main_pcmmio_dout.c: Added
     4        string2XXX routines to RTEMS so we have ability to do heavy error
     5        checking on numeric inputs.
     6
    172009-07-21      Joel Sherrill <joel.sherrill@oarcorp.com>
    28
  • pcmmio/original/Makefile

    r9fec0a5 r69f7221  
    2323SHARED_CSRCS += main_pcmmio_adc.c main_pcmmio_dac.c
    2424SHARED_CSRCS += mio_io_rtems.c
     25#SHARED_CSRCS += string2double.c string2float.c string2int.c \
     26#  string2long.c string2longlong.c string2unsignedchar.c \
     27#  string2unsignedint.c string2unsignedlong.c string2unsignedlonglong.c
    2528
    2629SHARED_COBJS = $(SHARED_CSRCS:%.c=${ARCH}/%.o)
  • pcmmio/original/README

    r9fec0a5 r69f7221  
    4949           voltage must be -10V to +10V
    5050
    51 
    5251Aliases
    5352  + adc  - alias for pcmmio_adc
     53  + dac  - alias for pcmmio_dac
    5454  + din  - alias for pcmmio_din
    5555  + dout - alias for pcmmio_dout
  • pcmmio/original/main_pcmmio_dac.c

    r9fec0a5 r69f7221  
    1313
    1414#include "pcmmio_commands.h"
     15#include <rtems/string2.h>
    1516
    1617#define __need_getopt_newlib
     
    6566   *  Convert the string arguments into number values
    6667   */
    67   dac     = strtof( argv[getopt_reent.optind], NULL );
     68  if ( !rtems_string_to_int( argv[getopt_reent.optind], &dac, NULL, 0 ) ) {
     69    printf( "DAC (%s) is not a number\n", argv[getopt_reent.optind] );
     70    PRINT_USAGE();
     71    return -1;
     72  }
     73
     74  if ( !rtems_string_to_float( argv[getopt_reent.optind+1], &voltage, NULL ) ) {
     75    printf( "Voltage (%s) is not a number\n", argv[getopt_reent.optind + 1] );
     76    PRINT_USAGE();
     77    return -1;
     78  }
     79
    6880  voltage = strtof( argv[getopt_reent.optind + 1], NULL );
    6981
     
    7284   */
    7385  if ( dac < 0 || dac > 7 ) {
    74     printf( "DAC number must be 0-7\n" );
     86    puts( "DAC number must be 0-7" );
    7587    PRINT_USAGE();
    7688    return -1;
  • pcmmio/original/main_pcmmio_dout.c

    r9fec0a5 r69f7221  
    1313
    1414#include "pcmmio_commands.h"
     15#include <rtems/string2.h>
    1516
    1617#define __need_getopt_newlib
     
    6465   *  Convert the string arguments into number values
    6566   */
    66   bit   = rtems_shell_str2int( argv[getopt_reent.optind] );
    67   value = rtems_shell_str2int( argv[getopt_reent.optind + 1] );
     67  if ( !rtems_string_to_int( argv[getopt_reent.optind], &bit, NULL, 0 ) ) {
     68    printf( "Bit (%s) is not a number\n", argv[getopt_reent.optind] );
     69    PRINT_USAGE();
     70    return -1;
     71  }
     72
     73  if ( !rtems_string_to_int(argv[getopt_reent.optind + 1], &value, NULL, 0) ) {
     74    printf( "Value (%s) is not a number\n", argv[getopt_reent.optind] );
     75    PRINT_USAGE();
     76    return -1;
     77  }
    6878
    6979  /*
Note: See TracChangeset for help on using the changeset viewer.