forked from Imagelibrary/rtems
Switched to termios callback structure.
This commit is contained in:
@@ -189,18 +189,23 @@ rtems_device_driver console_open(
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_status_code sc;
|
||||
static const rtems_termios_callbacks pollCallbacks = {
|
||||
NULL, /* firstOpen */
|
||||
NULL, /* lastClose */
|
||||
console_inbyte_nonblocking, /* pollRead */
|
||||
console_write_support, /* write */
|
||||
NULL, /* setAttributes */
|
||||
NULL, /* stopRemoteTx */
|
||||
NULL, /* startRemoteTx */
|
||||
0 /* outputUsesInterrupts */
|
||||
};
|
||||
|
||||
assert( minor <= 1 );
|
||||
if ( minor > 2 )
|
||||
return RTEMS_INVALID_NUMBER;
|
||||
|
||||
sc = rtems_termios_open (major, minor, arg,
|
||||
NULL,
|
||||
NULL,
|
||||
console_inbyte_nonblocking,
|
||||
console_write_support,
|
||||
0);
|
||||
assert( minor <= 1 );
|
||||
if ( minor > 2 )
|
||||
return RTEMS_INVALID_NUMBER;
|
||||
|
||||
sc = rtems_termios_open (major, minor, arg, &pollCallbacks );
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* external prototypes for monitor interface routines */
|
||||
|
||||
void outbyte( char );
|
||||
char inbyte( void );
|
||||
|
||||
/*
|
||||
* console_outbyte_polled
|
||||
@@ -87,9 +91,10 @@ void DEBUG_puts(
|
||||
*
|
||||
*/
|
||||
|
||||
int console_write_support (int minor, char *buf, int len)
|
||||
int console_write_support (int minor, const void *bufarg, int len)
|
||||
{
|
||||
int nwrite = 0;
|
||||
const char *buf = bufarg;
|
||||
|
||||
while (nwrite < len) {
|
||||
console_outbyte_polled( minor, *buf++ );
|
||||
@@ -130,18 +135,24 @@ rtems_device_driver console_open(
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_status_code sc;
|
||||
static const rtems_termios_callbacks pollCallbacks = {
|
||||
NULL, /* firstOpen */
|
||||
NULL, /* lastClose */
|
||||
console_inbyte_nonblocking, /* pollRead */
|
||||
console_write_support, /* write */
|
||||
NULL, /* setAttributes */
|
||||
NULL, /* stopRemoteTx */
|
||||
NULL, /* startRemoteTx */
|
||||
0 /* outputUsesInterrupts */
|
||||
};
|
||||
|
||||
assert( minor <= 1 );
|
||||
if ( minor > 2 )
|
||||
return RTEMS_INVALID_NUMBER;
|
||||
|
||||
assert( minor <= 1 );
|
||||
if ( minor > 2 )
|
||||
return RTEMS_INVALID_NUMBER;
|
||||
|
||||
sc = rtems_termios_open (major, minor, arg,
|
||||
NULL,
|
||||
NULL,
|
||||
console_inbyte_nonblocking,
|
||||
console_write_support,
|
||||
0);
|
||||
sc = rtems_termios_open (major, minor, arg, &pollCallbacks );
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
@@ -420,31 +420,42 @@ rtems_device_driver console_open(
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_status_code sc;
|
||||
#if defined(CONSOLE_USE_INTERRUPTS)
|
||||
rtems_libio_open_close_args_t *args = arg;
|
||||
rtems_libio_open_close_args_t *args = arg;
|
||||
static const rtems_termios_callbacks intrCallbacks = {
|
||||
NULL, /* firstOpen */
|
||||
NULL, /* lastClose */
|
||||
NULL, /* pollRead */
|
||||
console_write_support, /* write */
|
||||
NULL, /* setAttributes */
|
||||
NULL, /* stopRemoteTx */
|
||||
NULL, /* startRemoteTx */
|
||||
0 /* outputUsesInterrupts */
|
||||
};
|
||||
#else
|
||||
static const rtems_termios_callbacks pollCallbacks = {
|
||||
NULL, /* firstOpen */
|
||||
NULL, /* lastClose */
|
||||
console_inbyte_nonblocking, /* pollRead */
|
||||
console_write_support, /* write */
|
||||
NULL, /* setAttributes */
|
||||
NULL, /* stopRemoteTx */
|
||||
NULL, /* startRemoteTx */
|
||||
0 /* outputUsesInterrupts */
|
||||
};
|
||||
#endif
|
||||
|
||||
assert( minor <= 1 );
|
||||
if ( minor > 2 )
|
||||
return RTEMS_INVALID_NUMBER;
|
||||
assert( minor <= 1 );
|
||||
if ( minor > 2 )
|
||||
return RTEMS_INVALID_NUMBER;
|
||||
|
||||
#if defined(CONSOLE_USE_INTERRUPTS)
|
||||
sc = rtems_termios_open (major, minor, arg,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
console_write_support,
|
||||
0);
|
||||
sc = rtems_termios_open (major, minor, arg, &intrCallbacks);
|
||||
|
||||
console_termios_data[ minor ] = args->iop->data1;
|
||||
console_termios_data[ minor ] = args->iop->data1;
|
||||
#else
|
||||
sc = rtems_termios_open (major, minor, arg,
|
||||
NULL,
|
||||
NULL,
|
||||
console_inbyte_nonblocking,
|
||||
console_write_support,
|
||||
0);
|
||||
sc = rtems_termios_open (major, minor, arg, &pollCallbacks);
|
||||
#endif
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
|
||||
Reference in New Issue
Block a user