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 00029 #include <ipc/ipc.h> 00030 #include <ipc/services.h> 00031 #include <sysinfo.h> 00032 #include <async.h> 00033 #include <as.h> 00034 #include <align.h> 00035 #include <errno.h> 00036 00037 #include "fb.h" 00038 #include "sysio.h" 00039 #include "ega.h" 00040 #include "main.h" 00041 00042 void receive_comm_area(ipc_callid_t callid, ipc_call_t *call, void **area) 00043 { 00044 void *dest; 00045 00046 dest = as_get_mappable_page(IPC_GET_ARG2(*call)); 00047 if (ipc_answer_fast(callid, 0, (sysarg_t)dest, 0) == 0) { 00048 if (*area) 00049 as_area_destroy(*area); 00050 *area = dest; 00051 } 00052 } 00053 00054 int main(int argc, char *argv[]) 00055 { 00056 ipcarg_t phonead; 00057 int initialized = 0; 00058 00059 #ifdef FB_ENABLED 00060 if (sysinfo_value("fb.kind") == 1) { 00061 if (fb_init() == 0) 00062 initialized = 1; 00063 } 00064 #endif 00065 #ifdef EGA_ENABLED 00066 if (! initialized && sysinfo_value("fb.kind") == 2) { 00067 if (ega_init() == 0) 00068 initialized = 1; 00069 } 00070 #endif 00071 00072 if (!initialized) 00073 sysio_init(); 00074 00075 if (ipc_connect_to_me(PHONE_NS, SERVICE_VIDEO, 0, &phonead) != 0) 00076 return -1; 00077 00078 async_manager(); 00079 /* Never reached */ 00080 return 0; 00081 }