usrSerialOld.c
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:1k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* usrSerialOld.c - old (pre-tornado) serial device configuration file */
  2. /* Copyright 1984-1998 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01b,24feb99,pr   added control for PC_CONSOLE in IO initialization (SPR#23075)
  7. 01a,03jun98,ms   written
  8. */
  9. /*
  10. DESCRIPTION
  11. User configurable old (pre-tornado) serial device intialization.
  12. */
  13. /******************************************************************************
  14. *
  15. * usrSerialOldInit - initialize the serial ports
  16. */
  17. STATUS usrSerialOldInit (void)
  18.     {
  19.     char tyName [20];
  20.     int ix;
  21.     if (NUM_TTY > 0)
  22. {
  23. tyCoDrv (); /* install console driver */
  24. for (ix = 0; ix < NUM_TTY; ix++) /* create serial devices */
  25.     {
  26.     sprintf (tyName, "%s%d", "/tyCo/", ix);
  27.     (void) tyCoDevCreate (tyName, ix, 512, 512);
  28. #if  (!(defined(INCLUDE_PC_CONSOLE)))
  29.     if (ix == CONSOLE_TTY)
  30. consoleFd = open (tyName, O_RDWR, 0);
  31. #endif /* INCLUDE_PC_CONSOLE */
  32.     }
  33. /* set baud rate */
  34. (void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
  35. (void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);
  36. }
  37.     ioGlobalStdSet (STD_IN,  consoleFd);
  38.     ioGlobalStdSet (STD_OUT, consoleFd);
  39.     ioGlobalStdSet (STD_ERR, consoleFd);
  40.     return (OK);
  41.     }