home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / Vector18.lha / ParNetExample / defs.h next >
Encoding:
C/C++ Source or Header  |  1993-12-18  |  3.6 KB  |  146 lines

  1. /*
  2.  * $Header: DH0:src/asm/parallel/parnet/RCS/defs.h,v 1.1 92/08/27 17:12:42 Barnard Exp $
  3.  *
  4.  */
  5.  
  6. /*
  7.  * This code was originally written by Matthew Dillon and put into Public Domain
  8.  *
  9.  * All changes concerning the adaption of Matt's original code to the
  10.  * Vector Connection I/O board are © 1991-1993 by Henning Schmiedehausen
  11.  * All rights for this changes are reserved. The original code is Public Domain
  12.  *
  13.  * This code is distributed with the expressed written permission of Matthew
  14.  * Dillon (Thank you very much, Matt)
  15.  *
  16.  */
  17.  
  18.  
  19. /*
  20.  *  DEFS.H
  21.  *
  22.  *  ---- NOTE, ONLY IOREQUEST STRUCTURE IS PUBLIC, ALL OTHER STRUCTURES
  23.  *     **WILL** CHANGE WITHOUT NOTICE ----
  24.  */
  25.  
  26. #define PARNET_SRC
  27.  
  28. #include <exec/types.h>
  29. #include <devices/trackdisk.h>
  30. #include <devices/timer.h>
  31. #include <libraries/dos.h>
  32. #include <hardware/intbits.h>
  33. #include <exec/errors.h>
  34. #include <exec/interrupts.h>
  35. #include <stdio.h>
  36. #include <stdlib.h>
  37.  
  38. #define PORTNAME    "parnet.cfg"
  39.  
  40. #define MAXPKTSIZE  (8192+256)
  41.  
  42. #define IOF_QUEUED  0x02
  43. #define IOF_RUN     0x04
  44.  
  45. #define STRM_RESERVE    0x8000        /*    ports reserved for stream protocol */
  46. #define STRM_PORTS    512        /*    must be factor of 32           */
  47.  
  48. typedef unsigned char    ubyte;
  49. typedef unsigned short    uword;
  50. typedef unsigned long    ulong;
  51.  
  52. typedef struct Library    LIB;
  53. typedef struct MsgPort    PORT;
  54. typedef struct List    LIST;
  55. typedef struct Node    NODE;
  56. typedef struct MinNode    MNODE;
  57. typedef struct Task    Task;
  58. typedef struct Message    Message;
  59.  
  60. typedef struct timerequest IOT;
  61.  
  62. typedef long (*func_ptr)();
  63. typedef void (*func_void)();
  64.  
  65. typedef struct {
  66.     LIB     Lib;        /*    library node        */
  67.     ubyte   ParAddress;     /*    1-255            */
  68.     PORT    Port;        /*    task port        */
  69.     long    PLock[2];        /*    task lock        */
  70.     LIST    UnitList;        /*    active units (ports)    */
  71. } Device;
  72.  
  73. /*
  74.  *  Unit Core Structure (not user accessable) (do not access!)
  75.  */
  76.  
  77. typedef struct {
  78.     NODE    Node;        /*    link node   DO NOT MOVE */
  79.     func_void BeginIO;        /*    begin I/O   DO NOT MOVE */
  80.     func_void AbortIO;        /*    abort I/O   DO NOT MOVE */
  81.     func_void CloseFunc;
  82.     func_void DataFunc;     /*    low level packet data    */
  83.     uword   RefCnt;
  84.     uword   Port;        /*    core port ident     */
  85.     uword   Protocol;        /*    protocol id        */
  86.     ulong   DestAddr;        /*    destination  0 = self    */
  87.     uword   Flags;        /*    status flags        */
  88.     uword   State;        /*    (protocol private)      */
  89.     long    UnitLock[2];
  90.     LIST    PendIOR;        /*    pending read requests        */
  91.     LIST    PendIOW;        /*    pending write requests        */
  92.     LIST    PendCon;        /*    pending connect requests    */
  93.     LIST    PendLsn;        /*    pending listen requests     */
  94. } Unit;
  95.  
  96. /*
  97.  *  Io request structure and user defines
  98.  */
  99.  
  100. #include "devices/parnet.h"
  101.  
  102. typedef IOParReq    Iob;
  103.  
  104. /*
  105.  *  A low level network packet
  106.  */
  107.  
  108. typedef struct {
  109.     Message Msg;
  110.     Iob     *iob;            /*    IO req (unit_str)       */
  111.     Unit    *io_Unit;            /*    unit involved        */
  112.     ubyte   DestAddr;            /*    Destination machine    */
  113.     ubyte   Reserved;
  114.     uword   DestPort;            /*    Destination port no.    */
  115.     ulong   DLen1;            /*    Data Length        */
  116.     ulong   DLen2;            /*    Data Length        */
  117.     ubyte   *Data1;            /*    Data Pointer (lw algn)  */
  118.     ubyte   *Data2;            /*    Data Pointer (lw algn)  */
  119. } Packet;
  120.  
  121. /*
  122.  *  private public port to remember addr across closes.
  123.  */
  124.  
  125. typedef struct {
  126.     PORT    Port;
  127.     long    Address;
  128.     long    Timeout;
  129.     char    DebugBuf[32];
  130. } PubPort;
  131.  
  132. /*
  133.  *  Globals
  134.  */
  135.  
  136. extern long    ParLLTimeout;        /*    par.asm */
  137. extern Device    *DevBase;
  138. extern PubPort    *StickyPort;
  139.  
  140. extern Unit    *FindUnitForPort();
  141. extern Unit    *AllocUnit();
  142. extern Packet    *AllocParPacket();
  143. extern void    ReadConfig();
  144. extern void    WriteConfig();
  145.  
  146.