Changeset 5856b627 in mainline for uspace/lib/drv/generic


Ignore:
Timestamp:
2013-08-20T12:36:48Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
26e2de3
Parents:
0ee999d (diff), 4da8fdb (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.
Message:

Mainline changes.

Location:
uspace/lib/drv/generic
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/dev_iface.c

    r0ee999d r5856b627  
    4949#include "remote_usbhid.h"
    5050#include "remote_pci.h"
     51#include "remote_audio_mixer.h"
     52#include "remote_audio_pcm.h"
    5153#include "remote_ahci.h"
    5254
    53 static iface_dipatch_table_t remote_ifaces = {
     55static const iface_dipatch_table_t remote_ifaces = {
    5456        .ifaces = {
    55                 &remote_hw_res_iface,
    56                 &remote_char_dev_iface,
    57                 &remote_graph_dev_iface,
    58                 &remote_nic_iface,
    59                 &remote_pci_iface,
    60                 &remote_usb_iface,
    61                 &remote_usbhc_iface,
    62                 &remote_usbhid_iface,
    63                 &remote_clock_dev_iface,
    64                 &remote_battery_dev_iface,
    65                 &remote_ahci_iface
     57                [AUDIO_MIXER_IFACE] = &remote_audio_mixer_iface,
     58                [AUDIO_PCM_BUFFER_IFACE] = &remote_audio_pcm_iface,
     59                [HW_RES_DEV_IFACE] = &remote_hw_res_iface,
     60                [CHAR_DEV_IFACE] = &remote_char_dev_iface,
     61                [GRAPH_DEV_IFACE] = &remote_graph_dev_iface,
     62                [NIC_DEV_IFACE] = &remote_nic_iface,
     63                [PCI_DEV_IFACE] = &remote_pci_iface,
     64                [USB_DEV_IFACE] = &remote_usb_iface,
     65                [USBHC_DEV_IFACE] = &remote_usbhc_iface,
     66                [USBHID_DEV_IFACE] = &remote_usbhid_iface,
     67                [CLOCK_DEV_IFACE] = &remote_clock_dev_iface,
     68                [BATTERY_DEV_IFACE] = &remote_battery_dev_iface,
     69                [AHCI_DEV_IFACE] = &remote_ahci_iface,
    6670        }
    6771};
  • uspace/lib/drv/generic/remote_hw_res.c

    r0ee999d r5856b627  
    11/*
    22 * Copyright (c) 2010 Lenka Trochtova
     3 * Copyright (c) 2011 Jan Vesely
    34 * All rights reserved.
    45 *
     
    4344static void remote_hw_res_enable_interrupt(ddf_fun_t *, void *, ipc_callid_t,
    4445    ipc_call_t *);
     46static void remote_hw_res_dma_channel_setup(ddf_fun_t *, void *, ipc_callid_t,
     47    ipc_call_t *);
     48static void remote_hw_res_dma_channel_remain(ddf_fun_t *, void *, ipc_callid_t,
     49    ipc_call_t *);
    4550
    4651static remote_iface_func_ptr_t remote_hw_res_iface_ops [] = {
    47         &remote_hw_res_get_resource_list,
    48         &remote_hw_res_enable_interrupt
     52        [HW_RES_GET_RESOURCE_LIST] = &remote_hw_res_get_resource_list,
     53        [HW_RES_ENABLE_INTERRUPT] = &remote_hw_res_enable_interrupt,
     54        [HW_RES_DMA_CHANNEL_SETUP] = &remote_hw_res_dma_channel_setup,
     55        [HW_RES_DMA_CHANNEL_REMAIN] = &remote_hw_res_dma_channel_remain,
    4956};
    5057
     
    94101}
    95102
     103static void remote_hw_res_dma_channel_setup(ddf_fun_t *fun, void *ops,
     104    ipc_callid_t callid, ipc_call_t *call)
     105{
     106        hw_res_ops_t *hw_res_ops = ops;
     107
     108        if (hw_res_ops->dma_channel_setup == NULL) {
     109                async_answer_0(callid, ENOTSUP);
     110                return;
     111        }
     112        const unsigned channel = DEV_IPC_GET_ARG1(*call) & 0xffff;
     113        const uint8_t  mode = DEV_IPC_GET_ARG1(*call) >> 16;
     114        const uint32_t address = DEV_IPC_GET_ARG2(*call);
     115        const uint32_t size = DEV_IPC_GET_ARG3(*call);
     116
     117        const int ret = hw_res_ops->dma_channel_setup(
     118            fun, channel, address, size, mode);
     119        async_answer_0(callid, ret);
     120}
     121
     122static void remote_hw_res_dma_channel_remain(ddf_fun_t *fun, void *ops,
     123    ipc_callid_t callid, ipc_call_t *call)
     124{
     125        hw_res_ops_t *hw_res_ops = ops;
     126
     127        if (hw_res_ops->dma_channel_setup == NULL) {
     128                async_answer_0(callid, ENOTSUP);
     129                return;
     130        }
     131        const unsigned channel = DEV_IPC_GET_ARG1(*call);
     132        size_t remain = 0;
     133        const int ret = hw_res_ops->dma_channel_remain(fun, channel, &remain);
     134        async_answer_1(callid, ret, remain);
     135}
    96136/**
    97137 * @}
Note: See TracChangeset for help on using the changeset viewer.