Path: utzoo!utgpu!water!watmath!clyde!rutgers!cmcl2!nrl-cmf!ames!amdcad!sun!pitstop!sundc!seismo!uunet!steinmetz!itsgw!imagine!pawl21.pawl.rpi.edu!jesup From: jesup@pawl21.pawl.rpi.edu (Randell E. Jesup) Newsgroups: comp.sys.amiga Subject: Serial Port Expansion Summary: prototype structures Message-ID: <223@imagine.PAWL.RPI.EDU> Date: 18 Jan 88 06:17:04 GMT Sender: news@imagine.PAWL.RPI.EDU Reply-To: beowulf!lunge!jesup@steinmetz.UUCP Organization: RPI Public Access Workstation Lab - Troy, NY Lines: 127 /* This is a first cut at the in-memory data structures for the mapping and to identify what serial boards are in the system. I've tried to make sure it is easily expanded in the future. Comments and suggestions would be greatly appreciated, even more so from people doing serial expansion boards. These are by no means graven in silly putty. :-) Randell Jesup, Lunge Software, 13 Frear Ave, Troy, NY 12180 (518) 272-2942 */ /* The structures were designed for easy use with the Exec list-handling */ /* routines. */ /* I've tried to make these multiples of 8 bytes long. */ struct Mapping { struct Node MappingNode; /* ln_Name points to null-terminated name, allocmem'ed */ /* Flags should be null for now */ /* Note: prioritized node - 0 is default */ /* Type should be NT_UNKNOWN (0) */ struct Mapping *NextMapping; /* next mapping for same unit */ struct SerialUnit *Unit; /* which unit associated with */ WORD MapReserved; /* set to 0!!! */ }; struct SerialUnit { struct Node UnitNode; UWORD UnitNumber; ULONG Flags; /* NULL for now */ struct SerialUnit *NextUnit; /* all units of a board are linked */ struct SerialBoard *Board; /* links back to board */ struct Mapping *FirstMapping; /* mappings for this unit */ CPTR UnitData; /* for private use by driver */ CPTR UnitReserved; /* Future expansion */ }; struct SerialBoard { struct Node SerialNode; /* ln_Name should be set to device name */ /* Note: not with any path eg: myserial.device */ UWORD NumUnits; /* units on this board */ ULONG Flags; /* NULL for now */ ULONG ManufacturerID; ULONG ProductID; CPTR BoardAddress; /* address board was assigned */ CPTR BoardData; /* for driver private use */ struct Device *Device; /* null means not loaded */ UBYTE *DeviceName; /* file name of device to load */ /* include path. eg: DEVS:myserial.device */ struct SerialUnit *FirstUnit; /* The other units are linked through NextUnit to FirstUnit */ CPTR BoardReserved[2]; /* leave NULL!!!! */ }; struct MapperBase { struct Library MapLibrary; ULONG Flags; /* NULL for now */ struct Semaphore MapperAccess; /* MUST obtain before looking */ /* at or modifying lists */ struct List BoardList; struct List UnitList; struct List MappingList; /* Note: prioritized */ CPTR Reserved[4]; /* I want a bunch of space for expansion here */ }; #define MAPPERLIB_NAME "mapper.library" #define MAPPER_VERSION 33 /* * The MapperBase, SerialBoard and SerialUnit structure lists should * remain in memory after creation. The Mapping structures can be * released, note the name was obtained by AllocMem(strlen(name)+1, * MEMF_PUBLIC). Do not release a Mapping structure if the * MapReserved field is non-null (for safe expansion). * * To access any of the lists, you MUST obtain the semaphore!!!! * * All these structures should be in public memory. The private data * areas for the drivers are meant for data storage when the driver * isn't loaded (or hasn't been loaded yet.) * * The code attached to each icon in the expansion drawer should * create a SerialBoard structure for each board it is handling. * It should create a SerialUnit structure for each unit on the * board. Finally, it should create a Mapping structure for each * mapping specified in the icon. Note: the lists of Mappings are * prioritized, default is 0. * * The syntax for the tooltypes in the icons is: * := ; * /* should these be case sensitive? */ * /* if so, what about foreign languages? */ * /* should whitespace be allowed? */ * := [:]; * := Unit_=[|...] * * General flowchart for expansion drawer code: * * * { * * * } * * * { * * * * { * * { * * } * } * } * * * * * * * */ // Randell Jesup Lunge Software Development // Dedicated Amiga Programmer 13 Frear Ave, Troy, NY 12180 \\// beowulf!lunge!jesup@steinmetz.UUCP (518) 272-2942 \/ (uunet!steinmetz!beowulf!lunge!jesup) BIX: rjesup