Changeset c621f4aa in mainline for uspace/srv/hid
- Timestamp:
- 2010-07-25T10:11:13Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 377cce8
- Parents:
- 24a2517 (diff), a2da43c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/srv/hid
- Files:
-
- 3 added
- 5 deleted
- 30 edited
-
adb_mouse/Makefile (modified) (2 diffs)
-
adb_mouse/adb_dev.c (modified) (1 diff)
-
char_mouse/Makefile (modified) (2 diffs)
-
char_mouse/chardev.c (modified) (1 diff)
-
char_mouse/proto/ps2.c (modified) (2 diffs)
-
console/Makefile (modified) (1 diff)
-
console/Makefile.build (deleted)
-
console/console.c (modified) (31 diffs)
-
console/gcons.c (modified) (20 diffs)
-
console/gcons.h (modified) (1 diff)
-
console/keybuffer.h (modified) (1 diff)
-
fb/Makefile (modified) (1 diff)
-
fb/Makefile.build (deleted)
-
fb/Makefile.common (deleted)
-
fb/ega.c (modified) (15 diffs)
-
fb/fb.c (modified) (7 diffs)
-
fb/main.c (modified) (6 diffs)
-
fb/msim.c (modified) (4 diffs)
-
fb/niagara.c (added)
-
fb/niagara.h (added)
-
fb/serial_console.c (modified) (19 diffs)
-
fb/serial_console.h (modified) (2 diffs)
-
fb/sgcn.c (modified) (1 diff)
-
kbd/Makefile (modified) (1 diff)
-
kbd/Makefile.build (deleted)
-
kbd/Makefile.common (deleted)
-
kbd/generic/kbd.c (modified) (3 diffs)
-
kbd/port/adb.c (modified) (1 diff)
-
kbd/port/chardev.c (modified) (1 diff)
-
kbd/port/gxemul.c (modified) (2 diffs)
-
kbd/port/msim.c (modified) (3 diffs)
-
kbd/port/niagara.c (added)
-
kbd/port/ns16550.c (modified) (4 diffs)
-
kbd/port/pl050.c (modified) (3 diffs)
-
kbd/port/sgcn.c (modified) (5 diffs)
-
kbd/port/ski.c (modified) (2 diffs)
-
kbd/port/sun.c (modified) (2 diffs)
-
kbd/port/z8530.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/adb_mouse/Makefile
r24a2517 rc621f4aa 28 28 29 29 USPACE_PREFIX = ../../.. 30 LIBS = $(LIBC_PREFIX)/libc.a31 30 EXTRA_CFLAGS = -Iinclude 32 33 OUTPUT = adb_ms 31 BINARY = adb_ms 34 32 35 33 SOURCES = \ … … 37 35 adb_dev.c 38 36 39 include ../../Makefile.common37 include $(USPACE_PREFIX)/Makefile.common -
uspace/srv/hid/adb_mouse/adb_dev.c
r24a2517 rc621f4aa 50 50 int adb_dev_init(void) 51 51 { 52 c har *input = "/dev/adb/mouse";52 const char *input = "/dev/adb/mouse"; 53 53 int input_fd; 54 54 -
uspace/srv/hid/char_mouse/Makefile
r24a2517 rc621f4aa 29 29 30 30 USPACE_PREFIX = ../../.. 31 LIBS = $(LIBC_PREFIX)/libc.a32 31 EXTRA_CFLAGS = -Iinclude 33 34 OUTPUT = char_ms 32 BINARY = char_ms 35 33 36 34 SOURCES = \ … … 39 37 chardev.c 40 38 41 include ../../Makefile.common39 include $(USPACE_PREFIX)/Makefile.common -
uspace/srv/hid/char_mouse/chardev.c
r24a2517 rc621f4aa 48 48 static int dev_phone; 49 49 50 #define NAME " kbd"50 #define NAME "char_mouse" 51 51 52 52 int mouse_port_init(void) 53 53 { 54 c har *input = "/dev/char/ps2b";54 const char *input = "/dev/char/ps2b"; 55 55 int input_fd; 56 56 -
uspace/srv/hid/char_mouse/proto/ps2.c
r24a2517 rc621f4aa 36 36 37 37 #include <stdio.h> 38 #include <mouse_port.h> 39 #include <char_mouse.h> 38 40 #include <mouse_proto.h> 39 #include <char_mouse.h>40 41 41 42 #define BUFSIZE 3 43 44 #define PS2_MOUSE_OUT_INIT 0xf4 45 #define PS2_MOUSE_ACK 0xfa 42 46 43 47 typedef struct { … … 67 71 int mouse_proto_init(void) 68 72 { 73 mouse_port_write(PS2_MOUSE_OUT_INIT); 69 74 return 0; 70 75 } -
uspace/srv/hid/console/Makefile
r24a2517 rc621f4aa 28 28 # 29 29 30 include Makefile.common 30 USPACE_PREFIX = ../../.. 31 BINARY = console 31 32 32 .PHONY: all clean 33 GENERIC_SOURCES = \ 34 console.c \ 35 keybuffer.c \ 36 gcons.c 33 37 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build PRECHECK=$(PRECHECK) 38 IMAGES = \ 39 gfx/helenos.ppm \ 40 gfx/nameic.ppm \ 41 gfx/cons_selected.ppm \ 42 gfx/cons_idle.ppm \ 43 gfx/cons_has_data.ppm \ 44 gfx/cons_kernel.ppm \ 45 gfx/anim_1.ppm \ 46 gfx/anim_2.ppm \ 47 gfx/anim_3.ppm \ 48 gfx/anim_4.ppm 37 49 38 clean: 39 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; 50 SOURCES = \ 51 $(GENERIC_SOURCES) \ 52 $(IMAGES) 53 54 include $(USPACE_PREFIX)/Makefile.common 55 56 %.o: %.ppm 57 $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) $< $@ -
uspace/srv/hid/console/console.c
r24a2517 rc621f4aa 47 47 #include <sys/mman.h> 48 48 #include <stdio.h> 49 #include <str ing.h>49 #include <str.h> 50 50 #include <sysinfo.h> 51 51 #include <event.h> … … 54 54 #include <vfs/vfs.h> 55 55 #include <fibril_synch.h> 56 #include <io/style.h> 57 #include <io/screenbuffer.h> 56 58 57 59 #include "console.h" 58 60 #include "gcons.h" 59 61 #include "keybuffer.h" 60 #include "screenbuffer.h" 62 61 63 62 64 #define NAME "console" … … 71 73 /** Information about framebuffer */ 72 74 struct { 73 int phone; /**< Framebuffer phone */74 ipcarg_t cols; /**< Framebuffer columns */75 ipcarg_t rows; /**< Framebuffer rows */76 i nt color_cap; /**< Color capabilities (FB_CCAP_xxx) */75 int phone; /**< Framebuffer phone */ 76 ipcarg_t cols; /**< Framebuffer columns */ 77 ipcarg_t rows; /**< Framebuffer rows */ 78 ipcarg_t color_cap; /**< Color capabilities (FB_CCAP_xxx) */ 77 79 } fb_info; 78 80 … … 99 101 /** Information on row-span yet unsent to FB driver. */ 100 102 struct { 101 size_t col; /**< Leftmost column of the span. */102 size_t row; /**< Row where the span lies. */103 size_t cnt; /**< Width of the span. */103 ipcarg_t col; /**< Leftmost column of the span. */ 104 ipcarg_t row; /**< Row where the span lies. */ 105 ipcarg_t cnt; /**< Width of the span. */ 104 106 } fb_pending; 105 107 … … 117 119 } 118 120 119 static void curs_goto( size_t x, size_t y)121 static void curs_goto(ipcarg_t x, ipcarg_t y) 120 122 { 121 123 async_msg_2(fb_info.phone, FB_CURSOR_GOTO, x, y); … … 147 149 } 148 150 149 static void set_style( int style)151 static void set_style(uint8_t style) 150 152 { 151 153 async_msg_1(fb_info.phone, FB_SET_STYLE, style); 152 154 } 153 155 154 static void set_color( int fgcolor, int bgcolor, int flags)156 static void set_color(uint8_t fgcolor, uint8_t bgcolor, uint8_t flags) 155 157 { 156 158 async_msg_3(fb_info.phone, FB_SET_COLOR, fgcolor, bgcolor, flags); 157 159 } 158 160 159 static void set_rgb_color( int fgcolor, int bgcolor)161 static void set_rgb_color(uint32_t fgcolor, uint32_t bgcolor) 160 162 { 161 163 async_msg_2(fb_info.phone, FB_SET_RGB_COLOR, fgcolor, bgcolor); … … 178 180 } 179 181 180 static int ccap_fb_to_con(i nt ccap_fb, int *ccap_con)182 static int ccap_fb_to_con(ipcarg_t ccap_fb, ipcarg_t *ccap_con) 181 183 { 182 184 switch (ccap_fb) { 183 case FB_CCAP_NONE: *ccap_con = CONSOLE_CCAP_NONE; break; 184 case FB_CCAP_STYLE: *ccap_con = CONSOLE_CCAP_STYLE; break; 185 case FB_CCAP_INDEXED: *ccap_con = CONSOLE_CCAP_INDEXED; break; 186 case FB_CCAP_RGB: *ccap_con = CONSOLE_CCAP_RGB; break; 187 default: return EINVAL; 188 } 189 185 case FB_CCAP_NONE: 186 *ccap_con = CONSOLE_CCAP_NONE; 187 break; 188 case FB_CCAP_STYLE: 189 *ccap_con = CONSOLE_CCAP_STYLE; 190 break; 191 case FB_CCAP_INDEXED: 192 *ccap_con = CONSOLE_CCAP_INDEXED; 193 break; 194 case FB_CCAP_RGB: 195 *ccap_con = CONSOLE_CCAP_RGB; 196 break; 197 default: 198 return EINVAL; 199 } 200 190 201 return EOK; 191 202 } … … 226 237 * 227 238 */ 228 static void cell_mark_changed( size_t col, size_t row)239 static void cell_mark_changed(ipcarg_t col, ipcarg_t row) 229 240 { 230 241 if (fb_pending.cnt != 0) { … … 253 264 { 254 265 bool flush_cursor = false; 255 266 256 267 switch (ch) { 257 268 case '\n': … … 297 308 async_msg_1(fb_info.phone, FB_SCROLL, 1); 298 309 } 299 310 300 311 if (cons == active_console && flush_cursor) 301 312 curs_goto(cons->scr.position_x, cons->scr.position_y); … … 327 338 328 339 if (cons != kernel_console) { 329 size_t x;330 size_t y;331 int rc = 0;332 333 340 async_serialize_start(); 334 341 … … 344 351 set_attrs(&cons->scr.attrs); 345 352 curs_visibility(false); 353 354 ipcarg_t x; 355 ipcarg_t y; 356 int rc = 0; 357 346 358 if (interbuffer) { 347 359 for (y = 0; y < cons->scr.size_y; y++) { … … 390 402 /* Ignore parameters, the connection is already opened */ 391 403 while (true) { 392 393 404 ipc_call_t call; 394 405 ipc_callid_t callid = async_get_call(&call); … … 433 444 static void mouse_events(ipc_callid_t iid, ipc_call_t *icall) 434 445 { 435 int button, press;436 int dx, dy;437 int newcon;438 439 446 /* Ignore parameters, the connection is already opened */ 440 447 while (true) { 441 442 448 ipc_call_t call; 443 449 ipc_callid_t callid = async_get_call(&call); 444 450 445 451 int retval; 446 452 447 453 switch (IPC_GET_METHOD(call)) { 448 454 case IPC_M_PHONE_HUNGUP: … … 450 456 return; 451 457 case MEVENT_BUTTON: 452 button = IPC_GET_ARG1(call); 453 press = IPC_GET_ARG2(call); 454 if (button == 1) { 455 newcon = gcons_mouse_btn(press); 458 if (IPC_GET_ARG1(call) == 1) { 459 int newcon = gcons_mouse_btn((bool) IPC_GET_ARG2(call)); 456 460 if (newcon != -1) 457 461 change_console(&consoles[newcon]); … … 460 464 break; 461 465 case MEVENT_MOVE: 462 dx = IPC_GET_ARG1(call); 463 dy = IPC_GET_ARG2(call); 464 gcons_mouse_move(dx, dy); 466 gcons_mouse_move((int) IPC_GET_ARG1(call), 467 (int) IPC_GET_ARG2(call)); 465 468 retval = 0; 466 469 break; … … 520 523 console_event_t ev; 521 524 fibril_mutex_lock(&input_mutex); 525 522 526 recheck: 523 527 while ((keybuffer_pop(&cons->keybuffer, &ev)) && (pos < size)) { … … 536 540 goto recheck; 537 541 } 542 538 543 fibril_mutex_unlock(&input_mutex); 539 544 } … … 542 547 { 543 548 console_event_t ev; 544 549 545 550 fibril_mutex_lock(&input_mutex); 551 546 552 recheck: 547 553 if (keybuffer_pop(&cons->keybuffer, &ev)) { … … 551 557 goto recheck; 552 558 } 559 553 560 fibril_mutex_unlock(&input_mutex); 554 561 } … … 580 587 ipcarg_t arg2; 581 588 ipcarg_t arg3; 582 583 int cons_ccap; 589 584 590 int rc; 585 591 … … 622 628 if (cons == active_console) { 623 629 async_req_0_0(fb_info.phone, FB_FLUSH); 624 625 630 curs_goto(cons->scr.position_x, cons->scr.position_y); 626 631 } … … 650 655 break; 651 656 case CONSOLE_GET_COLOR_CAP: 652 rc = ccap_fb_to_con(fb_info.color_cap, & cons_ccap);657 rc = ccap_fb_to_con(fb_info.color_cap, &arg1); 653 658 if (rc != EOK) { 654 659 ipc_answer_0(callid, rc); 655 660 continue; 656 661 } 657 arg1 = cons_ccap;658 662 break; 659 663 case CONSOLE_SET_STYLE: … … 714 718 return false; 715 719 } 716 720 717 721 kbd_phone = fd_phone(input_fd); 718 722 if (kbd_phone < 0) { … … 720 724 return false; 721 725 } 722 726 723 727 /* NB: The callback connection is slotted for removal */ 724 728 ipcarg_t phonehash; … … 727 731 return false; 728 732 } 729 733 730 734 async_new_connection(phonehash, 0, NULL, keyboard_events); 731 735 732 736 /* Connect to mouse device */ 733 737 mouse_phone = -1; 734 738 int mouse_fd = open("/dev/hid_in/mouse", O_RDONLY); 735 739 736 740 if (mouse_fd < 0) { 737 741 printf(NAME ": Notice - failed opening %s\n", "/dev/hid_in/mouse"); 738 742 goto skip_mouse; 739 743 } 740 744 741 745 mouse_phone = fd_phone(mouse_fd); 742 746 if (mouse_phone < 0) { … … 744 748 goto skip_mouse; 745 749 } 746 750 747 751 if (ipc_connect_to_me(mouse_phone, SERVICE_CONSOLE, 0, 0, &phonehash) != 0) { 748 752 printf(NAME ": Failed to create callback from mouse device\n"); … … 750 754 goto skip_mouse; 751 755 } 752 756 753 757 async_new_connection(phonehash, 0, NULL, mouse_events); 754 758 skip_mouse: 755 759 756 760 /* Connect to framebuffer driver */ 757 761 fb_info.phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_VIDEO, 0, 0); … … 760 764 return -1; 761 765 } 762 766 763 767 /* Register driver */ 764 768 int rc = devmap_driver_register(NAME, client_connection); … … 772 776 773 777 /* Synchronize, the gcons could put something in queue */ 774 ipcarg_t color_cap;775 778 async_req_0_0(fb_info.phone, FB_FLUSH); 776 779 async_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.cols, &fb_info.rows); 777 async_req_0_1(fb_info.phone, FB_GET_COLOR_CAP, &color_cap); 778 fb_info.color_cap = color_cap; 780 async_req_0_1(fb_info.phone, FB_GET_COLOR_CAP, &fb_info.color_cap); 779 781 780 782 /* Set up shared memory buffer. */ … … 827 829 async_serialize_start(); 828 830 gcons_redraw_console(); 829 set_ rgb_color(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND);831 set_style(STYLE_NORMAL); 830 832 screen_clear(); 831 833 curs_goto(0, 0); -
uspace/srv/hid/console/gcons.c
r24a2517 rc621f4aa 38 38 #include <stdio.h> 39 39 #include <sys/mman.h> 40 #include <str ing.h>40 #include <str.h> 41 41 #include <align.h> 42 42 #include <bool.h> … … 54 54 #define STATUS_HEIGHT 48 55 55 56 #define MAIN_COLOR 0xffffff 56 #define COLOR_MAIN 0xffffff 57 #define COLOR_FOREGROUND 0x202020 58 #define COLOR_BACKGROUND 0xffffff 59 60 extern char _binary_gfx_helenos_ppm_start[0]; 61 extern int _binary_gfx_helenos_ppm_size; 62 extern char _binary_gfx_nameic_ppm_start[0]; 63 extern int _binary_gfx_nameic_ppm_size; 64 65 extern char _binary_gfx_anim_1_ppm_start[0]; 66 extern int _binary_gfx_anim_1_ppm_size; 67 extern char _binary_gfx_anim_2_ppm_start[0]; 68 extern int _binary_gfx_anim_2_ppm_size; 69 extern char _binary_gfx_anim_3_ppm_start[0]; 70 extern int _binary_gfx_anim_3_ppm_size; 71 extern char _binary_gfx_anim_4_ppm_start[0]; 72 extern int _binary_gfx_anim_4_ppm_size; 73 74 extern char _binary_gfx_cons_selected_ppm_start[0]; 75 extern int _binary_gfx_cons_selected_ppm_size; 76 extern char _binary_gfx_cons_idle_ppm_start[0]; 77 extern int _binary_gfx_cons_idle_ppm_size; 78 extern char _binary_gfx_cons_has_data_ppm_start[0]; 79 extern int _binary_gfx_cons_has_data_ppm_size; 80 extern char _binary_gfx_cons_kernel_ppm_start[0]; 81 extern int _binary_gfx_cons_kernel_ppm_size; 57 82 58 83 static bool use_gcons = false; … … 82 107 static size_t active_console = 0; 83 108 84 s ize_t mouse_x;85 s ize_t mouse_y;86 87 bool btn_pressed;88 s ize_t btn_x;89 s ize_t btn_y;109 static ipcarg_t mouse_x = 0; 110 static ipcarg_t mouse_y= 0; 111 112 static bool btn_pressed = false; 113 static ipcarg_t btn_x = 0; 114 static ipcarg_t btn_y = 0; 90 115 91 116 static void vp_switch(int vp) … … 95 120 96 121 /** Create view port */ 97 static int vp_create( size_t x, size_t y, size_t width, size_t height)122 static int vp_create(ipcarg_t x, ipcarg_t y, ipcarg_t width, ipcarg_t height) 98 123 { 99 124 return async_req_2_0(fbphone, FB_VIEWPORT_CREATE, (x << 16) | y, … … 112 137 113 138 /** Transparent putchar */ 114 static void tran_putch(wchar_t ch, size_t col, size_t row)139 static void tran_putch(wchar_t ch, ipcarg_t col, ipcarg_t row) 115 140 { 116 141 async_msg_3(fbphone, FB_PUTCHAR, ch, col, row); … … 259 284 void gcons_mouse_move(ssize_t dx, ssize_t dy) 260 285 { 261 mouse_x = limit(mouse_x + dx, 0, xres); 262 mouse_y = limit(mouse_y + dy, 0, yres); 263 286 ssize_t nx = (ssize_t) mouse_x + dx; 287 ssize_t ny = (ssize_t) mouse_y + dy; 288 289 mouse_x = (size_t) limit(nx, 0, xres); 290 mouse_y = (size_t) limit(ny, 0, yres); 291 264 292 if (active_console != KERNEL_CONSOLE) 265 293 async_msg_2(fbphone, FB_POINTER_MOVE, mouse_x, mouse_y); 266 294 } 267 295 268 static int gcons_find_conbut(i nt x, int y)269 { 270 i nt status_start = STATUS_START + (xres - 800) / 2;296 static int gcons_find_conbut(ipcarg_t x, ipcarg_t y) 297 { 298 ipcarg_t status_start = STATUS_START + (xres - 800) / 2; 271 299 272 300 if ((y < STATUS_TOP) || (y >= STATUS_TOP + STATUS_HEIGHT)) … … 278 306 if (x >= status_start + (STATUS_WIDTH + STATUS_SPACE) * CONSOLE_COUNT) 279 307 return -1; 308 280 309 if (((x - status_start) % (STATUS_WIDTH + STATUS_SPACE)) < STATUS_SPACE) 281 310 return -1; 282 311 283 return (x - status_start) / (STATUS_WIDTH + STATUS_SPACE); 312 ipcarg_t btn = (x - status_start) / (STATUS_WIDTH + STATUS_SPACE); 313 314 if (btn < CONSOLE_COUNT) 315 return btn; 316 317 return -1; 284 318 } 285 319 … … 287 321 * 288 322 * @param state New state (true - pressed, false - depressed) 323 * 289 324 */ 290 325 int gcons_mouse_btn(bool state) 291 326 { 292 int conbut; 327 /* Ignore mouse clicks if no buttons 328 are drawn at all */ 329 if (xres < 800) 330 return -1; 293 331 294 332 if (state) { 295 conbut = gcons_find_conbut(mouse_x, mouse_y);333 int conbut = gcons_find_conbut(mouse_x, mouse_y); 296 334 if (conbut != -1) { 297 335 btn_pressed = true; … … 307 345 btn_pressed = false; 308 346 309 conbut = gcons_find_conbut(mouse_x, mouse_y);347 int conbut = gcons_find_conbut(mouse_x, mouse_y); 310 348 if (conbut == gcons_find_conbut(btn_x, btn_y)) 311 349 return conbut; … … 313 351 return -1; 314 352 } 315 316 353 317 354 /** Draw a PPM pixmap to framebuffer … … 321 358 * @param x Coordinate of upper left corner 322 359 * @param y Coordinate of upper left corner 323 */ 324 static void draw_pixmap(char *logo, size_t size, int x, int y) 325 { 326 char *shm; 327 int rc; 328 360 * 361 */ 362 static void draw_pixmap(char *logo, size_t size, ipcarg_t x, ipcarg_t y) 363 { 329 364 /* Create area */ 330 shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED |365 char *shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | 331 366 MAP_ANONYMOUS, 0, 0); 332 367 if (shm == MAP_FAILED) … … 336 371 337 372 /* Send area */ 338 rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm);373 int rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm); 339 374 if (rc) 340 375 goto exit; … … 356 391 } 357 392 358 extern char _binary_gfx_helenos_ppm_start[0];359 extern int _binary_gfx_helenos_ppm_size;360 extern char _binary_gfx_nameic_ppm_start[0];361 extern int _binary_gfx_nameic_ppm_size;362 363 393 /** Redraws console graphics */ 364 394 void gcons_redraw_console(void) 365 395 { 366 int i;367 368 396 if (!use_gcons) 369 397 return; 370 398 371 399 vp_switch(0); 372 set_rgb_color( MAIN_COLOR, MAIN_COLOR);400 set_rgb_color(COLOR_MAIN, COLOR_MAIN); 373 401 clear(); 374 402 draw_pixmap(_binary_gfx_helenos_ppm_start, … … 377 405 (size_t) &_binary_gfx_nameic_ppm_size, 5, 17); 378 406 407 unsigned int i; 379 408 for (i = 0; i < CONSOLE_COUNT; i++) 380 409 redraw_state(i); … … 393 422 static int make_pixmap(char *data, size_t size) 394 423 { 395 char *shm;396 int rc;397 int pxid = -1;398 399 424 /* Create area */ 400 shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED |425 char *shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | 401 426 MAP_ANONYMOUS, 0, 0); 402 427 if (shm == MAP_FAILED) … … 405 430 memcpy(shm, data, size); 406 431 432 int pxid = -1; 433 407 434 /* Send area */ 408 rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm);435 int rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm); 409 436 if (rc) 410 437 goto exit; … … 432 459 } 433 460 434 extern char _binary_gfx_anim_1_ppm_start[0];435 extern int _binary_gfx_anim_1_ppm_size;436 extern char _binary_gfx_anim_2_ppm_start[0];437 extern int _binary_gfx_anim_2_ppm_size;438 extern char _binary_gfx_anim_3_ppm_start[0];439 extern int _binary_gfx_anim_3_ppm_size;440 extern char _binary_gfx_anim_4_ppm_start[0];441 extern int _binary_gfx_anim_4_ppm_size;442 443 461 static void make_anim(void) 444 462 { 445 int an = async_req_1_0(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE]); 463 int an = async_req_1_0(fbphone, FB_ANIM_CREATE, 464 cstatus_vp[KERNEL_CONSOLE]); 446 465 if (an < 0) 447 466 return; 448 467 449 468 int pm = make_pixmap(_binary_gfx_anim_1_ppm_start, 450 ( int) &_binary_gfx_anim_1_ppm_size);469 (size_t) &_binary_gfx_anim_1_ppm_size); 451 470 async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 452 471 453 472 pm = make_pixmap(_binary_gfx_anim_2_ppm_start, 454 ( int) &_binary_gfx_anim_2_ppm_size);473 (size_t) &_binary_gfx_anim_2_ppm_size); 455 474 async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 456 475 457 476 pm = make_pixmap(_binary_gfx_anim_3_ppm_start, 458 ( int) &_binary_gfx_anim_3_ppm_size);477 (size_t) &_binary_gfx_anim_3_ppm_size); 459 478 async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 460 479 461 480 pm = make_pixmap(_binary_gfx_anim_4_ppm_start, 462 ( int) &_binary_gfx_anim_4_ppm_size);481 (size_t) &_binary_gfx_anim_4_ppm_size); 463 482 async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); 464 483 … … 467 486 animation = an; 468 487 } 469 470 extern char _binary_gfx_cons_selected_ppm_start[0];471 extern int _binary_gfx_cons_selected_ppm_size;472 extern char _binary_gfx_cons_idle_ppm_start[0];473 extern int _binary_gfx_cons_idle_ppm_size;474 extern char _binary_gfx_cons_has_data_ppm_start[0];475 extern int _binary_gfx_cons_has_data_ppm_size;476 extern char _binary_gfx_cons_kernel_ppm_start[0];477 extern int _binary_gfx_cons_kernel_ppm_size;478 488 479 489 /** Initialize nice graphical console environment */ … … 500 510 501 511 /* Create status buttons */ 502 size_t status_start = STATUS_START + (xres - 800) / 2;512 ipcarg_t status_start = STATUS_START + (xres - 800) / 2; 503 513 size_t i; 504 514 for (i = 0; i < CONSOLE_COUNT; i++) { … … 511 521 512 522 vp_switch(cstatus_vp[i]); 513 set_rgb_color( 0x202020, 0xffffff);523 set_rgb_color(COLOR_FOREGROUND, COLOR_BACKGROUND); 514 524 } 515 525 -
uspace/srv/hid/console/gcons.h
r24a2517 rc621f4aa 38 38 #include <sys/types.h> 39 39 40 void gcons_init(int phone);40 void gcons_init(int); 41 41 42 42 void gcons_redraw_console(void); 43 void gcons_change_console(size_t index);44 void gcons_notify_char(size_t index);43 void gcons_change_console(size_t); 44 void gcons_notify_char(size_t); 45 45 void gcons_in_kernel(void); 46 46 47 void gcons_notify_connect(size_t index);48 void gcons_notify_disconnect(size_t index);47 void gcons_notify_connect(size_t); 48 void gcons_notify_disconnect(size_t); 49 49 50 void gcons_mouse_move(ssize_t dx, ssize_t dy);50 void gcons_mouse_move(ssize_t, ssize_t); 51 51 int gcons_mouse_btn(bool state); 52 52 -
uspace/srv/hid/console/keybuffer.h
r24a2517 rc621f4aa 47 47 typedef struct { 48 48 console_event_t fifo[KEYBUFFER_SIZE]; 49 unsigned longhead;50 unsigned longtail;51 unsigned longitems;49 size_t head; 50 size_t tail; 51 size_t items; 52 52 } keybuffer_t; 53 53 -
uspace/srv/hid/fb/Makefile
r24a2517 rc621f4aa 28 28 # 29 29 30 include Makefile.common 30 USPACE_PREFIX = ../../.. 31 ROOT_PATH = $(USPACE_PREFIX)/.. 31 32 32 .PHONY: all clean 33 COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common 34 CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config 33 35 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build PRECHECK=$(PRECHECK) 36 BINARY = fb 37 37 38 clean: 39 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; 38 -include $(COMMON_MAKEFILE) 39 -include $(CONFIG_MAKEFILE) 40 41 SOURCES = \ 42 main.c \ 43 ppm.c 44 45 ifneq ($(UARCH),ia64) 46 SOURCES += \ 47 fb.c \ 48 font-8x16.c 49 EXTRA_CFLAGS += -DFB_ENABLED 50 endif 51 52 ifeq ($(UARCH),ia32) 53 SOURCES += \ 54 ega.c 55 EXTRA_CFLAGS += -DEGA_ENABLED 56 endif 57 58 ifeq ($(UARCH),ia64) 59 SOURCES += \ 60 ega.c \ 61 ski.c \ 62 serial_console.c 63 EXTRA_CFLAGS += -DSKI_ENABLED -DEGA_ENABLED 64 endif 65 66 ifeq ($(UARCH),amd64) 67 SOURCES += \ 68 ega.c 69 EXTRA_CFLAGS += -DEGA_ENABLED 70 endif 71 72 ifeq ($(UARCH),mips32) 73 SOURCES += \ 74 msim.c \ 75 serial_console.c 76 EXTRA_CFLAGS += -DMSIM_ENABLED 77 endif 78 79 ifeq ($(UARCH),sparc64) 80 ifeq ($(PROCESSOR),sun4v) 81 SOURCES += \ 82 niagara.c \ 83 serial_console.c 84 EXTRA_CFLAGS += -DNIAGARA_ENABLED 85 endif 86 87 ifeq ($(MACHINE),serengeti) 88 SOURCES += \ 89 sgcn.c \ 90 serial_console.c 91 EXTRA_CFLAGS += -DSGCN_ENABLED 92 endif 93 endif 94 95 EXTRA_CFLAGS += -D$(UARCH) 96 97 include $(USPACE_PREFIX)/Makefile.common -
uspace/srv/hid/fb/ega.c
r24a2517 rc621f4aa 28 28 29 29 /** @defgroup egafb EGA framebuffer 30 * @brief HelenOS EGA framebuffer.30 * @brief HelenOS EGA framebuffer. 31 31 * @ingroup fbs 32 32 * @{ 33 */ 33 */ 34 34 /** @file 35 35 */ … … 52 52 #include <io/style.h> 53 53 #include <io/color.h> 54 #include <io/screenbuffer.h> 54 55 #include <sys/types.h> 55 56 56 57 #include "ega.h" 57 #include "../console/screenbuffer.h"58 58 #include "main.h" 59 59 60 #define MAX_SAVED_SCREENS 256 60 #define MAX_SAVED_SCREENS 256 61 61 62 typedef struct saved_screen { 62 63 short *data; … … 65 66 saved_screen saved_screens[MAX_SAVED_SCREENS]; 66 67 67 #define EGA_IO_BASE ((ioport8_t *) 0x3d4) 68 #define EGA_IO_SIZE 2 69 70 int ega_normal_color = 0x0f; 71 int ega_inverted_color = 0xf0; 72 73 #define NORMAL_COLOR ega_normal_color 74 #define INVERTED_COLOR ega_inverted_color 68 #define EGA_IO_BASE ((ioport8_t *) 0x3d4) 69 #define EGA_IO_SIZE 2 75 70 76 71 /* Allow only 1 connection */ 77 72 static int client_connected = 0; 78 73 79 static unsigned int scr_width;80 static unsigned int scr_height;74 static sysarg_t scr_width; 75 static sysarg_t scr_height; 81 76 static uint8_t *scr_addr; 82 77 83 static unsigned int style; 84 85 static unsigned attr_to_ega_style(const attrs_t *a); 86 static uint8_t ega_glyph(wchar_t ch); 78 static uint8_t style_normal = 0xf0; 79 static uint8_t style_inverted = 0x0f; 80 static uint8_t style; 81 82 static uint8_t style_to_ega_style(uint8_t style) 83 { 84 switch (style) { 85 case STYLE_EMPHASIS: 86 return (style_normal | 0x04); 87 case STYLE_SELECTED: 88 return (style_inverted | 0x40); 89 case STYLE_INVERTED: 90 return style_inverted; 91 } 92 93 return style_normal; 94 } 95 96 static uint8_t color_to_ega_style(uint8_t fg_color, uint8_t bg_color, 97 uint8_t attr) 98 { 99 uint8_t style = (fg_color & 7) | ((bg_color & 7) << 4); 100 101 if (attr & CATTR_BRIGHT) 102 style |= 0x08; 103 104 return style; 105 } 106 107 static uint8_t rgb_to_ega_style(uint32_t fg, uint32_t bg) 108 { 109 return (fg > bg) ? style_inverted : style_normal; 110 } 111 112 static uint8_t attr_to_ega_style(const attrs_t *attr) 113 { 114 switch (attr->t) { 115 case at_style: 116 return style_to_ega_style(attr->a.s.style); 117 case at_idx: 118 return color_to_ega_style(attr->a.i.fg_color, 119 attr->a.i.bg_color, attr->a.i.flags); 120 case at_rgb: 121 return rgb_to_ega_style(attr->a.r.fg_color, attr->a.r.bg_color); 122 default: 123 return style_normal; 124 } 125 } 126 127 static uint8_t ega_glyph(wchar_t ch) 128 { 129 if (ch >= 0 && ch < 128) 130 return ch; 131 132 return '?'; 133 } 87 134 88 135 static void clrscr(void) … … 96 143 } 97 144 98 static void cursor_goto(unsigned int col, unsigned int row) 99 { 100 int ega_cursor; 101 102 ega_cursor = col + scr_width * row; 145 static void cursor_goto(sysarg_t col, sysarg_t row) 146 { 147 sysarg_t cursor = col + scr_width * row; 103 148 104 149 pio_write_8(EGA_IO_BASE, 0xe); 105 pio_write_8(EGA_IO_BASE + 1, ( ega_cursor >> 8) & 0xff);150 pio_write_8(EGA_IO_BASE + 1, (cursor >> 8) & 0xff); 106 151 pio_write_8(EGA_IO_BASE, 0xf); 107 pio_write_8(EGA_IO_BASE + 1, ega_cursor & 0xff);152 pio_write_8(EGA_IO_BASE + 1, cursor & 0xff); 108 153 } 109 154 110 155 static void cursor_disable(void) 111 156 { 112 uint8_t stat;113 114 157 pio_write_8(EGA_IO_BASE, 0xa); 115 stat = pio_read_8(EGA_IO_BASE + 1); 158 159 uint8_t stat = pio_read_8(EGA_IO_BASE + 1); 160 116 161 pio_write_8(EGA_IO_BASE, 0xa); 117 162 pio_write_8(EGA_IO_BASE + 1, stat | (1 << 5)); … … 120 165 static void cursor_enable(void) 121 166 { 122 uint8_t stat;123 124 167 pio_write_8(EGA_IO_BASE, 0xa); 125 stat = pio_read_8(EGA_IO_BASE + 1); 168 169 uint8_t stat = pio_read_8(EGA_IO_BASE + 1); 170 126 171 pio_write_8(EGA_IO_BASE, 0xa); 127 172 pio_write_8(EGA_IO_BASE + 1, stat & (~(1 << 5))); 128 173 } 129 174 130 static void scroll( int rows)131 { 132 unsignedi;133 175 static void scroll(ssize_t rows) 176 { 177 size_t i; 178 134 179 if (rows > 0) { 135 180 memmove(scr_addr, ((char *) scr_addr) + rows * scr_width * 2, … … 142 187 scr_width * scr_height * 2 + rows * scr_width * 2); 143 188 for (i = 0; i < -rows * scr_width; i++) 144 ((short *) scr_addr)[i] = ((style << 8 ) + ' ');145 } 146 } 147 148 static void printchar(wchar_t c, unsigned int col, unsigned int row)189 ((short *) scr_addr)[i] = ((style << 8 ) + ' '); 190 } 191 } 192 193 static void printchar(wchar_t c, sysarg_t col, sysarg_t row) 149 194 { 150 195 scr_addr[(row * scr_width + col) * 2] = ega_glyph(c); … … 158 203 * @param vport Viewport id 159 204 * @param data Text data. 160 * @param x Leftmost column of the area. 161 * @param y Topmost row of the area. 162 * @param w Number of rows. 163 * @param h Number of columns. 205 * @param x Leftmost column of the area. 206 * @param y Topmost row of the area. 207 * @param w Number of rows. 208 * @param h Number of columns. 209 * 164 210 */ 165 static void draw_text_data(keyfield_t *data, unsigned int x, 166 unsigned int y, unsigned int w, unsigned int h) 167 { 168 unsigned int i, j; 211 static void draw_text_data(keyfield_t *data, sysarg_t x, sysarg_t y, 212 sysarg_t w, sysarg_t h) 213 { 214 sysarg_t i; 215 sysarg_t j; 169 216 keyfield_t *field; 170 217 uint8_t *dp; 171 218 172 219 for (j = 0; j < h; j++) { 173 220 for (i = 0; i < w; i++) { 174 221 field = &data[j * w + i]; 175 222 dp = &scr_addr[2 * ((y + j) * scr_width + (x + i))]; 176 223 177 224 dp[0] = ega_glyph(field->character); 178 225 dp[1] = attr_to_ega_style(&field->attrs); … … 183 230 static int save_screen(void) 184 231 { 185 int i; 186 187 for (i = 0; (i < MAX_SAVED_SCREENS) && (saved_screens[i].data); i++) 188 ; 189 if (i == MAX_SAVED_SCREENS) 232 ipcarg_t i; 233 234 /* Find empty screen */ 235 for (i = 0; (i < MAX_SAVED_SCREENS) && (saved_screens[i].data); i++); 236 237 if (i == MAX_SAVED_SCREENS) 190 238 return EINVAL; 191 if (!(saved_screens[i].data = malloc(2 * scr_width * scr_height))) 239 240 if (!(saved_screens[i].data = malloc(2 * scr_width * scr_height))) 192 241 return ENOMEM; 242 193 243 memcpy(saved_screens[i].data, scr_addr, 2 * scr_width * scr_height); 194 195 return i; 196 } 197 198 static int print_screen(int i) 199 { 200 if (saved_screens[i].data) 244 return (int) i; 245 } 246 247 static int print_screen(ipcarg_t i) 248 { 249 if ((i >= MAX_SAVED_SCREENS) || (saved_screens[i].data)) 201 250 memcpy(scr_addr, saved_screens[i].data, 2 * scr_width * 202 251 scr_height); 203 252 else 204 253 return EINVAL; 205 return i; 206 } 207 208 static int style_to_ega_style(int style) 209 { 210 unsigned int ega_style; 211 212 switch (style) { 213 case STYLE_NORMAL: 214 ega_style = INVERTED_COLOR; 215 break; 216 case STYLE_EMPHASIS: 217 ega_style = INVERTED_COLOR | 4; 218 break; 219 default: 220 return INVERTED_COLOR; 221 } 222 223 return ega_style; 224 } 225 226 static unsigned int color_to_ega_style(int fg_color, int bg_color, int attr) 227 { 228 unsigned int style; 229 230 style = (fg_color & 7) | ((bg_color & 7) << 4); 231 if (attr & CATTR_BRIGHT) 232 style = style | 0x08; 233 234 return style; 235 } 236 237 static unsigned int rgb_to_ega_style(uint32_t fg, uint32_t bg) 238 { 239 return (fg > bg) ? NORMAL_COLOR : INVERTED_COLOR; 240 } 241 242 static unsigned attr_to_ega_style(const attrs_t *a) 243 { 244 switch (a->t) { 245 case at_style: 246 return style_to_ega_style(a->a.s.style); 247 case at_rgb: 248 return rgb_to_ega_style(a->a.r.fg_color, a->a.r.bg_color); 249 case at_idx: 250 return color_to_ega_style(a->a.i.fg_color, 251 a->a.i.bg_color, a->a.i.flags); 252 default: 253 return INVERTED_COLOR; 254 } 255 } 256 257 static uint8_t ega_glyph(wchar_t ch) 258 { 259 if (ch >= 0 && ch < 128) 260 return ch; 261 262 return '?'; 254 255 return (int) i; 263 256 } 264 257 265 258 static void ega_client_connection(ipc_callid_t iid, ipc_call_t *icall) 266 259 { 267 int retval; 268 ipc_callid_t callid; 269 ipc_call_t call; 270 wchar_t c; 271 unsigned int row, col, w, h; 272 int bg_color, fg_color, attr; 273 uint32_t bg_rgb, fg_rgb; 260 size_t intersize = 0; 274 261 keyfield_t *interbuf = NULL; 275 size_t intersize = 0; 276 int i; 277 262 278 263 if (client_connected) { 279 264 ipc_answer_0(iid, ELIMIT); 280 265 return; 281 266 } 267 268 /* Accept connection */ 282 269 client_connected = 1; 283 ipc_answer_0(iid, EOK); /* Accept connection */ 284 285 while (1) { 286 callid = async_get_call(&call); 287 switch (IPC_GET_METHOD(call)) { 270 ipc_answer_0(iid, EOK); 271 272 while (true) { 273 ipc_call_t call; 274 ipc_callid_t callid = async_get_call(&call); 275 276 wchar_t c; 277 278 ipcarg_t col; 279 ipcarg_t row; 280 ipcarg_t w; 281 ipcarg_t h; 282 283 ssize_t rows; 284 285 uint8_t bg_color; 286 uint8_t fg_color; 287 uint8_t attr; 288 289 uint32_t fg_rgb; 290 uint32_t bg_rgb; 291 292 ipcarg_t scr; 293 int retval; 294 295 switch (IPC_GET_METHOD(call)) { 288 296 case IPC_M_PHONE_HUNGUP: 289 297 client_connected = 0; 290 298 ipc_answer_0(callid, EOK); 291 return; /* Exit thread */ 299 300 /* Exit thread */ 301 return; 292 302 case IPC_M_SHARE_OUT: 293 303 /* We accept one area for data interchange */ … … 299 309 continue; 300 310 } 311 301 312 retval = EINVAL; 302 313 break; 303 314 case FB_DRAW_TEXT_DATA: 315 if (!interbuf) { 316 retval = EINVAL; 317 break; 318 } 319 304 320 col = IPC_GET_ARG1(call); 305 321 row = IPC_GET_ARG2(call); 306 322 w = IPC_GET_ARG3(call); 307 323 h = IPC_GET_ARG4(call); 308 if (!interbuf) { 324 325 if ((col + w > scr_width) || (row + h > scr_height)) { 309 326 retval = EINVAL; 310 327 break; 311 328 } 312 if (col + w > scr_width || row + h > scr_height) { 313 retval = EINVAL; 314 break; 315 } 329 316 330 draw_text_data(interbuf, col, row, w, h); 317 331 retval = 0; … … 331 345 col = IPC_GET_ARG2(call); 332 346 row = IPC_GET_ARG3(call); 333 if (col >= scr_width || row >= scr_height) { 347 348 if ((col >= scr_width) || (row >= scr_height)) { 334 349 retval = EINVAL; 335 350 break; 336 351 } 352 337 353 printchar(c, col, row); 338 354 retval = 0; 339 355 break; 340 case FB_CURSOR_GOTO:341 col = IPC_GET_ARG1(call);356 case FB_CURSOR_GOTO: 357 col = IPC_GET_ARG1(call); 342 358 row = IPC_GET_ARG2(call); 343 if (row >= scr_height || col >= scr_width) { 359 360 if ((row >= scr_height) || (col >= scr_width)) { 344 361 retval = EINVAL; 345 362 break; 346 363 } 364 347 365 cursor_goto(col, row); 348 retval = 0;349 break;366 retval = 0; 367 break; 350 368 case FB_SCROLL: 351 i = IPC_GET_ARG1(call); 352 if (i > (int) scr_height || i < -((int) scr_height)) { 353 retval = EINVAL; 354 break; 355 } 356 scroll(i); 369 rows = IPC_GET_ARG1(call); 370 371 if (rows >= 0) { 372 if ((ipcarg_t) rows > scr_height) { 373 retval = EINVAL; 374 break; 375 } 376 } else { 377 if ((ipcarg_t) (-rows) > scr_height) { 378 retval = EINVAL; 379 break; 380 } 381 } 382 383 scroll(rows); 357 384 retval = 0; 358 385 break; … … 362 389 else 363 390 cursor_disable(); 391 364 392 retval = 0; 365 393 break; … … 372 400 bg_color = IPC_GET_ARG2(call); 373 401 attr = IPC_GET_ARG3(call); 402 374 403 style = color_to_ega_style(fg_color, bg_color, attr); 375 404 retval = 0; … … 378 407 fg_rgb = IPC_GET_ARG1(call); 379 408 bg_rgb = IPC_GET_ARG2(call); 409 380 410 style = rgb_to_ega_style(fg_rgb, bg_rgb); 381 411 retval = 0; 382 412 break; 383 413 case FB_VP_DRAW_PIXMAP: 384 i= IPC_GET_ARG2(call);385 retval = print_screen( i);414 scr = IPC_GET_ARG2(call); 415 retval = print_screen(scr); 386 416 break; 387 417 case FB_VP2PIXMAP: … … 389 419 break; 390 420 case FB_DROP_PIXMAP: 391 i = IPC_GET_ARG1(call); 392 if (i >= MAX_SAVED_SCREENS) { 421 scr = IPC_GET_ARG1(call); 422 423 if (scr >= MAX_SAVED_SCREENS) { 393 424 retval = EINVAL; 394 425 break; 395 426 } 396 if (saved_screens[i].data) { 397 free(saved_screens[i].data); 398 saved_screens[i].data = NULL; 399 } 427 428 if (saved_screens[scr].data) { 429 free(saved_screens[scr].data); 430 saved_screens[scr].data = NULL; 431 } 432 400 433 retval = 0; 401 434 break; … … 413 446 int ega_init(void) 414 447 { 415 void *ega_ph_addr; 416 size_t sz; 417 418 ega_ph_addr = (void *) sysinfo_value("fb.address.physical"); 419 scr_width = sysinfo_value("fb.width"); 420 scr_height = sysinfo_value("fb.height"); 421 422 if (sysinfo_value("fb.blinking")) { 423 ega_normal_color &= 0x77; 424 ega_inverted_color &= 0x77; 425 } 426 427 style = NORMAL_COLOR; 428 448 sysarg_t paddr; 449 if (sysinfo_get_value("fb.address.physical", &paddr) != EOK) 450 return -1; 451 452 if (sysinfo_get_value("fb.width", &scr_width) != EOK) 453 return -1; 454 455 if (sysinfo_get_value("fb.height", &scr_height) != EOK) 456 return -1; 457 458 sysarg_t blinking; 459 if (sysinfo_get_value("fb.blinking", &blinking) != EOK) 460 blinking = false; 461 462 void *ega_ph_addr = (void *) paddr; 463 if (blinking) { 464 style_normal &= 0x77; 465 style_inverted &= 0x77; 466 } 467 468 style = style_normal; 469 429 470 iospace_enable(task_get_id(), (void *) EGA_IO_BASE, 2); 430 431 s z = scr_width * scr_height * 2;471 472 size_t sz = scr_width * scr_height * 2; 432 473 scr_addr = as_get_mappable_page(sz); 433 474 434 475 if (physmem_map(ega_ph_addr, scr_addr, ALIGN_UP(sz, PAGE_SIZE) >> 435 476 PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE) != 0) 436 477 return -1; 437 478 438 479 async_set_client_connection(ega_client_connection); 439 480 440 481 return 0; 441 482 } 442 443 483 444 484 /** -
uspace/srv/hid/fb/fb.c
r24a2517 rc621f4aa 41 41 #include <stdlib.h> 42 42 #include <unistd.h> 43 #include <str ing.h>43 #include <str.h> 44 44 #include <ddi.h> 45 45 #include <sysinfo.h> … … 59 59 #include <stdio.h> 60 60 #include <byteorder.h> 61 #include <io/screenbuffer.h> 61 62 62 63 #include "font-8x16.h" 63 64 #include "fb.h" 64 65 #include "main.h" 65 #include "../console/screenbuffer.h"66 66 #include "ppm.h" 67 67 … … 72 72 #define DEFAULT_FGCOLOR 0x000000 73 73 74 #define GLYPH_UNAVAIL '?'75 76 #define MAX_ANIM_LEN 877 #define MAX_ANIMATIONS 478 #define MAX_PIXMAPS 256 /**< Maximum number of saved pixmaps */79 #define MAX_VIEWPORTS 128 /**< Viewport is a rectangular area on the screen */74 #define GLYPH_UNAVAIL '?' 75 76 #define MAX_ANIM_LEN 8 77 #define MAX_ANIMATIONS 4 78 #define MAX_PIXMAPS 256 /**< Maximum number of saved pixmaps */ 79 #define MAX_VIEWPORTS 128 /**< Viewport is a rectangular area on the screen */ 80 80 81 81 /** Function to render a pixel from a RGB value. */ … … 956 956 bb_cell_t *bbp; 957 957 attrs_t *a; 958 attr_rgb_t rgb;959 958 960 959 for (j = 0; j < h; j++) { … … 966 965 967 966 a = &data[j * w + i].attrs; 967 968 attr_rgb_t rgb; 969 rgb.fg_color = 0; 970 rgb.bg_color = 0; 968 971 rgb_from_attr(&rgb, a); 969 972 … … 1511 1514 rgb->bg_color = color_table[COLOR_WHITE]; 1512 1515 break; 1516 case STYLE_INVERTED: 1517 rgb->fg_color = color_table[COLOR_WHITE]; 1518 rgb->bg_color = color_table[COLOR_BLACK]; 1519 break; 1520 case STYLE_SELECTED: 1521 rgb->fg_color = color_table[COLOR_WHITE]; 1522 rgb->bg_color = color_table[COLOR_RED]; 1523 break; 1513 1524 default: 1514 1525 return EINVAL; 1515 1526 } 1516 1527 1517 1528 return EOK; 1518 1529 } … … 1756 1767 async_set_client_connection(fb_client_connection); 1757 1768 1758 void *fb_ph_addr = (void *) sysinfo_value("fb.address.physical"); 1759 unsigned int fb_offset = sysinfo_value("fb.offset"); 1760 unsigned int fb_width = sysinfo_value("fb.width"); 1761 unsigned int fb_height = sysinfo_value("fb.height"); 1762 unsigned int fb_scanline = sysinfo_value("fb.scanline"); 1763 unsigned int fb_visual = sysinfo_value("fb.visual"); 1764 1765 unsigned int fbsize = fb_scanline * fb_height; 1769 sysarg_t fb_ph_addr; 1770 if (sysinfo_get_value("fb.address.physical", &fb_ph_addr) != EOK) 1771 return -1; 1772 1773 sysarg_t fb_offset; 1774 if (sysinfo_get_value("fb.offset", &fb_offset) != EOK) 1775 fb_offset = 0; 1776 1777 sysarg_t fb_width; 1778 if (sysinfo_get_value("fb.width", &fb_width) != EOK) 1779 return -1; 1780 1781 sysarg_t fb_height; 1782 if (sysinfo_get_value("fb.height", &fb_height) != EOK) 1783 return -1; 1784 1785 sysarg_t fb_scanline; 1786 if (sysinfo_get_value("fb.scanline", &fb_scanline) != EOK) 1787 return -1; 1788 1789 sysarg_t fb_visual; 1790 if (sysinfo_get_value("fb.visual", &fb_visual) != EOK) 1791 return -1; 1792 1793 sysarg_t fbsize = fb_scanline * fb_height; 1766 1794 void *fb_addr = as_get_mappable_page(fbsize); 1767 1768 if (physmem_map( fb_ph_addr + fb_offset, fb_addr,1795 1796 if (physmem_map((void *) fb_ph_addr + fb_offset, fb_addr, 1769 1797 ALIGN_UP(fbsize, PAGE_SIZE) >> PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE) != 0) 1770 1798 return -1; 1771 1799 1772 1800 if (screen_init(fb_addr, fb_width, fb_height, fb_scanline, fb_visual)) 1773 1801 return 0; 1774 1802 1775 1803 return -1; 1776 1804 } -
uspace/srv/hid/fb/main.c
r24a2517 rc621f4aa 41 41 #include "ski.h" 42 42 #include "sgcn.h" 43 #include "niagara.h" 43 44 #include "main.h" 44 45 … … 59 60 int main(int argc, char *argv[]) 60 61 { 61 printf( NAME ": HelenOS Framebuffer service\n");62 printf("%s: HelenOS Framebuffer service\n", NAME); 62 63 63 ipcarg_t phonead;64 64 bool initialized = false; 65 sysarg_t fb_present; 66 sysarg_t fb_kind; 67 68 if (sysinfo_get_value("fb", &fb_present) != EOK) 69 fb_present = false; 70 71 if (sysinfo_get_value("fb.kind", &fb_kind) != EOK) { 72 printf("%s: Unable to detect framebuffer configuration\n", NAME); 73 return -1; 74 } 65 75 66 76 #ifdef FB_ENABLED 67 if ( sysinfo_value("fb.kind") == 1) {77 if ((!initialized) && (fb_kind == 1)) { 68 78 if (fb_init() == 0) 69 79 initialized = true; … … 71 81 #endif 72 82 #ifdef EGA_ENABLED 73 if ((!initialized) && ( sysinfo_value("fb.kind")== 2)) {83 if ((!initialized) && (fb_kind == 2)) { 74 84 if (ega_init() == 0) 75 85 initialized = true; … … 77 87 #endif 78 88 #ifdef MSIM_ENABLED 79 if ((!initialized) && ( sysinfo_value("fb.kind")== 3)) {89 if ((!initialized) && (fb_kind == 3)) { 80 90 if (msim_init() == 0) 81 91 initialized = true; … … 83 93 #endif 84 94 #ifdef SGCN_ENABLED 85 if ((!initialized) && ( sysinfo_value("fb.kind")== 4)) {95 if ((!initialized) && (fb_kind == 4)) { 86 96 if (sgcn_init() == 0) 87 97 initialized = true; 88 98 } 89 99 #endif 100 #ifdef NIAGARA_ENABLED 101 if ((!initialized) && (fb_kind == 5)) { 102 if (niagara_init() == 0) 103 initialized = true; 104 } 105 #endif 90 106 #ifdef SKI_ENABLED 91 if ((!initialized) && ( sysinfo_value("fb") != true)) {107 if ((!initialized) && (fb_kind == 6)) { 92 108 if (ski_init() == 0) 93 109 initialized = true; … … 98 114 return -1; 99 115 116 ipcarg_t phonead; 100 117 if (ipc_connect_to_me(PHONE_NS, SERVICE_VIDEO, 0, 0, &phonead) != 0) 101 118 return -1; 102 119 103 printf( NAME ": Accepting connections\n");120 printf("%s: Accepting connections\n", NAME); 104 121 async_manager(); 105 122 -
uspace/srv/hid/fb/msim.c
r24a2517 rc621f4aa 29 29 30 30 /** @defgroup msimfb MSIM text console 31 * @brief HelenOS MSIM text console.31 * @brief HelenOS MSIM text console. 32 32 * @ingroup fbs 33 33 * @{ 34 */ 34 */ 35 35 /** @file 36 36 */ … … 41 41 #include <as.h> 42 42 #include <ddi.h> 43 #include <errno.h> 43 44 44 45 #include "serial_console.h" … … 57 58 int msim_init(void) 58 59 { 59 void *phys_addr = (void *) sysinfo_value("fb.address.physical"); 60 sysarg_t phys_addr; 61 if (sysinfo_get_value("fb.address.physical", &phys_addr) != EOK) 62 return -1; 63 60 64 virt_addr = (char *) as_get_mappable_page(1); 61 65 62 if (physmem_map(phys_addr, virt_addr, 1, AS_AREA_READ | AS_AREA_WRITE) != 0) 66 if (physmem_map((void *) phys_addr, virt_addr, 1, 67 AS_AREA_READ | AS_AREA_WRITE) != 0) 63 68 return -1; 64 69 … … 69 74 } 70 75 71 /** 72 * @} 76 /** @} 73 77 */ -
uspace/srv/hid/fb/serial_console.c
r24a2517 rc621f4aa 31 31 /** 32 32 * @defgroup serial Serial console 33 * @brief Serial console services (putc, puts, clear screen, cursor goto,...)33 * @brief Serial console services (putc, puts, clear screen, cursor goto,...) 34 34 * @{ 35 */ 35 */ 36 36 37 37 /** @file … … 46 46 #include <io/color.h> 47 47 #include <io/style.h> 48 #include <str ing.h>49 50 #include "../console/screenbuffer.h" 48 #include <str.h> 49 #include <io/screenbuffer.h> 50 51 51 #include "main.h" 52 52 #include "serial_console.h" … … 54 54 #define MAX_CONTROL 20 55 55 56 static void serial_sgr(const unsigned int mode); 57 void serial_putchar(wchar_t ch); 58 59 static int scr_width; 60 static int scr_height; 61 static bool color = true; /** True if producing color output. */ 62 static bool utf8 = false; /** True if producing UTF8 output. */ 56 static ipcarg_t scr_width; 57 static ipcarg_t scr_height; 58 static bool color = true; /**< True if producing color output. */ 59 static bool utf8 = false; /**< True if producing UTF8 output. */ 63 60 static putc_function_t putc_function; 61 62 static ipcarg_t lastcol = 0; 63 static ipcarg_t lastrow = 0; 64 static attrs_t cur_attr = { 65 .t = at_style, 66 .a.s.style = STYLE_NORMAL 67 }; 64 68 65 69 /* Allow only 1 connection */ … … 67 71 68 72 enum sgr_color_index { 69 CI_BLACK = 0,70 CI_RED = 1,71 CI_GREEN = 2,72 CI_BROWN = 3,73 CI_BLUE = 4,74 CI_MAGENTA = 5,75 CI_CYAN = 6,76 CI_WHITE = 7,73 CI_BLACK = 0, 74 CI_RED = 1, 75 CI_GREEN = 2, 76 CI_BROWN = 3, 77 CI_BLUE = 4, 78 CI_MAGENTA = 5, 79 CI_CYAN = 6, 80 CI_WHITE = 7 77 81 }; 78 82 79 83 enum sgr_command { 80 SGR_RESET = 0, 81 SGR_BOLD = 1, 82 SGR_BLINK = 5, 83 SGR_REVERSE = 7, 84 SGR_NORMAL_INT = 22, 85 SGR_BLINK_OFF = 25, 86 SGR_REVERSE_OFF = 27, 87 SGR_FGCOLOR = 30, 88 SGR_BGCOLOR = 40 84 SGR_RESET = 0, 85 SGR_BOLD = 1, 86 SGR_UNDERLINE = 4, 87 SGR_BLINK = 5, 88 SGR_REVERSE = 7, 89 SGR_FGCOLOR = 30, 90 SGR_BGCOLOR = 40 89 91 }; 90 92 91 93 static int color_map[] = { 92 [COLOR_BLACK] = CI_BLACK,93 [COLOR_BLUE] = CI_RED,94 [COLOR_GREEN] = CI_GREEN,95 [COLOR_CYAN] = CI_CYAN,96 [COLOR_RED] = CI_RED,94 [COLOR_BLACK] = CI_BLACK, 95 [COLOR_BLUE] = CI_RED, 96 [COLOR_GREEN] = CI_GREEN, 97 [COLOR_CYAN] = CI_CYAN, 98 [COLOR_RED] = CI_RED, 97 99 [COLOR_MAGENTA] = CI_MAGENTA, 98 [COLOR_YELLOW] = CI_BROWN,99 [COLOR_WHITE] = CI_WHITE100 [COLOR_YELLOW] = CI_BROWN, 101 [COLOR_WHITE] = CI_WHITE 100 102 }; 101 103 102 void serial_puts(c har *str)104 void serial_puts(const char *str) 103 105 { 104 106 while (*str) … … 106 108 } 107 109 108 void serial_putchar(wchar_t ch) 109 { 110 uint8_t buf[STR_BOUNDS(1)]; 111 size_t offs; 112 size_t i; 113 110 static void serial_putchar(wchar_t ch) 111 { 114 112 if (utf8 != true) { 115 113 if (ch >= 0 && ch < 128) 116 114 (*putc_function)((uint8_t) ch); 117 else 115 else 118 116 (*putc_function)('?'); 117 119 118 return; 120 119 } 121 122 offs = 0; 120 121 size_t offs = 0; 122 char buf[STR_BOUNDS(1)]; 123 123 if (chr_encode(ch, buf, &offs, STR_BOUNDS(1)) == EOK) { 124 size_t i; 124 125 for (i = 0; i < offs; i++) 125 126 (*putc_function)(buf[i]); 126 } else {127 } else 127 128 (*putc_function)('?'); 128 } 129 130 } 131 132 void serial_goto(const unsigned int col, const unsigned int row) 129 } 130 131 void serial_goto(const ipcarg_t col, const ipcarg_t row) 133 132 { 134 133 if ((col > scr_width) || (row > scr_height)) … … 138 137 snprintf(control, MAX_CONTROL, "\033[%u;%uf", row + 1, col + 1); 139 138 serial_puts(control); 139 } 140 141 /** ECMA-48 Set Graphics Rendition. */ 142 static void serial_sgr(const unsigned int mode) 143 { 144 char control[MAX_CONTROL]; 145 snprintf(control, MAX_CONTROL, "\033[%um", mode); 146 serial_puts(control); 147 } 148 149 static void serial_set_style(console_style_t style) 150 { 151 switch (style) { 152 case STYLE_EMPHASIS: 153 serial_sgr(SGR_RESET); 154 if (color) { 155 serial_sgr(SGR_FGCOLOR + CI_RED); 156 serial_sgr(SGR_BGCOLOR + CI_WHITE); 157 } 158 serial_sgr(SGR_BOLD); 159 break; 160 case STYLE_INVERTED: 161 serial_sgr(SGR_RESET); 162 if (color) { 163 serial_sgr(SGR_FGCOLOR + CI_WHITE); 164 serial_sgr(SGR_BGCOLOR + CI_BLACK); 165 } else 166 serial_sgr(SGR_REVERSE); 167 break; 168 case STYLE_SELECTED: 169 serial_sgr(SGR_RESET); 170 if (color) { 171 serial_sgr(SGR_FGCOLOR + CI_WHITE); 172 serial_sgr(SGR_BGCOLOR + CI_RED); 173 } else 174 serial_sgr(SGR_UNDERLINE); 175 break; 176 default: 177 serial_sgr(SGR_RESET); 178 if (color) { 179 serial_sgr(SGR_FGCOLOR + CI_BLACK); 180 serial_sgr(SGR_BGCOLOR + CI_WHITE); 181 } 182 } 183 } 184 185 static void serial_set_idx(uint8_t fgcolor, uint8_t bgcolor, 186 uint8_t flags) 187 { 188 serial_sgr(SGR_RESET); 189 if (color) { 190 serial_sgr(SGR_FGCOLOR + color_map[fgcolor & 7]); 191 serial_sgr(SGR_BGCOLOR + color_map[bgcolor & 7]); 192 if (flags & CATTR_BRIGHT) 193 serial_sgr(SGR_BOLD); 194 } else { 195 if (fgcolor >= bgcolor) 196 serial_sgr(SGR_REVERSE); 197 } 198 } 199 200 static void serial_set_rgb(uint32_t fgcolor, uint32_t bgcolor) 201 { 202 serial_sgr(SGR_RESET); 203 204 if (fgcolor >= bgcolor) 205 serial_sgr(SGR_REVERSE); 206 } 207 208 static void serial_set_attrs(attrs_t *a) 209 { 210 switch (a->t) { 211 case at_style: 212 serial_set_style(a->a.s.style); 213 break; 214 case at_rgb: 215 serial_set_rgb(a->a.r.fg_color, a->a.r.bg_color); 216 break; 217 case at_idx: 218 serial_set_idx(a->a.i.fg_color, a->a.i.bg_color, 219 a->a.i.flags); 220 break; 221 } 140 222 } 141 223 … … 148 230 serial_sgr(SGR_BGCOLOR + CI_WHITE); 149 231 } 150 232 151 233 serial_puts("\033[2J"); 152 } 153 154 void serial_scroll(int i) 234 235 serial_set_attrs(&cur_attr); 236 } 237 238 void serial_scroll(ssize_t i) 155 239 { 156 240 if (i > 0) { … … 165 249 } 166 250 167 /** ECMA-48 Set Graphics Rendition. */168 static void serial_sgr(const unsigned int mode)169 {170 char control[MAX_CONTROL];171 snprintf(control, MAX_CONTROL, "\033[%um", mode);172 serial_puts(control);173 }174 175 251 /** Set scrolling region. */ 176 void serial_set_scroll_region( unsignedlast_row)252 void serial_set_scroll_region(ipcarg_t last_row) 177 253 { 178 254 char control[MAX_CONTROL]; … … 191 267 } 192 268 193 void serial_console_init(putc_function_t putc_fn, uint32_t w, uint32_t h)269 void serial_console_init(putc_function_t putc_fn, ipcarg_t w, ipcarg_t h) 194 270 { 195 271 scr_width = w; … … 198 274 } 199 275 200 static void serial_set_style(int style)201 {202 if (style == STYLE_EMPHASIS) {203 if (color) {204 serial_sgr(SGR_RESET);205 serial_sgr(SGR_FGCOLOR + CI_RED);206 serial_sgr(SGR_BGCOLOR + CI_WHITE);207 }208 serial_sgr(SGR_BOLD);209 } else {210 if (color) {211 serial_sgr(SGR_RESET);212 serial_sgr(SGR_FGCOLOR + CI_BLACK);213 serial_sgr(SGR_BGCOLOR + CI_WHITE);214 }215 serial_sgr(SGR_NORMAL_INT);216 }217 }218 219 static void serial_set_idx(unsigned fgcolor, unsigned bgcolor,220 unsigned flags)221 {222 if (color) {223 serial_sgr(SGR_RESET);224 serial_sgr(SGR_FGCOLOR + color_map[fgcolor]);225 serial_sgr(SGR_BGCOLOR + color_map[bgcolor]);226 } else {227 if (fgcolor < bgcolor)228 serial_sgr(SGR_RESET);229 else230 serial_sgr(SGR_REVERSE);231 }232 }233 234 static void serial_set_rgb(uint32_t fgcolor, uint32_t bgcolor)235 {236 if (fgcolor < bgcolor)237 serial_sgr(SGR_REVERSE_OFF);238 else239 serial_sgr(SGR_REVERSE);240 }241 242 static void serial_set_attrs(const attrs_t *a)243 {244 switch (a->t) {245 case at_style:246 serial_set_style(a->a.s.style);247 break;248 case at_rgb:249 serial_set_rgb(a->a.r.fg_color, a->a.r.bg_color);250 break;251 case at_idx:252 serial_set_idx(a->a.i.fg_color,253 a->a.i.bg_color, a->a.i.flags);254 break;255 default:256 break;257 }258 }259 260 276 /** Draw text data to viewport. 261 277 * 262 * @param vport Viewport id 263 * @param data Text data. 264 * @param x Leftmost column of the area. 265 * @param y Topmost row of the area. 266 * @param w Number of rows. 267 * @param h Number of columns. 268 */ 269 static void draw_text_data(keyfield_t *data, unsigned int x, 270 unsigned int y, unsigned int w, unsigned int h) 271 { 272 unsigned int i, j; 273 keyfield_t *field; 274 attrs_t *a0, *a1; 275 276 serial_goto(x, y); 277 a0 = &data[0].attrs; 278 * @param vport Viewport id 279 * @param data Text data. 280 * @param x0 Leftmost column of the area. 281 * @param y0 Topmost row of the area. 282 * @param width Number of rows. 283 * @param height Number of columns. 284 * 285 */ 286 static void draw_text_data(keyfield_t *data, ipcarg_t x0, ipcarg_t y0, 287 ipcarg_t width, ipcarg_t height) 288 { 289 attrs_t *a0 = &data[0].attrs; 278 290 serial_set_attrs(a0); 279 280 for (j = 0; j < h; j++) { 281 if (j > 0 && w != scr_width) 282 serial_goto(x, j); 283 284 for (i = 0; i < w; i++) { 285 field = &data[j * w + i]; 286 287 a1 = &field->attrs; 288 if (!attrs_same(*a0, *a1)) 289 serial_set_attrs(a1); 290 serial_putchar(field->character); 291 a0 = a1; 291 292 ipcarg_t y; 293 for (y = 0; y < height; y++) { 294 serial_goto(x0, y0 + y); 295 296 ipcarg_t x; 297 for (x = 0; x < width; x++) { 298 attrs_t *attr = &data[y * width + x].attrs; 299 300 if (!attrs_same(*a0, *attr)) { 301 serial_set_attrs(attr); 302 a0 = attr; 303 } 304 305 serial_putchar(data[y * width + x].character); 292 306 } 293 307 } 294 308 } 295 296 int lastcol = 0;297 int lastrow = 0;298 309 299 310 /** … … 302 313 void serial_client_connection(ipc_callid_t iid, ipc_call_t *icall) 303 314 { 304 int retval;305 ipc_callid_t callid;306 ipc_call_t call;307 315 keyfield_t *interbuf = NULL; 308 316 size_t intersize = 0; 309 310 wchar_t c;311 int col, row, w, h;312 int i;313 314 attrs_t cur_attr;315 317 316 318 if (client_connected) { … … 321 323 client_connected = 1; 322 324 ipc_answer_0(iid, EOK); 323 324 cur_attr.t = at_style;325 cur_attr.a.s.style = STYLE_NORMAL;326 325 327 326 /* Clear the terminal, set scrolling region … … 332 331 333 332 while (true) { 334 callid = async_get_call(&call); 333 ipc_call_t call; 334 ipc_callid_t callid = async_get_call(&call); 335 336 wchar_t c; 337 ipcarg_t col; 338 ipcarg_t row; 339 ipcarg_t w; 340 ipcarg_t h; 341 ssize_t rows; 342 343 int retval; 344 335 345 switch (IPC_GET_METHOD(call)) { 336 346 case IPC_M_PHONE_HUNGUP: 337 347 client_connected = 0; 338 348 ipc_answer_0(callid, EOK); 349 350 /* Exit thread */ 339 351 return; 340 352 case IPC_M_SHARE_OUT: … … 347 359 continue; 348 360 } 361 349 362 retval = EINVAL; 350 363 break; … … 354 367 w = IPC_GET_ARG3(call); 355 368 h = IPC_GET_ARG4(call); 369 356 370 if (!interbuf) { 357 371 retval = EINVAL; 358 372 break; 359 373 } 360 if (col + w > scr_width || row + h > scr_height) { 374 375 if ((col + w > scr_width) || (row + h > scr_height)) { 361 376 retval = EINVAL; 362 377 break; 363 378 } 379 364 380 draw_text_data(interbuf, col, row, w, h); 365 381 lastcol = col + w; … … 371 387 col = IPC_GET_ARG2(call); 372 388 row = IPC_GET_ARG3(call); 389 373 390 if ((lastcol != col) || (lastrow != row)) 374 391 serial_goto(col, row); 392 375 393 lastcol = col + 1; 376 394 lastrow = row; … … 400 418 cur_attr.t = at_style; 401 419 cur_attr.a.s.style = IPC_GET_ARG1(call); 402 cur_attr.a.i.bg_color = IPC_GET_ARG2(call);403 420 serial_set_attrs(&cur_attr); 404 405 421 retval = 0; 406 422 break; … … 411 427 cur_attr.a.i.flags = IPC_GET_ARG3(call); 412 428 serial_set_attrs(&cur_attr); 413 414 429 retval = 0; 415 430 break; 416 431 case FB_SET_RGB_COLOR: 417 432 cur_attr.t = at_rgb; 418 cur_attr.a. i.fg_color = IPC_GET_ARG1(call);419 cur_attr.a. i.bg_color = IPC_GET_ARG2(call);433 cur_attr.a.r.fg_color = IPC_GET_ARG1(call); 434 cur_attr.a.r.bg_color = IPC_GET_ARG2(call); 420 435 serial_set_attrs(&cur_attr); 421 422 436 retval = 0; 423 437 break; 424 438 case FB_SCROLL: 425 i = IPC_GET_ARG1(call); 426 if ((i > scr_height) || (i < -scr_height)) { 427 retval = EINVAL; 428 break; 439 rows = IPC_GET_ARG1(call); 440 441 if (rows >= 0) { 442 if ((ipcarg_t) rows > scr_height) { 443 retval = EINVAL; 444 break; 445 } 446 } else { 447 if ((ipcarg_t) (-rows) > scr_height) { 448 retval = EINVAL; 449 break; 450 } 429 451 } 430 serial_scroll(i); 452 453 serial_scroll(rows); 431 454 serial_goto(lastcol, lastrow); 432 455 retval = 0; … … 448 471 case FB_SCREEN_RECLAIM: 449 472 serial_clrscr(); 450 serial_set_attrs(&cur_attr);451 473 retval = 0; 452 474 break; -
uspace/srv/hid/fb/serial_console.h
r24a2517 rc621f4aa 29 29 /** 30 30 * @defgroup serial Serial console 31 * @brief Serial console services (putc, puts, clear screen, cursor goto,...)31 * @brief Serial console services (putc, puts, clear screen, cursor goto,...) 32 32 * @{ 33 */ 33 */ 34 34 35 35 /** @file … … 43 43 typedef void (*putc_function_t)(char); 44 44 45 void serial_puts(char *str); 46 void serial_goto(const unsigned int col, const unsigned int row); 47 void serial_clrscr(void); 48 void serial_scroll(int i); 49 void serial_cursor_disable(void); 50 void serial_cursor_enable(void); 51 void serial_set_scroll_region(unsigned height); 52 void serial_console_init(putc_function_t putc_fn, uint32_t w, uint32_t h); 53 void serial_client_connection(ipc_callid_t iid, ipc_call_t *icall); 54 45 extern void serial_puts(const char *); 46 extern void serial_goto(const ipcarg_t, const ipcarg_t); 47 extern void serial_clrscr(void); 48 extern void serial_scroll(ssize_t); 49 extern void serial_cursor_disable(void); 50 extern void serial_cursor_enable(void); 51 extern void serial_set_scroll_region(ipcarg_t); 52 extern void serial_console_init(putc_function_t, ipcarg_t, ipcarg_t); 53 extern void serial_client_connection(ipc_callid_t, ipc_call_t *); 55 54 56 55 #endif -
uspace/srv/hid/fb/sgcn.c
r24a2517 rc621f4aa 122 122 int sgcn_init(void) 123 123 { 124 sram_virt_addr = (uintptr_t) as_get_mappable_page(sysinfo_value("sram.area.size")); 124 sysarg_t sram_paddr; 125 if (sysinfo_get_value("sram.address.physical", &sram_paddr) != EOK) 126 return -1; 125 127 126 if (physmem_map((void *) sysinfo_value("sram.address.physical"), 127 (void *) sram_virt_addr, sysinfo_value("sram.area.size") / PAGE_SIZE, 128 AS_AREA_READ | AS_AREA_WRITE) != 0) 128 sysarg_t sram_size; 129 if (sysinfo_get_value("sram.area.size", &sram_size) != EOK) 130 return -1; 131 132 if (sysinfo_get_value("sram.buffer.offset", &sram_buffer_offset) != EOK) 133 sram_buffer_offset = 0; 134 135 sram_virt_addr = (uintptr_t) as_get_mappable_page(sram_size); 136 137 if (physmem_map((void *) sram_paddr, (void *) sram_virt_addr, 138 sram_size / PAGE_SIZE, AS_AREA_READ | AS_AREA_WRITE) != 0) 129 139 return -1; 130 140 131 141 serial_console_init(sgcn_putc, WIDTH, HEIGHT); 132 133 sram_buffer_offset = sysinfo_value("sram.buffer.offset");134 142 135 143 async_set_client_connection(serial_client_connection); -
uspace/srv/hid/kbd/Makefile
r24a2517 rc621f4aa 28 28 # 29 29 30 include Makefile.common 30 USPACE_PREFIX = ../../.. 31 ROOT_PATH = $(USPACE_PREFIX)/.. 31 32 32 .PHONY: all clean 33 COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common 34 CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config 33 35 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build PRECHECK=$(PRECHECK) 36 EXTRA_CFLAGS = -Iinclude 37 BINARY = kbd 37 38 38 clean: 39 rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; 39 -include $(COMMON_MAKEFILE) 40 -include $(CONFIG_MAKEFILE) 41 42 ## Sources 43 # 44 45 SOURCES = \ 46 generic/kbd.c \ 47 genarch/gsp.c \ 48 genarch/stroke.c \ 49 layout/cz.c \ 50 layout/us_qwerty.c \ 51 layout/us_dvorak.c 52 53 ifeq ($(UARCH),amd64) 54 SOURCES += \ 55 port/chardev.c \ 56 ctl/pc.c 57 endif 58 59 ifeq ($(UARCH),arm32) 60 ifeq ($(MACHINE),gta02) 61 SOURCES += \ 62 port/dummy.c \ 63 ctl/pc.c 64 endif 65 ifeq ($(MACHINE),testarm) 66 SOURCES += \ 67 port/gxemul.c 68 69 ifeq ($(CONFIG_FB),y) 70 SOURCES += \ 71 ctl/gxe_fb.c 72 else 73 SOURCES += \ 74 ctl/stty.c 75 endif 76 endif 77 ifeq ($(MACHINE),integratorcp) 78 SOURCES += \ 79 port/pl050.c \ 80 ctl/pl050.c 81 endif 82 endif 83 84 ifeq ($(UARCH),ia32) 85 SOURCES += \ 86 port/chardev.c \ 87 ctl/pc.c 88 endif 89 90 ifeq ($(MACHINE),i460GX) 91 SOURCES += \ 92 port/chardev.c \ 93 ctl/pc.c 94 endif 95 96 ifeq ($(MACHINE),ski) 97 SOURCES += \ 98 port/ski.c \ 99 ctl/stty.c 100 endif 101 102 ifeq ($(MACHINE),msim) 103 SOURCES += \ 104 port/msim.c \ 105 ctl/stty.c 106 endif 107 108 ifeq ($(MACHINE),lgxemul) 109 SOURCES += \ 110 port/gxemul.c 111 112 ifeq ($(CONFIG_FB),y) 113 SOURCES += \ 114 ctl/gxe_fb.c 115 else 116 SOURCES += \ 117 ctl/stty.c 118 endif 119 endif 120 121 ifeq ($(MACHINE),bgxemul) 122 SOURCES += \ 123 port/gxemul.c 124 125 ifeq ($(CONFIG_FB),y) 126 SOURCES += \ 127 ctl/gxe_fb.c 128 else 129 SOURCES += \ 130 ctl/stty.c 131 endif 132 endif 133 134 ifeq ($(UARCH),ppc32) 135 SOURCES += \ 136 port/adb.c \ 137 ctl/apple.c 138 endif 139 140 ifeq ($(UARCH),sparc64) 141 ifeq ($(PROCESSOR),sun4v) 142 SOURCES += \ 143 port/niagara.c \ 144 ctl/stty.c 145 else 146 ifeq ($(MACHINE),serengeti) 147 SOURCES += \ 148 port/sgcn.c \ 149 ctl/stty.c 150 endif 151 ifeq ($(MACHINE),generic) 152 SOURCES += \ 153 port/sun.c \ 154 port/z8530.c \ 155 port/ns16550.c \ 156 ctl/sun.c 157 endif 158 endif 159 endif 160 161 ifeq ($(UARCH),abs32le) 162 SOURCES += \ 163 port/dummy.c \ 164 ctl/pc.c 165 endif 166 167 include $(USPACE_PREFIX)/Makefile.common -
uspace/srv/hid/kbd/generic/kbd.c
r24a2517 rc621f4aa 212 212 int main(int argc, char **argv) 213 213 { 214 printf(NAME ": HelenOS Keyboard service\n"); 215 216 if (sysinfo_value("kbd.cir.fhc") == 1) 214 printf("%s: HelenOS Keyboard service\n", NAME); 215 216 sysarg_t fhc; 217 sysarg_t obio; 218 219 if ((sysinfo_get_value("kbd.cir.fhc", &fhc) == EOK) && (fhc)) 217 220 cir_service = SERVICE_FHC; 218 else if ( sysinfo_value("kbd.cir.obio") == 1)221 else if ((sysinfo_get_value("kbd.cir.obio", &obio) == EOK) && (obio)) 219 222 cir_service = SERVICE_OBIO; 220 223 … … 240 243 int rc = devmap_driver_register(NAME, client_connection); 241 244 if (rc < 0) { 242 printf( NAME ": Unable to register driver (%d)\n", rc);245 printf("%s: Unable to register driver (%d)\n", NAME, rc); 243 246 return -1; 244 247 } … … 249 252 dev_handle_t dev_handle; 250 253 if (devmap_device_register(kbd, &dev_handle) != EOK) { 251 printf( NAME ": Unable to register device %s\n", kbd);254 printf("%s: Unable to register device %s\n", NAME, kbd); 252 255 return -1; 253 256 } -
uspace/srv/hid/kbd/port/adb.c
r24a2517 rc621f4aa 53 53 int kbd_port_init(void) 54 54 { 55 c har *input = "/dev/adb/kbd";55 const char *input = "/dev/adb/kbd"; 56 56 int input_fd; 57 57 -
uspace/srv/hid/kbd/port/chardev.c
r24a2517 rc621f4aa 52 52 int kbd_port_init(void) 53 53 { 54 c har *input = "/dev/char/ps2a";54 const char *input = "/dev/char/ps2a"; 55 55 int input_fd; 56 56 -
uspace/srv/hid/kbd/port/gxemul.c
r24a2517 rc621f4aa 41 41 #include <kbd.h> 42 42 #include <ddi.h> 43 #include <errno.h> 43 44 44 45 static irq_cmd_t gxemul_cmds[] = { … … 63 64 int kbd_port_init(void) 64 65 { 66 sysarg_t addr; 67 if (sysinfo_get_value("kbd.address.virtual", &addr) != EOK) 68 return -1; 69 70 sysarg_t inr; 71 if (sysinfo_get_value("kbd.inr", &inr) != EOK) 72 return -1; 73 65 74 async_set_interrupt_received(gxemul_irq_handler); 66 gxemul_cmds[0].addr = (void *) sysinfo_value("kbd.address.virtual"); 67 ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(), 68 0, &gxemul_kbd); 75 gxemul_cmds[0].addr = (void *) addr; 76 ipc_register_irq(inr, device_assign_devno(), 0, &gxemul_kbd); 69 77 return 0; 70 78 } -
uspace/srv/hid/kbd/port/msim.c
r24a2517 rc621f4aa 30 30 * @ingroup kbd 31 31 * @{ 32 */ 32 */ 33 33 /** @file 34 * @brief Msim keyboard port driver.34 * @brief Msim keyboard port driver. 35 35 */ 36 36 … … 41 41 #include <kbd.h> 42 42 #include <ddi.h> 43 #include <errno.h> 43 44 44 45 irq_cmd_t msim_cmds[] = { … … 63 64 int kbd_port_init(void) 64 65 { 66 sysarg_t vaddr; 67 if (sysinfo_get_value("kbd.address.virtual", &vaddr) != EOK) 68 return -1; 69 70 sysarg_t inr; 71 if (sysinfo_get_value("kbd.inr", &inr) != EOK) 72 return -1; 73 74 msim_cmds[0].addr = (void *) vaddr; 65 75 async_set_interrupt_received(msim_irq_handler); 66 msim_cmds[0].addr = sysinfo_value("kbd.address.virtual"); 67 ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(), 68 0, &msim_kbd); 76 ipc_register_irq(inr, device_assign_devno(), 0, &msim_kbd); 77 69 78 return 0; 70 79 } -
uspace/srv/hid/kbd/port/ns16550.c
r24a2517 rc621f4aa 30 30 * @ingroup kbd 31 31 * @{ 32 */ 32 */ 33 33 /** @file 34 * @brief NS16550 port driver.34 * @brief NS16550 port driver. 35 35 */ 36 36 … … 43 43 #include <sun.h> 44 44 #include <ddi.h> 45 #include <errno.h> 45 46 46 47 /* NS16550 registers */ 47 #define RBR_REG 0/** Receiver Buffer Register. */48 #define IER_REG 1/** Interrupt Enable Register. */49 #define IIR_REG 2/** Interrupt Ident Register (read). */50 #define FCR_REG 2/** FIFO control register (write). */51 #define LCR_REG 3/** Line Control register. */52 #define MCR_REG 4/** Modem Control Register. */53 #define LSR_REG 5/** Line Status Register. */48 #define RBR_REG 0 /** Receiver Buffer Register. */ 49 #define IER_REG 1 /** Interrupt Enable Register. */ 50 #define IIR_REG 2 /** Interrupt Ident Register (read). */ 51 #define FCR_REG 2 /** FIFO control register (write). */ 52 #define LCR_REG 3 /** Line Control register. */ 53 #define MCR_REG 4 /** Modem Control Register. */ 54 #define LSR_REG 5 /** Line Status Register. */ 54 55 55 #define LSR_DATA_READY 0x0156 #define LSR_DATA_READY 0x01 56 57 57 58 static irq_cmd_t ns16550_cmds[] = { 58 59 { 59 60 .cmd = CMD_PIO_READ_8, 60 .addr = (void *) 0, /* will be patched in run-time */61 .addr = (void *) 0, /* Will be patched in run-time */ 61 62 .dstarg = 1 62 63 }, … … 74 75 { 75 76 .cmd = CMD_PIO_READ_8, 76 .addr = (void *) 0, /* will be patched in run-time */77 .addr = (void *) 0, /* Will be patched in run-time */ 77 78 .dstarg = 2 78 79 }, … … 96 97 void *vaddr; 97 98 98 async_set_interrupt_received(ns16550_irq_handler); 99 100 ns16550_physical = sysinfo_value("kbd.address.physical"); 101 ns16550_kernel = sysinfo_value("kbd.address.kernel"); 99 if (sysinfo_get_value("kbd.address.physical", &ns16550_physical) != EOK) 100 return -1; 101 102 if (sysinfo_get_value("kbd.address.kernel", &ns16550_kernel) != EOK) 103 return -1; 104 105 sysarg_t inr; 106 if (sysinfo_get_value("kbd.inr", &inr) != EOK) 107 return -1; 108 102 109 ns16550_kbd.cmds[0].addr = (void *) (ns16550_kernel + LSR_REG); 103 110 ns16550_kbd.cmds[3].addr = (void *) (ns16550_kernel + RBR_REG); 104 ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(), 105 sysinfo_value("kbd.inr"), &ns16550_kbd); 111 112 async_set_interrupt_received(ns16550_irq_handler); 113 ipc_register_irq(inr, device_assign_devno(), inr, &ns16550_kbd); 114 106 115 return pio_enable((void *) ns16550_physical, 8, &vaddr); 107 }108 109 void ns16550_port_yield(void)110 {111 }112 113 void ns16550_port_reclaim(void)114 {115 116 } 116 117 -
uspace/srv/hid/kbd/port/pl050.c
r24a2517 rc621f4aa 45 45 #include <ddi.h> 46 46 #include <stdio.h> 47 #include <errno.h> 47 48 48 #define PL050_STAT_RXFULL (1 << 4) 49 #define PL050_STAT_RXFULL (1 << 4) 50 49 51 static irq_cmd_t pl050_cmds[] = { 50 52 { … … 66 68 { 67 69 .cmd = CMD_PIO_READ_8, 68 .addr = NULL, /* will be patched in run-time */70 .addr = NULL, /* Will be patched in run-time */ 69 71 .dstarg = 2 70 72 }, … … 83 85 int kbd_port_init(void) 84 86 { 85 86 pl050_kbd.cmds[0].addr = (void *) sysinfo_value("kbd.address.status"); 87 pl050_kbd.cmds[3].addr = (void *) sysinfo_value("kbd.address.data"); 88 87 sysarg_t addr; 88 if (sysinfo_get_value("kbd.address.status", &addr) != EOK) 89 return -1; 90 91 pl050_kbd.cmds[0].addr = (void *) addr; 92 93 if (sysinfo_get_value("kbd.address.data", &addr) != EOK) 94 return -1; 95 96 pl050_kbd.cmds[3].addr = (void *) addr; 97 98 sysarg_t inr; 99 if (sysinfo_get_value("kbd.inr", &inr) != EOK) 100 return -1; 101 89 102 async_set_interrupt_received(pl050_irq_handler); 90 91 ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(), 0, &pl050_kbd); 92 103 ipc_register_irq(inr, device_assign_devno(), 0, &pl050_kbd); 104 93 105 return 0; 94 106 } -
uspace/srv/hid/kbd/port/sgcn.c
r24a2517 rc621f4aa 30 30 * @ingroup kbd 31 31 * @{ 32 */ 32 */ 33 33 /** @file 34 * @brief SGCN (Serengeti Console) keyboard port driver.34 * @brief SGCN (Serengeti Console) keyboard port driver. 35 35 */ 36 36 … … 44 44 #include <thread.h> 45 45 #include <bool.h> 46 #include <errno.h> 46 47 47 #define POLL_INTERVAL 1000048 #define POLL_INTERVAL 10000 48 49 49 50 /** 50 51 * SGCN buffer header. It is placed at the very beginning of the SGCN 51 * buffer. 52 * buffer. 52 53 */ 53 54 typedef struct { … … 92 93 93 94 /* polling thread */ 94 static void *sgcn_thread_impl(void *arg);95 static void sgcn_thread_impl(void *arg); 95 96 96 97 static volatile bool polling_disabled = false; … … 102 103 int kbd_port_init(void) 103 104 { 104 sram_virt_addr = (uintptr_t) as_get_mappable_page(sysinfo_value("sram.area.size")); 105 if (physmem_map((void *) sysinfo_value("sram.address.physical"), 106 (void *) sram_virt_addr, sysinfo_value("sram.area.size") / PAGE_SIZE, 107 AS_AREA_READ | AS_AREA_WRITE) != 0) { 105 sysarg_t sram_paddr; 106 if (sysinfo_get_value("sram.address.physical", &sram_paddr) != EOK) 107 return -1; 108 109 sysarg_t sram_size; 110 if (sysinfo_get_value("sram.area.size", &sram_size) != EOK) 111 return -1; 112 113 if (sysinfo_get_value("sram.buffer.offset", &sram_buffer_offset) != EOK) 114 sram_buffer_offset = 0; 115 116 sram_virt_addr = (uintptr_t) as_get_mappable_page(sram_size); 117 118 if (physmem_map((void *) sram_paddr, (void *) sram_virt_addr, 119 sram_size / PAGE_SIZE, AS_AREA_READ | AS_AREA_WRITE) != 0) { 108 120 printf("SGCN: uspace driver could not map physical memory."); 109 121 return -1; 110 122 } 111 123 112 sram_buffer_offset = sysinfo_value("sram.buffer.offset");113 114 124 thread_id_t tid; 115 int rc; 116 117 rc = thread_create(sgcn_thread_impl, NULL, "kbd_poll", &tid); 118 if (rc != 0) { 125 int rc = thread_create(sgcn_thread_impl, NULL, "kbd_poll", &tid); 126 if (rc != 0) 119 127 return rc; 120 } 121 128 122 129 return 0; 123 130 } … … 167 174 * Thread to poll SGCN for keypresses. 168 175 */ 169 static void *sgcn_thread_impl(void *arg)176 static void sgcn_thread_impl(void *arg) 170 177 { 171 178 (void) arg; -
uspace/srv/hid/kbd/port/ski.c
r24a2517 rc621f4aa 49 49 #define POLL_INTERVAL 10000 50 50 51 static void *ski_thread_impl(void *arg);51 static void ski_thread_impl(void *arg); 52 52 static int32_t ski_getchar(void); 53 53 … … 84 84 85 85 /** Thread to poll Ski for keypresses. */ 86 static void *ski_thread_impl(void *arg)86 static void ski_thread_impl(void *arg) 87 87 { 88 88 int32_t c; -
uspace/srv/hid/kbd/port/sun.c
r24a2517 rc621f4aa 39 39 #include <sun.h> 40 40 #include <sysinfo.h> 41 #include <errno.h> 42 #include <bool.h> 41 43 42 44 /** Sun keyboard virtual port driver. … … 50 52 int kbd_port_init(void) 51 53 { 52 if (sysinfo_value("kbd.type.z8530")) { 54 sysarg_t z8530; 55 if (sysinfo_get_value("kbd.type.z8530", &z8530) != EOK) 56 z8530 = false; 57 58 sysarg_t ns16550; 59 if (sysinfo_get_value("kbd.type.ns16550", &ns16550) != EOK) 60 ns16550 = false; 61 62 if (z8530) { 53 63 if (z8530_port_init() == 0) 54 64 return 0; 55 65 } 56 66 57 if ( sysinfo_value("kbd.type.ns16550")) {67 if (ns16550) { 58 68 if (ns16550_port_init() == 0) 59 69 return 0; -
uspace/srv/hid/kbd/port/z8530.c
r24a2517 rc621f4aa 30 30 * @ingroup kbd 31 31 * @{ 32 */ 32 */ 33 33 /** @file 34 * @brief Z8530 keyboard port driver.34 * @brief Z8530 keyboard port driver. 35 35 */ 36 36 … … 44 44 #include <sys/types.h> 45 45 #include <ddi.h> 46 #include <errno.h> 46 47 47 #define CHAN_A_STATUS 448 #define CHAN_A_DATA 648 #define CHAN_A_STATUS 4 49 #define CHAN_A_DATA 6 49 50 50 #define RR0_RCA 151 #define RR0_RCA 1 51 52 52 53 static irq_cmd_t z8530_cmds[] = { 53 54 { 54 55 .cmd = CMD_PIO_READ_8, 55 .addr = (void *) 0, /* will be patched in run-time */56 .addr = (void *) 0, /* Will be patched in run-time */ 56 57 .dstarg = 1 57 58 }, … … 69 70 { 70 71 .cmd = CMD_PIO_READ_8, 71 .addr = (void *) 0, /* will be patched in run-time */72 .addr = (void *) 0, /* Will be patched in run-time */ 72 73 .dstarg = 2 73 74 }, … … 86 87 int z8530_port_init(void) 87 88 { 89 sysarg_t kaddr; 90 if (sysinfo_get_value("kbd.address.kernel", &kaddr) != EOK) 91 return -1; 92 93 sysarg_t inr; 94 if (sysinfo_get_value("kbd.inr", &inr) != EOK) 95 return -1; 96 97 z8530_cmds[0].addr = (void *) kaddr + CHAN_A_STATUS; 98 z8530_cmds[3].addr = (void *) kaddr + CHAN_A_DATA; 99 88 100 async_set_interrupt_received(z8530_irq_handler); 89 z8530_cmds[0].addr = (void *) sysinfo_value("kbd.address.kernel") + 90 CHAN_A_STATUS; 91 z8530_cmds[3].addr = (void *) sysinfo_value("kbd.address.kernel") + 92 CHAN_A_DATA; 93 ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(), 94 sysinfo_value("kbd.inr"), &z8530_kbd); 101 ipc_register_irq(inr, device_assign_devno(), inr, &z8530_kbd); 102 95 103 return 0; 96 }97 98 void z8530_port_yield(void)99 {100 }101 102 void z8530_port_reclaim(void)103 {104 104 } 105 105
Note:
See TracChangeset
for help on using the changeset viewer.
