Text preview for : 174393-001_XENIX_286_Device_Driver_Guide_Nov84.pdf part of Intel 174393-001 XENIX 286 Device Driver Guide Nov84 Intel system3xx xenix-286 174393-001_XENIX_286_Device_Driver_Guide_Nov84.pdf



Back to : 174393-001_XENIX_286_Devi | Home

XENIX* 286
DEVICE DRIVER GUIDE

*XENIX is a trademark of Microsoft Corporation.




Copyright @ 1984, Intel Corporation
Intel Corporation, 3065 Bowers Avenue, Santa Clara. California 9505'
Order Number: 174393-001
XENIX* 286
DEVICE DRIVER GUIDE

Order Number: 174393-001



*XENIX is a trademark of Microsoft Corporation.




COPYright @ 1984 Intel Corporation
I Intel Corporation, 3065 Bowers Avenue, Santa Clara, California 95051 I
The information in this document is subject to change without notice.

Intel Corporation makes no warranty of any kind with regard to this material, including, but not limited to, the implied
warranties of merchantability and fitness for a particular purpose. Intel Corporation assumes no responsibility for any errors
that may appear in this document. Intel Corporation makes no commitment to update or to keep current the information
contained in this document.

Intel Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in an Intel product. No
other circuit patent licenses are implied.

Intel software products are copyrighted by and shall remain the property ofIntel Corporation. Use, duplication or disclosure is
subject to restrictions stated in Intel's software license, or as defined in ASPR 7-104.9 (a) (9),

No part of this document may be copied or reproduced in any form or by any means without prior written consent of Intel
Corporation.

The following are trademarks of Intel Corporation and its affiliates and may be used only to identify Intel products:


BITBUS im iRMX OpenNET
COMMputer iMDDX iSBC Plug-A-Bubble
CREDIT iMMX iSBX PROMPT
Data Pipeline Insite iSDM Promware
Genius intel iSXM QUEST
A QueX
1 intelBOS KEPROM
i Intelevision Library Manager Ripplemode
I2ICE inteligent Identifier MCS RMXJ80
ICE inteligent Programming Megachassis RUPI
iCS Intellec MICROMAINFRAME Seamless
iDBP Intellink MULTIBUS SLD
iDIS iOSP MULTICHANNEL SYSTEM 2000
iLBX iPDS MULTIMODULE UPI


XENIX is a trademark of Microsoft Corporation. Microsoft is a trademark of Microsoft Corporation. UNIX is a trademark of
Bell Laboratories.




REV. REVISION mSTORY DATE
-001 Original issue 11/84




ii 10/~4,
TABLE OF CONTENTS



CONTENTS
CHAPTER 1 PAGE
INTRODUCTION
Prerequisites 1-1
Manual Organization 1-1
Notation 1-2
CHAPTER 2
DRIVER FUNDAMENTALS
XENIX I/O Overview 2-1
Basic I/O Model 2-1
I/O Levels 2-2
Device Types 2-3
Driver Overview 2-3
Kernel Review 2-4
What Is the Kernel? 2-4
Privilege Levels 2-4
Memory Organization 2-4
Multiple Processes 2-5
Process Control 2-6
Interrupt Handling 2-7
Locking Out Interrupts 2-8
Device Identification 2-9
Device Driver Interface 2-11
Driver Files 2-12
Driver Support Routines 2-13
Physical I/O Routines 2-13
Accessing User Memory 2-14
CHAPTER 3
SIMPLE CHARACTER DRIVERS
Character Buffering 3-1
Driver Files 3-3
Driver Constants 3-3
Data Structures 3-4
Driver Procedures 3-5
ixxxinit Procedure 3-5
ixxxopen Procedure 3-5
ixxxclose Procedure 3-6
ixxxread Procedure 3-6
ixxxwrite Procedure 3-7
ixxxioctl Procedure 3-8
ixxxenq Procedure 3-8
ixxxstart Procedure 3-8
ixxxintr Procedure 3-9
Output Summary 3-10




iii
Table of Contents XENIX 286 Device Drivers



CONTENTS PAGE

CHAPTER 4
TERMINAL DRIVERS
tty Structure 4-2
Line Discipline Routines 4-2
ttinit 4-3
ttopen 4-4
ttclose 4-4
ttread 4-4
ttwrite 4-4
ttiocom 4-5
ttioctl 4-5
ttin 4-5
ttout 4-6
ttxput 4-6
Modem Control by Terminal Drivers 4-6
Driver Description 4-6
ixxxinit Procedure 4-7
ixxxparam Procedure 4-7
ixxxopen Procedure 4-8
ixxxclose Procedure 4-8
ixxxread Procedure 4-9
ixxxwrite Procedure 4-9
ixxxintr Procedure 4-9
ixxxproc Procedure 4-10
ixxxstart Procedure 4-11
ixxxioctl Procedure 4-11
iSBC 534 Driver 4-12
sys/h/i534.h Listing 4-12
sys/cfg/c534.c Listing 4-17
sys/io/i534.c Listing 4-18

