Changes in / [5e4f22b:725d038] in mainline


Ignore:
Files:
31 added
12 edited

Legend:

Unmodified
Added
Removed
  • boot/Makefile.common

    r5e4f22b r725d038  
    114114        $(USPACE_PATH)/srv/devman/devman
    115115
    116 RD_DRVS = \
    117         infrastructure/root \
     116RD_DRVS_ESSENTIAL = \
     117        infrastructure/root
     118
     119RD_DRVS_NON_ESSENTIAL = \
    118120        infrastructure/rootvirt \
    119121        test/test1 \
     
    155157        $(USPACE_PATH)/app/dltest2/dltest2 \
    156158        $(USPACE_PATH)/app/dload/dload \
     159        $(USPACE_PATH)/app/dplay/dplay \
    157160        $(USPACE_PATH)/app/edit/edit \
    158161        $(USPACE_PATH)/app/ext2info/ext2info \
     
    161164        $(USPACE_PATH)/app/killall/killall \
    162165        $(USPACE_PATH)/app/loc/loc \
     166        $(USPACE_PATH)/app/mixerctl/mixerctl \
    163167        $(USPACE_PATH)/app/mkfat/mkfat \
    164168        $(USPACE_PATH)/app/mkexfat/mkexfat \
     
    220224RD_SRVS = $(RD_SRVS_ESSENTIAL)
    221225RD_APPS = $(RD_APPS_ESSENTIAL)
     226RD_DRVS = $(RD_DRVS_ESSENTIAL)
    222227else
    223228RD_SRVS = $(RD_SRVS_ESSENTIAL) $(RD_SRVS_NON_ESSENTIAL)
    224229RD_APPS = $(RD_APPS_ESSENTIAL) $(RD_APPS_NON_ESSENTIAL)
     230RD_DRVS = $(RD_DRVS_ESSENTIAL) $(RD_DRVS_NON_ESSENTAIL)
    225231endif
    226232
  • boot/arch/amd64/Makefile.inc

    r5e4f22b r725d038  
    2828
    2929RD_SRVS_ESSENTIAL += \
     30        $(USPACE_PATH)/srv/devman/devman \
    3031        $(USPACE_PATH)/srv/hw/irc/apic/apic \
    3132        $(USPACE_PATH)/srv/hw/irc/i8259/i8259
     
    3435        $(USPACE_PATH)/srv/bd/ata_bd/ata_bd
    3536
    36 RD_DRVS += \
     37RD_DRVS_ESSENTIAL += \
    3738        infrastructure/rootpc \
    3839        bus/pci/pciintel \
    3940        bus/isa \
     41        audio/sb16 \
    4042        char/i8042 \
     43        char/ps2mouse \
     44        char/xtkbd
     45
     46RD_DRVS_NON_ESSENTIAL += \
    4147        char/ns8250 \
    42         char/ps2mouse \
    43         char/xtkbd \
    4448        bus/usb/ehci\
    4549        bus/usb/ohci \
     
    5660        bus/isa
    5761
     62RD_APPS_ESSENTIAL += \
     63        $(USPACE_PATH)/app/dplay/dplay \
     64        $(USPACE_PATH)/app/mixerctl/mixerctl \
     65       
    5866BOOT_OUTPUT = $(ROOT_PATH)/image.iso
    5967PREBUILD = $(INITRD).img
  • boot/arch/ppc32/Makefile.inc

    r5e4f22b r725d038  
    4242        $(USPACE_PATH)/srv/hw/bus/cuda_adb/cuda_adb
    4343
    44 RD_DRVS += \
     44RD_DRVS_NON_ESSENTIAL += \
    4545        infrastructure/rootmac
    4646
  • uspace/Makefile

    r5e4f22b r725d038  
    3838        app/bnchmark \
    3939        app/devctl \
     40        app/dplay \
    4041        app/edit \
    4142        app/ext2info \
     
    4849        app/loc \
    4950        app/lsusb \
     51        app/mixerctl \
    5052        app/mkfat \
    5153        app/mkexfat \
     
    103105        srv/hid/remcons \
    104106        srv/hw/char/s3c24xx_uart \
     107        drv/audio/sb16 \
    105108        drv/infrastructure/root \
    106109        drv/infrastructure/rootvirt \
  • uspace/drv/bus/isa/isa.c

    r5e4f22b r725d038  
    9191        fibril_mutex_t mutex;
    9292        ddf_fun_t *fnode;
     93        hw_resource_t resources[ISA_MAX_HW_RES];
    9394        hw_resource_list_t hw_resources;
    9495        link_t bus_link;
     
    207208
    208209        fibril_mutex_initialize(&fun->mutex);
     210        fun->hw_resources.resources = fun->resources;
     211
    209212        fun->fnode = fnode;
    210213        return fun;
     
    518521}
    519522
    520 static void fun_hw_res_alloc(isa_fun_t *fun)
    521 {
    522         fun->hw_resources.resources =
    523             (hw_resource_t *) malloc(sizeof(hw_resource_t) * ISA_MAX_HW_RES);
    524 }
    525 
    526 static void fun_hw_res_free(isa_fun_t *fun)
    527 {
    528         free(fun->hw_resources.resources);
    529         fun->hw_resources.resources = NULL;
    530 }
    531 
    532523static char *isa_fun_read_info(char *fun_conf, isa_bus_t *isa)
    533524{
     
    558549                return NULL;
    559550        }
    560 
    561         /* Allocate buffer for the list of hardware resources of the device. */
    562         fun_hw_res_alloc(fun);
    563551
    564552        /* Get properties of the device (match ids, irq and io range). */
     
    677665                list_remove(&fun->bus_link);
    678666
    679                 fun_hw_res_free(fun);
    680667                ddf_fun_destroy(fun->fnode);
    681668        }
  • uspace/lib/c/generic/device/hw_res.c

    r5e4f22b r725d038  
    4242{
    4343        sysarg_t count = 0;
    44        
     44
    4545        async_exch_t *exch = async_exchange_begin(sess);
     46        if (exch == NULL)
     47                return ENOMEM;
    4648        int rc = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    4749            HW_RES_GET_RESOURCE_LIST, &count);
    48        
     50
    4951        if (rc != EOK) {
    5052                async_exchange_end(exch);
    5153                return rc;
    5254        }
    53        
     55
    5456        size_t size = count * sizeof(hw_resource_t);
    5557        hw_resource_t *resources = (hw_resource_t *) malloc(size);
     
    5961                return ENOMEM;
    6062        }
    61        
     63
    6264        rc = async_data_read_start(exch, resources, size);
    6365        async_exchange_end(exch);
    64        
     66
    6567        if (rc != EOK) {
    6668                free(resources);
    6769                return rc;
    6870        }
    69        
     71
    7072        hw_resources->resources = resources;
    7173        hw_resources->count = count;
    72        
     74
    7375        return EOK;
    7476}
     
    7779{
    7880        async_exch_t *exch = async_exchange_begin(sess);
     81        if (exch == NULL)
     82                return false;
    7983        int rc = async_req_1_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    8084            HW_RES_ENABLE_INTERRUPT);
    8185        async_exchange_end(exch);
    82        
     86
    8387        return (rc == EOK);
     88}
     89
     90/**
     91 * Setup DMA channel to specified place and mode.
     92 * @param channel DMA Channel 1,2,3 for 8 bit transfers, 5,6,7 for 16 bit.
     93 * @param pa Physical address of the buffer. Must be < 16MB for 16 bit and < 1MB
     94 *           for 8 bit transfers.
     95 * @param size DMA buffer size, limited to 64K.
     96 * @param mode Mode of the DMA channel:
     97 *              - Read or Write
     98 *              - Allow automatic reset
     99 *              - Use address decrement instead of increment
     100 *              - Use SINGLE/BLOCK/ON DEMAND transfer mode
     101 * @return Error code.
     102 */
     103int hw_res_dma_channel_setup(async_sess_t *sess,
     104    unsigned channel, uint32_t pa, uint16_t size, uint8_t mode)
     105{
     106        async_exch_t *exch = async_exchange_begin(sess);
     107        if (exch == NULL)
     108                return ENOMEM;
     109        const uint32_t packed = size | (mode << 16);
     110        const int ret = async_req_4_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
     111            HW_RES_DMA_CHANNEL_SETUP, channel, pa, packed);
     112        async_exchange_end(exch);
     113
     114        return ret;
    84115}
    85116
  • uspace/lib/c/generic/device/hw_res_parsed.c

    r5e4f22b r725d038  
    3838#include <errno.h>
    3939
    40 static void hw_res_parse_add_irq(hw_res_list_parsed_t *out, hw_resource_t *res,
    41     int flags)
     40static void hw_res_parse_add_dma_channel(hw_res_list_parsed_t *out,
     41    const hw_resource_t *res, int flags)
     42{
     43        assert(res);
     44        assert((res->type == DMA_CHANNEL_8) || (res->type == DMA_CHANNEL_16));
     45       
     46        const unsigned channel = (res->type == DMA_CHANNEL_8) ?
     47            res->res.dma_channel.dma8 : res->res.dma_channel.dma16;
     48        const size_t count = out->dma_channels.count;
     49        const int keep_duplicit = flags & HW_RES_KEEP_DUPLICIT;
     50       
     51        if (!keep_duplicit) {
     52                for (size_t i = 0; i < count; ++i) {
     53                        if (out->dma_channels.channels[i] == channel)
     54                                return;
     55                }
     56        }
     57       
     58        out->dma_channels.channels[count] = channel;
     59        ++out->dma_channels.count;
     60}
     61
     62static void hw_res_parse_add_irq(hw_res_list_parsed_t *out,
     63    const hw_resource_t *res, int flags)
    4264{
    4365        assert(res && (res->type == INTERRUPT));
     
    5981
    6082static void hw_res_parse_add_io_range(hw_res_list_parsed_t *out,
    61     hw_resource_t *res, int flags)
     83    const hw_resource_t *res, int flags)
    6284{
    6385        assert(res && (res->type == IO_RANGE));
     
    90112
    91113static void hw_res_parse_add_mem_range(hw_res_list_parsed_t *out,
    92     hw_resource_t *res, int flags)
     114    const hw_resource_t *res, int flags)
    93115{
    94116        assert(res && (res->type == MEM_RANGE));
     
    132154 *
    133155 */
    134 int hw_res_list_parse(hw_resource_list_t *hw_resources,
     156int hw_res_list_parse(const hw_resource_list_t *hw_resources,
    135157    hw_res_list_parsed_t *out, int flags)
    136158{
     
    141163        hw_res_list_parsed_clean(out);
    142164       
    143         out->irqs.irqs = malloc(res_count * sizeof(int));
    144         out->io_ranges.ranges = malloc(res_count * sizeof(io_range_t));
    145         out->mem_ranges.ranges = malloc(res_count * sizeof(mem_range_t));
     165        out->irqs.irqs = calloc(res_count, sizeof(int));
     166        out->dma_channels.channels = calloc(res_count, sizeof(int));
     167        out->io_ranges.ranges = calloc(res_count, sizeof(io_range_t));
     168        out->mem_ranges.ranges = calloc(res_count, sizeof(mem_range_t));
     169        if (!out->irqs.irqs || !out->dma_channels.channels ||
     170            !out->io_ranges.ranges || !out->mem_ranges.ranges) {
     171                hw_res_list_parsed_clean(out);
     172                return ENOMEM;
     173        }
    146174       
    147175        for (size_t i = 0; i < res_count; ++i) {
    148                 hw_resource_t *resource = &(hw_resources->resources[i]);
    149                
     176                const hw_resource_t *resource = &(hw_resources->resources[i]);
     177
    150178                switch (resource->type) {
    151179                case INTERRUPT:
     
    158186                        hw_res_parse_add_mem_range(out, resource, flags);
    159187                        break;
     188                case DMA_CHANNEL_8:
     189                case DMA_CHANNEL_16:
     190                        hw_res_parse_add_dma_channel(out, resource, flags);
     191                        break;
    160192                default:
     193                        hw_res_list_parsed_clean(out);
    161194                        return EINVAL;
    162195                }
    163196        }
    164        
     197
    165198        return EOK;
    166199};
  • uspace/lib/c/include/device/hw_res_parsed.h

    r5e4f22b r725d038  
    139139}
    140140
    141 extern int hw_res_list_parse(hw_resource_list_t *, hw_res_list_parsed_t *, int);
     141extern int hw_res_list_parse(
     142    const hw_resource_list_t *, hw_res_list_parsed_t *, int);
    142143extern int hw_res_get_list_parsed(async_sess_t *, hw_res_list_parsed_t *, int);
    143144
  • uspace/lib/c/include/ipc/dev_iface.h

    r5e4f22b r725d038  
    3636typedef enum {
    3737        HW_RES_DEV_IFACE = 0,
     38
     39        /** Audio device mixer interface */
     40        AUDIO_MIXER_IFACE,
     41        /** Audio device pcm buffer interface */
     42        AUDIO_PCM_BUFFER_IFACE,
     43
    3844        /** Character device interface */
    3945        CHAR_DEV_IFACE,
  • uspace/lib/drv/Makefile

    r5e4f22b r725d038  
    3838        generic/log.c \
    3939        generic/logbuf.c \
     40        generic/remote_audio_mixer.c \
     41        generic/remote_audio_pcm_buffer.c \
    4042        generic/remote_hw_res.c \
    4143        generic/remote_char_dev.c \
  • uspace/lib/drv/generic/dev_iface.c

    r5e4f22b r725d038  
    4646#include "remote_usbhid.h"
    4747#include "remote_pci.h"
     48#include "remote_audio_mixer.h"
     49#include "remote_audio_pcm_buffer.h"
    4850
    49 static iface_dipatch_table_t remote_ifaces = {
     51static const iface_dipatch_table_t remote_ifaces = {
    5052        .ifaces = {
    51                 &remote_hw_res_iface,
    52                 &remote_char_dev_iface,
    53                 &remote_nic_iface,
    54                 &remote_pci_iface,
    55                 &remote_usb_iface,
    56                 &remote_usbhc_iface,
    57                 &remote_usbhid_iface
     53                [AUDIO_MIXER_IFACE] = &remote_audio_mixer_iface,
     54                [AUDIO_PCM_BUFFER_IFACE] = &remote_audio_pcm_buffer_iface,
     55                [HW_RES_DEV_IFACE] = &remote_hw_res_iface,
     56                [CHAR_DEV_IFACE] = &remote_char_dev_iface,
     57                [NIC_DEV_IFACE] = &remote_nic_iface,
     58                [PCI_DEV_IFACE] = &remote_pci_iface,
     59                [USB_DEV_IFACE] = &remote_usb_iface,
     60                [USBHC_DEV_IFACE] = &remote_usbhc_iface,
     61                [USBHID_DEV_IFACE] = &remote_usbhid_iface,
    5862        }
    5963};
  • uspace/lib/drv/generic/remote_hw_res.c

    r5e4f22b r725d038  
    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 *);
    4548
    4649static remote_iface_func_ptr_t remote_hw_res_iface_ops [] = {
    47         &remote_hw_res_get_resource_list,
    48         &remote_hw_res_enable_interrupt
     50        [HW_RES_GET_RESOURCE_LIST] = &remote_hw_res_get_resource_list,
     51        [HW_RES_ENABLE_INTERRUPT] = &remote_hw_res_enable_interrupt,
     52        [HW_RES_DMA_CHANNEL_SETUP] = &remote_hw_res_dma_channel_setup,
    4953};
    5054
     
    9498}
    9599
     100static void remote_hw_res_dma_channel_setup(ddf_fun_t *fun, void *ops,
     101    ipc_callid_t callid, ipc_call_t *call)
     102{
     103        hw_res_ops_t *hw_res_ops = ops;
     104
     105        if (hw_res_ops->dma_channel_setup == NULL) {
     106                async_answer_0(callid, ENOTSUP);
     107                return;
     108        }
     109        const unsigned channel = DEV_IPC_GET_ARG1(*call);
     110        const uint32_t address = DEV_IPC_GET_ARG2(*call);
     111        const uint16_t size = DEV_IPC_GET_ARG3(*call) & 0xffff;
     112        const uint8_t mode = DEV_IPC_GET_ARG3(*call) >> 16;
     113
     114        const int ret = hw_res_ops->dma_channel_setup(
     115            fun, channel, address, size, mode);
     116        async_answer_0(callid, ret);
     117}
     118
    96119/**
    97120 * @}
Note: See TracChangeset for help on using the changeset viewer.