Changeset 55a8e0c in mainline


Ignore:
Timestamp:
2011-11-13T21:22:51Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e6def65
Parents:
d98d136
Message:

isa: Add support for DMA channels.

Location:
uspace/drv/bus/isa
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/isa/isa.c

    rd98d136 r55a8e0c  
    7474#define ISA_FUN(fun) ((isa_fun_t *) ((fun)->driver_data))
    7575
    76 #define ISA_MAX_HW_RES 4
     76#define ISA_MAX_HW_RES 5
    7777
    7878typedef struct {
     
    314314}
    315315
     316static void isa_fun_set_dma(isa_fun_t *fun, int dma)
     317{
     318        size_t count = fun->hw_resources.count;
     319        hw_resource_t *resources = fun->hw_resources.resources;
     320
     321        if (count < ISA_MAX_HW_RES) {
     322                if (dma > 0 && dma < 4) {
     323                        resources[count].type = DMA_CHANNEL_8;
     324                        resources[count].res.dma_channel.dma8 = dma;
     325
     326                        fun->hw_resources.count++;
     327                        ddf_msg(LVL_NOTE, "Added dma 0x%x to function %s", dma,
     328                            fun->fnode->name);
     329                        return;
     330                }
     331
     332                if (dma > 4 && dma < 8) {
     333                        resources[count].type = DMA_CHANNEL_16;
     334                        resources[count].res.dma_channel.dma16 = dma;
     335
     336                        fun->hw_resources.count++;
     337                        ddf_msg(LVL_NOTE, "Added dma 0x%x to function %s", dma,
     338                            fun->fnode->name);
     339                        return;
     340                }
     341
     342                ddf_msg(LVL_WARN, "Skipped dma 0x%x for function %s", dma,
     343                    fun->fnode->name);
     344        }
     345}
     346
    316347static void isa_fun_set_io_range(isa_fun_t *fun, size_t addr, size_t len)
    317348{
     
    343374        if (val != end)
    344375                isa_fun_set_irq(fun, irq);
     376}
     377
     378static void fun_parse_dma(isa_fun_t *fun, char *val)
     379{
     380        int dma = 0;
     381        char *end = NULL;
     382
     383        val = skip_spaces(val);
     384        dma = (int)strtol(val, &end, 10);
     385
     386        if (val != end)
     387                isa_fun_set_dma(fun, dma);
    345388}
    346389
     
    436479        if (!prop_parse(fun, line, "io_range", &fun_parse_io_range) &&
    437480            !prop_parse(fun, line, "irq", &fun_parse_irq) &&
     481            !prop_parse(fun, line, "dma", &fun_parse_dma) &&
    438482            !prop_parse(fun, line, "match", &fun_parse_match_id)) {
    439483
  • uspace/drv/bus/isa/isa.dev

    rd98d136 r55a8e0c  
    1616sb16:
    1717        match 100 isa/sb16
    18         irq 5
    1918        io_range 220 20
    2019        io_range 330 2
     20        irq 5
     21        dma 1
     22        dma 5
Note: See TracChangeset for help on using the changeset viewer.