udebug.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008 Jiri Svoboda
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 #include <udebug.h>
00036 #include <sys/types.h>
00037 #include <async.h>
00038 
00039 int udebug_begin(int phoneid)
00040 {
00041         return async_req_1_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_BEGIN);
00042 }
00043 
00044 int udebug_end(int phoneid)
00045 {
00046         return async_req_1_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_END);
00047 }
00048 
00049 int udebug_set_evmask(int phoneid, udebug_evmask_t mask)
00050 {
00051         return async_req_2_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_SET_EVMASK,
00052                 mask);
00053 }
00054 
00055 int udebug_thread_read(int phoneid, void *buffer, size_t n,
00056         size_t *copied, size_t *needed)
00057 {
00058         sysarg_t a_copied, a_needed;
00059         int rc;
00060 
00061         rc = async_req_3_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_THREAD_READ,
00062                 (sysarg_t)buffer, n, NULL, &a_copied, &a_needed);
00063 
00064         *copied = (size_t)a_copied;
00065         *needed = (size_t)a_needed;
00066 
00067         return rc;
00068 }
00069 
00070 int udebug_name_read(int phoneid, void *buffer, size_t n,
00071         size_t *copied, size_t *needed)
00072 {
00073         sysarg_t a_copied, a_needed;
00074         int rc;
00075 
00076         rc = async_req_3_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_NAME_READ,
00077                 (sysarg_t)buffer, n, NULL, &a_copied, &a_needed);
00078 
00079         *copied = (size_t)a_copied;
00080         *needed = (size_t)a_needed;
00081 
00082         return rc;
00083 }
00084 
00085 int udebug_areas_read(int phoneid, void *buffer, size_t n,
00086         size_t *copied, size_t *needed)
00087 {
00088         sysarg_t a_copied, a_needed;
00089         int rc;
00090 
00091         rc = async_req_3_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_AREAS_READ,
00092                 (sysarg_t)buffer, n, NULL, &a_copied, &a_needed);
00093 
00094         *copied = (size_t)a_copied;
00095         *needed = (size_t)a_needed;
00096 
00097         return rc;
00098 }
00099 
00100 int udebug_mem_read(int phoneid, void *buffer, uintptr_t addr, size_t n)
00101 {
00102         return async_req_4_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_MEM_READ,
00103             (sysarg_t)buffer, addr, n);
00104 }
00105 
00106 int udebug_args_read(int phoneid, thash_t tid, sysarg_t *buffer)
00107 {
00108         return async_req_3_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_ARGS_READ,
00109             tid, (sysarg_t)buffer);
00110 }
00111 
00112 int udebug_regs_read(int phoneid, thash_t tid, void *buffer)
00113 {
00114         return async_req_3_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_REGS_READ,
00115             tid, (sysarg_t)buffer);
00116 }
00117 
00118 int udebug_go(int phoneid, thash_t tid, udebug_event_t *ev_type,
00119     sysarg_t *val0, sysarg_t *val1)
00120 {
00121         sysarg_t a_ev_type;
00122         int rc;
00123 
00124         rc =  async_req_2_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_GO,
00125             tid, &a_ev_type, val0, val1);
00126 
00127         *ev_type = a_ev_type;
00128         return rc;
00129 }
00130 
00131 int udebug_stop(int phoneid, thash_t tid)
00132 {
00133         return async_req_2_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_STOP,
00134             tid);
00135 }
00136 

Generated on Thu Jun 2 07:45:46 2011 for HelenOS/USB by  doxygen 1.4.7