rtems_device_driver console_control(
	rtems_device_major_number	major,
	rtems_device_minor_number	minor,
	void				*arg)
{
	return rtems_termios_ioctl(arg);
}
Esempio n. 2
0
/*
 * Handle ioctl request.
 */
rtems_device_driver paux_control(
  rtems_device_major_number major,
  rtems_device_minor_number minor,
  void                      *arg
)
{
  rtems_libio_ioctl_args_t *args = arg;

  switch( args->command ) {
    default:
      return rtems_termios_ioctl (arg);
      break;

    case MW_UID_REGISTER_DEVICE:
      printk( "PS2 Mouse: registering\n" );
      mouse_parser_initialize( "ps2" );
      ps2_set_driver_handler( minor, mouse_parser_enqueue );
      break;

    case MW_UID_UNREGISTER_DEVICE:
/*
      unregister_mou_msg_queue( -1 );
*/
      ps2_set_driver_handler( minor, NULL );
      break;
  }
  args->ioctl_return = 0;
  return RTEMS_SUCCESSFUL;
}
/* ARGSUSED */
int
ppptioctl(struct rtems_termios_tty *tty, rtems_libio_ioctl_args_t *args)
{
/*    int                 i;	*/
    int                 error = RTEMS_SUCCESSFUL;
    ioctl_command_t     cmd   = args->command;
    caddr_t             data  = args->buffer;
    struct ppp_softc   *sc    = tty->t_sc;

    switch (cmd) {
    case RTEMS_IO_GET_ATTRIBUTES:
    case RTEMS_IO_SET_ATTRIBUTES:
    case RTEMS_IO_TCDRAIN:
    case RTEMS_IO_SNDWAKEUP:
    case RTEMS_IO_RCVWAKEUP:
    case TIOCGETD:
    case TIOCSETD:
        error = rtems_termios_ioctl(args);
	break;

    case PPPIOCSASYNCMAP:
	sc->sc_asyncmap[0] = *(u_int *)data;
	break;

    case PPPIOCGASYNCMAP:
	*(u_int *)data = sc->sc_asyncmap[0];
	break;

    case PPPIOCSRASYNCMAP:
	sc->sc_rasyncmap = *(u_int *)data;
	break;

    case PPPIOCGRASYNCMAP:
	*(u_int *)data = sc->sc_rasyncmap;
	break;

    case PPPIOCSXASYNCMAP:
	bcopy(data, sc->sc_asyncmap, sizeof(sc->sc_asyncmap));
	sc->sc_asyncmap[1] = 0;		    /* mustn't escape 0x20 - 0x3f */
	sc->sc_asyncmap[2] &= ~0x40000000;  /* mustn't escape 0x5e */
	sc->sc_asyncmap[3] |= 0x60000000;   /* must escape 0x7d, 0x7e */
	break;

    case PPPIOCGXASYNCMAP:
	bcopy(sc->sc_asyncmap, data, sizeof(sc->sc_asyncmap));
	break;

    default:
        rtems_bsdnet_semaphore_obtain();
	error = pppioctl(sc, cmd, data, 0, NULL);
        rtems_bsdnet_semaphore_release();
    }
    return error;
}
Esempio n. 4
0
/*
 * Handle ioctl request. This is a generic internal
 * routine to handle both devices.
 */
static rtems_device_driver tty_control( int port, void  *arg )
{
	rtems_libio_ioctl_args_t *args = arg;
	switch( args->command )
	{
	   default:
      return rtems_termios_ioctl (arg);
		break;
   }
 	args->ioctl_return = 0;
   return RTEMS_SUCCESSFUL;
}
Esempio n. 5
0
/******************************************************
  Name: console_control
  Input parameters: channel #, termios args
  Output parameters: -
  Description: Handle ioctl request
 *****************************************************/
rtems_device_driver console_control(
  rtems_device_major_number major,
  rtems_device_minor_number minor,
  void                    * arg
)
{
 	rtems_libio_ioctl_args_t *args = arg;

 	if (args->command == RTEMS_IO_SET_ATTRIBUTES)
 		SetAttributes (minor, (struct termios *)args->buffer);

	return rtems_termios_ioctl (arg);
}
/* console_control --
 *     Handle console device I/O control (IOCTL)
 *
 * PARAMETERS:
 *     major - major device number for console devices
 *     minor - minor device number for console
 *     arg - device ioctl argument
 *
 * RETURNS:
 *     RTEMS error code
 */
rtems_device_driver
console_control(rtems_device_major_number major,
                rtems_device_minor_number minor,
                void *arg)
{
    if (console_mode != CONSOLE_MODE_RAW)
    {
        return rtems_termios_ioctl (arg);
    }
    else
    {
        return RTEMS_SUCCESSFUL;
    }
}
Esempio n. 7
0
/*
 * Handle ioctl request.
 */
