1*001b8e98Spooka /* $NetBSD: pud_sys.h,v 1.1 2007/11/20 18:47:06 pooka Exp $ */ 2*001b8e98Spooka 3*001b8e98Spooka /* 4*001b8e98Spooka * Copyright (c) 2007 Antti Kantee. All Rights Reserved. 5*001b8e98Spooka * 6*001b8e98Spooka * Development of this software was supported by the 7*001b8e98Spooka * Research Foundation of Helsinki University of Technology 8*001b8e98Spooka * 9*001b8e98Spooka * Redistribution and use in source and binary forms, with or without 10*001b8e98Spooka * modification, are permitted provided that the following conditions 11*001b8e98Spooka * are met: 12*001b8e98Spooka * 1. Redistributions of source code must retain the above copyright 13*001b8e98Spooka * notice, this list of conditions and the following disclaimer. 14*001b8e98Spooka * 2. Redistributions in binary form must reproduce the above copyright 15*001b8e98Spooka * notice, this list of conditions and the following disclaimer in the 16*001b8e98Spooka * documentation and/or other materials provided with the distribution. 17*001b8e98Spooka * 18*001b8e98Spooka * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 19*001b8e98Spooka * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20*001b8e98Spooka * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21*001b8e98Spooka * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22*001b8e98Spooka * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23*001b8e98Spooka * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24*001b8e98Spooka * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25*001b8e98Spooka * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26*001b8e98Spooka * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27*001b8e98Spooka * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28*001b8e98Spooka * SUCH DAMAGE. 29*001b8e98Spooka */ 30*001b8e98Spooka 31*001b8e98Spooka #ifndef _DEV_PUD_PUDSYS_H_ 32*001b8e98Spooka #define _DEV_PUD_PUDSYS_H_ 33*001b8e98Spooka 34*001b8e98Spooka #include <dev/putter/putter_sys.h> 35*001b8e98Spooka 36*001b8e98Spooka #include <dev/pud/pud_msgif.h> 37*001b8e98Spooka 38*001b8e98Spooka struct pud_touser { 39*001b8e98Spooka struct pud_req *pt_pdr; 40*001b8e98Spooka 41*001b8e98Spooka kcondvar_t pt_cv; 42*001b8e98Spooka TAILQ_ENTRY(pud_touser) pt_entries; 43*001b8e98Spooka }; 44*001b8e98Spooka 45*001b8e98Spooka struct pud_dev { 46*001b8e98Spooka dev_t pd_dev; 47*001b8e98Spooka struct putter_instance *pd_pi; 48*001b8e98Spooka 49*001b8e98Spooka kmutex_t pd_mtx; 50*001b8e98Spooka 51*001b8e98Spooka TAILQ_HEAD(,pud_touser) pd_waitq_req; 52*001b8e98Spooka TAILQ_HEAD(,pud_touser) pd_waitq_resp; 53*001b8e98Spooka kcondvar_t pd_waitq_req_cv; 54*001b8e98Spooka size_t pd_waitcount; 55*001b8e98Spooka 56*001b8e98Spooka kcondvar_t pd_draincv; 57*001b8e98Spooka 58*001b8e98Spooka LIST_ENTRY(pud_dev) pd_entries; 59*001b8e98Spooka 60*001b8e98Spooka uint64_t pd_nextreq; 61*001b8e98Spooka }; 62*001b8e98Spooka 63*001b8e98Spooka int pud_config(int, int, int); 64*001b8e98Spooka int pud_request(dev_t, void *, size_t, int, int); 65*001b8e98Spooka 66*001b8e98Spooka struct pud_dev *pud_dev2pud(dev_t); 67*001b8e98Spooka 68*001b8e98Spooka #endif /* _DEV_PUD_PUDSYS_H_ */ 69