home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 024 / psi110g.zip / EAGLE.H < prev    next >
C/C++ Source or Header  |  1994-04-17  |  5KB  |  130 lines

  1. #ifndef _EAGLE_H
  2. #define _EAGLE_H
  3.   
  4. #ifndef _GLOBAL_H
  5. #include "global.h"
  6. #endif
  7.   
  8. #ifndef _MBUF_H
  9. #include "mbuf.h"
  10. #endif
  11.   
  12. #ifndef _IFACE_H
  13. #include "iface.h"
  14. #endif
  15.   
  16. /* Hardware-dependent routines for the EAGLE card for the PC
  17.  * This card contains a Zilog 8530 only - no modem!
  18.  */
  19. #define EGMAX   1       /* One card max */
  20. #define AX_MTU  512
  21. #define INTMASK 0x21        /* Intel 8259 interrupt controller mask */
  22.   
  23. struct EGTAB {
  24.     INTERRUPT (*oldvec) __ARGS((void)); /* Original interrupt vector contents */
  25.     int16 addr;     /* Base I/O address */
  26.     unsigned vec;       /* Vector */
  27.     long ints;      /* Interrupt count */
  28. };
  29. extern struct EGTAB Eagle[];
  30.   
  31. /* Register offset info, specific to the EAGLE
  32.  * E.g., to read the data port on channel A, use
  33.  *  inportb(egchan[dev].base + CHANA + DATA)
  34.  */
  35. #define CHANB       0   /* Base of channel B regs */
  36. #define CHANA       2   /* Base of channel A regs */
  37.   
  38. /* 8530 ports on each channel */
  39. #define CTL 0
  40. #define DATA    1
  41. #define DMACTRL     4   /* Base of channel + 4 */
  42.   
  43. /* EAGLE DMA/INTERRUPT CONTROL REGISTER */
  44. #define DMAPORT     0   /* 0 = Data Port */
  45. #define INTPORT     1   /* 1 = Interrupt Port */
  46. #define DMACHANA    0   /* 0 = DMA on CHANNEL A */
  47. #define DMACHANB    2   /* 1 = DMA on Channel B */
  48. #define DMADISABLE  0   /* 0 = DMA disabled */
  49. #define DMAENABLE   4   /* 1 = DMA enabled */
  50. #define INTDISABLE  0   /* 0 = Interrupts disabled */
  51. #define INTENABLE   8   /* 1 = Interrupts enabled */
  52. #define INTACKTOG   10  /* 1 = INT ACK TOGGLE */
  53.   
  54.   
  55. struct egchan {
  56.     long rxints;        /* Receiver interrupts */
  57.     long txints;        /* Transmitter interrupts */
  58.     long exints;        /* External/status interrupts */
  59.     long spints;        /* Special receiver interrupts */
  60.   
  61.     int enqueued;       /* Packets actually forwarded */
  62.     int rxframes;       /* Number of Frames Actally Received */
  63.     int toobig;     /* Giant receiver packets */
  64.     int crcerr;     /* CRC Errors */
  65.     int aborts;     /* Receiver aborts */
  66.     int rovers;     /* Receiver Overruns */
  67.   
  68.     char status;        /* Copy of R0 at last external interrupt */
  69.     struct mbuf *rcvbuf;    /* Buffer for current rx packet */
  70.     int16 bufsiz;       /* Size of rcvbuf */
  71.     char *rcp;      /* Pointer into rcvbuf */
  72.   
  73.     struct mbuf *sndq;  /* Packets awaiting transmission */
  74.     int16 sndcnt;       /* Number of packets on sndq */
  75.     struct mbuf *sndbuf;    /* Current buffer being transmitted */
  76.     char tstate;        /* Tranmsitter state */
  77. #define IDLE    0       /* Transmitter off, no data pending */
  78. #define ACTIVE  1       /* Transmitter on, sending data */
  79. #define UNDERRUN 2      /* Transmitter on, flushing CRC */
  80. #define FLAGOUT 3       /* CRC sent - attempt to start next frame */
  81. #define DEFER 4         /* Receive Active - DEFER Transmit */
  82.     char rstate;        /* Set when !DCD goes to 0 (TRUE) */
  83. /* Normal state is ACTIVE if Receive enabled */
  84. #define RXERROR 2       /* Error -- Aborting current Frame */
  85. #define RXABORT 3       /* ABORT sequence detected */
  86. #define TOOBIG 4        /* too large a frame to store */
  87.     int dev;        /* Device number */
  88.     int16 base;     /* Base of I/O registers */
  89.     int16 stata;        /* address of Channel A status regs */
  90.     int16 statb;        /* address of Channel B status regs */
  91.     int16 dmactrl;      /* address of DMA/INTERRUPT reg on card */
  92.     int16 speed;        /* Line speed, bps */
  93.     char txdelay;       /* Transmit Delay 10 ms/cnt */
  94.     char persist;       /* Persistence (0-255) as a % */
  95.     char slotime;       /* Delay to wait on persistence hit */
  96.     char squeldelay;    /* Delay after XMTR OFF for squelch tail */
  97.     struct iface *iface;    /* Associated interface */
  98. };
  99. extern struct egchan Egchan[];
  100.   
  101.   
  102. #define OFF 0
  103. #define ON  1
  104. #define INIT    2
  105.   
  106. /* 8530 clock speed */
  107.   
  108. #define XTAL    ((long) 3686400L/2)   /* 32X clock constant */
  109.   
  110. /*************************************************************/
  111. /* TEMP FOR DEBUG ONLY - eliminates Divide by zero interrupt */
  112. /*             - preset for 1200 BAUD !!!!!!!!!!!!!! */
  113. /*************************************************************/
  114. #define TXCONST 1534             /* (XTAL/1200L)-2 */
  115. #define RXCONST 46           /* ((XTAL/32)/1200L)-2 */
  116.   
  117. /* Baud rate generator definitions */
  118. struct baudrate {
  119.     int16 speed;
  120.     char val;
  121. };
  122.   
  123. /* In eagle.c: */
  124. void egint __ARGS((int dev));
  125.   
  126. /* In eaglevec.asm: */
  127. INTERRUPT eg0vec __ARGS((void));
  128.   
  129. #endif  /* _EAGLE_H */
  130.