Changes in / [5882487:b52dd1de] in mainline
- Files:
-
- 4 deleted
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
r5882487 rb52dd1de 109 109 $(USPACE_PATH)/srv/fs/ext4fs/ext4fs \ 110 110 $(USPACE_PATH)/srv/hid/remcons/remcons \ 111 $(USPACE_PATH)/srv/hid/isdv4_tablet/isdv4_tablet \112 111 $(USPACE_PATH)/srv/net/ethip/ethip \ 113 112 $(USPACE_PATH)/srv/net/inetsrv/inetsrv \ -
uspace/Makefile
r5882487 rb52dd1de 103 103 srv/hid/console \ 104 104 srv/hid/s3c24xx_ts \ 105 srv/hid/isdv4_tablet \106 105 srv/hid/fb \ 107 106 srv/hid/input \ -
uspace/app/edit/edit.c
r5882487 rb52dd1de 126 126 static int file_save_range(char const *fname, spt_t const *spos, 127 127 spt_t const *epos); 128 static char *filename_prompt(char const *prompt, char const *init_value); 128 129 static char *range_get_str(spt_t const *spos, spt_t const *epos); 129 130 static char *prompt(char const *prompt, char const *init_value);131 130 132 131 static void pane_text_display(void); … … 143 142 static void caret_move_word_left(void); 144 143 static void caret_move_word_right(void); 145 static void caret_move_to_line(int row);146 static void caret_go_to_line_ask(void);147 144 148 145 static bool selection_active(void); … … 407 404 caret_move_word_left(); 408 405 break; 409 case KC_L:410 caret_go_to_line_ask();411 break;412 406 default: 413 407 break; … … 429 423 } 430 424 431 /** Move caret while preserving or resetting selection. */ 432 static void caret_movement(int drow, int dcolumn, enum dir_spec align_dir, 433 bool select) 425 static void key_handle_movement(unsigned int key, bool select) 434 426 { 435 427 spt_t pt; … … 443 435 had_sel = !spt_equal(&caret_pt, &pt); 444 436 445 caret_move(drow, dcolumn, align_dir); 437 switch (key) { 438 case KC_LEFT: 439 caret_move(0, -1, dir_before); 440 break; 441 case KC_RIGHT: 442 caret_move(0, 0, dir_after); 443 break; 444 case KC_UP: 445 caret_move(-1, 0, dir_before); 446 break; 447 case KC_DOWN: 448 caret_move(+1, 0, dir_before); 449 break; 450 case KC_HOME: 451 caret_move(0, -ED_INFTY, dir_before); 452 break; 453 case KC_END: 454 caret_move(0, +ED_INFTY, dir_before); 455 break; 456 case KC_PAGE_UP: 457 caret_move(-pane.rows, 0, dir_before); 458 break; 459 case KC_PAGE_DOWN: 460 caret_move(+pane.rows, 0, dir_before); 461 break; 462 default: 463 break; 464 } 446 465 447 466 if (select == false) { … … 468 487 } 469 488 470 static void key_handle_movement(unsigned int key, bool select)471 {472 switch (key) {473 case KC_LEFT:474 caret_movement(0, -1, dir_before, select);475 break;476 case KC_RIGHT:477 caret_movement(0, 0, dir_after, select);478 break;479 case KC_UP:480 caret_movement(-1, 0, dir_before, select);481 break;482 case KC_DOWN:483 caret_movement(+1, 0, dir_before, select);484 break;485 case KC_HOME:486 caret_movement(0, -ED_INFTY, dir_before, select);487 break;488 case KC_END:489 caret_movement(0, +ED_INFTY, dir_before, select);490 break;491 case KC_PAGE_UP:492 caret_movement(-pane.rows, 0, dir_before, select);493 break;494 case KC_PAGE_DOWN:495 caret_movement(+pane.rows, 0, dir_before, select);496 break;497 default:498 break;499 }500 }501 502 489 /** Save the document. */ 503 490 static int file_save(char const *fname) … … 533 520 char *fname; 534 521 535 fname = prompt("Save As", old_fname);522 fname = filename_prompt("Save As", old_fname); 536 523 if (fname == NULL) { 537 524 status_display("Save cancelled."); … … 548 535 } 549 536 550 /** Ask for a string. */551 static char * prompt(char const *prompt, char const *init_value)537 /** Ask for a file name. */ 538 static char *filename_prompt(char const *prompt, char const *init_value) 552 539 { 553 540 kbd_event_t ev; … … 855 842 /* Fill until the end of display area. */ 856 843 857 if ( (unsigned)s_column - 1 <scr_columns)858 fill = scr_columns - (s_column - 1);844 if (str_length(row_buf) < (unsigned) scr_columns) 845 fill = scr_columns - str_length(row_buf); 859 846 else 860 847 fill = 0; … … 1090 1077 pane.rflags |= REDRAW_TEXT; 1091 1078 } 1092 1093 /** Change the caret position to a beginning of a given line1094 */1095 static void caret_move_to_line(int row)1096 {1097 spt_t pt;1098 coord_t coord;1099 1100 tag_get_pt(&pane.caret_pos, &pt);1101 spt_get_coord(&pt, &coord);1102 1103 caret_movement(row - coord.row, 0, dir_before, false);1104 }1105 1106 /** Ask for line and go to it. */1107 static void caret_go_to_line_ask(void)1108 {1109 char *sline;1110 1111 sline = prompt("Go to line", "");1112 if (sline == NULL) {1113 status_display("Go to line cancelled.");1114 return;1115 }1116 1117 char *endptr;1118 int line = strtol(sline, &endptr, 10);1119 if (*endptr != '\0') {1120 status_display("Invalid number entered.");1121 return;1122 }1123 1124 caret_move_to_line(line);1125 }1126 1127 1079 1128 1080 /** Check for non-empty selection. */ -
uspace/app/sportdmp/sportdmp.c
r5882487 rb52dd1de 140 140 ssize_t i; 141 141 for (i = 0; i < read; i++) { 142 printf("%02hhx ", buf[i]); 142 if ((buf[i] >= 32) && (buf[i] < 128)) 143 putchar((wchar_t) buf[i]); 144 else 145 putchar('.'); 146 fflush(stdout); 143 147 } 144 fflush(stdout);145 148 } 146 149 -
uspace/drv/bus/usb/usbmast/main.c
r5882487 rb52dd1de 82 82 void *arg); 83 83 84 static int usbmast_bd_open(bd_srv s_t *, bd_srv_t *);84 static int usbmast_bd_open(bd_srv_t *); 85 85 static int usbmast_bd_close(bd_srv_t *); 86 86 static int usbmast_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); … … 100 100 static usbmast_fun_t *bd_srv_usbmast(bd_srv_t *bd) 101 101 { 102 return (usbmast_fun_t *)bd-> srvs->sarg;102 return (usbmast_fun_t *)bd->arg; 103 103 } 104 104 … … 240 240 mfun->lun = lun; 241 241 242 bd_srv s_init(&mfun->bds);243 mfun->bd s.ops = &usbmast_bd_ops;244 mfun->bd s.sarg = mfun;242 bd_srv_init(&mfun->bd); 243 mfun->bd.ops = &usbmast_bd_ops; 244 mfun->bd.arg = mfun; 245 245 246 246 /* Set up a connection handler. */ … … 311 311 312 312 mfun = (usbmast_fun_t *) ((ddf_fun_t *)arg)->driver_data; 313 bd_conn(iid, icall, &mfun->bd s);313 bd_conn(iid, icall, &mfun->bd); 314 314 } 315 315 316 316 /** Open device. */ 317 static int usbmast_bd_open(bd_srv s_t *bds, bd_srv_t *bd)317 static int usbmast_bd_open(bd_srv_t *bd) 318 318 { 319 319 return EOK; -
uspace/drv/bus/usb/usbmast/usbmast.h
r5882487 rb52dd1de 69 69 /** Block size in bytes */ 70 70 size_t block_size; 71 /** Block device serv icestructure */72 bd_srv s_t bds;71 /** Block device server structure */ 72 bd_srv_t bd; 73 73 } usbmast_fun_t; 74 74 -
uspace/drv/char/ns8250/cyclic_buffer.h
r5882487 rb52dd1de 36 36 #define CYCLIC_BUFFER_H_ 37 37 38 #define BUF_LEN 409638 #define BUF_LEN 256 39 39 40 40 typedef struct cyclic_buffer { -
uspace/drv/char/ns8250/ns8250.c
r5882487 rb52dd1de 82 82 /** Interrupt ID Register definition. */ 83 83 #define NS8250_IID_ACTIVE (1 << 0) 84 #define NS8250_IID_CAUSE_MASK 0x0e85 #define NS8250_IID_CAUSE_RXSTATUS 0x0686 84 87 85 /** FIFO Control Register definition. */ … … 181 179 /** The fibril mutex for synchronizing the access to the device. */ 182 180 fibril_mutex_t mutex; 183 /** Indicates that some data has become available */184 fibril_condvar_t input_buffer_available;185 181 /** True if device is removed. */ 186 182 bool removed; … … 242 238 { 243 239 ns8250_t *ns = NS8250(fun); 244 int ret = 0; 245 246 if (count == 0) return 0; 240 int ret = EOK; 247 241 248 242 fibril_mutex_lock(&ns->mutex); 249 while (buf_is_empty(&ns->input_buffer))250 fibril_condvar_wait(&ns->input_buffer_available, &ns->mutex);251 243 while (!buf_is_empty(&ns->input_buffer) && (size_t)ret < count) { 252 244 buf[ret] = (char)buf_pop_front(&ns->input_buffer); … … 468 460 { 469 461 /* Interrupt when data received. */ 470 pio_write_8(®s->ier, NS8250_IER_RXREADY | NS8250_IER_RXSTATUS);462 pio_write_8(®s->ier, NS8250_IER_RXREADY); 471 463 pio_write_8(®s->mcr, NS8250_MCR_DTR | NS8250_MCR_RTS 472 464 | NS8250_MCR_OUT2); … … 507 499 async_exchange_end(exch); 508 500 509 /* Read LSR to clear possible previous LSR interrupt */510 pio_read_8(&ns->regs->lsr);511 512 501 /* Enable interrupt on the serial port. */ 513 502 ns8250_port_interrupts_enable(ns->regs); … … 706 695 /* 8 bits, no parity, two stop bits. */ 707 696 ns8250_port_set_com_props(ns->regs, SERIAL_NO_PARITY, 8, 2); 708 /* 709 * Enable FIFO, clear them, with 4-byte threshold for greater 710 * reliability. 711 */ 697 /* Enable FIFO, clear them, with 14-byte threshold. */ 712 698 pio_write_8(&ns->regs->iid, NS8250_FCR_FIFOENABLE 713 | NS8250_FCR_RXFIFORESET | NS8250_FCR_TXFIFORESET 714 | NS8250_FCR_RXTRIGGERLOW );699 | NS8250_FCR_RXFIFORESET | NS8250_FCR_TXFIFORESET 700 | NS8250_FCR_RXTRIGGERLOW | NS8250_FCR_RXTRIGGERHI); 715 701 /* 716 702 * RTS/DSR set (Request to Send and Data Terminal Ready lines enabled), … … 745 731 bool cont = true; 746 732 747 fibril_mutex_lock(&ns->mutex);748 733 while (cont) { 734 fibril_mutex_lock(&ns->mutex); 735 749 736 cont = ns8250_received(regs); 750 737 if (cont) { … … 752 739 753 740 if (ns->client_connected) { 754 bool buf_was_empty = buf_is_empty(&ns->input_buffer);755 741 if (!buf_push_back(&ns->input_buffer, val)) { 756 742 ddf_msg(LVL_WARN, "Buffer overflow on " 757 743 "%s.", ns->dev->name); 758 break;759 744 } else { 760 745 ddf_msg(LVL_DEBUG2, "Character %c saved " 761 746 "to the buffer of %s.", 762 747 val, ns->dev->name); 763 if (buf_was_empty)764 fibril_condvar_broadcast(&ns->input_buffer_available);765 748 } 766 749 } 767 750 } 768 } 769 fibril_mutex_unlock(&ns->mutex); 770 fibril_yield(); 751 752 fibril_mutex_unlock(&ns->mutex); 753 fibril_yield(); 754 } 771 755 } 772 756 773 757 /** The interrupt handler. 774 758 * 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. 759 * The serial port is initialized to interrupt when some data come, so the 760 * interrupt is handled by reading the incomming data. 778 761 * 779 762 * @param dev The serial port device. … … 782 765 ipc_call_t *icall) 783 766 { 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); 767 ns8250_read_from_device(NS8250_FROM_DEV(dev)); 795 768 } 796 769 … … 838 811 839 812 fibril_mutex_initialize(&ns->mutex); 840 fibril_condvar_initialize(&ns->input_buffer_available);841 813 ns->dev = dev; 842 814 … … 1081 1053 static void ns8250_init(void) 1082 1054 { 1083 ddf_log_init(NAME, LVL_ WARN);1055 ddf_log_init(NAME, LVL_ERROR); 1084 1056 1085 1057 ns8250_dev_ops.open = &ns8250_open; -
uspace/lib/c/generic/bd_srv.c
r5882487 rb52dd1de 67 67 } 68 68 69 if (srv-> srvs->ops->read_blocks == NULL) {69 if (srv->ops->read_blocks == NULL) { 70 70 async_answer_0(rcallid, ENOTSUP); 71 71 async_answer_0(callid, ENOTSUP); … … 73 73 } 74 74 75 rc = srv-> srvs->ops->read_blocks(srv, ba, cnt, buf, size);75 rc = srv->ops->read_blocks(srv, ba, cnt, buf, size); 76 76 if (rc != EOK) { 77 77 async_answer_0(rcallid, ENOMEM); … … 109 109 } 110 110 111 if (srv-> srvs->ops->read_toc == NULL) {111 if (srv->ops->read_toc == NULL) { 112 112 async_answer_0(rcallid, ENOTSUP); 113 113 async_answer_0(callid, ENOTSUP); … … 115 115 } 116 116 117 rc = srv-> srvs->ops->read_toc(srv, session, buf, size);117 rc = srv->ops->read_toc(srv, session, buf, size); 118 118 if (rc != EOK) { 119 119 async_answer_0(rcallid, ENOMEM); … … 146 146 } 147 147 148 if (srv-> srvs->ops->write_blocks == NULL) {149 async_answer_0(callid, ENOTSUP); 150 return; 151 } 152 153 rc = srv-> srvs->ops->write_blocks(srv, ba, cnt, data, size);148 if (srv->ops->write_blocks == NULL) { 149 async_answer_0(callid, ENOTSUP); 150 return; 151 } 152 153 rc = srv->ops->write_blocks(srv, ba, cnt, data, size); 154 154 free(data); 155 155 async_answer_0(callid, rc); … … 162 162 size_t block_size; 163 163 164 if (srv-> srvs->ops->get_block_size == NULL) {165 async_answer_0(callid, ENOTSUP); 166 return; 167 } 168 169 rc = srv-> srvs->ops->get_block_size(srv, &block_size);164 if (srv->ops->get_block_size == NULL) { 165 async_answer_0(callid, ENOTSUP); 166 return; 167 } 168 169 rc = srv->ops->get_block_size(srv, &block_size); 170 170 async_answer_1(callid, rc, block_size); 171 171 } … … 177 177 aoff64_t num_blocks; 178 178 179 if (srv-> srvs->ops->get_num_blocks == NULL) {180 async_answer_0(callid, ENOTSUP); 181 return; 182 } 183 184 rc = srv-> srvs->ops->get_num_blocks(srv, &num_blocks);179 if (srv->ops->get_num_blocks == NULL) { 180 async_answer_0(callid, ENOTSUP); 181 return; 182 } 183 184 rc = srv->ops->get_num_blocks(srv, &num_blocks); 185 185 async_answer_2(callid, rc, LOWER32(num_blocks), UPPER32(num_blocks)); 186 186 } 187 187 188 static bd_srv_t *bd_srv_create(bd_srvs_t *srvs) 189 { 190 bd_srv_t *srv; 191 192 srv = calloc(1, sizeof(srv)); 193 if (srv == NULL) 194 return NULL; 195 196 srv->srvs = srvs; 197 return srv; 198 } 199 200 void bd_srvs_init(bd_srvs_t *srvs) 201 { 202 srvs->ops = NULL; 203 srvs->sarg = NULL; 204 } 205 206 int bd_conn(ipc_callid_t iid, ipc_call_t *icall, bd_srvs_t *srvs) 207 { 208 bd_srv_t *srv; 209 int rc; 188 void bd_srv_init(bd_srv_t *srv) 189 { 190 fibril_mutex_initialize(&srv->lock); 191 srv->connected = false; 192 srv->ops = NULL; 193 srv->arg = NULL; 194 srv->client_sess = NULL; 195 } 196 197 int bd_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg) 198 { 199 bd_srv_t *srv = (bd_srv_t *)arg; 200 int rc; 201 202 fibril_mutex_lock(&srv->lock); 203 if (srv->connected) { 204 fibril_mutex_unlock(&srv->lock); 205 async_answer_0(iid, EBUSY); 206 return EBUSY; 207 } 208 209 srv->connected = true; 210 fibril_mutex_unlock(&srv->lock); 210 211 211 212 /* Accept the connection */ 212 213 async_answer_0(iid, EOK); 213 214 srv = bd_srv_create(srvs);215 if (srv == NULL)216 return ENOMEM;217 214 218 215 async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE); … … 222 219 srv->client_sess = sess; 223 220 224 rc = srv s->ops->open(srvs,srv);221 rc = srv->ops->open(srv); 225 222 if (rc != EOK) 226 223 return rc; … … 233 230 if (!method) { 234 231 /* The other side has hung up */ 232 fibril_mutex_lock(&srv->lock); 233 srv->connected = false; 234 fibril_mutex_unlock(&srv->lock); 235 235 async_answer_0(callid, EOK); 236 236 break; … … 258 258 } 259 259 260 rc = srvs->ops->close(srv); 261 free(srv); 262 263 return rc; 260 return srv->ops->close(srv); 264 261 } 265 262 -
uspace/lib/c/include/bd_srv.h
r5882487 rb52dd1de 36 36 #define LIBC_BD_SRV_H_ 37 37 38 #include <adt/list.h>39 38 #include <async.h> 40 39 #include <fibril_synch.h> … … 44 43 typedef struct bd_ops bd_ops_t; 45 44 46 /** Service setup (per sevice) */47 45 typedef struct { 46 fibril_mutex_t lock; 47 bool connected; 48 48 bd_ops_t *ops; 49 void *sarg; 50 } bd_srvs_t; 51 52 /** Server structure (per client session) */ 53 typedef struct { 54 bd_srvs_t *srvs; 49 void *arg; 55 50 async_sess_t *client_sess; 56 void *carg;57 51 } bd_srv_t; 58 52 59 53 typedef struct bd_ops { 60 int (*open)(bd_srv s_t *, bd_srv_t *);54 int (*open)(bd_srv_t *); 61 55 int (*close)(bd_srv_t *); 62 56 int (*read_blocks)(bd_srv_t *, aoff64_t, size_t, void *, size_t); … … 67 61 } bd_ops_t; 68 62 69 extern void bd_srv s_init(bd_srvs_t *);63 extern void bd_srv_init(bd_srv_t *); 70 64 71 extern int bd_conn(ipc_callid_t, ipc_call_t *, bd_srvs_t*);65 extern int bd_conn(ipc_callid_t, ipc_call_t *, void *); 72 66 73 67 #endif -
uspace/lib/c/include/ipc/input.h
r5882487 rb52dd1de 46 46 INPUT_EVENT_KEY = IPC_FIRST_USER_METHOD, 47 47 INPUT_EVENT_MOVE, 48 INPUT_EVENT_ABS_MOVE,49 48 INPUT_EVENT_BUTTON 50 49 } input_notif_t; -
uspace/lib/c/include/ipc/mouseev.h
r5882487 rb52dd1de 47 47 typedef enum { 48 48 MOUSEEV_MOVE_EVENT = IPC_FIRST_USER_METHOD, 49 MOUSEEV_ABS_MOVE_EVENT,50 49 MOUSEEV_BUTTON_EVENT 51 50 } mouseev_notif_t; -
uspace/srv/bd/ata_bd/ata_bd.c
r5882487 rb52dd1de 104 104 static void ata_bd_connection(ipc_callid_t iid, ipc_call_t *icall, void *); 105 105 106 static int ata_bd_open(bd_srv s_t *, bd_srv_t *);106 static int ata_bd_open(bd_srv_t *); 107 107 static int ata_bd_close(bd_srv_t *); 108 108 static int ata_bd_read_blocks(bd_srv_t *, uint64_t ba, size_t cnt, void *buf, … … 114 114 static int ata_bd_get_num_blocks(bd_srv_t *, aoff64_t *); 115 115 116 static int ata_rcmd_read( disk_t *disk, uint64_t ba, size_t cnt,116 static int ata_rcmd_read(int disk_id, uint64_t ba, size_t cnt, 117 117 void *buf); 118 static int ata_rcmd_write( disk_t *disk, uint64_t ba, size_t cnt,118 static int ata_rcmd_write(int disk_id, uint64_t ba, size_t cnt, 119 119 const void *buf); 120 120 static int disk_init(disk_t *d, int disk_id); 121 static int drive_identify( disk_t *disk, void *buf);122 static int identify_pkt_dev( disk_t *disk, void *buf);123 static int ata_cmd_packet( disk_t *disk, const void *cpkt, size_t cpkt_size,121 static int drive_identify(int drive_id, void *buf); 122 static int identify_pkt_dev(int dev_idx, void *buf); 123 static int ata_cmd_packet(int dev_idx, const void *cpkt, size_t cpkt_size, 124 124 void *obuf, size_t obuf_size); 125 static int ata_pcmd_inquiry( disk_t *disk, void *obuf, size_t obuf_size);126 static int ata_pcmd_read_12( disk_t *disk, uint64_t ba, size_t cnt,125 static int ata_pcmd_inquiry(int dev_idx, void *obuf, size_t obuf_size); 126 static int ata_pcmd_read_12(int dev_idx, uint64_t ba, size_t cnt, 127 127 void *obuf, size_t obuf_size); 128 static int ata_pcmd_read_toc( disk_t *disk, uint8_t ses,128 static int ata_pcmd_read_toc(int dev_idx, uint8_t ses, 129 129 void *obuf, size_t obuf_size); 130 130 static void disk_print_summary(disk_t *d); … … 146 146 static disk_t *bd_srv_disk(bd_srv_t *bd) 147 147 { 148 return (disk_t *)bd->srvs->sarg; 149 } 150 151 static int disk_dev_idx(disk_t *disk) 152 { 153 return (disk->disk_id & 1); 148 return (disk_t *)bd->arg; 154 149 } 155 150 … … 301 296 { 302 297 service_id_t dsid; 303 int i; 304 disk_t *disk; 298 int disk_id, i; 305 299 306 300 /* Get the device service ID. */ … … 308 302 309 303 /* Determine which disk device is the client connecting to. */ 310 disk = NULL;304 disk_id = -1; 311 305 for (i = 0; i < MAX_DISKS; i++) 312 306 if (ata_disk[i].service_id == dsid) 313 disk = &ata_disk[i];314 315 if (disk == NULL || disk->present == false) {307 disk_id = i; 308 309 if (disk_id < 0 || ata_disk[disk_id].present == false) { 316 310 async_answer_0(iid, EINVAL); 317 311 return; 318 312 } 319 313 320 bd_conn(iid, icall, & disk->bds);314 bd_conn(iid, icall, &ata_disk[disk_id].bd); 321 315 } 322 316 … … 342 336 fibril_mutex_initialize(&d->lock); 343 337 344 bd_srv s_init(&d->bds);345 d->bd s.ops = &ata_bd_ops;346 d->bd s.sarg = d;338 bd_srv_init(&d->bd); 339 d->bd.ops = &ata_bd_ops; 340 d->bd.arg = d; 347 341 348 342 /* Try identify command. */ 349 rc = drive_identify(d , &idata);343 rc = drive_identify(disk_id, &idata); 350 344 if (rc == EOK) { 351 345 /* Success. It's a register (non-packet) device. */ … … 367 361 368 362 if (bc == PDEV_SIGNATURE_BC) { 369 rc = identify_pkt_dev(d , &idata);363 rc = identify_pkt_dev(disk_id, &idata); 370 364 if (rc == EOK) { 371 365 /* We have a packet device. */ … … 451 445 if (d->dev_type == ata_pkt_dev) { 452 446 /* Send inquiry. */ 453 rc = ata_pcmd_inquiry( d, &inq_data, sizeof(inq_data));447 rc = ata_pcmd_inquiry(0, &inq_data, sizeof(inq_data)); 454 448 if (rc != EOK) { 455 449 printf("Device inquiry failed.\n"); … … 473 467 } 474 468 475 static int ata_bd_open(bd_srv s_t *bds, bd_srv_t *bd)469 static int ata_bd_open(bd_srv_t *bd) 476 470 { 477 471 return EOK; … … 494 488 495 489 while (cnt > 0) { 496 if (disk->dev_type == ata_reg_dev) {497 rc = ata_rcmd_read(disk , ba, 1, buf);498 } else {499 rc = ata_pcmd_read_12(disk , ba, 1, buf,490 if (disk->dev_type == ata_reg_dev) 491 rc = ata_rcmd_read(disk->disk_id, ba, 1, buf); 492 else 493 rc = ata_pcmd_read_12(disk->disk_id, ba, 1, buf, 500 494 disk->block_size); 501 }502 495 503 496 if (rc != EOK) … … 517 510 disk_t *disk = bd_srv_disk(bd); 518 511 519 return ata_pcmd_read_toc(disk , session, buf, size);512 return ata_pcmd_read_toc(disk->disk_id, session, buf, size); 520 513 } 521 514 … … 534 527 535 528 while (cnt > 0) { 536 rc = ata_rcmd_write(disk , ba, 1, buf);529 rc = ata_rcmd_write(disk->disk_id, ba, 1, buf); 537 530 if (rc != EOK) 538 531 return rc; … … 569 562 * whether an ATA device is present and if so, to determine its parameters. 570 563 * 571 * @param disk Disk564 * @param disk_id Device ID, 0 or 1. 572 565 * @param buf Pointer to a 512-byte buffer. 573 566 * … … 575 568 * not present). EIO if device responds with error. 576 569 */ 577 static int drive_identify( disk_t *disk, void *buf)570 static int drive_identify(int disk_id, void *buf) 578 571 { 579 572 uint16_t data; … … 582 575 size_t i; 583 576 584 drv_head = ((disk_ dev_idx(disk)!= 0) ? DHR_DRV : 0);577 drv_head = ((disk_id != 0) ? DHR_DRV : 0); 585 578 586 579 if (wait_status(0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK) … … 628 621 * whether an ATAPI device is present and if so, to determine its parameters. 629 622 * 630 * @param d isk Disk623 * @param dev_idx Device index, 0 or 1. 631 624 * @param buf Pointer to a 512-byte buffer. 632 625 */ 633 static int identify_pkt_dev( disk_t *disk, void *buf)626 static int identify_pkt_dev(int dev_idx, void *buf) 634 627 { 635 628 uint16_t data; … … 638 631 size_t i; 639 632 640 drv_head = ((d isk_dev_idx(disk)!= 0) ? DHR_DRV : 0);633 drv_head = ((dev_idx != 0) ? DHR_DRV : 0); 641 634 642 635 if (wait_status(0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK) … … 673 666 * Only data-in commands are supported (e.g. inquiry, read). 674 667 * 675 * @param d isk Disk668 * @param dev_idx Device index (0 or 1) 676 669 * @param obuf Buffer for storing data read from device 677 670 * @param obuf_size Size of obuf in bytes … … 679 672 * @return EOK on success, EIO on error. 680 673 */ 681 static int ata_cmd_packet( disk_t *disk, const void *cpkt, size_t cpkt_size,674 static int ata_cmd_packet(int dev_idx, const void *cpkt, size_t cpkt_size, 682 675 void *obuf, size_t obuf_size) 683 676 { … … 685 678 uint8_t status; 686 679 uint8_t drv_head; 680 disk_t *d; 687 681 size_t data_size; 688 682 uint16_t val; 689 683 690 fibril_mutex_lock(&disk->lock); 684 d = &ata_disk[dev_idx]; 685 fibril_mutex_lock(&d->lock); 691 686 692 687 /* New value for Drive/Head register */ 693 688 drv_head = 694 ((d isk_dev_idx(disk)!= 0) ? DHR_DRV : 0);689 ((dev_idx != 0) ? DHR_DRV : 0); 695 690 696 691 if (wait_status(0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK) { 697 fibril_mutex_unlock(&d isk->lock);692 fibril_mutex_unlock(&d->lock); 698 693 return EIO; 699 694 } … … 702 697 703 698 if (wait_status(0, ~(SR_BSY|SR_DRQ), NULL, TIMEOUT_BSY) != EOK) { 704 fibril_mutex_unlock(&d isk->lock);699 fibril_mutex_unlock(&d->lock); 705 700 return EIO; 706 701 } … … 713 708 714 709 if (wait_status(SR_DRQ, ~SR_BSY, &status, TIMEOUT_BSY) != EOK) { 715 fibril_mutex_unlock(&d isk->lock);710 fibril_mutex_unlock(&d->lock); 716 711 return EIO; 717 712 } … … 722 717 723 718 if (wait_status(0, ~SR_BSY, &status, TIMEOUT_BSY) != EOK) { 724 fibril_mutex_unlock(&d isk->lock);719 fibril_mutex_unlock(&d->lock); 725 720 return EIO; 726 721 } 727 722 728 723 if ((status & SR_DRQ) == 0) { 729 fibril_mutex_unlock(&d isk->lock);724 fibril_mutex_unlock(&d->lock); 730 725 return EIO; 731 726 } … … 738 733 if (data_size > obuf_size) { 739 734 /* Output buffer is too small to store data. */ 740 fibril_mutex_unlock(&d isk->lock);735 fibril_mutex_unlock(&d->lock); 741 736 return EIO; 742 737 } … … 749 744 750 745 if (status & SR_ERR) { 751 fibril_mutex_unlock(&d isk->lock);752 return EIO; 753 } 754 755 fibril_mutex_unlock(&d isk->lock);746 fibril_mutex_unlock(&d->lock); 747 return EIO; 748 } 749 750 fibril_mutex_unlock(&d->lock); 756 751 757 752 return EOK; … … 760 755 /** Issue ATAPI Inquiry. 761 756 * 762 * @param d isk Disk757 * @param dev_idx Device index (0 or 1) 763 758 * @param obuf Buffer for storing inquiry data read from device 764 759 * @param obuf_size Size of obuf in bytes … … 766 761 * @return EOK on success, EIO on error. 767 762 */ 768 static int ata_pcmd_inquiry( disk_t *disk, void *obuf, size_t obuf_size)763 static int ata_pcmd_inquiry(int dev_idx, void *obuf, size_t obuf_size) 769 764 { 770 765 ata_pcmd_inquiry_t cp; … … 776 771 cp.alloc_len = min(obuf_size, 0xff); /* Allocation length */ 777 772 778 rc = ata_cmd_packet( disk, &cp, sizeof(cp), obuf, obuf_size);773 rc = ata_cmd_packet(0, &cp, sizeof(cp), obuf, obuf_size); 779 774 if (rc != EOK) 780 775 return rc; … … 788 783 * function will fail. 789 784 * 790 * @param d isk Disk785 * @param dev_idx Device index (0 or 1) 791 786 * @param ba Starting block address 792 787 * @param cnt Number of blocks to read … … 796 791 * @return EOK on success, EIO on error. 797 792 */ 798 static int ata_pcmd_read_12( disk_t *disk, uint64_t ba, size_t cnt,793 static int ata_pcmd_read_12(int dev_idx, uint64_t ba, size_t cnt, 799 794 void *obuf, size_t obuf_size) 800 795 { … … 811 806 cp.nblocks = host2uint32_t_be(cnt); 812 807 813 rc = ata_cmd_packet( disk, &cp, sizeof(cp), obuf, obuf_size);808 rc = ata_cmd_packet(0, &cp, sizeof(cp), obuf, obuf_size); 814 809 if (rc != EOK) 815 810 return rc; … … 828 823 * function will fail. 829 824 * 830 * @param d isk Disk825 * @param dev_idx Device index (0 or 1) 831 826 * @param session Starting session 832 827 * @param obuf Buffer for storing inquiry data read from device … … 835 830 * @return EOK on success, EIO on error. 836 831 */ 837 static int ata_pcmd_read_toc( disk_t *disk, uint8_t session, void *obuf,832 static int ata_pcmd_read_toc(int dev_idx, uint8_t session, void *obuf, 838 833 size_t obuf_size) 839 834 { … … 859 854 /** Read a physical from the device. 860 855 * 861 * @param disk Disk856 * @param disk_id Device index (0 or 1) 862 857 * @param ba Address the first block. 863 858 * @param cnt Number of blocks to transfer. … … 866 861 * @return EOK on success, EIO on error. 867 862 */ 868 static int ata_rcmd_read( disk_t *disk, uint64_t ba, size_t blk_cnt,863 static int ata_rcmd_read(int disk_id, uint64_t ba, size_t blk_cnt, 869 864 void *buf) 870 865 { … … 873 868 uint8_t status; 874 869 uint8_t drv_head; 870 disk_t *d; 875 871 block_coord_t bc; 876 872 873 d = &ata_disk[disk_id]; 874 877 875 /* Silence warning. */ 878 876 memset(&bc, 0, sizeof(bc)); 879 877 880 878 /* Compute block coordinates. */ 881 if (coord_calc(d isk, ba, &bc) != EOK)879 if (coord_calc(d, ba, &bc) != EOK) 882 880 return EINVAL; 883 881 884 882 /* New value for Drive/Head register */ 885 883 drv_head = 886 ((disk_ dev_idx(disk)!= 0) ? DHR_DRV : 0) |887 ((d isk->amode != am_chs) ? DHR_LBA : 0) |884 ((disk_id != 0) ? DHR_DRV : 0) | 885 ((d->amode != am_chs) ? DHR_LBA : 0) | 888 886 (bc.h & 0x0f); 889 887 890 fibril_mutex_lock(&d isk->lock);888 fibril_mutex_lock(&d->lock); 891 889 892 890 /* Program a Read Sectors operation. */ 893 891 894 892 if (wait_status(0, ~SR_BSY, NULL, TIMEOUT_BSY) != EOK) { 895 fibril_mutex_unlock(&d isk->lock);893 fibril_mutex_unlock(&d->lock); 896 894 return EIO; 897 895 } … … 900 898 901 899 if (wait_status(SR_DRDY, ~SR_BSY, NULL, TIMEOUT_DRDY) != EOK) { 902 fibril_mutex_unlock(&d isk->lock);900 fibril_mutex_unlock(&d->lock); 903 901 return EIO; 904 902 } … … 907 905 coord_sc_program(&bc, 1); 908 906 909 pio_write_8(&cmd->command, d isk->amode == am_lba48 ?907 pio_write_8(&cmd->command, d->amode == am_lba48 ? 910 908 CMD_READ_SECTORS_EXT : CMD_READ_SECTORS); 911 909 912 910 if (wait_status(0, ~SR_BSY, &status, TIMEOUT_BSY) != EOK) { 913 fibril_mutex_unlock(&d isk->lock);911 fibril_mutex_unlock(&d->lock); 914 912 return EIO; 915 913 } … … 918 916 /* Read data from the device buffer. */ 919 917 920 for (i = 0; i < disk->block_size / 2; i++) {918 for (i = 0; i < ata_disk[disk_id].block_size / 2; i++) { 921 919 data = pio_read_16(&cmd->data_port); 922 920 ((uint16_t *) buf)[i] = data; … … 927 925 return EIO; 928 926 929 fibril_mutex_unlock(&d isk->lock);927 fibril_mutex_unlock(&d->lock); 930 928 return EOK; 931 929 } … … 933 931 /** Write a physical block to the device. 934 932 * 935 * @param disk Disk933 * @param disk_id Device index (0 or 1) 936 934 * @param ba Address of the first block. 937 935 * @param cnt Number of blocks to transfer. … … 940 938 * @return EOK on success, EIO on error. 941 939 */ 942 static int ata_rcmd_write( disk_t *disk, uint64_t ba, size_t cnt,940 static int ata_rcmd_write(int disk_id, uint64_t ba, size_t cnt, 943 941 const void *buf) 944 942 { … … 946 944 uint8_t status; 947 945 uint8_t drv_head; 946 disk_t *d; 948 947 block_coord_t bc; 949 948 949 d = &ata_disk[disk_id]; 950 950 951 /* Silence warning. */ 951 952 memset(&bc, 0, sizeof(bc)); 952 953 953 954 /* Compute block coordinates. */ 954 if (coord_calc(d isk, ba, &bc) != EOK)955 if (coord_calc(d, ba, &bc) != EOK) 955 956 return EINVAL; 956 957 957 958 /* New value for Drive/Head register */ 958 959 drv_head = 959 ((disk_ dev_idx(disk)!= 0) ? DHR_DRV : 0) |960 ((d isk->amode != am_chs) ? DHR_LBA : 0) |960 ((disk_id != 0) ? DHR_DRV : 0) | 961 ((d->amode != am_chs) ? DHR_LBA : 0) | 961 962 (bc.h & 0x0f); 962 963 963 fibril_mutex_lock(&d isk->lock);964 fibril_mutex_lock(&d->lock); 964 965 965 966 /* Program a Write Sectors operation. */ 966 967 967 968 if (wait_status(0, ~SR_BSY, NULL, TIMEOUT_BSY) != EOK) { 968 fibril_mutex_unlock(&d isk->lock);969 fibril_mutex_unlock(&d->lock); 969 970 return EIO; 970 971 } … … 973 974 974 975 if (wait_status(SR_DRDY, ~SR_BSY, NULL, TIMEOUT_DRDY) != EOK) { 975 fibril_mutex_unlock(&d isk->lock);976 fibril_mutex_unlock(&d->lock); 976 977 return EIO; 977 978 } … … 980 981 coord_sc_program(&bc, 1); 981 982 982 pio_write_8(&cmd->command, d isk->amode == am_lba48 ?983 pio_write_8(&cmd->command, d->amode == am_lba48 ? 983 984 CMD_WRITE_SECTORS_EXT : CMD_WRITE_SECTORS); 984 985 985 986 if (wait_status(0, ~SR_BSY, &status, TIMEOUT_BSY) != EOK) { 986 fibril_mutex_unlock(&d isk->lock);987 fibril_mutex_unlock(&d->lock); 987 988 return EIO; 988 989 } … … 991 992 /* Write data to the device buffer. */ 992 993 993 for (i = 0; i < d isk->block_size / 2; i++) {994 for (i = 0; i < d->block_size / 2; i++) { 994 995 pio_write_16(&cmd->data_port, ((uint16_t *) buf)[i]); 995 996 } 996 997 } 997 998 998 fibril_mutex_unlock(&d isk->lock);999 fibril_mutex_unlock(&d->lock); 999 1000 1000 1001 if (status & SR_ERR) -
uspace/srv/bd/ata_bd/ata_bd.h
r5882487 rb52dd1de 119 119 service_id_t service_id; 120 120 int disk_id; 121 bd_srv s_t bds;121 bd_srv_t bd; 122 122 } disk_t; 123 123 -
uspace/srv/bd/file_bd/file_bd.c
r5882487 rb52dd1de 62 62 63 63 static service_id_t service_id; 64 static bd_srv s_t bd_srvs;64 static bd_srv_t bd_srv; 65 65 static fibril_mutex_t dev_lock; 66 66 … … 69 69 static void file_bd_connection(ipc_callid_t iid, ipc_call_t *icall, void *); 70 70 71 static int file_bd_open(bd_srv s_t *, bd_srv_t *);71 static int file_bd_open(bd_srv_t *); 72 72 static int file_bd_close(bd_srv_t *); 73 73 static int file_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); … … 154 154 static int file_bd_init(const char *fname) 155 155 { 156 bd_srv s_init(&bd_srvs);157 bd_srv s.ops = &file_bd_ops;156 bd_srv_init(&bd_srv); 157 bd_srv.ops = &file_bd_ops; 158 158 159 159 async_set_client_connection(file_bd_connection); … … 188 188 static void file_bd_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 189 189 { 190 bd_conn(iid, icall, &bd_srv s);190 bd_conn(iid, icall, &bd_srv); 191 191 } 192 192 193 193 /** Open device. */ 194 static int file_bd_open(bd_srv s_t *bds, bd_srv_t *bd)194 static int file_bd_open(bd_srv_t *bd) 195 195 { 196 196 return EOK; -
uspace/srv/bd/gxe_bd/gxe_bd.c
r5882487 rb52dd1de 88 88 /** GXE block device soft state */ 89 89 typedef struct { 90 /** Block device serv icestructure */91 bd_srv s_t bds;90 /** Block device server structure */ 91 bd_srv_t bd; 92 92 int disk_id; 93 93 } gxe_bd_t; … … 109 109 static int gxe_bd_write_block(int disk_id, uint64_t ba, const void *buf); 110 110 111 static int gxe_bd_open(bd_srv s_t *, bd_srv_t *);111 static int gxe_bd_open(bd_srv_t *); 112 112 static int gxe_bd_close(bd_srv_t *); 113 113 static int gxe_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); … … 127 127 static gxe_bd_t *bd_srv_gxe(bd_srv_t *bd) 128 128 { 129 return (gxe_bd_t *)bd-> srvs->sarg;129 return (gxe_bd_t *)bd->arg; 130 130 } 131 131 … … 166 166 char name[16]; 167 167 168 bd_srv s_init(&gxe_bd[i].bds);169 gxe_bd[i].bd s.ops = &gxe_bd_ops;170 gxe_bd[i].bd s.sarg = (void *)&gxe_bd[i];168 bd_srv_init(&gxe_bd[i].bd); 169 gxe_bd[i].bd.ops = &gxe_bd_ops; 170 gxe_bd[i].bd.arg = (void *)&gxe_bd[i]; 171 171 172 172 snprintf(name, 16, "%s/disk%u", NAMESPACE, i); … … 203 203 } 204 204 205 bd_conn(iid, icall, &gxe_bd[disk_id].bd s);205 bd_conn(iid, icall, &gxe_bd[disk_id].bd); 206 206 } 207 207 208 208 /** Open device. */ 209 static int gxe_bd_open(bd_srv s_t *bds, bd_srv_t *bd)209 static int gxe_bd_open(bd_srv_t *bd) 210 210 { 211 211 return EOK; -
uspace/srv/bd/part/guid_part/guid_part.c
r5882487 rb52dd1de 83 83 /** Service representing the partition (outbound device) */ 84 84 service_id_t dsid; 85 /** Block device serv icestructure */86 bd_srv s_t bds;85 /** Block device server structure */ 86 bd_srv_t bd; 87 87 /** Points to next partition structure. */ 88 88 struct part *next; … … 104 104 static int gpt_bsa_translate(part_t *p, aoff64_t ba, size_t cnt, aoff64_t *gba); 105 105 106 static int gpt_bd_open(bd_srv s_t *, bd_srv_t *);106 static int gpt_bd_open(bd_srv_t *); 107 107 static int gpt_bd_close(bd_srv_t *); 108 108 static int gpt_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); … … 122 122 static part_t *bd_srv_part(bd_srv_t *bd) 123 123 { 124 return (part_t *)bd-> srvs->sarg;124 return (part_t *)bd->arg; 125 125 } 126 126 … … 325 325 } 326 326 327 bd_srv s_init(&part->bds);328 part->bd s.ops = &gpt_bd_ops;329 part->bd s.sarg = part;327 bd_srv_init(&part->bd); 328 part->bd.ops = &gpt_bd_ops; 329 part->bd.arg = part; 330 330 331 331 part->dsid = 0; … … 357 357 assert(part->present == true); 358 358 359 bd_conn(iid, icall, &part->bd s);359 bd_conn(iid, icall, &part->bd); 360 360 } 361 361 362 362 /** Open device. */ 363 static int gpt_bd_open(bd_srv s_t *bds, bd_srv_t *bd)363 static int gpt_bd_open(bd_srv_t *bd) 364 364 { 365 365 return EOK; -
uspace/srv/bd/part/mbr_part/mbr_part.c
r5882487 rb52dd1de 100 100 /** Device representing the partition (outbound device) */ 101 101 service_id_t dsid; 102 /** Block device serv ice sturcture */103 bd_srv s_t bds;102 /** Block device server structure */ 103 bd_srv_t bd; 104 104 /** Points to next partition structure. */ 105 105 struct part *next; … … 154 154 static int mbr_bsa_translate(part_t *p, uint64_t ba, size_t cnt, uint64_t *gba); 155 155 156 static int mbr_bd_open(bd_srv s_t *, bd_srv_t *);156 static int mbr_bd_open(bd_srv_t *); 157 157 static int mbr_bd_close(bd_srv_t *); 158 158 static int mbr_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); … … 172 172 static part_t *bd_srv_part(bd_srv_t *bd) 173 173 { 174 return (part_t *)bd-> srvs->sarg;174 return (part_t *)bd->arg; 175 175 } 176 176 … … 402 402 part->present = (pte->ptype != PT_UNUSED) ? true : false; 403 403 404 bd_srv s_init(&part->bds);405 part->bd s.ops = &mbr_bd_ops;406 part->bd s.sarg = part;404 bd_srv_init(&part->bd); 405 part->bd.ops = &mbr_bd_ops; 406 part->bd.arg = part; 407 407 408 408 part->dsid = 0; … … 433 433 434 434 assert(part->present == true); 435 bd_conn(iid, icall, &part->bd s);435 bd_conn(iid, icall, &part->bd); 436 436 } 437 437 438 438 /** Open device. */ 439 static int mbr_bd_open(bd_srv s_t *bds, bd_srv_t *bd)439 static int mbr_bd_open(bd_srv_t *bd) 440 440 { 441 441 return EOK; -
uspace/srv/bd/rd/rd.c
r5882487 rb52dd1de 68 68 static const size_t block_size = 512; 69 69 70 static int rd_open(bd_srv s_t *, bd_srv_t *);70 static int rd_open(bd_srv_t *); 71 71 static int rd_close(bd_srv_t *); 72 72 static int rd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); … … 93 93 }; 94 94 95 static bd_srv s_t bd_srvs;95 static bd_srv_t bd_srv; 96 96 97 97 static void rd_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg) 98 98 { 99 bd_conn(iid, icall, &bd_srv s);99 bd_conn(iid, icall, &bd_srv); 100 100 } 101 101 102 102 /** Open device. */ 103 static int rd_open(bd_srv s_t *bds, bd_srv_t *bd)103 static int rd_open(bd_srv_t *bd) 104 104 { 105 105 return EOK; … … 175 175 (void *) addr_phys, size); 176 176 177 bd_srv s_init(&bd_srvs);178 bd_srv s.ops = &rd_bd_ops;177 bd_srv_init(&bd_srv); 178 bd_srv.ops = &rd_bd_ops; 179 179 180 180 async_set_client_connection(rd_client_conn); -
uspace/srv/bd/sata_bd/sata_bd.c
r5882487 rb52dd1de 57 57 static int disk_count; 58 58 59 static int sata_bd_open(bd_srv s_t *, bd_srv_t *);59 static int sata_bd_open(bd_srv_t *); 60 60 static int sata_bd_close(bd_srv_t *); 61 61 static int sata_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); … … 75 75 static sata_bd_dev_t *bd_srv_sata(bd_srv_t *bd) 76 76 { 77 return (sata_bd_dev_t *)bd-> srvs->sarg;77 return (sata_bd_dev_t *)bd->arg; 78 78 } 79 79 … … 104 104 ahci_get_num_blocks(disk[disk_count].sess, &disk[disk_count].blocks); 105 105 106 bd_srv s_init(&disk[disk_count].bds);107 disk[disk_count].bd s.ops = &sata_bd_ops;108 disk[disk_count].bd s.sarg = &disk[disk_count];106 bd_srv_init(&disk[disk_count].bd); 107 disk[disk_count].bd.ops = &sata_bd_ops; 108 disk[disk_count].bd.arg = &disk[disk_count]; 109 109 110 110 printf("Device %s - %s , blocks: %lu, block_size: %lu\n", … … 183 183 } 184 184 185 bd_conn(iid, icall, &disk[disk_id].bd s);185 bd_conn(iid, icall, &disk[disk_id].bd); 186 186 } 187 187 188 188 /** Open device. */ 189 static int sata_bd_open(bd_srv s_t *bds, bd_srv_t *bd)189 static int sata_bd_open(bd_srv_t *bd) 190 190 { 191 191 return EOK; -
uspace/srv/bd/sata_bd/sata_bd.h
r5882487 rb52dd1de 58 58 size_t block_size; 59 59 /** Block device server structure */ 60 bd_srv s_t bds;60 bd_srv_t bd; 61 61 } sata_bd_dev_t; 62 62 -
uspace/srv/hid/console/console.c
r5882487 rb52dd1de 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 }396 385 } 397 386 … … 514 503 async_answer_0(callid, EOK); 515 504 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;521 505 case INPUT_EVENT_BUTTON: 522 506 /* Got pointer button press/release event */ -
uspace/srv/hid/input/generic/input.c
r5882487 rb52dd1de 191 191 } 192 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 }202 }203 204 193 /** Mouse button has been pressed. */ 205 194 void mouse_push_event_button(mouse_dev_t *mdev, int bnum, int press) -
uspace/srv/hid/input/include/mouse.h
r5882487 rb52dd1de 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);67 65 extern void mouse_push_event_button(mouse_dev_t *, int, int); 68 66 -
uspace/srv/hid/input/proto/mousedev.c
r5882487 rb52dd1de 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;104 98 case MOUSEEV_BUTTON_EVENT: 105 99 mouse_push_event_button(mousedev->mouse_dev,
Note:
See TracChangeset
for help on using the changeset viewer.