Subversion Repositories HelenOS

Rev

Rev 2622 | Rev 2637 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2622 Rev 2635
Line 446... Line 446...
446
}
446
}
447
 
447
 
448
/** Connect client to the device.
448
/** Connect client to the device.
449
 * Find device driver owning requested device and forward
449
 * Find device driver owning requested device and forward
450
 * the message to it.
450
 * the message to it.
451
 *
-
 
452
 *
-
 
453
 */
451
 */
454
static void devmap_forward(ipc_callid_t callid, ipc_call_t *call)
452
static void devmap_forward(ipc_callid_t callid, ipc_call_t *call)
455
{
453
{
456
    devmap_device_t *dev;
454
    devmap_device_t *dev;
457
    int handle;
455
    int handle;
458
 
456
 
459
    /*
457
    /*
460
     * Get handle from request
458
     * Get handle from request
461
     */
459
     */
462
    handle = IPC_GET_ARG1(*call);
460
    handle = IPC_GET_ARG2(*call);
463
    dev = devmap_device_find_handle(handle);
461
    dev = devmap_device_find_handle(handle);
464
 
462
 
465
    if (NULL == dev) {
463
    if (NULL == dev) {
466
        printf("DEVMAP: No registered device with handle %d.\n",
464
        printf("DEVMAP: No registered device with handle %d.\n",
467
            handle);
465
            handle);
468
        ipc_answer_0(callid, ENOENT);
466
        ipc_answer_0(callid, ENOENT);
469
        return;
467
        return;
470
    }
468
    }
471
 
469
 
472
    /* FIXME: is this correct method how to pass argument on forwarding ?*/
-
 
473
    ipc_forward_fast(callid, dev->driver->phone, (ipcarg_t)(dev->handle),
470
    ipc_forward_fast(callid, dev->driver->phone, (ipcarg_t)(dev->handle),
474
        0, IPC_FF_NONE);
471
        IPC_GET_ARG3(*call), 0, IPC_FF_NONE);
475
    return;
472
    return;
476
}
473
}
477
 
474
 
478
/** Find handle for device instance identified by name.
475
/** Find handle for device instance identified by name.
479
 * In answer will be send EOK and device handle in arg1 or a error
476
 * In answer will be send EOK and device handle in arg1 or a error
Line 667... Line 664...
667
        case IPC_M_PHONE_HUNGUP:
664
        case IPC_M_PHONE_HUNGUP:
668
            printf("DEVMAP: connection hung up.\n");
665
            printf("DEVMAP: connection hung up.\n");
669
            cont = false;
666
            cont = false;
670
            continue; /* Exit thread */
667
            continue; /* Exit thread */
671
 
668
 
672
        case DEVMAP_DEVICE_CONNECT_ME_TO:
-
 
673
            /* Connect client to selected device */
-
 
674
            printf("DEVMAP: connect to device %d.\n",
-
 
675
                IPC_GET_ARG1(call));
-
 
676
            devmap_forward(callid, &call);
-
 
677
            break;
-
 
678
 
-
 
679
        case DEVMAP_DEVICE_GET_HANDLE:
669
        case DEVMAP_DEVICE_GET_HANDLE:
680
            devmap_get_handle(callid, &call);
670
            devmap_get_handle(callid, &call);
681
 
671
 
682
            break;
672
            break;
683
        case DEVMAP_DEVICE_GET_NAME:
673
        case DEVMAP_DEVICE_GET_NAME:
Line 707... Line 697...
707
        devmap_connection_driver(iid, icall);
697
        devmap_connection_driver(iid, icall);
708
        break;
698
        break;
709
    case DEVMAP_CLIENT:
699
    case DEVMAP_CLIENT:
710
        devmap_connection_client(iid, icall);
700
        devmap_connection_client(iid, icall);
711
        break;
701
        break;
-
 
702
    case DEVMAP_CONNECT_TO_DEVICE:
-
 
703
            /* Connect client to selected device */
-
 
704
        printf("DEVMAP: connect to device %d.\n",
-
 
705
            IPC_GET_ARG2(*icall));
-
 
706
        devmap_forward(iid, icall);
-
 
707
        break;
712
    default:
708
    default:
713
        ipc_answer_0(iid, ENOENT); /* No such interface */
709
        ipc_answer_0(iid, ENOENT); /* No such interface */
714
        printf("DEVMAP: Unknown interface %u.\n",
710
        printf("DEVMAP: Unknown interface %u.\n",
715
            (ipcarg_t)(IPC_GET_ARG1(*icall)));
711
            (ipcarg_t)(IPC_GET_ARG1(*icall)));
716
    }
712
    }