home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / driverkit / driverTypes.h < prev    next >
Text File  |  1993-06-30  |  5KB  |  213 lines

  1. /*     Copyright (c) 1991 NeXT Computer, Inc.  All rights reserved. 
  2.  *
  3.  * driverTypes.h - Data types and #defines for driverServer interface.
  4.  *
  5.  * HISTORY
  6.  * 05-June-91    Doug Mitchell at NeXT
  7.  *      Created. 
  8.  */
  9.  
  10. #ifndef    _DRIVERKIT_DRIVERTYPES_
  11. #define _DRIVERKIT_DRIVERTYPES_
  12.  
  13. #import <bsd/sys/types.h>
  14. #import <mach/port.h>
  15. #import <mach/mach_types.h>
  16. #import <architecture/arch_types.h>
  17. #import <driverkit/return.h>
  18. #import <objc/objc.h>
  19.  
  20. #ifndef    NULL
  21. #define    NULL    0
  22. #endif    NULL
  23.     
  24. /*
  25.  * Simple data types.
  26.  */
  27. typedef unsigned int     IOChannelCommand;
  28. typedef unsigned int    IOChannelEnqueueOption;
  29. typedef unsigned int     IOChannelDequeueOption;
  30. typedef unsigned char     IODescriptorCommand;
  31. typedef unsigned int    IODeviceNumber;
  32. typedef unsigned int     IOObjectNumber;
  33.  
  34. /*
  35.  * Machine-independent DMA channel status.
  36.  */
  37. typedef enum {
  38.     IO_None,            // no appropriate status
  39.     IO_Complete,            // DMA channel idle
  40.     IO_Running,            // DMA channel running 
  41.     IO_Underrun,            // under/overrun
  42.     IO_BusError,            // bus error
  43.     IO_BufferError,            // DMA buffer error
  44. } IODMAStatus;
  45.  
  46.  
  47. typedef enum {
  48.     IO_DMARead,            // device to memory
  49.     IO_DMAWrite            // memory to device
  50. } IODMADirection;
  51.  
  52. /*
  53.  * Machine-independent caching specification.
  54.  */
  55. typedef    enum {
  56.     IO_CacheOff,            // cache inhibit
  57.     IO_WriteThrough,
  58.     IO_CopyBack
  59. } IOCache;
  60.  
  61. /*
  62.  * A typoedef which distinguishes direct, indirect, and pseudo devices.
  63.  */
  64. typedef enum {
  65.     IO_DirectDevice,
  66.     IO_IndirectDevice,
  67.     IO_PseudoDevice
  68. } IODeviceStyle;
  69.  
  70. /*
  71.  * Indicates a range of values.  Used for memory regions, port regions, etc.
  72.  */
  73. typedef struct range {
  74.     unsigned int    start;
  75.     unsigned int    size;
  76. } IORange;
  77.  
  78. /*
  79.  * Map between #defined or enum'd constants and text description.
  80.  */
  81. typedef struct {
  82.     int value;
  83.     const char *name;
  84. } IONamedValue;
  85.  
  86. /*
  87.  * Value-to-string conversion arrays in libDriver.
  88.  */
  89. extern const IONamedValue IODMAStatusStrings[];        // for IODMAStatus
  90.  
  91. /*
  92.  * Specify DMA alignment.
  93.  * A value of 0 means no restriction for associated parameter.
  94.  */
  95. typedef struct {
  96.     unsigned    readStart;
  97.     unsigned    writeStart;
  98.     unsigned    readLength;
  99.     unsigned    writeLength;
  100. } IODMAAlignment;
  101.  
  102. #define IO_NULL_VM_TASK        ((vm_task_t)0)
  103.  
  104. /*
  105.  * Hardcoded IOSlotId for native devices.
  106.  */
  107. #define IO_NATIVE_SLOT_ID    ((IOSlotId)-1)
  108.  
  109. /*
  110.  * Hardcoded IODeviceType for slot devices.
  111.  */
  112. #define IO_SLOT_DEVICE_TYPE    ((IODeviceType)-1)
  113.  
  114. /*
  115.  * IOSlotId and IODeviceType for non-existent device.
  116.  */
  117. #define IO_NULL_SLOT_ID        ((IOSlotId)0)
  118. #define IO_NULL_DEVICE_TYPE    ((IODeviceType)0)
  119. #define IO_NULL_DEVICE_INDEX    ((IODeviceIndex)0)
  120.  
  121. /*
  122.  * Maximum sizes for IOMapSlot() and IOMapBoard().
  123.  */
  124. #define IO_MAX_BOARD_SIZE    (256 * 1024 * 1024)
  125. #define IO_MAX_NRW_SLOT_SIZE    (15 * 1024 * 1024)
  126. #define IO_MAX_SLOT_SIZE    (16 * 1024 * 1024)
  127.  
  128. /*
  129.  * Standard type for an ASCII name (e.g., deviceName, deviceType).
  130.  */
  131. #define IO_STRING_LENGTH    80
  132. typedef char IOString[IO_STRING_LENGTH];
  133.  
  134. /*
  135.  * Parameter name for get/set parameter RPCs.
  136.  */
  137. #define IO_MAX_PARAMETER_NAME_LENGTH    (64)
  138. typedef char IOParameterName[IO_MAX_PARAMETER_NAME_LENGTH];
  139.  
  140. /* 
  141.  * Actual data arrays passed in get/set parameter RPCs.
  142.  */
  143. #define IO_MAX_PARAMETER_ARRAY_LENGTH    (512)
  144. typedef int IOIntParameter[IO_MAX_PARAMETER_ARRAY_LENGTH];
  145. typedef char IOCharParameter[IO_MAX_PARAMETER_ARRAY_LENGTH];
  146.  
  147. #if    i386
  148. /*
  149.  * Pull in i386 (EISA) specific stuff.
  150.  */
  151.  
  152. #import <driverkit/i386/driverTypes.h>
  153. #endif    i386
  154.  
  155. /* 
  156.  * Values for IOChannelCommand.
  157.  */
  158. #define IO_CC_ENABLE_INTERRUPTS        0x00000001    // enable interrrupts
  159. #define IO_CC_DISABLE_INTERRUPTS    0x00000002    // disable interrupts
  160. #define IO_CC_CONNECT_FRAME_LOOP    0x00000004    // create DMA frame 
  161.                             //    loop
  162. #define IO_CC_DISCONNECT_FRAME_LOOP    0x00000008    // disconnect DMA frame
  163.                             //    loop
  164.  
  165. /*
  166.  * m68k only. 
  167.  */
  168. #define IO_CC_START_READ        0x00000008    // start DMA Read
  169. #define IO_CC_START_WRITE        0x00000010    // start DMA Write
  170. #define IO_CC_ABORT            0x00000020    // abort current 
  171.                             //   operation
  172. #define IO_CC_ENABLE_DEVICE_INTERRUPTS    0x00000040    // enable ints, device 
  173.                             //   level
  174. #define IO_CC_DISABLE_DEVICE_INTERRUPTS    0x00000080    // disable ints, device
  175.                             //   level
  176.  
  177. /*
  178.  * Used as channelNumber argument for commands which do not refer to a
  179.  * channel.
  180.  */
  181. #define IO_NO_CHANNEL    (-1)
  182.  
  183.  
  184. /*
  185.  * Values for IOChannelEnqueueOption.
  186.  */
  187. #define IO_CEO_END_OF_RECORD        0x00000001    // end of record
  188. #define IO_CEO_DESCRIPTOR_INTERRUPT    0x00000002    // generate descriptor 
  189.                             //    interrupt
  190. #define IO_CEO_ENABLE_INTERRUPTS    0x00000004    // enable interrupt
  191. #define IO_CEO_ENABLE_CHANNEL        0x00000008    // enable channel (m68k
  192.                             //    only)
  193. #define IO_CEO_DESCRIPTOR_COMMAND    0x00000010    // enable descriptor 
  194.                             // command (nrw only)
  195.  
  196. /*
  197.  * Values for IOChannelDequeueOption.
  198.  * IF IO_CDO_ALL is specified and the channel is running, CR_BUSY will be
  199.  * returned and all other options will be ignored.
  200.  */
  201. #define IO_CDO_DONE            0x00000001    // dequeue completed
  202.                             //   descriptors
  203. #define IO_CDO_ALL            0x00000002    // dequeue all 
  204.                             //   descriptors 
  205. #define IO_CDO_ENABLE_INTERRUPTS    0x00000004    // enable interrupt
  206. #define IO_CDO_ENABLE_INTERRUPTS_IF_EMPTY 0x00000008    // enable interrupt if
  207.                             // no more descriptors
  208.                             // can be dequeued
  209.  
  210. #define IO_NULL_DMA_ID    ((unsigned) 0)
  211.  
  212. #endif    _DRIVERKIT_DRIVERTYPES_
  213.