Ignore:
Timestamp:
05/03/09 08:52:49 (12 years ago)
Author:
rorothetroll
Message:

csctapi/io_serial.[c,h] : added read/write serial routine for OS X
csctapi/ifd_towitoko.c : added calls to the new OS X routines inside #ifdefs
csctapi/atr.c : added calls to the new OS X routines inside #ifdefs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/csctapi/ifd_towitoko.c

    r21 r67  
    555555        if(ioctl(ifd->io->fd, IOCTL_SET_ATR_READY)<0)
    556556            return IFD_TOWITOKO_IO_ERROR;
    557            
     557#ifdef OS_MACOSX
     558        while(n<SCI_MAX_ATR_SIZE && IO_Serial_Read_MacOSX(ifd->io, IFD_TOWITOKO_ATR_TIMEOUT, 1, buf+n))
     559#else           
    558560        while(n<SCI_MAX_ATR_SIZE && IO_Serial_Read(ifd->io, IFD_TOWITOKO_ATR_TIMEOUT, 1, buf+n))
     561#endif
    559562        {
    560563            n++;
     
    757760        if ((sent == 0) && (block_delay != char_delay))
    758761        {
     762#ifdef OS_MACOSX
     763            if (!IO_Serial_Write_MacOSX (ifd->io, block_delay, 1, buffer))
     764#else
    759765            if (!IO_Serial_Write (ifd->io, block_delay, 1, buffer))
     766#endif
    760767                return IFD_TOWITOKO_IO_ERROR;
    761768           
     769#ifdef OS_MACOSX
     770            if (!IO_Serial_Write_MacOSX (ifd->io, char_delay, to_send-1, buffer+1))
     771#else
    762772            if (!IO_Serial_Write (ifd->io, char_delay, to_send-1, buffer+1))
     773#endif
    763774                return IFD_TOWITOKO_IO_ERROR;
    764775        }
    765776        else
    766777        {
     778#ifdef OS_MACOSX
     779            if (!IO_Serial_Write_MacOSX (ifd->io, char_delay, to_send, buffer+sent))
     780#else
    767781            if (!IO_Serial_Write (ifd->io, char_delay, to_send, buffer+sent))
     782#endif
    768783                return IFD_TOWITOKO_IO_ERROR;
    769784        }
     
    791806    {
    792807        /* Read first byte using block timeout */
     808#ifdef OS_MACOSX
     809        if (!IO_Serial_Read_MacOSX (ifd->io, block_timeout, 1, buffer))
     810#else
    793811        if (!IO_Serial_Read (ifd->io, block_timeout, 1, buffer))
     812#endif
    794813            return IFD_TOWITOKO_IO_ERROR;
    795814       
     
    797816        {
    798817            /* Read remaining data bytes using char timeout */
     818#ifdef OS_MACOSX
     819            if (!IO_Serial_Read_MacOSX (ifd->io, char_timeout, size - 1, buffer + 1))
     820#else
    799821            if (!IO_Serial_Read (ifd->io, char_timeout, size - 1, buffer + 1))
     822#endif
    800823                return IFD_TOWITOKO_IO_ERROR;
    801824        }
     
    804827    {
    805828        /* Read all data bytes with the same timeout */
     829#ifdef OS_MACOSX
     830        if (!IO_Serial_Read_MacOSX (ifd->io, char_timeout, size, buffer))
     831#else
    806832        if (!IO_Serial_Read (ifd->io, char_timeout, size, buffer))
     833#endif
    807834            return IFD_TOWITOKO_IO_ERROR;
    808835    }
Note: See TracChangeset for help on using the changeset viewer.