File indexing completed on 2025-05-11 08:24:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #ifdef HAVE_CONFIG_H
0030 #include "config.h"
0031 #endif
0032
0033 #include <tmacros.h>
0034 #include <termios.h>
0035 #include <rtems/termiostypes.h>
0036 #include <rtems/dumpbuf.h>
0037
0038
0039 void ppp_test_driver_set_rx(const char *expected, size_t len);
0040 void pppasyncattach(void);
0041 int pppopen(struct rtems_termios_tty *tty);
0042 int pppclose(struct rtems_termios_tty *tty);
0043 int pppread(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args);
0044 int pppwrite(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args);
0045 int pppioctl(struct rtems_termios_tty *tty, rtems_libio_ioctl_args_t *args);
0046 int pppinput(int c, struct rtems_termios_tty *tty);
0047 int pppstart(struct rtems_termios_tty *tp, int len);
0048
0049
0050
0051
0052
0053 static struct rtems_termios_linesw pppdisc = {
0054 pppopen, pppclose, pppread, pppwrite,
0055 pppinput, pppstart, pppioctl, NULL
0056 };
0057
0058 const char *RXExpected;
0059 size_t RXLength;
0060
0061 void ppp_test_driver_set_rx( const char *expected, size_t len )
0062 {
0063 RXExpected = expected;
0064 RXLength = len;
0065 }
0066
0067 void pppasyncattach(void)
0068 {
0069 rtems_termios_linesw[PPPDISC] = pppdisc;
0070 }
0071
0072 int pppopen(struct rtems_termios_tty *tty)
0073 {
0074 puts( "pppopen called" );
0075 return 0;
0076 }
0077
0078 int pppclose(struct rtems_termios_tty *tty)
0079 {
0080 puts( "pppclose called" );
0081 return 0;
0082 }
0083
0084 int pppread(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args)
0085 {
0086 puts( "pppread called" );
0087
0088 rtems_termios_enqueue_raw_characters( tty, (char *)RXExpected, RXLength );
0089
0090 RXExpected = NULL;
0091 RXLength = 0;
0092 return 0;
0093 }
0094
0095 int pppwrite(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args)
0096 {
0097 int maximum = rw_args->count;
0098 char *out_buffer = rw_args->buffer;
0099
0100 printf( "pppwrite called - %d bytes\n", maximum );
0101 rtems_print_buffer( (unsigned char *) out_buffer, maximum );
0102 rw_args->bytes_moved = maximum;
0103 rtems_termios_dequeue_characters( tty, 1 );
0104 return 0;
0105 }
0106
0107 int pppioctl(struct rtems_termios_tty *tty, rtems_libio_ioctl_args_t *args)
0108 {
0109 puts( "pppioctl called" );
0110 return 0;
0111 }
0112
0113 int pppinput(int c, struct rtems_termios_tty *tty)
0114 {
0115 printf( "pppinput called - with (%c)\n", c );
0116 return 0;
0117 }
0118
0119 int pppstart(struct rtems_termios_tty *tp, int len)
0120 {
0121 puts( "pppstart called" );
0122 return 0;
0123 }
0124
0125