Changeset b5e68c8 in mainline for uspace/srv/hw/bus/cuda_adb/cuda_adb.c
- Timestamp:
- 2011-05-12T16:49:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f36787d7
- Parents:
- e80329d6 (diff), 750636a (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hw/bus/cuda_adb/cuda_adb.c
re80329d6 rb5e68c8 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 }
Note:
See TracChangeset
for help on using the changeset viewer.