Annotation of kernel/bsd/dev/ppc/ev_private.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /******************************************************************************
                     26: 
                     27:     ev_private.h
                     28:     Internal defs for the events driver.  The contents of this module
                     29:     may need to be tweaked slightly from one architecture to the next.
                     30:     22 May 1992        Mike Paquette at NeXT Computers, Inc.
                     31:     
                     32:     Copyright 1992 NeXT, Inc.
                     33:     
                     34:     Modified:
                     35:     
                     36: 
                     37: ******************************************************************************/
                     38: 
                     39: #ifdef DRIVER_PRIVATE
                     40: 
                     41: #ifndef _PPC_DEV_EV_PRIVATE_
                     42: #define _PPC_DEV_EV_PRIVATE_
                     43: 
                     44: #import <bsd/dev/machine/event.h>
                     45: /*
                     46:  * Prototypes for functions implementing machine dependent code.
                     47:  */
                     48:  IOReturn
                     49: createEventShmem(      port_t task,                    // in
                     50:                        vm_size_t size,                 // in
                     51:                        struct vm_map **owner,          // out
                     52:                        vm_offset_t *owner_addr,        // out
                     53:                        vm_offset_t *shmem_addr );      // out
                     54:  IOReturn
                     55: destroyEventShmem(     port_t task,
                     56:                        struct vm_map *owner,
                     57:                        vm_size_t size,
                     58:                        vm_offset_t owner_addr,
                     59:                        vm_offset_t shmem_addr );
                     60: 
                     61: const char **defaultEventSources(void);
                     62: 
                     63: /* Initial cursor position */
                     64: #define INIT_CURSOR_X          100
                     65: #define INIT_CURSOR_Y          100
                     66: 
                     67: /* Default mouse click time and motion constants */
                     68: #define        EV_DCLICKTIME   30      /* Default ticks for a double-click */
                     69: #define        EV_DCLICKSPACE  3       /* Default pixel threshold for double-clicks */
                     70: 
                     71: /* Default Wait Cursor Timing Constants (in nanoseconds) */
                     72: #define DefaultWCSustain       300000000ULL    /* 0.3 seconds */       
                     73: #define DefaultWCFrameRate     75000000ULL     /* 13.3 frames/second */
                     74: #define DefaultWCThreshold     1200000000ULL   /* 1.2 seconds */
                     75: 
                     76: #define EV_STD_CURSOR  0
                     77: #define EV_WAITCURSOR  1
                     78: #define EV_WAITCURSOR_1        2
                     79: #define EV_WAITCURSOR_2        3
                     80: #define EV_MAXCURSOR   (EV_WAITCURSOR_2)
                     81: 
                     82: /* Default dim time is 5 minutes */
                     83: #define DAUTODIMPERIOD (EV_TICKS_PER_SEC*60*5)
                     84: /* Default dim level is one-fourth */
                     85: #define DDIMBRIGHTNESS (EV_SCREEN_MAX_BRIGHTNESS/4)
                     86: 
                     87: 
                     88: /* Where event numbers start */
                     89: #define INITEVENTNUM   13
                     90: #define        NULLEVENTNUM 0          /* The event number that never was */
                     91: 
                     92: #define MOVEDEVENTMASK \
                     93:        (NX_MOUSEMOVEDMASK | NX_LMOUSEDRAGGEDMASK | NX_RMOUSEDRAGGEDMASK )
                     94: #define COALESCEEVENTMASK \
                     95:        (MOVEDEVENTMASK | NX_MOUSEEXITEDMASK)
                     96: #define MOUSEEVENTMASK \
                     97:        (NX_LMOUSEDOWNMASK|NX_RMOUSEDOWNMASK|NX_LMOUSEUPMASK|NX_RMOUSEUPMASK)
                     98: #define PRESSUREEVENTMASK \
                     99:        (NX_LMOUSEDOWNMASK|NX_LMOUSEUPMASK|NX_MOUSEMOVEDMASK|NX_LMOUSEDRAGGEDMASK)
                    100: 
                    101: #define HARD_POWEROFF_MASK             (NX_COMMANDMASK|NX_ALTERNATEMASK)
                    102: /* Flags used to trigger debug operations in a DEBUG kernel */
                    103: #define PWR_BREAK_TO_DEBUGGER_MASK     (NX_CONTROLMASK)
                    104: #define BRIGHT_BREAK_TO_DEBUGGER_MASK  (NX_ALTERNATEMASK|NX_SHIFTMASK)
                    105: 
                    106: /* Flags which can modify meaning of special volume/brightness keys */
                    107: #define SPECIALKEYS_MODIFIER_MASK \
                    108:                        (NX_COMMANDMASK|NX_ALTERNATEMASK|NX_CONTROLMASK)
                    109: 
                    110: /* Bits in evg->eventFlags owned by keyboard devices */
                    111: #define KEYBOARD_FLAGSMASK \
                    112:        (NX_ALPHASHIFTMASK | NX_SHIFTMASK | NX_CONTROLMASK | NX_ALTERNATEMASK \
                    113:        | NX_COMMANDMASK | NX_NUMERICPADMASK | NX_HELPMASK | NX_NEXTCTLKEYMASK\
                    114:        | NX_NEXTLSHIFTKEYMASK | NX_NEXTRSHIFTKEYMASK | NX_NEXTLCMDKEYMASK \
                    115:        | NX_NEXTRCMDKEYMASK | NX_NEXTLALTKEYMASK | NX_NEXTRALTKEYMASK)
                    116: 
                    117: /* bits in evg->eventFlags owned by pointer devices */
                    118: #define POINTER_FLAGSMASK \
                    119:        (NX_STYLUSPROXIMITYMASK | NX_NONCOALSESCEDMASK)
                    120: #define SCREENTOKEN 256        /* Some non-zero token to or with screen number */
                    121: 
                    122: /* A macro to report if the event queue is not empty */
                    123: #define EventsInQueue() \
                    124:     (eventsOpen && (((EvGlobals*)evg)->LLEHead != ((EvGlobals*)evg)->LLETail))
                    125: 
                    126: /*
                    127:  * Internal types and definitions used to drive I/O thread operations.
                    128:  */
                    129: #define EV_IO_OP_MSG_ID        1
                    130: /* Private control message IDs used in talking to the EventListener thread */
                    131: typedef enum {
                    132:        EVENT_LISTENER_EXIT,
                    133:        EVENT_LISTENER_PING,
                    134:        EVENT_LISTENER_CALLBACK
                    135: } evIoOp;
                    136: 
                    137: // Parameters to use for Obj-C callback from I/O thread
                    138: typedef struct
                    139: {
                    140:        id              instance;       // Sender and reciever MUST be
                    141:        SEL             selector;       // in the same address space
                    142:        id              data;           // for this to work.
                    143: } evCallback;
                    144: 
                    145: // Union of all possible param structs we may want to pass
                    146: typedef union {
                    147:            evCallback  callback;       // EVENT_LISTENER_CALLBACK
                    148: } evIoOpParams;
                    149: 
                    150: typedef struct {
                    151:        evIoOp                  op;             // EVENT_LISTENER_EXIT, etc.
                    152:        id                      cmdLock;        // NXConditionLock. Exported
                    153:                                                //   methods sleep on this.
                    154:        IOReturn                *status;        // Returned status if any
                    155:        evIoOpParams            params;
                    156: } evIoOpBuf;
                    157: 
                    158: /*
                    159:  * Condition variable states for evIoOpBuf.cmdLock.
                    160:  */
                    161: #define CMD_INPROGRESS         1
                    162: #define CMD_DONE               2
                    163: 
                    164: /*
                    165:  * Mach message wrapper for threadOpBuf.
                    166:  */
                    167: typedef struct {
                    168:        msg_header_t    header;
                    169:        msg_type_t      type;
                    170:        evIoOpBuf       opBuf;
                    171: } evIoOpMsg;
                    172: 
                    173: /*
                    174:  * Low level communications buffers between the Event IO thread and
                    175:  * the Event Driver and clients.
                    176:  */
                    177: #define EV_INBUFLEN    512     // sizes for message buffers
                    178: #define EV_OUTBUFLEN   5120    // Tweak to match MiG max sizes
                    179: 
                    180: typedef struct {
                    181:        msg_header_t    hdr;
                    182:        char            data[EV_INBUFLEN - sizeof (msg_header_t)];
                    183: } EvInMsg;
                    184: 
                    185: typedef struct {
                    186:        msg_header_t    hdr;
                    187:        char            data[EV_OUTBUFLEN - sizeof (msg_header_t)];
                    188: } EvOutMsg;
                    189: 
                    190: struct _eventMsg {
                    191:     msg_header_t h;
                    192:     msg_type_t   t;
                    193: };
                    194: 
                    195: /******************************************************************************
                    196:     EvScreen
                    197:     This structure is used by the ev driver.
                    198:     It holds information about a single screen: how much private shmem it owns,
                    199:     where its private shmem region starts, its global bounds and four procedure
                    200:     vectors. This structure is allocated by the ev driver and is filled in
                    201:     when a driver calls ev_register_screen().
                    202: ******************************************************************************/
                    203: 
                    204: typedef volatile struct _evScreen {
                    205:     id instance;       /* Driver instance owning this screen. */
                    206:     void *shmemPtr;    /* Ptr to private shmem (if non-zero size) */
                    207:     int shmemSize;     /* Size of private shmem */
                    208:     Bounds bounds;     /* Screen's bounds in device coordinates */
                    209: } EvScreen;
                    210: 
                    211: /*
                    212:  *     We maintain a queue of EventSrc instances attached to the Event
                    213:  *     Driver.  These sources are dynamically checked in with the Event
                    214:  *     Driver.  When the driver is closed (as on Window Server exit) we
                    215:  *     post a relinquishOwnership:client message to the drivers.
                    216:  */
                    217: typedef struct {
                    218:        id                      eventSrc;
                    219: } eventSrcInfo;
                    220: 
                    221: typedef struct {
                    222:        eventSrcInfo            info;
                    223:        queue_chain_t           link;
                    224: } attachedEventSrc;
                    225: 
                    226: // No-op XPR stuff
                    227: #define xpr_ev_oc(x, a, b, c, d, e)
                    228: #define xpr_ev_shmemalloc(x, a, b, c, d, e)
                    229: #define xpr_ev_shmemlock(x, a, b, c, d, e)
                    230: #define xpr_ev_regscr(x, a, b, c, d, e)
                    231: #define xpr_ev_cursor(x, a, b, c, d, e)
                    232: #define xpr_ev_keybd(x, a, b, c, d, e)
                    233: #define xpr_evsrc(x, a, b, c, d, e)
                    234: #define xpr_ev_post(x, a, b, c, d, e)
                    235: #define xpr_ev_dspy(x, a, b, c, d, e)
                    236: 
                    237: #endif /* _PPC_DEV_EV_PRIVATE_ */
                    238: 
                    239: #endif /* DRIVER_PRIVATE */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.