Changeset ddd0499d in mainline for uspace/drv/audio/sb16/sb16.c


Ignore:
Timestamp:
2013-09-12T22:05:13Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4285851
Parents:
695b6ff (diff), 7de1988c (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:

Support for PIO window-relative and absolute HW resource ranges.

The goal of this merge is to allow bus drivers to pass resources with IO
and memory ranges to the child drivers either in the PIO window-relative
form or system bus absolute form. Using the PIO window and the
relative/absolute attribute of a range, each driver can now reconstruct
both forms. Helper functions are provided to automate these
transformations as much as possible.

Changes in this merge in a greater detail:

  • Support for PIO_WINDOW_DEV_IFACE in isa so that it can provide the PIO window to its children.
  • Add 'relative' member to both hw_resource_t.res.mem_range and hw_resource_t.res.io_range so that the drivers can actually tell whether a range is absolute (eg. it was absolutized by its parent).
  • Add pio_enable_resource() to allow drivers to enable PIO without the need to actually care about what kind of range the resource contains. This is used by pci now.
  • Automate things even more for drivers that use hw_res_get_list_parsed(). The parsed HW resources compute both forms (relative/absolute) and offer it to the driver which is using them. Such a driver then uses whatever form is more fit for it and its purposes.
  • Drivers using the parsed resources can use pio_enable_range() to enable PIO and RNGABS*()/RNGREL()/RNGSZ courtesy macros for easier access to the actual range address/size are provided.
  • Device drivers affected by these API changes were converted.
  • uhcirh now requires uhci to provide PIO_WINDOW_DEV_IFACE; however, the uhcirh driver is removed in the feature USB branch so there was no point in implementing this feature and UHCI USB is thus temporarily broken.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/audio/sb16/sb16.c

    r695b6ff rddd0499d  
    7777}
    7878
    79 void sb16_irq_code(void *regs, int dma8, int dma16, irq_cmd_t cmds[], irq_pio_range_t ranges[])
     79void sb16_irq_code(addr_range_t *regs, int dma8, int dma16, irq_cmd_t cmds[],
     80    irq_pio_range_t ranges[])
    8081{
    8182        assert(regs);
    8283        assert(dma8 > 0 && dma8 < 4);
    83         sb16_regs_t *registers = regs;
     84
     85        sb16_regs_t *registers = RNGABSPTR(*regs);
    8486        memcpy(cmds, irq_cmds, sizeof(irq_cmds));
    85         cmds[0].addr = (void*)&registers->dsp_read_status;
    86         ranges[0].base = (uintptr_t)registers;
     87        cmds[0].addr = (void *) &registers->dsp_read_status;
     88        ranges[0].base = (uintptr_t) registers;
    8789        ranges[0].size = sizeof(*registers);
    8890        if (dma16 > 4 && dma16 < 8) {
    8991                /* Valid dma16 */
    90                 cmds[1].addr = (void*)&registers->dma16_ack;
     92                cmds[1].addr = (void *) &registers->dma16_ack;
    9193        } else {
    9294                cmds[1].cmd = CMD_ACCEPT;
     
    9496}
    9597
    96 int sb16_init_sb16(sb16_t *sb, void *regs, size_t size,
    97     ddf_dev_t *dev, int dma8, int dma16)
     98int sb16_init_sb16(sb16_t *sb, addr_range_t *regs, ddf_dev_t *dev, int dma8,
     99    int dma16)
    98100{
    99101        assert(sb);
     102
    100103        /* Setup registers */
    101         int ret = pio_enable(regs, size, (void**)&sb->regs);
     104        int ret = pio_enable_range(regs, (void **) &sb->regs);
    102105        if (ret != EOK)
    103106                return ret;
    104         ddf_log_debug("PIO registers at %p accessible.", sb->regs);
     107        ddf_log_note("PIO registers at %p accessible.", sb->regs);
    105108
    106109        /* Initialize DSP */
     
    187190}
    188191
    189 int sb16_init_mpu(sb16_t *sb, void *regs, size_t size)
     192int sb16_init_mpu(sb16_t *sb, addr_range_t *regs)
    190193{
    191194        sb->mpu_regs = NULL;
Note: See TracChangeset for help on using the changeset viewer.