Search
lxdream.org :: lxdream/src/serial.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/serial.h
changeset 1077:136fc24d17ef
prev736:a02d1475ccfd
next1081:ef31ae97bb8b
author nkeynes
date Wed Oct 07 17:53:56 2009 +1000 (12 years ago)
permissions -rw-r--r--
last change Create a host attachment for the SCIF serial port. By default, uses /dev/console
Add general fd listening to netutil, and rename to ioutil
Add SCIF update on port read/write - fixes KOS timing problems but needs to
be redone properly.
file annotate diff log raw
1.1 --- a/src/serial.h Mon Jul 14 07:44:42 2008 +0000
1.2 +++ b/src/serial.h Wed Oct 07 17:53:56 2009 +1000
1.3 @@ -20,6 +20,8 @@
1.4
1.5 #include <stdint.h>
1.6
1.7 +#include "lxdream.h"
1.8 +
1.9 #ifdef __cplusplus
1.10 extern "C" {
1.11 #endif
1.12 @@ -33,17 +35,44 @@
1.13 #define SERIAL_2STOPBITS 0x08
1.14
1.15 typedef struct serial_device {
1.16 - void (*set_line_speed)(uint32_t bps);
1.17 - void (*set_line_params)(int flags);
1.18 - void (*receive_data)(uint8_t value);
1.19 + void (*attach)(struct serial_device *dev);
1.20 + void (*detach)(struct serial_device *dev);
1.21 + void (*destroy)(struct serial_device *dev);
1.22 + void (*set_line_speed)(struct serial_device *dev, uint32_t bps);
1.23 + void (*set_line_params)(struct serial_device *dev, int flags);
1.24 + void (*receive_data)(struct serial_device *dev, uint8_t value);
1.25 } *serial_device_t;
1.26
1.27 -void serial_attach_device( serial_device_t dev );
1.28 -void serial_detach_device( );
1.29 +serial_device_t serial_attach_device( serial_device_t dev );
1.30 +serial_device_t serial_detach_device( );
1.31 +serial_device_t serial_get_device( );
1.32 +
1.33 +/**
1.34 + * Destroy a serial device.
1.35 + */
1.36 +void serial_destroy_device( serial_device_t dev );
1.37 +
1.38
1.39 void serial_transmit_data( char *data, int length );
1.40 void serial_transmit_break( void );
1.41
1.42 +/**
1.43 + * Create a serial device on a host device identified by the given
1.44 + * file (ie /dev/tty). If filename identifies a regular file, it is opened
1.45 + * for output only.
1.46 + */
1.47 +serial_device_t serial_fd_device_new_filename( const gchar *filename );
1.48 +
1.49 +/**
1.50 + * Create a serial device on the host console (stdin/stdout).
1.51 + */
1.52 +serial_device_t serial_fd_device_new_console();
1.53 +
1.54 +/**
1.55 + * Create a serial device on a pair of file streams (in and out)
1.56 + */
1.57 +serial_device_t serial_fd_device_new_file( FILE *in, FILE *out, gboolean closeOnDestroy );
1.58 +
1.59 #ifdef __cplusplus
1.60 }
1.61 #endif
.