The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/i386at/kd_queue.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* 
    2  * Mach Operating System
    3  * Copyright (c) 1991,1990,1989 Carnegie Mellon University
    4  * All Rights Reserved.
    5  * 
    6  * Permission to use, copy, modify and distribute this software and its
    7  * documentation is hereby granted, provided that both the copyright
    8  * notice and this permission notice appear in all copies of the
    9  * software, derivative works or modified versions, and any portions
   10  * thereof, and that both notices appear in supporting documentation.
   11  * 
   12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   15  * 
   16  * Carnegie Mellon requests users of this software to return to
   17  * 
   18  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   19  *  School of Computer Science
   20  *  Carnegie Mellon University
   21  *  Pittsburgh PA 15213-3890
   22  * 
   23  * any improvements or extensions that they make and grant Carnegie Mellon
   24  * the rights to redistribute these changes.
   25  */
   26 /* 
   27  * HISTORY
   28  * $Log:        kd_queue.c,v $
   29  * Revision 2.5  91/05/14  16:27:39  mrt
   30  *      Correcting copyright
   31  * 
   32  * Revision 2.4  91/02/05  17:19:24  mrt
   33  *      Changed to new Mach copyright
   34  *      [91/02/01  17:45:50  mrt]
   35  * 
   36  * Revision 2.3  90/11/26  14:50:35  rvb
   37  *      jsb bet me to XMK34, sigh ...
   38  *      [90/11/26            rvb]
   39  *      Synched 2.5 & 3.0 at I386q (r1.5.1.3) & XMK35 (r2.3)
   40  *      [90/11/15            rvb]
   41  * 
   42  * Revision 2.2  90/05/21  13:27:29  dbg
   43  *      First checkin.
   44  *      [90/05/17  15:43:38  dbg]
   45  * 
   46  * Revision 1.5.1.2  90/02/28  15:50:29  rvb
   47  *      Fix numerous typo's in Olivetti disclaimer.
   48  *      [90/02/28            rvb]
   49  * 
   50  * Revision 1.5.1.1  90/01/08  13:30:48  rvb
   51  *      Add Olivetti copyright.
   52  *      [90/01/08            rvb]
   53  * 
   54  * Revision 1.5  89/07/17  10:41:36  rvb
   55  *      Olivetti Changes to X79 upto 5/9/89:
   56  *      [89/07/11            rvb]
   57  * 
   58  * Revision 1.1.1.1  89/04/27  12:35:55  kupfer
   59  * X79 from CMU.
   60  * 
   61  * Revision 1.4  89/03/09  20:06:54  rpd
   62  *      More cleanup.
   63  * 
   64  * Revision 1.3  89/02/26  12:42:46  gm0w
   65  *      Changes for cleanup.
   66  * 
   67  */
   68  
   69 /* **********************************************************************
   70  File:         kd_queue.c
   71  Description:  Event queue code for keyboard/display (and mouse) driver.
   72 
   73  $ Header: $
   74 
   75  Copyright Ing. C. Olivetti & C. S.p.A. 1989.
   76  All rights reserved.
   77 ********************************************************************** */
   78 /*
   79   Copyright 1988, 1989 by Olivetti Advanced Technology Center, Inc.,
   80 Cupertino, California.
   81 
   82                 All Rights Reserved
   83 
   84   Permission to use, copy, modify, and distribute this software and
   85 its documentation for any purpose and without fee is hereby
   86 granted, provided that the above copyright notice appears in all
   87 copies and that both the copyright notice and this permission notice
   88 appear in supporting documentation, and that the name of Olivetti
   89 not be used in advertising or publicity pertaining to distribution
   90 of the software without specific, written prior permission.
   91 
   92   OLIVETTI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
   93 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
   94 IN NO EVENT SHALL OLIVETTI BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
   95 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
   96 LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
   97 NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUR OF OR IN CONNECTION
   98 WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   99 */
  100 
  101 
  102 #include <i386at/kd_queue.h>
  103 
  104 /*
  105  * Notice that when adding an entry to the queue, the caller provides 
  106  * its own storage, which is copied into the queue.  However, when 
  107  * removing an entry from the queue, the caller is given a pointer to a 
  108  * queue element.  This means that the caller must either process the 
  109  * element or copy it into its own storage before unlocking the queue.
  110  *
  111  * These routines should be called only at a protected SPL.
  112  */
  113 
  114 #define q_next(index)   (((index)+1) % KDQSIZE)
  115 
  116 boolean_t
  117 kdq_empty(q)
  118         kd_event_queue *q;
  119 {
  120         return(q->firstfree == q->firstout);
  121 }
  122 
  123 boolean_t
  124 kdq_full(q)
  125         kd_event_queue *q;
  126 {
  127         return(q_next(q->firstfree) == q->firstout);
  128 }
  129 
  130 void
  131 kdq_put(q, ev)
  132         kd_event_queue *q;
  133         kd_event *ev;
  134 {
  135         kd_event *qp = q->events + q->firstfree;
  136 
  137         qp->type = ev->type;
  138         qp->time = ev->time;
  139         qp->value = ev->value;
  140         q->firstfree = q_next(q->firstfree);
  141 }
  142 
  143 kd_event *
  144 kdq_get(q)
  145         kd_event_queue *q;
  146 {
  147         kd_event *result = q->events + q->firstout;
  148 
  149         q->firstout = q_next(q->firstout);
  150         return(result);
  151 }
  152 
  153 void
  154 kdq_reset(q)
  155         kd_event_queue *q;
  156 {
  157         q->firstout = q->firstfree = 0;
  158 }

Cache object: 8771400b9f8cc974edc34cf4588805b3


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.