CHAPTER 5
BLOCK DRIVERS
Block Buffering 5-2
Block Driver Overview 5-6
Driver Files 5-8
Driver Constants 5-8
Driver Data Structures 5-10
ixxxinit Procedure 5-11
ixxxopen Procedure 5-12
ixxxclose Procedure 5-13
ixxxstrategy Procedure 5-14
ixxxstart Procedure 5-15
ixxxintr Procedure 5-16
ixxxread and ixxxwrite Procedures 5-17
ixxxioctl Procedure 5-18




iv
XENIX 286 Device Drivers Table of Contents



CONTENTS PAGE

CHAPTER 6
ADDING DRIVERS TO THE CONFIGURATION
Editing the master file 6-2
Editing xenixconf 6-6
Editing the makefiles 6-7
Making aNew Kernel 6-7
Making the Device Special File 6-8
Adding Terminal Information 6-8
Executing the New Kernel 6-9
Deleting a Device Driver 6-9
APPENDIX A
MEMORY-MAPPED I/O FOR DRIVERS
Small Model Kernel A-I
Creating the Segment Descriptor A-I
The Peek Routines A-2
The Poke Routines A-3

APPENDIX B
CONVERTING DRIVERS FROM
RELEASE 1 TO RELEASE 3 OF XENIX 286
Terminal Drivers B-1
tty Structure B-1
Changes to Routines B-4
Line Discipline Routines B-6
The tty.h File B-6
Block Device Drivers B-9
Buff er Changes B-9
Addressing B-9

APPENDIX C
tty.h INCLUDE FILE
APPENDIX D
termio.h INCLUDE FILE

APPENDIX E
buf.h INCLUDE FILE
APPENDIX F
iobuf.h INCLUDE FILE
APPENDIX G
master FILE
APPENDIX H
xenixconf FILE
APPENDIX I
c.c FILE
APPENDIX J
RELATED PUBLICATIONS
INDEX




v
Table of Contents XENIX 286 Device Drivers



TABLES
TABLE TITLE PAGE

2-1 XENIX I/O Software 2-2
B-1 Changed tty Fields B-2
B-2 New tty Fields B-3
B-3 ixxxproc Commands B-4
B-4 Line Discipline Routines B-6
B-5 Input Modes Describing Basic Terminal Input Control B-7
B-6 Output Modes Specifying System Treatment of Output B-7
B-7 Control Modes Describing Hardware Control of the Terminal B-8
B-8 Line Discipline Modes Used to Control Terminal Function B-8


FIGURES
FIGURE TITLE PAGE

6-1 Device Table from sys/conf/master 6-2




vi
CHAPTER 1
INTRODUCTION


This manual describes how to write or modify device drivers for Intel's Release 3 of the
XENIX 286 Operating System. A device driver is a software module that controls an
input/output (I/O) device and provides a system-defined interface to the device.


Prereq u isites
This manual assumes that you, the reader, understand the C programming language and
basic programming concepts. This manual also assumes some knowledge of XENIX or
UNIX. If you are writing or modifying a specific driver, you should also understand any
hardware controlled by the driver.


Manual Organization
This manual contains these chapters:

1. Introduction: Prerequisites, manual organization, and notation.

2. Driver Fundamentals: XENIX I/O overview, device types, driver interface, driver
organization, kernel concepts, and kernel support routines.

3. Simple Character Drivers: Character buffering services and how to write a simple
character driver.

4. Terminal Drivers: Terminal support services and how to write a terminal driver.

5. Block Drivers: Block buffering, caching, and sorting services and how to write a
block driver.

6. Adding Drivers to the Configuration: How to modify the XENIX 286 system to
include your driver.


This manual contains these appendixes:

A. Memory-Mapped VO for Drivers: Procedures used for reading and writing device
registers that are mapped into the iAPX 286 main memory address space, rather
than the iAPX 286 I/O port address space.

B. Converting Drivers from Release 1 to Release 3 of XENIX 286: Hints and
guidelines for converting drivers written for Release 1 of Intel's XENIX 286
Operating System to Release 3.



1-1
Introduction XENIX 286 Device Drivers



C. tty.h Include File: definitions used by terminal drivers and other character
drivers.

D. termio.h Include File: additional definitions used by terminal drivers.

E. buf.h Include File: definition of block buffer headers used for block I/O.

F. iobuf.h Include File: definition of static headers (one per block device) that
reference lists of block buffer headers for block I/O.

G. master File: configuration file to be edited when defining a new device driver.

H. xenixconf File: configuration file to be edited when adding or removing devices in
a configuration.

I. c.c File: C program file that contains the interfaces to all device drivers in the
configura t ion.

J. Related Publications: Descriptions and ordering information for all XENIX 286
Release 3 manuals and any other publications referenced by this manual.


Notation
These notational conventions are used in this manual: