Changeset 16639bb in mainline
- Timestamp:
- 2012-08-15T22:13:37Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 83298e8
- Parents:
- f7ea5400 (diff), c5a6076 (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. - Files:
-
- 4 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
rf7ea5400 r16639bb 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
rf7ea5400 r16639bb 102 102 srv/hid/console \ 103 103 srv/hid/s3c24xx_ts \ 104 srv/hid/isdv4_tablet \ 104 105 srv/hid/fb \ 105 106 srv/hid/input \ -
uspace/app/edit/edit.c
rf7ea5400 r16639bb 842 842 /* Fill until the end of display area. */ 843 843 844 if ( str_length(row_buf) < (unsigned)scr_columns)845 fill = scr_columns - str_length(row_buf);844 if ((unsigned)s_column - 1 < scr_columns) 845 fill = scr_columns - (s_column - 1); 846 846 else 847 847 fill = 0; -
uspace/app/sportdmp/sportdmp.c
rf7ea5400 r16639bb 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/bus/usb/usbmast/main.c
rf7ea5400 r16639bb 82 82 void *arg); 83 83 84 static int usbmast_bd_open(bd_srv _t *);84 static int usbmast_bd_open(bd_srvs_t *, 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-> arg;102 return (usbmast_fun_t *)bd->srvs->sarg; 103 103 } 104 104 … … 240 240 mfun->lun = lun; 241 241 242 bd_srv _init(&mfun->bd);243 mfun->bd .ops = &usbmast_bd_ops;244 mfun->bd .arg = mfun;242 bd_srvs_init(&mfun->bds); 243 mfun->bds.ops = &usbmast_bd_ops; 244 mfun->bds.sarg = 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 );313 bd_conn(iid, icall, &mfun->bds); 314 314 } 315 315 316 316 /** Open device. */ 317 static int usbmast_bd_open(bd_srv _t *bd)317 static int usbmast_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 318 318 { 319 319 return EOK; -
uspace/drv/bus/usb/usbmast/usbmast.h
rf7ea5400 r16639bb 69 69 /** Block size in bytes */ 70 70 size_t block_size; 71 /** Block device serv erstructure */72 bd_srv _t bd;71 /** Block device service structure */ 72 bd_srvs_t bds; 73 73 } usbmast_fun_t; 74 74 -
uspace/drv/char/ns8250/cyclic_buffer.h
rf7ea5400 r16639bb 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
rf7ea5400 r16639bb 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/generic/bd_srv.c
rf7ea5400 r16639bb 67 67 } 68 68 69 if (srv-> ops->read_blocks == NULL) {69 if (srv->srvs->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-> ops->read_blocks(srv, ba, cnt, buf, size);75 rc = srv->srvs->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-> ops->read_toc == NULL) {111 if (srv->srvs->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-> ops->read_toc(srv, session, buf, size);117 rc = srv->srvs->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-> 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);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); 154 154 free(data); 155 155 async_answer_0(callid, rc); … … 162 162 size_t block_size; 163 163 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);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); 170 170 async_answer_1(callid, rc, block_size); 171 171 } … … 177 177 aoff64_t num_blocks; 178 178 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);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); 185 185 async_answer_2(callid, rc, LOWER32(num_blocks), UPPER32(num_blocks)); 186 186 } 187 187 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); 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; 211 210 212 211 /* Accept the connection */ 213 212 async_answer_0(iid, EOK); 213 214 srv = bd_srv_create(srvs); 215 if (srv == NULL) 216 return ENOMEM; 214 217 215 218 async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE); … … 219 222 srv->client_sess = sess; 220 223 221 rc = srv ->ops->open(srv);224 rc = srvs->ops->open(srvs, srv); 222 225 if (rc != EOK) 223 226 return rc; … … 230 233 if (!method) { 231 234 /* 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 return srv->ops->close(srv); 260 rc = srvs->ops->close(srv); 261 free(srv); 262 263 return rc; 261 264 } 262 265 -
uspace/lib/c/include/bd_srv.h
rf7ea5400 r16639bb 36 36 #define LIBC_BD_SRV_H_ 37 37 38 #include <adt/list.h> 38 39 #include <async.h> 39 40 #include <fibril_synch.h> … … 43 44 typedef struct bd_ops bd_ops_t; 44 45 46 /** Service setup (per sevice) */ 45 47 typedef struct { 46 fibril_mutex_t lock;47 bool connected;48 48 bd_ops_t *ops; 49 void *arg; 49 void *sarg; 50 } bd_srvs_t; 51 52 /** Server structure (per client session) */ 53 typedef struct { 54 bd_srvs_t *srvs; 50 55 async_sess_t *client_sess; 56 void *carg; 51 57 } bd_srv_t; 52 58 53 59 typedef struct bd_ops { 54 int (*open)(bd_srv _t *);60 int (*open)(bd_srvs_t *, bd_srv_t *); 55 61 int (*close)(bd_srv_t *); 56 62 int (*read_blocks)(bd_srv_t *, aoff64_t, size_t, void *, size_t); … … 61 67 } bd_ops_t; 62 68 63 extern void bd_srv _init(bd_srv_t *);69 extern void bd_srvs_init(bd_srvs_t *); 64 70 65 extern int bd_conn(ipc_callid_t, ipc_call_t *, void*);71 extern int bd_conn(ipc_callid_t, ipc_call_t *, bd_srvs_t *); 66 72 67 73 #endif -
uspace/lib/c/include/ipc/input.h
rf7ea5400 r16639bb 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
rf7ea5400 r16639bb 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/bd/ata_bd/ata_bd.c
rf7ea5400 r16639bb 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 _t *);106 static int ata_bd_open(bd_srvs_t *, 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, … … 146 146 static disk_t *bd_srv_disk(bd_srv_t *bd) 147 147 { 148 return (disk_t *)bd-> arg;148 return (disk_t *)bd->srvs->sarg; 149 149 } 150 150 … … 312 312 } 313 313 314 bd_conn(iid, icall, &ata_disk[disk_id].bd );314 bd_conn(iid, icall, &ata_disk[disk_id].bds); 315 315 } 316 316 … … 336 336 fibril_mutex_initialize(&d->lock); 337 337 338 bd_srv _init(&d->bd);339 d->bd .ops = &ata_bd_ops;340 d->bd .arg = d;338 bd_srvs_init(&d->bds); 339 d->bds.ops = &ata_bd_ops; 340 d->bds.sarg = d; 341 341 342 342 /* Try identify command. */ … … 467 467 } 468 468 469 static int ata_bd_open(bd_srv _t *bd)469 static int ata_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 470 470 { 471 471 return EOK; -
uspace/srv/bd/ata_bd/ata_bd.h
rf7ea5400 r16639bb 119 119 service_id_t service_id; 120 120 int disk_id; 121 bd_srv _t bd;121 bd_srvs_t bds; 122 122 } disk_t; 123 123 -
uspace/srv/bd/file_bd/file_bd.c
rf7ea5400 r16639bb 62 62 63 63 static service_id_t service_id; 64 static bd_srv _t bd_srv;64 static bd_srvs_t bd_srvs; 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 _t *);71 static int file_bd_open(bd_srvs_t *, 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 _init(&bd_srv);157 bd_srv .ops = &file_bd_ops;156 bd_srvs_init(&bd_srvs); 157 bd_srvs.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 );190 bd_conn(iid, icall, &bd_srvs); 191 191 } 192 192 193 193 /** Open device. */ 194 static int file_bd_open(bd_srv _t *bd)194 static int file_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 195 195 { 196 196 return EOK; -
uspace/srv/bd/gxe_bd/gxe_bd.c
rf7ea5400 r16639bb 88 88 /** GXE block device soft state */ 89 89 typedef struct { 90 /** Block device serv erstructure */91 bd_srv _t bd;90 /** Block device service structure */ 91 bd_srvs_t bds; 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 _t *);111 static int gxe_bd_open(bd_srvs_t *, 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-> arg;129 return (gxe_bd_t *)bd->srvs->sarg; 130 130 } 131 131 … … 166 166 char name[16]; 167 167 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];168 bd_srvs_init(&gxe_bd[i].bds); 169 gxe_bd[i].bds.ops = &gxe_bd_ops; 170 gxe_bd[i].bds.sarg = (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 );205 bd_conn(iid, icall, &gxe_bd[disk_id].bds); 206 206 } 207 207 208 208 /** Open device. */ 209 static int gxe_bd_open(bd_srv _t *bd)209 static int gxe_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 210 210 { 211 211 return EOK; -
uspace/srv/bd/part/guid_part/guid_part.c
rf7ea5400 r16639bb 83 83 /** Service representing the partition (outbound device) */ 84 84 service_id_t dsid; 85 /** Block device serv erstructure */86 bd_srv _t bd;85 /** Block device service structure */ 86 bd_srvs_t bds; 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 _t *);106 static int gpt_bd_open(bd_srvs_t *, 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-> arg;124 return (part_t *)bd->srvs->sarg; 125 125 } 126 126 … … 325 325 } 326 326 327 bd_srv _init(&part->bd);328 part->bd .ops = &gpt_bd_ops;329 part->bd .arg = part;327 bd_srvs_init(&part->bds); 328 part->bds.ops = &gpt_bd_ops; 329 part->bds.sarg = part; 330 330 331 331 part->dsid = 0; … … 357 357 assert(part->present == true); 358 358 359 bd_conn(iid, icall, &part->bd );359 bd_conn(iid, icall, &part->bds); 360 360 } 361 361 362 362 /** Open device. */ 363 static int gpt_bd_open(bd_srv _t *bd)363 static int gpt_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 364 364 { 365 365 return EOK; -
uspace/srv/bd/part/mbr_part/mbr_part.c
rf7ea5400 r16639bb 100 100 /** Device representing the partition (outbound device) */ 101 101 service_id_t dsid; 102 /** Block device serv er structure */103 bd_srv _t bd;102 /** Block device service sturcture */ 103 bd_srvs_t bds; 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 _t *);156 static int mbr_bd_open(bd_srvs_t *, 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-> arg;174 return (part_t *)bd->srvs->sarg; 175 175 } 176 176 … … 402 402 part->present = (pte->ptype != PT_UNUSED) ? true : false; 403 403 404 bd_srv _init(&part->bd);405 part->bd .ops = &mbr_bd_ops;406 part->bd .arg = part;404 bd_srvs_init(&part->bds); 405 part->bds.ops = &mbr_bd_ops; 406 part->bds.sarg = part; 407 407 408 408 part->dsid = 0; … … 433 433 434 434 assert(part->present == true); 435 bd_conn(iid, icall, &part->bd );435 bd_conn(iid, icall, &part->bds); 436 436 } 437 437 438 438 /** Open device. */ 439 static int mbr_bd_open(bd_srv _t *bd)439 static int mbr_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 440 440 { 441 441 return EOK; -
uspace/srv/bd/rd/rd.c
rf7ea5400 r16639bb 68 68 static const size_t block_size = 512; 69 69 70 static int rd_open(bd_srv _t *);70 static int rd_open(bd_srvs_t *, 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 _t bd_srv;95 static bd_srvs_t bd_srvs; 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 );99 bd_conn(iid, icall, &bd_srvs); 100 100 } 101 101 102 102 /** Open device. */ 103 static int rd_open(bd_srv _t *bd)103 static int rd_open(bd_srvs_t *bds, bd_srv_t *bd) 104 104 { 105 105 return EOK; … … 175 175 (void *) addr_phys, size); 176 176 177 bd_srv _init(&bd_srv);178 bd_srv .ops = &rd_bd_ops;177 bd_srvs_init(&bd_srvs); 178 bd_srvs.ops = &rd_bd_ops; 179 179 180 180 async_set_client_connection(rd_client_conn); -
uspace/srv/bd/sata_bd/sata_bd.c
rf7ea5400 r16639bb 57 57 static int disk_count; 58 58 59 static int sata_bd_open(bd_srv _t *);59 static int sata_bd_open(bd_srvs_t *, 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-> arg;77 return (sata_bd_dev_t *)bd->srvs->sarg; 78 78 } 79 79 … … 104 104 ahci_get_num_blocks(disk[disk_count].sess, &disk[disk_count].blocks); 105 105 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];106 bd_srvs_init(&disk[disk_count].bds); 107 disk[disk_count].bds.ops = &sata_bd_ops; 108 disk[disk_count].bds.sarg = &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 );185 bd_conn(iid, icall, &disk[disk_id].bds); 186 186 } 187 187 188 188 /** Open device. */ 189 static int sata_bd_open(bd_srv _t *bd)189 static int sata_bd_open(bd_srvs_t *bds, bd_srv_t *bd) 190 190 { 191 191 return EOK; -
uspace/srv/bd/sata_bd/sata_bd.h
rf7ea5400 r16639bb 58 58 size_t block_size; 59 59 /** Block device server structure */ 60 bd_srv _t bd;60 bd_srvs_t bds; 61 61 } sata_bd_dev_t; 62 62 -
uspace/srv/hid/console/console.c
rf7ea5400 r16639bb 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
rf7ea5400 r16639bb 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
rf7ea5400 r16639bb 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
rf7ea5400 r16639bb 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.