home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-1.ZIP / GCOMM / ASISETV.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-14  |  2.8 KB  |  83 lines

  1. /* asisetv.c
  2. *
  3. * The Greenleaf Comm Library
  4. *
  5. * Copyright (C) 1985-1990 Greenleaf Software Inc.  All Rights Reserved.
  6. *
  7. *  int asisetv(port,addr8250,intn,addr8259,irq,brkdly,wmodem,wtime,rtime,
  8. *                   sh_ioad,sh_bmask)
  9. *  int port;            - Port 0..MAX_PORT
  10. *  unsigned addr8250;   - Absolute I/O Address of 8250 Type UART
  11. *  int intn;            - Interrupt Number (Refers to vector)
  12. *  unsigned addr8259;   - Absolute I/O Address of 8259 type interrupt
  13. *                         controller
  14. *  int irq;             - IRQ number for 8259 (IRQ1..IRQ8)
  15. *  int brkdly;          - Duration of break signal, multiple of 54.9ms 1..255
  16. *  int wmodem;          - YES or NO - Controls WAIT for CTS,DSR and CD
  17. *                         (polled mode)
  18. *  int wtime;           - Polled mode write timeout for asputc()
  19. *  int rtime;           - Polled mode Read Timeout for asgetc()
  20. *  unsigned sh_ioad;    - Absolute I/O Address of Status Port on Shared
  21. *                         hardware - make 0 if not shared hardware.
  22. *  unsigned sh_bmask;   - Bit mask for Shared Hardware Status Port to
  23. *                         indicate that this port has interrupted.
  24. *
  25. *
  26. * DESCRIPTION
  27. *  This function determines most of the hardware dependent parameters for
  28. *  the port.  These parameters will be used for all subsequent communications
  29. *  functions in the library.
  30. *
  31. * SIDE EFFECTS
  32. *  none.
  33. *
  34. * RETURNS
  35. *
  36. *
  37. *       Value           Meaning
  38. *     -------          --------
  39. *       ASSUCCESS       Successful
  40. *       ASINVPORT       Requested port is out of range
  41. *       ASINVPAR        Invalid parameter
  42. *       ASINUSE         Port already in use
  43. *
  44. * MODIFICATIONS
  45. *  19-MAY-1988  14:10:49.45  version 2.11
  46. *    Removed range checking of some parameters.
  47. */
  48. #include <stdio.h>
  49. #include "gf.h"
  50. #include "asiports.h"
  51.  
  52.  
  53. int GF_CONV asisetv(port,addr8250,intn,addr8259,irq,brkdly,wmodem,wtime,rtime,
  54.             sh_ioad,sh_bmask)
  55. int port,intn,irq,brkdly,wmodem,wtime,rtime;
  56. unsigned addr8250,addr8259,sh_ioad,sh_bmask;
  57. {
  58.  
  59.         if(port<0 || port>MAX_PORT)
  60.                 return(ASINVPORT);
  61.         if(_aschkcnl(port)!=NULL)
  62.                 return(ASINUSE);
  63.         as_8250port[port]=addr8250;
  64.         as_intnums[port]=intn;
  65.         if(!(addr8259==0x20)&&!(addr8259==0xA0)&&!(addr8259>=0x100&&
  66.              addr8259<=0x3ff))
  67.                 return (ASINVPAR);
  68.         as_8259ports[port]=addr8259;
  69.         if(irq<1||irq>8)
  70.                 return (ASINVPAR);
  71.         as_8259irq[port]=irq;
  72.         if(brkdly<1||brkdly>255)
  73.                 return (ASINVPAR);
  74.         as_brkdly[port]=brkdly;
  75.         as_wmodem[port]=wmodem;
  76.         as_wtime[port]=wtime;
  77.         as_rtime[port]=rtime;
  78.         as_shioad[port]=sh_ioad;
  79.         as_shbmask[port]=sh_bmask;
  80.         return(ASSUCCESS);
  81. }
  82.  
  83.