|
|||
Prex Home / Browse Source - Prex Version: 0.9.0 |
|||
root/bsp/drv/include/dki.h/* [<][>][^][v][top][bottom][index][help] */INCLUDED FROM1 /* 2 * Copyright (c) 2005-2007, Kohsuke Ohtani 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the author nor the names of any co-contributors 14 * may be used to endorse or promote products derived from this software 15 * without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30 /* 31 * dki.h - Driver-Kernel Interface 32 */ 33 34 #ifndef _DKI_H 35 #define _DKI_H 36 37 #include <types.h> 38 #include <sys/queue.h> 39 #include <sys/dbgctl.h> 40 #include <sys/bootinfo.h> 41 #include <sys/ipl.h> 42 #include <sys/power.h> 43 #include <sys/capability.h> 44 #include <sys/device.h> 45 46 extern dkifn_t *dki_table; /* pointer to DKI function table */ 47 48 /* 49 * Device open mode 50 */ 51 #define DO_RDONLY 0x0 52 #define DO_WRONLY 0x1 53 #define DO_RDWR 0x2 54 #define DO_RWMASK 0x3 55 56 /* 57 * Return value of ISR 58 */ 59 #define INT_DONE 0 /* done */ 60 #define INT_ERROR 1 /* error */ 61 #define INT_CONTINUE 2 /* continue to IST */ 62 63 /* No IST for irq_attach() */ 64 #define IST_NONE ((void (*)(void *)) -1) 65 66 /* 67 * Event for sleep/wakeup 68 */ 69 struct event { 70 struct queue sleepq; /* queue for waiting thread */ 71 const char *name; /* pointer to event name string */ 72 }; 73 74 #define event_init(event, evt_name) \ 75 do { list_init(&(event)->sleepq); (event)->name = evt_name; } while (0) 76 77 /* 78 * Sleep result 79 */ 80 #define SLP_SUCCESS 0 81 #define SLP_BREAK 1 82 #define SLP_TIMEOUT 2 83 #define SLP_INVAL 3 84 #define SLP_INTR 4 85 86 /* 87 * DPC (Deferred Procedure Call) object 88 * The data member is private to kernel. 89 */ 90 struct dpc { 91 void *_data[5]; 92 }; 93 94 typedef struct dpc dpc_t; 95 96 /* 97 * Timer structure 98 * The data member is private to kernel. 99 */ 100 struct timer { 101 void *_data[10]; 102 }; 103 104 typedef struct timer timer_t; 105 106 __BEGIN_DECLS 107 device_t device_create(struct driver *, const char *, int); 108 int device_destroy(device_t); 109 device_t device_lookup(const char *); 110 int device_control(device_t, u_long, void *); 111 int device_broadcast(u_long, void *, int); 112 void *device_private(device_t); 113 114 int copyin(const void *, void *, size_t); 115 int copyout(const void *, void *, size_t); 116 int copyinstr(const void *, void *, size_t); 117 118 void *kmem_alloc(size_t); 119 void kmem_free(void *); 120 void *kmem_map(void *, size_t); 121 122 paddr_t page_alloc(psize_t); 123 void page_free(paddr_t, psize_t); 124 void page_reserve(paddr_t, psize_t); 125 126 irq_t irq_attach(int, int, int, int (*)(void *), void (*)(void *), void *); 127 void irq_detach(irq_t); 128 129 int spl0(void); 130 int splhigh(void); 131 void splx(int); 132 133 void timer_callout(timer_t *, u_long, void (*)(void *), void *); 134 void timer_stop(timer_t *); 135 u_long timer_delay(u_long); 136 u_long timer_ticks(void); 137 138 void sched_lock(void); 139 void sched_unlock(void); 140 int sched_tsleep(struct event *, u_long); 141 void sched_wakeup(struct event *); 142 void sched_dpc(struct dpc *, void (*)(void *), void *); 143 #define sched_sleep(event) sched_tsleep((event), 0) 144 145 int task_capable(cap_t); 146 int exception_post(task_t, int); 147 void machine_bootinfo(struct bootinfo **); 148 void machine_powerdown(int); 149 int sysinfo(int, void *); 150 void panic(const char *); 151 void printf(const char *, ...); 152 void dbgctl(int, void *); 153 __END_DECLS 154 155 #endif /* !_DKI_H */ /* [<][>][^][v][top][bottom][index][help] */ | |||
Copyright© 2005-2009 Kohsuke Ohtani |