home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.1 (Developer) [x86] / NeXT Step 3.1 Intel dev.cdr.dmg / NextDeveloper / Headers / bsd / dev / i386 / kmreg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-30  |  7.1 KB  |  254 lines

  1. /*    @(#)kmreg.h    1.0    10/12/87    (c) 1987 NeXT    */
  2.  
  3. /* 
  4.  **********************************************************************
  5.  * HISTORY
  6.  * 12-Oct-87  John Seamons (jks) at NeXT
  7.  *    Created.
  8.  * 29 Dec-87  Leo Hourvitz (leo) at NeXT
  9.  *    KMREG_H
  10.  *
  11.  **********************************************************************
  12.  */
  13.  
  14. #ifndef KMREG_H
  15. #define KMREG_H
  16.  
  17. #import <sys/types.h>
  18. #import <sys/ioctl.h>
  19. #import <sys/tty.h>
  20.  
  21. #define    KMIOCEXISTING    _IO('k', 0)        /* use existing window */
  22. #define    KMIOCPOPUP    _IO('k', 1)        /* popup new window */
  23. #define    KMIOCRESTORE    _IO('k', 2)        /* restore background */
  24. #define    KMIOCDUMPLOG    _IO('k', 3)        /* dump message log */
  25. #define    KMIOCGFLAGS    _IOR('k', 4, int)    /* return km.flags value */
  26. #define KMIOCDRAWRECT    _IOW('k', 5, struct km_drawrect)  /* Draw rect from bits */
  27. #define KMIOCERASERECT    _IOW('k', 6, struct km_drawrect)  /* Erase a rect. */
  28. #define KMIOSLEDSTATES    _IOW('k', 7, int)    /* Turn LED's on and off. */
  29.  
  30. /* Colors for fg, bg in struct km_drawrect */
  31. #define KM_COLOR_WHITE        0
  32. #define KM_COLOR_LTGRAY        1
  33. #define KM_COLOR_DKGRAY        2
  34. #define KM_COLOR_BLACK        3
  35.  
  36. /*
  37.  * The data to be rendered is treated as a pixmap of 2 bit pixels.
  38.  * The most significant bits of each byte is
  39.  * the leftmost pixel in that byte.  Pixel values are
  40.  * assigned as described above.
  41.  *
  42.  * Each scanline should start on a 4 pixel boundry within the bitmap,
  43.  * and should be a multiple of 4 pixels in length.
  44.  *
  45.  * For the KMIOCERASERECT call, 'data' should be an integer set to the 
  46.  * color to be used for the clear operation (data.fill).
  47.  * A rect at (x,y) measuring 'width' by 'height' will be cleared to 
  48.  * the specified value.
  49.  */
  50. struct km_drawrect {
  51.     unsigned short x;    /* Upper left corner of rect to be imaged. */
  52.     unsigned short y;
  53.     unsigned short width;    /* Width and height of rect to be imaged, in pixels */
  54.     unsigned short height;
  55.     union {
  56.         void *bits;    /* Pointer to 2 bit per pixel raster data. */
  57.         int   fill;    /* Const color for erase operation. */
  58.     } data;
  59.         
  60. };
  61.  
  62. #define    POPUP_Y        223            /* where popup window goes */
  63.  
  64. /* popup window styles */
  65. #define    POPUP_NOM    0            /* nominal style */
  66. #define    POPUP_ALERT    1            /* alert style */
  67. #define    POPUP_FULL    2            /* nom, but draw full screen */
  68.  
  69. /*
  70.  * Keyboard bus commands and responses.
  71.  * 0 <= adrs <= 15; 15 is broadcast; mouse addresses are odd.
  72.  */
  73. #define    KM_RESET        0x0f000000
  74. #define    KM_SET_ADRS(adrs)    (0xef000000 | ((adrs) << 16))
  75. #define    KM_READ_VERS(adrs)    (0xf0000000 | ((adrs) << 24))
  76. #define    KM_POLL(adrs)        (0x10000000 | ((adrs) << 24))
  77. #define    KM_SET_LEDS(adrs,leds)    (0x00000000 | ((adrs) << 24) | ((leds) << 16))
  78. #define    KM_LED_LEFT        1
  79. #define    KM_LED_RIGHT        2
  80.  
  81. /* format of data returned by keyboard & mouse */
  82. struct keyboard {
  83.     u_int    : 16,
  84.         valid : 1,
  85. #if    defined(i386)
  86.         control : 1,
  87.         shift_left : 1,
  88.         shift_right : 1,
  89.         command_left : 1,
  90.         command_right : 1,
  91.         alt_left : 1,
  92.         alt_right : 1,
  93. #else
  94.         alt_right : 1,
  95.         alt_left : 1,
  96.         command_right : 1,
  97.         command_left : 1,
  98.         shift_right : 1,
  99.         shift_left : 1,
  100.         control : 1,
  101. #endif
  102.         up_down : 1,
  103. #define    KM_DOWN    0
  104. #define    KM_UP    1
  105.         key_code : 7;
  106. };
  107.  
  108. struct mouse {
  109.     u_int    : 16,
  110.         delta_y : 7,
  111.         button_right : 1,
  112.         delta_x : 7,
  113.         button_left : 1;
  114. };
  115.  
  116. union kybd_event {
  117.     int    data;
  118.     struct    keyboard k;
  119. };
  120.  
  121. union mouse_event {
  122.     int    data;
  123.     struct    mouse m;
  124. };
  125.  
  126. struct km {
  127.     union    kybd_event kybd_event;
  128.     union    kybd_event autorepeat_event;
  129.     short    x, y;
  130. #if defined(MONITOR)
  131.     /* No backing store support in ROM monitor. */
  132.     short    nc_tm, nc_lm, nc_w, nc_h;
  133.     int    store;
  134. #else    /* KERNEL */
  135.     short    nc_tm, nc_lm, nc_w, nc_w2, nc_h, nc_h2;
  136.     int    store, store2;
  137. #endif
  138.     int    fg, bg;
  139.     short    ansi;
  140.     short    *cp;
  141. #define    KM_NP        3
  142.     short    p[KM_NP];
  143.     volatile short flags;
  144. #define    KMF_INIT    0x0001
  145. #define    KMF_AUTOREPEAT    0x0002
  146. #define    KMF_STOP    0x0004
  147. #define    KMF_SEE_MSGS    0x0008
  148. #define    KMF_PERMANENT    0x0010
  149. #define    KMF_ALERT    0x0020
  150. #define    KMF_HW_INIT    0x0040
  151. #define    KMF_MON_INIT    0x0080
  152.  
  153. #if defined(MONITOR)
  154. #define    KMF_CURSOR    0x0100
  155. #define    KMF_NMI        0x0200
  156. #else    /* KERNEL */
  157. /* Assorted stuff for kernel console support */
  158. #define    KMF_ALERT_KEY    0x0100
  159. #define    KMF_CURSOR    0x0200
  160. #define    KMF_ANIM_RUN    0x0400
  161.     short    save;
  162. #define    KM_NSAVE    8
  163.     short    save_flags[KM_NSAVE];
  164.     struct    tty *save_tty[KM_NSAVE];
  165.     short    showcount;
  166. #endif    /* KERNEL */
  167. };
  168.  
  169. /*
  170.  * Data layout for console device.
  171.  */
  172. struct km_console_info
  173. {
  174.     int    pixels_per_word;    /* Pixels per 32 bit word: 16, 4, 2, or 1 */
  175.     int    bytes_per_scanline;
  176.     int    dspy_w;            /* Visible display width in pixels */
  177.     int    dspy_max_w;        /* Display width in pixels */
  178.     int    dspy_h;            /* Visible display height in pixels */
  179. #define KM_CON_ON_NEXTBUS    1    /* flag_bits: Console is NextBus device */
  180.     int    flag_bits;        /* Vendor and NeXT flags */
  181.     int    color[4];        /* Bit pattern for white thru black */
  182. #define KM_HIGH_SLOT    6        /* highest possible console slot. */
  183.     char    slot_num;        /* Slot of console device */
  184.     char    fb_num;            /* Logical frame buffer in slot for console */
  185.     char    byte_lane_id;        /* A value of 1, 4, or 8 */
  186.     int    start_access_pfunc;    /* P-code run before each FB access */
  187.     int    end_access_pfunc;    /* P-code run after each FB access */
  188.     struct    {        /* Frame buffer related addresses to be mapped */
  189.             int    phys_addr;
  190.             int    virt_addr;
  191.             int    size;
  192. #define KM_CON_MAP_ENTRIES    6
  193. #define KM_CON_PCODE        0
  194. #define KM_CON_FRAMEBUFFER    1
  195. #define KM_CON_BACKINGSTORE    2
  196.         } map_addr[KM_CON_MAP_ENTRIES];
  197.     int    access_stack;
  198. };
  199.  
  200. #if    KERNEL
  201. struct km km;
  202. extern char *mach_title;
  203. int alert_key;
  204. /*
  205.  * The following struct describes the memory layout of the console device, for I/O 
  206.  * purposes.  This structure is by default initialized to support the lowest common 
  207.  * denominator, the 2 bit display.
  208.  */
  209. struct km_console_info km_coni;
  210.  
  211. /* Convenient defs into this structure. */
  212. #define KM_NPPW        km_coni.pixels_per_word
  213. #define KM_WHITE    km_coni.color[0]
  214. #define KM_LT_GRAY    km_coni.color[1]
  215. #define KM_DK_GRAY    km_coni.color[2]
  216. #define KM_BLACK    km_coni.color[3]
  217. #define KM_VIDEO_W    km_coni.dspy_w
  218. #define KM_VIDEO_MW    km_coni.dspy_max_w
  219. #define KM_VIDEO_H    km_coni.dspy_h
  220. #define KM_P_VIDEOMEM    km_coni.map_addr[KM_CON_FRAMEBUFFER].virt_addr
  221. #define KM_VIDEO_NBPL    km_coni.bytes_per_scanline
  222. #define KM_BACKING_STORE    km_coni.map_addr[KM_CON_BACKINGSTORE].virt_addr
  223. #define KM_BACKING_SIZE    km_coni.map_addr[KM_CON_BACKINGSTORE].size
  224. #define KM_PCODE_TABLE    km_coni.map_addr[KM_CON_PCODE].virt_addr
  225.  
  226. #endif    KERNEL
  227. #if defined(MONITOR)
  228. /* Convenient defs into this structure, for the ROM monitor. */
  229. #define KM_NPPW        mg->km_coni.pixels_per_word
  230. #define KM_WHITE    mg->km_coni.color[0]
  231. #define KM_LT_GRAY    mg->km_coni.color[1]
  232. #define KM_DK_GRAY    mg->km_coni.color[2]
  233. #define KM_BLACK    mg->km_coni.color[3]
  234. #define KM_VIDEO_W    mg->km_coni.dspy_w
  235. #define KM_VIDEO_MW    mg->km_coni.dspy_max_w
  236. #define KM_VIDEO_H    mg->km_coni.dspy_h
  237. #define KM_VIDEO_NBPL    mg->km_coni.bytes_per_scanline
  238. #define KM_P_VIDEOMEM    mg->km_coni.map_addr[KM_CON_FRAMEBUFFER].virt_addr
  239. #define KM_BACKING_STORE    mg->km_coni.map_addr[KM_CON_BACKINGSTORE].virt_addr
  240. #define KM_BACKING_SIZE    mg->km_coni.map_addr[KM_CON_BACKINGSTORE].size
  241. #define KM_PCODE_TABLE    mg->km_coni.map_addr[KM_CON_PCODE].virt_addr
  242.  
  243. #define KM_DEFAULT_STORE    (P_MAINMEM + 0x100000)
  244. #define KM_DEFAULT_STORE_SIZE    0x100000
  245.  
  246. #endif    /* MONITOR */
  247.  
  248. #endif KMREG_H
  249.  
  250.  
  251.  
  252.  
  253.  
  254.