rtems_device_driver console_control(
  rtems_device_major_number major,
  rtems_device_minor_number minor,
  void *arg
)
{
  if ( minor > NUM_PORTS-1 )
    return RTEMS_INVALID_NUMBER;

  #if UARTS_USE_TERMIOS == 1
    return rtems_termios_ioctl( arg );
  #else
    return RTEMS_SUCCESSFUL;
  #endif
}
Esempio n. 8
0
static
rtems_device_driver my_pty_control(
  rtems_device_major_number major,
  rtems_device_minor_number minor,
  void                    * arg
)
{
  rtems_libio_ioctl_args_t *args = (rtems_libio_ioctl_args_t*)arg;
  struct winsize           *wp = (struct winsize*)args->buffer;
  pty_t                    *p = &telnet_ptys[minor];

  switch (args->command) {

    case TIOCGWINSZ:

      wp->ws_row = p->height;
      wp->ws_col = p->width;
      args->ioctl_return=0;
#if DEBUG & DEBUG_WH
      fprintf(stderr,
          "ioctl(TIOCGWINSZ), returning %ix%i\n",
          wp->ws_col,
          wp->ws_row);
#endif

      return RTEMS_SUCCESSFUL;

    case TIOCSWINSZ:
#if DEBUG & DEBUG_WH
      fprintf(stderr,
          "ioctl(TIOCGWINSZ), setting %ix%i\n",
          wp->ws_col,
          wp->ws_row);
#endif

      p->height = wp->ws_row;
      p->width  = wp->ws_col;
      args->ioctl_return=0;

      return RTEMS_SUCCESSFUL;

    default:

     break;
  }

  return rtems_termios_ioctl(arg);
}
Esempio n. 9
0
/*
 * Handle ioctl request.
 */
rtems_device_driver console_control(
  rtems_device_major_number major,
  rtems_device_minor_number minor,
  void                      *arg
)
{
/* does the BSP support break callbacks ? */
#if defined(BIOCSETBREAKCB) && defined(BIOCGETBREAKCB)
  rtems_libio_ioctl_args_t  *ioa=arg;
  switch (ioa->command) {
    case BIOCSETBREAKCB: return BSP_uart_set_break_cb(minor, ioa);
    case BIOCGETBREAKCB: return BSP_uart_get_break_cb(minor, ioa);
    default:             break;
  }
#endif
  return rtems_termios_ioctl (arg);
}
Esempio n. 10
0
/*
 * Handle ioctl request.
 */
rtems_device_driver console_control(
				    rtems_device_major_number major,
				    rtems_device_minor_number minor,
				    void                    * arg
				    )
{
  rtems_libio_ioctl_args_t *ioa=arg;

  switch (ioa->command) {
#if 0
  case CON8XX_IO_SET_TRM_CHAR:
    return scc_io_set_trm_char(minor, ioa);
#endif
  default:
    return rtems_termios_ioctl (arg);
    break;
  }
}
Esempio n. 11
0
/*
 * Handle ioctl request. This is a generic internal
 * routine to handle both devices.
 */
static rtems_device_driver serial_mouse_control_internal( int port, void  *arg )
{
	rtems_libio_ioctl_args_t *args = arg;
	switch( args->command )
	{
	   default:
      return rtems_termios_ioctl (arg);
		break;

      case MW_UID_REGISTER_DEVICE:
      printk( "SerialMouse: reg=%s\n", args->buffer );
      register_mou_msg_queue( args->buffer, BSP_UART_PORT );
		break;

      case MW_UID_UNREGISTER_DEVICE:
      unregister_mou_msg_queue( BSP_UART_PORT );
		break;

   }
 	args->ioctl_return = 0;
   return RTEMS_SUCCESSFUL;
}
/* PAGE
 *
 *  console_open
 *
 *  open a port as a termios console.
 *
 */
rtems_device_driver console_open(
  rtems_device_major_number major,
  rtems_device_minor_number minor,
  void                    * arg
)
{
	rtems_status_code status;
	rtems_libio_open_close_args_t *args = arg;
	rtems_libio_ioctl_args_t IoctlArgs;
	struct termios	Termios;
	rtems_termios_callbacks Callbacks;
	console_fns *c;

	/*
	 * Verify the port number is valid.
	 */
	if(minor>Console_Port_Count)
	{
		return RTEMS_INVALID_NUMBER;
	}

	/*
	 *  open the port as a termios console driver.
	 */
	c = Console_Port_Tbl[minor].pDeviceFns;
	Callbacks.firstOpen     = c->deviceFirstOpen;
	Callbacks.lastClose     = c->deviceLastClose;
	Callbacks.pollRead      = c->deviceRead;
	Callbacks.write         = c->deviceWrite;
	Callbacks.setAttributes = c->deviceSetAttributes;
	Callbacks.stopRemoteTx  =
		Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx;
	Callbacks.startRemoteTx =
		Console_Port_Tbl[minor].pDeviceFlow->deviceStartRemoteTx;
	Callbacks.outputUsesInterrupts = c->deviceOutputUsesInterrupts;
	status = rtems_termios_open ( major, minor, arg, &Callbacks);
	Console_Port_Data[minor].termios_data = args->iop->data1;

	if(minor!=Console_Port_Minor)
	{
		/*
		 * If this is not the console we do not want ECHO and
		 * so forth
		 */
		IoctlArgs.iop=args->iop;
		IoctlArgs.command=RTEMS_IO_GET_ATTRIBUTES;
		IoctlArgs.buffer=&Termios;
		rtems_termios_ioctl(&IoctlArgs);
		Termios.c_lflag=ICANON;
		IoctlArgs.command=RTEMS_IO_SET_ATTRIBUTES;
		rtems_termios_ioctl(&IoctlArgs);
	}

	if((args->iop->flags&LIBIO_FLAGS_READ) &&
	   Console_Port_Tbl[minor].pDeviceFlow &&
	   Console_Port_Tbl[minor].pDeviceFlow->deviceStartRemoteTx)
	{
		Console_Port_Tbl[minor].pDeviceFlow->deviceStartRemoteTx(minor);
	}

	return status;
}