Changeset eb522e8 in mainline for uspace/srv/hw
- Timestamp:
- 2011-06-01T08:43:42Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8d6c1f1
- Parents:
- 9e2e715 (diff), e51a514 (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/hw
- Files:
-
- 5 added
- 5 deleted
- 6 edited
- 11 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hw/bus/cuda_adb/cuda_adb.c
r9e2e715 reb522e8 143 143 int main(int argc, char *argv[]) 144 144 { 145 dev _handle_t dev_handle;145 devmap_handle_t devmap_handle; 146 146 int rc; 147 147 int i; … … 151 151 for (i = 0; i < ADB_MAX_ADDR; ++i) { 152 152 adb_dev[i].client_phone = -1; 153 adb_dev[i].dev _handle = 0;153 adb_dev[i].devmap_handle = 0; 154 154 } 155 155 … … 160 160 } 161 161 162 rc = devmap_device_register("adb/kbd", &dev _handle);162 rc = devmap_device_register("adb/kbd", &devmap_handle); 163 163 if (rc != EOK) { 164 devmap_hangup_phone(DEVMAP_DRIVER);165 164 printf(NAME ": Unable to register device %s.\n", "adb/kdb"); 166 165 return rc; 167 166 } 168 167 169 adb_dev[2].dev _handle = dev_handle;170 adb_dev[8].dev _handle = dev_handle;171 172 rc = devmap_device_register("adb/mouse", &dev _handle);168 adb_dev[2].devmap_handle = devmap_handle; 169 adb_dev[8].devmap_handle = devmap_handle; 170 171 rc = devmap_device_register("adb/mouse", &devmap_handle); 173 172 if (rc != EOK) { 174 devmap_hangup_phone(DEVMAP_DRIVER);175 173 printf(NAME ": Unable to register device %s.\n", "adb/mouse"); 176 174 return rc; 177 175 } 178 176 179 adb_dev[9].dev _handle = dev_handle;177 adb_dev[9].devmap_handle = devmap_handle; 180 178 181 179 if (cuda_init() < 0) { … … 195 193 ipc_callid_t callid; 196 194 ipc_call_t call; 197 ipcarg_t method;198 dev _handle_t dh;195 sysarg_t method; 196 devmap_handle_t dh; 199 197 int retval; 200 198 int dev_addr, i; … … 206 204 dev_addr = -1; 207 205 for (i = 0; i < ADB_MAX_ADDR; i++) { 208 if (adb_dev[i].dev _handle == dh)206 if (adb_dev[i].devmap_handle == dh) 209 207 dev_addr = i; 210 208 } 211 209 212 210 if (dev_addr < 0) { 213 ipc_answer_0(iid, EINVAL);211 async_answer_0(iid, EINVAL); 214 212 return; 215 213 } 216 214 217 215 /* Answer the IPC_M_CONNECT_ME_TO call. */ 218 ipc_answer_0(iid, EOK);216 async_answer_0(iid, EOK); 219 217 220 218 while (1) { 221 219 callid = async_get_call(&call); 222 method = IPC_GET_ METHOD(call);220 method = IPC_GET_IMETHOD(call); 223 221 switch (method) { 224 222 case IPC_M_PHONE_HUNGUP: 225 223 /* The other side has hung up. */ 226 ipc_answer_0(callid, EOK);224 async_answer_0(callid, EOK); 227 225 return; 228 226 case IPC_M_CONNECT_TO_ME: … … 237 235 */ 238 236 for (i = 0; i < ADB_MAX_ADDR; ++i) { 239 if (adb_dev[i].dev _handle == dh) {237 if (adb_dev[i].devmap_handle == dh) { 240 238 adb_dev[i].client_phone = IPC_GET_ARG5(call); 241 239 } … … 247 245 break; 248 246 } 249 ipc_answer_0(callid, retval);247 async_answer_0(callid, retval); 250 248 } 251 249 } … … 278 276 cuda_irq_code.cmds[0].addr = (void *) &((cuda_t *) instance->cuda_kernel)->ifr; 279 277 async_set_interrupt_received(cuda_irq_handler); 280 ipc_register_irq(10, device_assign_devno(), 0, &cuda_irq_code);278 register_irq(10, device_assign_devno(), 0, &cuda_irq_code); 281 279 282 280 /* Enable SR interrupt. */ … … 369 367 static void cuda_irq_rcv_end(void *buf, size_t *len) 370 368 { 371 uint8_t data,b;372 369 uint8_t b; 370 373 371 b = pio_read_8(&dev->b); 374 data =pio_read_8(&dev->sr);375 372 pio_read_8(&dev->sr); 373 376 374 if ((b & TREQ) == 0) { 377 375 instance->xstate = cx_receive; … … 381 379 cuda_send_start(); 382 380 } 383 384 385 381 382 memcpy(buf, instance->rcv_buf, instance->bidx); 383 *len = instance->bidx; 386 384 instance->bidx = 0; 387 385 } -
uspace/srv/hw/bus/cuda_adb/cuda_adb.h
r9e2e715 reb522e8 104 104 105 105 typedef struct { 106 dev _handle_t dev_handle;106 devmap_handle_t devmap_handle; 107 107 int client_phone; 108 108 } adb_dev_t; -
uspace/srv/hw/char/i8042/i8042.c
r9e2e715 reb522e8 40 40 #include <libarch/ddi.h> 41 41 #include <devmap.h> 42 #include <ipc/ipc.h>43 42 #include <async.h> 44 43 #include <unistd.h> … … 46 45 #include <stdio.h> 47 46 #include <errno.h> 47 #include <inttypes.h> 48 48 49 49 #include "i8042.h" … … 145 145 146 146 snprintf(name, 16, "%s/ps2%c", NAMESPACE, dchar[i]); 147 rc = devmap_device_register(name, &i8042_port[i].dev _handle);147 rc = devmap_device_register(name, &i8042_port[i].devmap_handle); 148 148 if (rc != EOK) { 149 devmap_hangup_phone(DEVMAP_DRIVER);150 149 printf(NAME ": Unable to register device %s.\n", name); 151 150 return rc; … … 199 198 i8042_kbd.cmds[0].addr = (void *) &((i8042_t *) i8042_kernel)->status; 200 199 i8042_kbd.cmds[3].addr = (void *) &((i8042_t *) i8042_kernel)->data; 201 ipc_register_irq(inr_a, device_assign_devno(), 0, &i8042_kbd); 202 ipc_register_irq(inr_b, device_assign_devno(), 0, &i8042_kbd); 203 printf("%s: registered for interrupts %d and %d\n", NAME, inr_a, inr_b); 200 register_irq(inr_a, device_assign_devno(), 0, &i8042_kbd); 201 register_irq(inr_b, device_assign_devno(), 0, &i8042_kbd); 202 printf("%s: registered for interrupts %" PRIun " and %" PRIun "\n", 203 NAME, inr_a, inr_b); 204 204 205 205 wait_ready(); … … 217 217 ipc_callid_t callid; 218 218 ipc_call_t call; 219 ipcarg_t method;220 dev _handle_t dh;219 sysarg_t method; 220 devmap_handle_t dh; 221 221 int retval; 222 222 int dev_id, i; … … 230 230 dev_id = -1; 231 231 for (i = 0; i < MAX_DEVS; i++) { 232 if (i8042_port[i].dev _handle == dh)232 if (i8042_port[i].devmap_handle == dh) 233 233 dev_id = i; 234 234 } 235 235 236 236 if (dev_id < 0) { 237 ipc_answer_0(iid, EINVAL);237 async_answer_0(iid, EINVAL); 238 238 return; 239 239 } 240 240 241 241 /* Answer the IPC_M_CONNECT_ME_TO call. */ 242 ipc_answer_0(iid, EOK);242 async_answer_0(iid, EOK); 243 243 244 244 printf(NAME ": accepted connection\n"); … … 246 246 while (1) { 247 247 callid = async_get_call(&call); 248 method = IPC_GET_ METHOD(call);248 method = IPC_GET_IMETHOD(call); 249 249 switch (method) { 250 250 case IPC_M_PHONE_HUNGUP: 251 251 /* The other side has hung up. */ 252 ipc_answer_0(callid, EOK);252 async_answer_0(callid, EOK); 253 253 return; 254 254 case IPC_M_CONNECT_TO_ME: … … 262 262 break; 263 263 case IPC_FIRST_USER_METHOD: 264 printf(NAME ": write % dto devid %d\n",264 printf(NAME ": write %" PRIun " to devid %d\n", 265 265 IPC_GET_ARG1(call), dev_id); 266 266 i8042_port_write(dev_id, IPC_GET_ARG1(call)); … … 271 271 break; 272 272 } 273 ipc_answer_0(callid, retval);273 async_answer_0(callid, retval); 274 274 } 275 275 } -
uspace/srv/hw/char/i8042/i8042.h
r9e2e715 reb522e8 52 52 /** Softstate structure, one for each serial port (primary and aux). */ 53 53 typedef struct { 54 dev _handle_t dev_handle;54 devmap_handle_t devmap_handle; 55 55 int client_phone; 56 56 } i8042_port_t; -
uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c
r9e2e715 reb522e8 40 40 #include <libarch/ddi.h> 41 41 #include <devmap.h> 42 #include <ipc/ipc.h>43 42 #include <ipc/char.h> 44 43 #include <async.h> … … 48 47 #include <sysinfo.h> 49 48 #include <errno.h> 49 #include <inttypes.h> 50 50 51 51 #include "s3c24xx_uart.h" … … 92 92 return -1; 93 93 94 rc = devmap_device_register(NAMESPACE "/" NAME, &uart->dev _handle);94 rc = devmap_device_register(NAMESPACE "/" NAME, &uart->devmap_handle); 95 95 if (rc != EOK) { 96 devmap_hangup_phone(DEVMAP_DRIVER);97 printf(NAME ": Unable to register device %s.\n");96 printf(NAME ": Unable to register device %s.\n", 97 NAMESPACE "/" NAME); 98 98 return -1; 99 99 } … … 114 114 ipc_callid_t callid; 115 115 ipc_call_t call; 116 ipcarg_t method;116 sysarg_t method; 117 117 int retval; 118 118 119 119 /* Answer the IPC_M_CONNECT_ME_TO call. */ 120 ipc_answer_0(iid, EOK);120 async_answer_0(iid, EOK); 121 121 122 122 while (1) { 123 123 callid = async_get_call(&call); 124 method = IPC_GET_ METHOD(call);124 method = IPC_GET_IMETHOD(call); 125 125 switch (method) { 126 126 case IPC_M_PHONE_HUNGUP: 127 127 /* The other side has hung up. */ 128 ipc_answer_0(callid, EOK);128 async_answer_0(callid, EOK); 129 129 return; 130 130 case IPC_M_CONNECT_TO_ME: … … 134 134 break; 135 135 case CHAR_WRITE_BYTE: 136 printf(NAME ": write % dto device\n",136 printf(NAME ": write %" PRIun " to device\n", 137 137 IPC_GET_ARG1(call)); 138 138 s3c24xx_uart_sendb(uart, (uint8_t) IPC_GET_ARG1(call)); … … 143 143 break; 144 144 } 145 ipc_answer_0(callid, retval);145 async_answer_0(callid, retval); 146 146 } 147 147 } … … 185 185 uart->client_phone = -1; 186 186 187 printf(NAME ": device at physical address 0x%x, inr %d.\n",188 uart->paddr, inr);187 printf(NAME ": device at physical address %p, inr %" PRIun ".\n", 188 (void *) uart->paddr, inr); 189 189 190 190 async_set_interrupt_received(s3c24xx_uart_irq_handler); 191 191 192 ipc_register_irq(inr, device_assign_devno(), 0, &uart_irq_code);192 register_irq(inr, device_assign_devno(), 0, &uart_irq_code); 193 193 194 194 /* Enable FIFO, Tx trigger level: empty, Rx trigger level: 1 byte. */ -
uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.h
r9e2e715 reb522e8 88 88 89 89 /** Device handle */ 90 dev _handle_t dev_handle;90 devmap_handle_t devmap_handle; 91 91 } s3c24xx_uart_t; 92 92 -
uspace/srv/hw/irc/apic/Makefile
r9e2e715 reb522e8 1 1 # 2 # Copyright (c) 20 08 Jiri Svoboda2 # Copyright (c) 2011 Martin Decky 3 3 # All rights reserved. 4 4 # … … 27 27 # 28 28 29 ARCH_SOURCES = arch/$(UARCH)/abs32le.c 29 USPACE_PREFIX = ../../../.. 30 BINARY = apic 31 32 SOURCES = \ 33 apic.c 34 35 include $(USPACE_PREFIX)/Makefile.common -
uspace/srv/hw/irc/fhc/fhc.c
r9e2e715 reb522e8 29 29 /** @addtogroup fhc 30 30 * @{ 31 */ 31 */ 32 32 33 33 /** 34 * @file 35 * @brief 34 * @file fhc.c 35 * @brief FHC bus controller driver. 36 36 */ 37 37 38 #include <ipc/ipc.h>39 38 #include <ipc/services.h> 40 #include <ipc/ bus.h>39 #include <ipc/irc.h> 41 40 #include <ipc/ns.h> 42 41 #include <sysinfo.h> … … 76 75 * Answer the first IPC_M_CONNECT_ME_TO call. 77 76 */ 78 ipc_answer_0(iid, EOK);77 async_answer_0(iid, EOK); 79 78 80 79 while (1) { … … 82 81 83 82 callid = async_get_call(&call); 84 switch (IPC_GET_METHOD(call)) { 85 case BUS_CLEAR_INTERRUPT: 83 switch (IPC_GET_IMETHOD(call)) { 84 case IRC_ENABLE_INTERRUPT: 85 /* Noop */ 86 async_answer_0(callid, EOK); 87 break; 88 case IRC_CLEAR_INTERRUPT: 86 89 inr = IPC_GET_ARG1(call); 87 90 switch (inr) { 88 91 case FHC_UART_INR: 89 92 fhc_uart_virt[FHC_UART_ICLR] = 0; 90 ipc_answer_0(callid, EOK);93 async_answer_0(callid, EOK); 91 94 break; 92 95 default: 93 ipc_answer_0(callid, ENOTSUP);96 async_answer_0(callid, ENOTSUP); 94 97 break; 95 98 } 96 99 break; 97 100 default: 98 ipc_answer_0(callid, EINVAL);101 async_answer_0(callid, EINVAL); 99 102 break; 100 103 } … … 129 132 } 130 133 131 printf(NAME ": FHC UART registers at %p, % dbytes\n", fhc_uart_phys,134 printf(NAME ": FHC UART registers at %p, %zu bytes\n", fhc_uart_phys, 132 135 fhc_uart_size); 133 136 134 137 async_set_client_connection(fhc_connection); 135 ipcarg_t phonead; 136 ipc_connect_to_me(PHONE_NS, SERVICE_FHC, 0, 0, &phonead); 138 service_register(SERVICE_IRC); 137 139 138 140 return true; -
uspace/srv/hw/irc/i8259/Makefile
r9e2e715 reb522e8 1 1 # 2 # Copyright (c) 20 08 Jiri Svoboda2 # Copyright (c) 2011 Martin Decky 3 3 # All rights reserved. 4 4 # … … 27 27 # 28 28 29 ARCH_SOURCES = arch/$(UARCH)/amd64.s 29 USPACE_PREFIX = ../../../.. 30 BINARY = i8259 31 32 SOURCES = \ 33 i8259.c 34 35 include $(USPACE_PREFIX)/Makefile.common -
uspace/srv/hw/irc/obio/obio.c
r9e2e715 reb522e8 27 27 */ 28 28 29 /** @addtogroup obio 29 /** @addtogroup obio 30 30 * @{ 31 */ 31 */ 32 32 33 33 /** 34 * @file 35 * @brief 34 * @file obio.c 35 * @brief OBIO driver. 36 36 * 37 37 * OBIO is a short for on-board I/O. On UltraSPARC IIi and systems with U2P, … … 42 42 */ 43 43 44 #include <ipc/ipc.h>45 44 #include <ipc/services.h> 46 #include <ipc/ bus.h>45 #include <ipc/irc.h> 47 46 #include <ipc/ns.h> 48 47 #include <sysinfo.h> … … 86 85 * Answer the first IPC_M_CONNECT_ME_TO call. 87 86 */ 88 ipc_answer_0(iid, EOK);87 async_answer_0(iid, EOK); 89 88 90 89 while (1) { … … 92 91 93 92 callid = async_get_call(&call); 94 switch (IPC_GET_METHOD(call)) { 95 case BUS_CLEAR_INTERRUPT: 93 switch (IPC_GET_IMETHOD(call)) { 94 case IRC_ENABLE_INTERRUPT: 95 /* Noop */ 96 async_answer_0(callid, EOK); 97 break; 98 case IRC_CLEAR_INTERRUPT: 96 99 inr = IPC_GET_ARG1(call); 97 100 base_virt[OBIO_CIR(inr & INO_MASK)] = 0; 98 ipc_answer_0(callid, EOK);101 async_answer_0(callid, EOK); 99 102 break; 100 103 default: 101 ipc_answer_0(callid, EINVAL);104 async_answer_0(callid, EINVAL); 102 105 break; 103 106 } … … 134 137 135 138 async_set_client_connection(obio_connection); 136 ipcarg_t phonead; 137 ipc_connect_to_me(PHONE_NS, SERVICE_OBIO, 0, 0, &phonead); 139 service_register(SERVICE_IRC); 138 140 139 141 return true; -
uspace/srv/hw/netif/ne2000/Makefile
r9e2e715 reb522e8 39 39 -include $(CONFIG_MAKEFILE) 40 40 41 ifeq ($(CONFIG_NETIF_NIL_BUNDLE),y) 42 LIBS += $(USPACE_PREFIX)/srv/net/nil/eth/libeth.a 43 endif 44 45 BINARY = dp8390 41 BINARY = ne2000 46 42 47 43 SOURCES = \ 48 44 dp8390.c \ 49 dp8390_module.c \50 45 ne2000.c 51 46
Note:
See TracChangeset
for help on using the changeset viewer.