72 lines
2.7 KiB
C
72 lines
2.7 KiB
C
/* ****************************************************************************
|
|
* libcasio/stream.h -- libcasio stream definition.
|
|
* Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
|
|
*
|
|
* This file is part of libcasio.
|
|
* libcasio is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation; either version 3.0 of the License,
|
|
* or (at your option) any later version.
|
|
*
|
|
* libcasio is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
* See the GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with libcasio; if not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* The libcasio stream abstraction is there so that the core code can be more
|
|
* platform-agnostic (althrough platform-specific helpers are built-in for
|
|
* popular platforms like Microsoft Windows or GNU/Linux distributions).
|
|
* A stream is basically what separates libcasio from the calculator.
|
|
* When data is read from the stream, what is expected is what the calculator
|
|
* has sent, and when data is written to the stream, it is what the calculator
|
|
* shall receive.
|
|
* ************************************************************************* */
|
|
#ifndef LIBCASIO_STREAM_H
|
|
# define LIBCASIO_STREAM_H
|
|
# include "cdefs.h"
|
|
# include <libtio.h>
|
|
|
|
CASIO_BEGIN_NAMESPACE
|
|
CASIO_BEGIN_DECLS
|
|
|
|
/* Make a stream out of another, while calculating a 32-bit checksum. */
|
|
|
|
CASIO_EXTERN(int) casio_open_csum32
|
|
OF((tio_stream_t **casio__stream, tio_stream_t *casio__original,
|
|
casio_uint32_t *casio__csum));
|
|
|
|
/* Find devices on serial buses. */
|
|
|
|
# define casio_next_serial(ITER, NEXTP) \
|
|
casio_next((ITER), (void **)(char const **)(NEXTP))
|
|
|
|
CASIO_EXTERN(int) casio_iter_serial
|
|
OF((casio_iter_t **casio__iterp));
|
|
|
|
/* Find devices on USB buses. */
|
|
|
|
# define CASIO_USB_TYPE_UNKNOWN 0 /* Unknown type (not a calculator?) */
|
|
# define CASIO_USB_TYPE_LEGACY 1 /* Protocol 7.00 over bulk transfers */
|
|
# define CASIO_USB_TYPE_SCSI 2 /* Bulk-Only Transport (SCSI) and
|
|
* “Protocol 7.00” over commands C0 to C2 */
|
|
|
|
typedef struct casio_usb_entry_s {
|
|
int casio_usb_entry_type; /* one of `CASIO_USB_TYPE_*` */
|
|
int casio_usb_entry_bus;
|
|
int casio_usb_entry_address;
|
|
} casio_usb_entry_t;
|
|
|
|
# define casio_next_usb(ITER, NEXTP) \
|
|
casio_next((ITER), (void **)(casio_usb_entry_t **)(NEXTP))
|
|
|
|
CASIO_EXTERN(int) casio_iter_usb
|
|
OF((casio_iter_t **casio__iterp));
|
|
|
|
CASIO_END_DECLS
|
|
CASIO_END_NAMESPACE
|
|
|
|
#endif /* LIBCASIO_STREAM_H */
|