Changes in / [135486d:b546231] in mainline
- Files:
-
- 4 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
r135486d rb546231 108 108 $(USPACE_PATH)/srv/fs/ext4fs/ext4fs \ 109 109 $(USPACE_PATH)/srv/hid/remcons/remcons \ 110 $(USPACE_PATH)/srv/hid/isdv4_tablet/isdv4_tablet \ 110 111 $(USPACE_PATH)/srv/net/ethip/ethip \ 111 112 $(USPACE_PATH)/srv/net/inetsrv/inetsrv \ -
uspace/Makefile
r135486d rb546231 101 101 srv/hid/console \ 102 102 srv/hid/s3c24xx_ts \ 103 srv/hid/isdv4_tablet \ 103 104 srv/hid/fb \ 104 105 srv/hid/input \ -
uspace/app/sportdmp/sportdmp.c
r135486d rb546231 140 140 ssize_t i; 141 141 for (i = 0; i < read; i++) { 142 if ((buf[i] >= 32) && (buf[i] < 128)) 143 putchar((wchar_t) buf[i]); 144 else 145 putchar('.'); 146 fflush(stdout); 142 printf("%02hhx ", buf[i]); 147 143 } 144 fflush(stdout); 148 145 } 149 146 -
uspace/drv/char/ns8250/cyclic_buffer.h
r135486d rb546231 36 36 #define CYCLIC_BUFFER_H_ 37 37 38 #define BUF_LEN 25638 #define BUF_LEN 4096 39 39 40 40 typedef struct cyclic_buffer { -
uspace/drv/char/ns8250/ns8250.c
r135486d rb546231 82 82 /** Interrupt ID Register definition. */ 83 83 #define NS8250_IID_ACTIVE (1 << 0) 84 #define NS8250_IID_CAUSE_MASK 0x0e 85 #define NS8250_IID_CAUSE_RXSTATUS 0x06 84 86 85 87 /** FIFO Control Register definition. */ … … 179 181 /** The fibril mutex for synchronizing the access to the device. */ 180 182 fibril_mutex_t mutex; 183 /** Indicates that some data has become available */ 184 fibril_condvar_t input_buffer_available; 181 185 /** True if device is removed. */ 182 186 bool removed; … … 238 242 { 239 243 ns8250_t *ns = NS8250(fun); 240 int ret = EOK; 244 int ret = 0; 245 246 if (count == 0) return 0; 241 247 242 248 fibril_mutex_lock(&ns->mutex); 249 while (buf_is_empty(&ns->input_buffer)) 250 fibril_condvar_wait(&ns->input_buffer_available, &ns->mutex); 243 251 while (!buf_is_empty(&ns->input_buffer) && (size_t)ret < count) { 244 252 buf[ret] = (char)buf_pop_front(&ns->input_buffer); … … 460 468 { 461 469 /* Interrupt when data received. */ 462 pio_write_8(®s->ier, NS8250_IER_RXREADY );470 pio_write_8(®s->ier, NS8250_IER_RXREADY | NS8250_IER_RXSTATUS); 463 471 pio_write_8(®s->mcr, NS8250_MCR_DTR | NS8250_MCR_RTS 464 472 | NS8250_MCR_OUT2); … … 499 507 async_exchange_end(exch); 500 508 509 /* Read LSR to clear possible previous LSR interrupt */ 510 pio_read_8(&ns->regs->lsr); 511 501 512 /* Enable interrupt on the serial port. */ 502 513 ns8250_port_interrupts_enable(ns->regs); … … 695 706 /* 8 bits, no parity, two stop bits. */ 696 707 ns8250_port_set_com_props(ns->regs, SERIAL_NO_PARITY, 8, 2); 697 /* Enable FIFO, clear them, with 14-byte threshold. */ 708 /* 709 * Enable FIFO, clear them, with 4-byte threshold for greater 710 * reliability. 711 */ 698 712 pio_write_8(&ns->regs->iid, NS8250_FCR_FIFOENABLE 699 | NS8250_FCR_RXFIFORESET | NS8250_FCR_TXFIFORESET 700 | NS8250_FCR_RXTRIGGERLOW | NS8250_FCR_RXTRIGGERHI);713 | NS8250_FCR_RXFIFORESET | NS8250_FCR_TXFIFORESET 714 | NS8250_FCR_RXTRIGGERLOW); 701 715 /* 702 716 * RTS/DSR set (Request to Send and Data Terminal Ready lines enabled), … … 731 745 bool cont = true; 732 746 747 fibril_mutex_lock(&ns->mutex); 733 748 while (cont) { 734 fibril_mutex_lock(&ns->mutex);735 736 749 cont = ns8250_received(regs); 737 750 if (cont) { … … 739 752 740 753 if (ns->client_connected) { 754 bool buf_was_empty = buf_is_empty(&ns->input_buffer); 741 755 if (!buf_push_back(&ns->input_buffer, val)) { 742 756 ddf_msg(LVL_WARN, "Buffer overflow on " 743 757 "%s.", ns->dev->name); 758 break; 744 759 } else { 745 760 ddf_msg(LVL_DEBUG2, "Character %c saved " 746 761 "to the buffer of %s.", 747 762 val, ns->dev->name); 763 if (buf_was_empty) 764 fibril_condvar_broadcast(&ns->input_buffer_available); 748 765 } 749 766 } 750 767 } 751 752 fibril_mutex_unlock(&ns->mutex); 753 fibril_yield(); 754 } 768 } 769 fibril_mutex_unlock(&ns->mutex); 770 fibril_yield(); 755 771 } 756 772 757 773 /** The interrupt handler. 758 774 * 759 * The serial port is initialized to interrupt when some data come, so the 760 * interrupt is handled by reading the incomming data. 775 * The serial port is initialized to interrupt when some data come or line 776 * status register changes, so the interrupt is handled by reading the incoming 777 * data and reading the line status register. 761 778 * 762 779 * @param dev The serial port device. … … 765 782 ipc_call_t *icall) 766 783 { 767 ns8250_read_from_device(NS8250_FROM_DEV(dev)); 784 ns8250_t *ns = NS8250_FROM_DEV(dev); 785 786 uint8_t iir = pio_read_8(&ns->regs->iid); 787 if ((iir & NS8250_IID_CAUSE_MASK) == NS8250_IID_CAUSE_RXSTATUS) { 788 uint8_t lsr = pio_read_8(&ns->regs->lsr); 789 if (lsr & NS8250_LSR_OE) { 790 ddf_msg(LVL_WARN, "Overrun error on %s", ns->dev->name); 791 } 792 } 793 794 ns8250_read_from_device(ns); 768 795 } 769 796 … … 811 838 812 839 fibril_mutex_initialize(&ns->mutex); 840 fibril_condvar_initialize(&ns->input_buffer_available); 813 841 ns->dev = dev; 814 842 … … 1053 1081 static void ns8250_init(void) 1054 1082 { 1055 ddf_log_init(NAME, LVL_ ERROR);1083 ddf_log_init(NAME, LVL_WARN); 1056 1084 1057 1085 ns8250_dev_ops.open = &ns8250_open; -
uspace/lib/c/include/ipc/input.h
r135486d rb546231 46 46 INPUT_EVENT_KEY = IPC_FIRST_USER_METHOD, 47 47 INPUT_EVENT_MOVE, 48 INPUT_EVENT_ABS_MOVE, 48 49 INPUT_EVENT_BUTTON 49 50 } input_notif_t; -
uspace/lib/c/include/ipc/mouseev.h
r135486d rb546231 47 47 typedef enum { 48 48 MOUSEEV_MOVE_EVENT = IPC_FIRST_USER_METHOD, 49 MOUSEEV_ABS_MOVE_EVENT, 49 50 MOUSEEV_BUTTON_EVENT 50 51 } mouseev_notif_t; -
uspace/srv/hid/console/console.c
r135486d rb546231 383 383 384 384 fb_pointer_update(fb_sess, mouse.x, mouse.y, true); 385 } 386 387 static void cons_mouse_abs_move(sysarg_t x, sysarg_t y, 388 sysarg_t max_x, sysarg_t max_y) 389 { 390 if (max_x && max_y) { 391 mouse.x = limit(x * xres / max_x, 0, xres); 392 mouse.y = limit(y * yres / max_y, 0, yres); 393 394 fb_pointer_update(fb_sess, mouse.x, mouse.y, true); 395 } 385 396 } 386 397 … … 503 514 async_answer_0(callid, EOK); 504 515 break; 516 case INPUT_EVENT_ABS_MOVE: 517 cons_mouse_abs_move(IPC_GET_ARG1(call), IPC_GET_ARG2(call), 518 IPC_GET_ARG3(call), IPC_GET_ARG4(call)); 519 async_answer_0(callid, EOK); 520 break; 505 521 case INPUT_EVENT_BUTTON: 506 522 /* Got pointer button press/release event */ -
uspace/srv/hid/input/generic/input.c
r135486d rb546231 189 189 } 190 190 async_exchange_end(exch); 191 } 192 193 /** Mouse pointer has moved in absolute mode. */ 194 void mouse_push_event_abs_move(mouse_dev_t *mdev, unsigned int x, unsigned int y, 195 unsigned int max_x, unsigned int max_y) 196 { 197 if (max_x && max_y) { 198 async_exch_t *exch = async_exchange_begin(client_sess); 199 async_msg_4(exch, INPUT_EVENT_ABS_MOVE, x, y, max_x, max_y); 200 async_exchange_end(exch); 201 } 191 202 } 192 203 -
uspace/srv/hid/input/include/mouse.h
r135486d rb546231 63 63 extern void mouse_push_data(mouse_dev_t *, sysarg_t); 64 64 extern void mouse_push_event_move(mouse_dev_t *, int, int, int); 65 extern void mouse_push_event_abs_move(mouse_dev_t *, unsigned int, unsigned int, 66 unsigned int, unsigned int); 65 67 extern void mouse_push_event_button(mouse_dev_t *, int, int); 66 68 -
uspace/srv/hid/input/proto/mousedev.c
r135486d rb546231 96 96 retval = EOK; 97 97 break; 98 case MOUSEEV_ABS_MOVE_EVENT: 99 mouse_push_event_abs_move(mousedev->mouse_dev, 100 IPC_GET_ARG1(call), IPC_GET_ARG2(call), 101 IPC_GET_ARG3(call), IPC_GET_ARG4(call)); 102 retval = EOK; 103 break; 98 104 case MOUSEEV_BUTTON_EVENT: 99 105 mouse_push_event_button(mousedev->mouse_dev,
Note:
See TracChangeset
for help on using the changeset viewer.