ipc.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2006 Ondrej Palkovsky
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * - Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * - The name of the author may not be used to endorse or promote products
00015  *   derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00035 #ifndef __LIBIPC_IPC_H__
00036 #define __LIBIPC_IPC_H__
00037 
00038 #include <kernel/ipc/ipc.h>
00039 #include <kernel/ipc/irq.h>
00040 #include <libc.h>
00041 #include <types.h>
00042 #include <kernel/synch/synch.h>
00043 
00044 typedef sysarg_t ipcarg_t;
00045 typedef struct {
00046         ipcarg_t args[IPC_CALL_LEN];
00047         ipcarg_t in_phone_hash;
00048 } ipc_call_t ;
00049 typedef sysarg_t ipc_callid_t;
00050 
00051 typedef void (* ipc_async_callback_t)(void *private, int retval,
00052                                       ipc_call_t *data);
00053 
00054 #define ipc_call_sync_2(phoneid, method, arg1, arg2, res1, res2) ipc_call_sync_3((phoneid), (method), (arg1), (arg2), 0, (res1), (res2), 0)
00055 extern int ipc_call_sync_3(int phoneid, ipcarg_t method, ipcarg_t arg1,
00056                            ipcarg_t arg2, ipcarg_t arg3,
00057                            ipcarg_t *result1, ipcarg_t *result2, 
00058                            ipcarg_t *result3);
00059 
00060 
00061 extern int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1,
00062                          ipcarg_t *result);
00063 extern ipc_callid_t ipc_wait_cycle(ipc_call_t *call, uint32_t usec, int flags);
00064 extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *data, uint32_t usec);
00065 static inline ipc_callid_t ipc_wait_for_call(ipc_call_t *data)
00066 {
00067         return ipc_wait_for_call_timeout(data, SYNCH_NO_TIMEOUT);
00068 }
00069 extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *data);
00070 
00071 extern ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
00072                            ipcarg_t arg2);
00073 extern ipcarg_t ipc_answer(ipc_callid_t callid, ipc_call_t *call);
00074 
00075 #define ipc_call_async(phoneid,method,arg1,private, callback,can_preempt) (ipc_call_async_2(phoneid, method, arg1, 0, private, callback, can_preempt))
00076 extern void ipc_call_async_2(int phoneid, ipcarg_t method, ipcarg_t arg1,
00077                       ipcarg_t arg2, void *private,
00078                       ipc_async_callback_t callback, int can_preempt);
00079 extern void ipc_call_async_3(int phoneid, ipcarg_t method, ipcarg_t arg1,
00080                              ipcarg_t arg2, ipcarg_t arg3, void *private,
00081                              ipc_async_callback_t callback, int can_preempt);
00082 
00083 extern int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phone);
00084 extern int ipc_connect_me_to(int phoneid, int arg1, int arg2);
00085 extern int ipc_hangup(int phoneid);
00086 extern int ipc_register_irq(int irq, irq_code_t *code);
00087 extern int ipc_unregister_irq(int irq);
00088 extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method, ipcarg_t arg1);
00089 
00090 #endif
00091 
00092 

Generated on Sun Jun 18 18:00:18 2006 for HelenOS Userspace (ia64) by  doxygen 1.4.6