00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include <ipc/services.h>
00030 #include <ipc/ns.h>
00031 #include <sysinfo.h>
00032 #include <async.h>
00033 #include <as.h>
00034 #include <align.h>
00035 #include <errno.h>
00036 #include <stdio.h>
00037
00038 #include "fb.h"
00039 #include "ega.h"
00040 #include "msim.h"
00041 #include "ski.h"
00042 #include "sgcn.h"
00043 #include "niagara.h"
00044 #include "main.h"
00045
00046 #define NAME "fb"
00047
00048 void receive_comm_area(ipc_callid_t callid, ipc_call_t *call, void **area)
00049 {
00050 void *dest;
00051
00052 dest = as_get_mappable_page(IPC_GET_ARG2(*call));
00053 if (async_answer_1(callid, EOK, (sysarg_t) dest) == 0) {
00054 if (*area)
00055 as_area_destroy(*area);
00056 *area = dest;
00057 }
00058 }
00059
00060 int main(int argc, char *argv[])
00061 {
00062 printf("%s: HelenOS Framebuffer service\n", NAME);
00063
00064 bool initialized = false;
00065 sysarg_t fb_present;
00066 sysarg_t fb_kind;
00067
00068 if (sysinfo_get_value("fb", &fb_present) != EOK)
00069 fb_present = false;
00070
00071 if (sysinfo_get_value("fb.kind", &fb_kind) != EOK) {
00072 printf("%s: Unable to detect framebuffer configuration\n", NAME);
00073 return -1;
00074 }
00075
00076 #ifdef FB_ENABLED
00077 if ((!initialized) && (fb_kind == 1)) {
00078 if (fb_init() == 0)
00079 initialized = true;
00080 }
00081 #endif
00082 #ifdef EGA_ENABLED
00083 if ((!initialized) && (fb_kind == 2)) {
00084 if (ega_init() == 0)
00085 initialized = true;
00086 }
00087 #endif
00088 #ifdef MSIM_ENABLED
00089 if ((!initialized) && (fb_kind == 3)) {
00090 if (msim_init() == 0)
00091 initialized = true;
00092 }
00093 #endif
00094 #ifdef SGCN_ENABLED
00095 if ((!initialized) && (fb_kind == 4)) {
00096 if (sgcn_init() == 0)
00097 initialized = true;
00098 }
00099 #endif
00100 #ifdef NIAGARA_ENABLED
00101 if ((!initialized) && (fb_kind == 5)) {
00102 if (niagara_init() == 0)
00103 initialized = true;
00104 }
00105 #endif
00106 #ifdef SKI_ENABLED
00107 if ((!initialized) && (fb_kind == 6)) {
00108 if (ski_init() == 0)
00109 initialized = true;
00110 }
00111 #endif
00112
00113 if (!initialized)
00114 return -1;
00115
00116 if (service_register(SERVICE_VIDEO) != EOK)
00117 return -1;
00118
00119 printf("%s: Accepting connections\n", NAME);
00120 async_manager();
00121
00122
00123 return 0;
00124 }