Changes in / [c6a7b3a:5d9fce4] in mainline


Ignore:
Files:
57 deleted
38 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    rc6a7b3a r5d9fce4  
    592592! CONFIG_OPTIMIZE_FOR_SIZE (n/y)
    593593
    594 % Number of consoles
    595 @ "1"
    596 @ "2"
    597 @ "3"
    598 @ "4"
    599 @ "5"
    600 @ "6"
    601 ! [CONFIG_FB=n] CONFIG_VC_COUNT(choice)
    602 
    603 %Kernel log on console 6
    604 ! [CONFIG_FB=n] CONFIG_KERNEL_LOG_VC_6 (y/n)
    605 
    606594% Barebone build with essential binaries only
    607595! CONFIG_BAREBONE (n/y)
  • boot/Makefile.common

    rc6a7b3a r5d9fce4  
    119119        $(USPACE_PATH)/srv/taskmon/taskmon
    120120
    121 RD_DRVS_ESSENTIAL = \
    122         infrastructure/root
    123 
    124 RD_DRVS_NON_ESSENTIAL = \
     121RD_DRVS = \
     122        infrastructure/root \
    125123        infrastructure/rootvirt \
    126124        fb/kfb \
     
    172170        $(USPACE_PATH)/app/killall/killall \
    173171        $(USPACE_PATH)/app/loc/loc \
    174         $(USPACE_PATH)/app/mixerctl/mixerctl \
    175172        $(USPACE_PATH)/app/logset/logset \
    176173        $(USPACE_PATH)/app/mkfat/mkfat \
     
    235232RD_SRVS = $(RD_SRVS_ESSENTIAL)
    236233RD_APPS = $(RD_APPS_ESSENTIAL)
    237 RD_DRVS = $(RD_DRVS_ESSENTIAL)
    238234else
    239235RD_SRVS = $(RD_SRVS_ESSENTIAL) $(RD_SRVS_NON_ESSENTIAL)
    240236RD_APPS = $(RD_APPS_ESSENTIAL) $(RD_APPS_NON_ESSENTIAL)
    241 RD_DRVS = $(RD_DRVS_ESSENTIAL) $(RD_DRVS_NON_ESSENTIAL)
    242237endif
    243238
  • boot/arch/amd64/Makefile.inc

    rc6a7b3a r5d9fce4  
    2828
    2929RD_SRVS_ESSENTIAL += \
    30         $(USPACE_PATH)/srv/audio/hound/hound \
    31         $(USPACE_PATH)/srv/devman/devman \
    3230        $(USPACE_PATH)/srv/hw/irc/apic/apic \
    3331        $(USPACE_PATH)/srv/hw/irc/i8259/i8259
     
    3634        $(USPACE_PATH)/srv/bd/ata_bd/ata_bd
    3735
    38 RD_DRVS_ESSENTIAL += \
     36RD_DRVS += \
    3937        infrastructure/rootpc \
    4038        bus/pci/pciintel \
    4139        bus/isa \
    42         audio/sb16 \
    4340        char/i8042 \
     41        char/ns8250 \
    4442        char/ps2mouse \
    45         char/xtkbd
    46 
    47 RD_DRVS_NON_ESSENTIAL += \
    48         char/ns8250 \
     43        char/xtkbd \
    4944        time/cmos-rtc \
    5045        bus/usb/ehci\
     
    6257        bus/isa
    6358
    64 RD_APPS_ESSENTIAL += \
    65         $(USPACE_PATH)/app/edit/edit \
    66         $(USPACE_PATH)/app/mixerctl/mixerctl \
    67         $(USPACE_PATH)/app/wavplay/wavplay \
    68        
    6959BOOT_OUTPUT = $(ROOT_PATH)/image.iso
    7060PREBUILD = $(INITRD).img
  • defaults/amd64/Makefile.config

    rc6a7b3a r5d9fce4  
    2525# Kernel console support
    2626CONFIG_KCONSOLE = y
    27 
    28 # Number of shell consoles
    29 CONFIG_VC_COUNT = 5
    3027
    3128# Kernel symbol information
  • defaults/arm32/Makefile.config

    rc6a7b3a r5d9fce4  
    1616# Kernel console support
    1717CONFIG_KCONSOLE = y
    18 
    19 # Number of shell consoles
    20 CONFIG_VC_COUNT = 5
    2118
    2219# Kernel symbol information
  • defaults/ia32/Makefile.config

    rc6a7b3a r5d9fce4  
    3131# Kernel console support
    3232CONFIG_KCONSOLE = y
    33 
    34 # Number of shell consoles
    35 CONFIG_VC_COUNT = 5
    3633
    3734# Kernel symbol information
  • defaults/ia64/Makefile.config

    rc6a7b3a r5d9fce4  
    2929CONFIG_KCONSOLE = y
    3030
    31 # Number of shell consoles
    32 CONFIG_VC_COUNT = 5
    33 
    3431# Kernel symbol information
    3532CONFIG_SYMTAB = y
  • defaults/mips32/Makefile.config

    rc6a7b3a r5d9fce4  
    2222# Kernel console support
    2323CONFIG_KCONSOLE = y
    24 
    25 # Number of shell consoles
    26 CONFIG_VC_COUNT = 5
    2724
    2825# Kernel symbol information
  • defaults/mips64/Makefile.config

    rc6a7b3a r5d9fce4  
    2222# Kernel console support
    2323CONFIG_KCONSOLE = y
    24 
    25 # Number of shell consoles
    26 CONFIG_VC_COUNT = 5
    2724
    2825# Kernel symbol information
  • defaults/ppc32/Makefile.config

    rc6a7b3a r5d9fce4  
    1616# Kernel console support
    1717CONFIG_KCONSOLE = y
    18 
    19 # Number of shell consoles
    20 CONFIG_VC_COUNT = 5
    2118
    2219# Kernel symbol information
  • defaults/sparc64/Makefile.config

    rc6a7b3a r5d9fce4  
    3232CONFIG_KCONSOLE = y
    3333
    34 # Number of shell consoles
    35 CONFIG_VC_COUNT = 5
    36 
    3734# Kernel symbol information
    3835CONFIG_SYMTAB = y
  • defaults/special/Makefile.config

    rc6a7b3a r5d9fce4  
    1717CONFIG_KCONSOLE = y
    1818
    19 # Number of shell consoles
    20 CONFIG_VC_COUNT = 5
    21 
    2219# Kernel symbol information
    2320CONFIG_SYMTAB = y
  • kernel/arch/ia32/src/mm/frame.c

    rc6a7b3a r5d9fce4  
    4747
    4848#define PHYSMEM_LIMIT32  UINT64_C(0x100000000)
    49 #define PHYSMEM_LIMIT_DMA   UINT64_C(0x1000000)
    5049
    5150size_t hardcoded_unmapped_ktext_size = 0;
     
    9291                                else
    9392                                        conf = minconf;
    94 
    95                                 if ((pfn * PAGE_SIZE) < PHYSMEM_LIMIT_DMA) {
    96                                         size_t dma_count = min(
    97                                             PHYSMEM_LIMIT_DMA / PAGE_SIZE - pfn,
    98                                             count);
    99                                         zone_create(pfn, dma_count, conf,
    100                                             ZONE_AVAILABLE | ZONE_DMA);
    101                                         count -= dma_count;
    102                                         pfn += dma_count;
    103                                 }
    104 
    105                                 conf = pfn;
    106                                 if (count) {
    107                                         zone_create(pfn, count, conf,
    108                                             ZONE_AVAILABLE | ZONE_LOWMEM);
    109                                 }
     93                                zone_create(pfn, count, conf,
     94                                    ZONE_AVAILABLE | ZONE_LOWMEM);
    11095                        } else {
    11196                                conf = zone_external_conf_alloc(count);
    112                                 if (conf != 0) {
     97                                if (conf != 0)
    11398                                        zone_create(pfn, count, conf,
    11499                                            ZONE_AVAILABLE | ZONE_HIGHMEM);
    115                                 }
    116100                        }
    117101                } else if ((e820table[i].type == MEMMAP_MEMORY_ACPI) ||
  • kernel/generic/include/mm/frame.h

    rc6a7b3a r5d9fce4  
    6363/** Allocate a frame which cannot be identity-mapped. */
    6464#define FRAME_HIGHMEM     0x20
    65 /** Allocate a frame which needs to be from DMA zone. */
    66 #define FRAME_DMA         0x40
    6765
    6866typedef uint8_t zone_flags_t;
     
    7977/** Zone contains memory that cannot be identity-mapped */
    8078#define ZONE_HIGHMEM    0x10
    81 /** Zone contains memory suitable for old ISA DMA */
    82 #define ZONE_DMA        0x20
    8379
    8480/** Mask of zone bits that must be matched exactly. */
     
    8682
    8783#define FRAME_TO_ZONE_FLAGS(ff) \
    88         ((((ff) & FRAME_DMA) ? ZONE_DMA : \
    89             (((ff) & FRAME_LOWMEM) ? ZONE_LOWMEM : \
     84        ((((ff) & FRAME_LOWMEM) ? ZONE_LOWMEM : \
    9085            (((ff) & FRAME_HIGHMEM) ? ZONE_HIGHMEM : \
    91             ZONE_LOWMEM /* | ZONE_HIGHMEM */))) | \
    92             ZONE_AVAILABLE)
     86            ZONE_LOWMEM /* | ZONE_HIGHMEM */)) | \
     87            ZONE_AVAILABLE) 
    9388
    9489#define ZONE_FLAGS_MATCH(zf, f) \
  • kernel/generic/include/time/clock.h

    rc6a7b3a r5d9fce4  
    3838#include <typedefs.h>
    3939
    40 #define HZ  1000
     40#define HZ  100
    4141
    4242/** Uptime structure */
  • kernel/generic/src/ddi/ddi.c

    rc6a7b3a r5d9fce4  
    336336                order = fnzb(pages - 1) + 1;
    337337       
    338         *phys = frame_alloc_noreserve(order, FRAME_DMA);
     338        *phys = frame_alloc_noreserve(order, 0);
    339339        if (*phys == NULL)
    340340                return ENOMEM;
  • kernel/generic/src/mm/frame.c

    rc6a7b3a r5d9fce4  
    518518NO_TRACE static void zone_mark_unavailable(zone_t *zone, size_t frame_idx)
    519519{
    520         if (!(zone->flags & ZONE_AVAILABLE))
    521                 return;
    522 //      ASSERT(zone->flags & ZONE_AVAILABLE);
     520        ASSERT(zone->flags & ZONE_AVAILABLE);
    523521       
    524522        frame_t *frame = zone_get_frame(zone, frame_idx);
     
    937935                        }
    938936                       
    939                         if (confframe >= start + count) {
    940                                 flags &= ~ZONE_AVAILABLE;
    941                                 goto nonavail;
    942 //                              panic("Cannot find configuration data for zone.");
    943                         }
     937                        if (confframe >= start + count)
     938                                panic("Cannot find configuration data for zone.");
    944939                }
    945940               
     
    965960                return znum;
    966961        }
    967 nonavail:
    968         (void)0; // label trick
     962       
    969963        /* Non-available zone */
    970964        size_t znum = zones_insert_zone(start, count, flags);
  • uspace/Makefile

    rc6a7b3a r5d9fce4  
    3939        app/bnchmark \
    4040        app/devctl \
    41         app/drec \
    4241        app/edit \
    4342        app/getterm \
     
    4847        app/klog \
    4948        app/loc \
    50         app/mixerctl \
    5149        app/logset \
    5250        app/mkfat \
     
    7472        app/sysinfo \
    7573        app/mkbd \
    76         app/wavplay \
    7774        app/date \
    7875        app/websrv \
    79         srv/audio/hound \
    8076        app/vdemo \
    8177        app/vlaunch \
     
    116112        srv/hid/remcons \
    117113        srv/hw/char/s3c24xx_uart \
    118         drv/audio/sb16 \
    119114        drv/infrastructure/root \
    120115        drv/infrastructure/rootvirt \
     
    215210        lib/softfloat \
    216211        lib/drv \
    217         lib/hound \
    218212        lib/graph \
    219213        lib/gui \
     
    228222        lib/usbhid \
    229223        lib/usbvirt \
    230         lib/pcm \
    231224        lib/bithenge \
    232225        lib/posix
  • uspace/Makefile.common

    rc6a7b3a r5d9fce4  
    131131
    132132LIBDRV_PREFIX = $(LIB_PREFIX)/drv
    133 LIBHOUND_PREFIX = $(LIB_PREFIX)/hound
    134 LIBPCM_PREFIX = $(LIB_PREFIX)/pcm
    135133LIBNET_PREFIX = $(LIB_PREFIX)/net
    136134LIBNIC_PREFIX = $(LIB_PREFIX)/nic
     
    262260
    263261ifneq ($(BINARY),)
    264 %.disasm: $(BINARY)_prestrip
     262%.disasm: $(BINARY)
    265263ifeq ($(CONFIG_LINE_DEBUG),y)
    266264        $(OBJDUMP) -d -S $< > $@
     
    269267endif
    270268
    271 .INTERMEDIATE: $(BINARY)_prestrip
    272 
    273 $(BINARY)_prestrip: $(LINKER_SCRIPT) $(OBJECTS) $(LIBS) $(BASE_LIBS)
    274         $(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(BINARY).map -o $@ $(OBJECTS) $(LIBS) $(BASE_LIBS)
    275 
    276 $(BINARY): $(BINARY)_prestrip $(BINARY).disasm
    277         cp $(BINARY)_prestrip $@
     269$(BINARY): $(LINKER_SCRIPT) $(OBJECTS) $(LIBS) $(BASE_LIBS)
     270        $(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(BINARY).map -o $(BINARY) $(OBJECTS) $(LIBS) $(BASE_LIBS)
    278271ifeq ($(CONFIG_STRIP_BINARIES),y)
    279272        $(STRIP) $(BINARY)
  • uspace/app/init/init.c

    rc6a7b3a r5d9fce4  
    391391                rc = console(HID_INPUT, HID_OUTPUT);
    392392                if (rc == EOK) {
    393 #ifndef CONFIG_VC_COUNT
    394 #define CONFIG_VC_COUNT 6
    395 #endif
    396                         switch((unsigned)CONFIG_VC_COUNT) {
    397                         default:
    398                         case 6: getterm("term/vc5", "/app/bdsh", false);
    399                         case 5: getterm("term/vc4", "/app/bdsh", false);
    400                         case 4: getterm("term/vc3", "/app/bdsh", false);
    401                         case 3: getterm("term/vc2", "/app/bdsh", false);
    402                         case 2: getterm("term/vc1", "/app/bdsh", false);
    403                         case 1: getterm("term/vc0", "/app/bdsh", true);
    404                         }
    405 #ifdef CONFIG_KERNEL_LOG_VC_6
     393                        getterm("term/vc0", "/app/bdsh", true);
     394                        getterm("term/vc1", "/app/bdsh", false);
     395                        getterm("term/vc2", "/app/bdsh", false);
     396                        getterm("term/vc3", "/app/bdsh", false);
     397                        getterm("term/vc4", "/app/bdsh", false);
     398                        getterm("term/vc5", "/app/bdsh", false);
    406399                        getterm("term/vc6", "/app/klog", false);
    407 #endif
    408400                }
    409401        }
    410         srv_start("/srv/hound");
    411402       
    412403        return 0;
  • uspace/drv/bus/isa/i8237.c

    rc6a7b3a r5d9fce4  
    3838#include <stdbool.h>
    3939#include <errno.h>
    40 #include <ddi.h>
    41 #include <ddf/log.h>
    4240#include <fibril_synch.h>
    4341#include <ddi.h>
     
    200198        .channels = {
    201199                /* The first chip 8-bit */
    202                 { /* Channel 0 - Unusable*/
    203                         .offset_reg_address = (uint8_t *) 0x00,
    204                         .size_reg_address = (uint8_t *) 0x01,
    205                         .page_reg_address = (uint8_t *) 0x87,
    206                         .single_mask_address = (uint8_t *) 0x0a,
    207                         .mode_address = (uint8_t *) 0x0b,
    208                         .flip_flop_address = (uint8_t *) 0x0c,
    209                 },
    210                 { /* Channel 1 */
    211                         .offset_reg_address = (uint8_t *) 0x02,
    212                         .size_reg_address = (uint8_t *) 0x03,
    213                         .page_reg_address = (uint8_t *) 0x83,
    214                         .single_mask_address = (uint8_t *) 0x0a,
    215                         .mode_address = (uint8_t *) 0x0b,
    216                         .flip_flop_address = (uint8_t *) 0x0c,
    217                 },
    218                 { /* Channel 2 */
    219                         .offset_reg_address = (uint8_t *) 0x04,
    220                         .size_reg_address = (uint8_t *) 0x05,
    221                         .page_reg_address = (uint8_t *) 0x81,
    222                         .single_mask_address = (uint8_t *) 0x0a,
    223                         .mode_address = (uint8_t *) 0x0b,
    224                         .flip_flop_address = (uint8_t *) 0x0c,
    225                 },
    226                 { /* Channel 3 */
    227                         .offset_reg_address = (uint8_t *) 0x06,
    228                         .size_reg_address = (uint8_t *) 0x07,
    229                         .page_reg_address = (uint8_t *) 0x82,
    230                         .single_mask_address = (uint8_t *) 0x0a,
    231                         .mode_address = (uint8_t *) 0x0b,
    232                         .flip_flop_address = (uint8_t *) 0x0c,
     200                {
     201                        (uint8_t *) 0x00,
     202                        (uint8_t *) 0x01,
     203                        (uint8_t *) 0x87,
     204                        (uint8_t *) 0x0a,
     205                        (uint8_t *) 0x0b,
     206                        (uint8_t *) 0x0c,
     207                },
     208                {
     209                        (uint8_t *) 0x02,
     210                        (uint8_t *) 0x03,
     211                        (uint8_t *) 0x83,
     212                        (uint8_t *) 0x0a,
     213                        (uint8_t *) 0x0b,
     214                        (uint8_t *) 0x0c,
     215                },
     216                {
     217                        (uint8_t *) 0x04,
     218                        (uint8_t *) 0x05,
     219                        (uint8_t *) 0x81,
     220                        (uint8_t *) 0x0a,
     221                        (uint8_t *) 0x0b,
     222                        (uint8_t *) 0x0c,
     223                },
     224                {
     225                        (uint8_t *) 0x06,
     226                        (uint8_t *) 0x07,
     227                        (uint8_t *) 0x82,
     228                        (uint8_t *) 0x0a,
     229                        (uint8_t *) 0x0b,
     230                        (uint8_t *) 0x0c,
    233231                },
    234232               
    235233                /* The second chip 16-bit */
    236                 { /* Channel 4 - Unusable */
    237                         .offset_reg_address = (uint8_t *) 0xc0,
    238                         .size_reg_address = (uint8_t *) 0xc2,
    239                         .page_reg_address = (uint8_t *) 0x8f,
    240                         .single_mask_address = (uint8_t *) 0xd4,
    241                         .mode_address = (uint8_t *) 0xd6,
    242                         .flip_flop_address = (uint8_t *) 0xd8,
    243                 },
    244                 { /* Channel 5 */
    245                         .offset_reg_address = (uint8_t *) 0xc4,
    246                         .size_reg_address = (uint8_t *) 0xc6,
    247                         .page_reg_address = (uint8_t *) 0x8b,
    248                         .single_mask_address = (uint8_t *) 0xd4,
    249                         .mode_address = (uint8_t *) 0xd6,
    250                         .flip_flop_address = (uint8_t *) 0xd8,
    251                 },
    252                 { /* Channel 6 */
    253                         .offset_reg_address = (uint8_t *) 0xc8,
    254                         .size_reg_address = (uint8_t *) 0xca,
    255                         .page_reg_address = (uint8_t *) 0x89,
    256                         .single_mask_address = (uint8_t *) 0xd4,
    257                         .mode_address = (uint8_t *) 0xd6,
    258                         .flip_flop_address = (uint8_t *) 0xd8,
    259                 },
    260                 { /* Channel 7 */
    261                         .offset_reg_address = (uint8_t *) 0xcc,
    262                         .size_reg_address = (uint8_t *) 0xce,
    263                         .page_reg_address = (uint8_t *) 0x8a,
    264                         .single_mask_address = (uint8_t *) 0xd4,
    265                         .mode_address = (uint8_t *) 0xd6,
    266                         .flip_flop_address = (uint8_t *) 0xd8,
     234                {
     235                        (uint8_t *) 0xc0,
     236                        (uint8_t *) 0xc2,
     237                        (uint8_t *) 0x8f,
     238                        (uint8_t *) 0xd4,
     239                        (uint8_t *) 0xd6,
     240                        (uint8_t *) 0xd8,
     241                },
     242                {
     243                        (uint8_t *) 0xc4,
     244                        (uint8_t *) 0xc6,
     245                        (uint8_t *) 0x8b,
     246                        (uint8_t *) 0xd4,
     247                        (uint8_t *) 0xd6,
     248                        (uint8_t *) 0xd8,
     249                },
     250                {
     251                        (uint8_t *) 0xc8,
     252                        (uint8_t *) 0xca,
     253                        (uint8_t *) 0x89,
     254                        (uint8_t *) 0xd4,
     255                        (uint8_t *) 0xd6,
     256                        (uint8_t *) 0xd8,
     257                },
     258                {
     259                        (uint8_t *) 0xcc,
     260                        (uint8_t *) 0xce,
     261                        (uint8_t *) 0x8a,
     262                        (uint8_t *) 0xd4,
     263                        (uint8_t *) 0xd6,
     264                        (uint8_t *) 0xd8,
    267265                },
    268266        },
     
    274272};
    275273
    276 /** Initialize I/O access to DMA controller I/O ports.
     274/* Initialize I/O access to DMA controller I/O ports.
    277275 *
    278276 * @param controller DMA Controller structure to initialize.
    279277 *
    280278 * @return Error code.
     279 *
    281280 */
    282281static inline int dma_controller_init(dma_controller_t *controller)
     
    305304       
    306305        return EOK;
    307 }
    308 
    309 /** Helper function. Channels 4,5,6, and 7 are 8 bit DMA.
    310  * @pram channel DMA channel.
    311  * @reutrn True, if channel is 4,5,6, or 7, false otherwise.
    312  */
    313 static inline bool is_dma16(unsigned channel)
    314 {
    315         return (channel >= 4) && (channel < 8);
    316 }
    317 
    318 /** Helper function. Channels 0,1,2, and 3 are 8 bit DMA.
    319  * @pram channel DMA channel.
    320  * @reutrn True, if channel is 0,1,2, or 3, false otherwise.
    321  */
    322 static inline bool is_dma8(unsigned channel)
    323 {
    324         return (channel < 4);
    325306}
    326307
     
    339320 *
    340321 * @return Error code.
    341  */
    342 int dma_channel_setup(unsigned int channel, uint32_t pa, uint16_t size,
     322 *
     323 */
     324int dma_setup_channel(unsigned int channel, uint32_t pa, uint16_t size,
    343325    uint8_t mode)
    344326{
    345         if (!is_dma8(channel) && !is_dma16(channel))
    346                 return ENOENT;
    347 
    348327        if ((channel == 0) || (channel == 4))
    349328                return ENOTSUP;
     329       
     330        if (channel > 7)
     331                return ENOENT;
    350332       
    351333        /* DMA is limited to 24bit addresses. */
     
    354336       
    355337        /* 8 bit channels use only 4 bits from the page register. */
    356         if (is_dma8(channel) && (pa >= (1 << 20)))
    357                 return EINVAL;
    358 
    359         /* Buffers cannot cross 64K page boundaries */
    360         if ((pa & 0xffff0000) !=  ((pa + size) & 0xffff0000))
     338        if ((channel > 0) && (channel < 4) && (pa >= (1 << 20)))
    361339                return EINVAL;
    362340       
     
    374352        ddf_msg(LVL_DEBUG, "Unspoiled address %#" PRIx32 " (size %" PRIu16 ")",
    375353            pa, size);
    376         if (is_dma16(channel)) {
     354        if (channel > 4) {
    377355                /* Size must be aligned to 16 bits */
    378356                if ((size & 1) != 0) {
     
    380358                        return EINVAL;
    381359                }
    382                 /* Size is in 2byte words */
     360               
    383361                size >>= 1;
     362               
    384363                /* Address is fun: lower 16 bits need to be shifted by 1 */
    385364                pa = ((pa & 0xffff) >> 1) | (pa & 0xff0000);
     
    447426}
    448427
    449 /** Query remaining buffer size.
    450  *
    451  * @param channel DMA Channel 1, 2, 3 for 8 bit transfers,
    452  *                    5, 6, 7 for 16 bit.
    453  * @param size    Place to store number of bytes pending in the assigned buffer.
    454  *
    455  * @return Error code.
    456  */
    457 int dma_channel_remain(unsigned channel, size_t *size)
    458 {
    459         assert(size);
    460         if (!is_dma8(channel) && !is_dma16(channel))
    461                 return ENOENT;
    462        
    463         if ((channel == 0) || (channel == 4))
    464                 return ENOTSUP;
    465        
    466         fibril_mutex_lock(&guard);
    467         if (!controller_8237.initialized) {
    468                 fibril_mutex_unlock(&guard);
    469                 return EIO;
    470         }
    471 
    472         const dma_channel_t dma_channel = controller_8237.channels[channel];
    473         /* Get size - reset flip-flop */
    474         pio_write_8(dma_channel.flip_flop_address, 0);
    475        
    476         /* Low byte */
    477         const uint8_t value_low = pio_read_8(dma_channel.size_reg_address);
    478         ddf_msg(LVL_DEBUG2, "Read size low byte: %p:%zx.",
    479             dma_channel.size_reg_address, value_low);
    480        
    481         /* High byte */
    482         const uint8_t value_high = pio_read_8(dma_channel.size_reg_address);
    483         ddf_msg(LVL_DEBUG2, "Read size high byte: %p:%zx.",
    484             dma_channel.size_reg_address, value_high);
    485         fibril_mutex_unlock(&guard);
    486 
    487         uint16_t remain = (value_high << 8 | value_low) ;
    488         /* 16 bit DMA size is in words,
    489          * the upper bits are bogus for 16bit transfers so we need to get
    490          * rid of them. Using limited type works well.*/
    491         if (is_dma16(channel))
    492                 remain <<= 1;
    493         *size =  is_dma16(channel) ? remain + 2: remain + 1;
    494         return EOK;
    495 }
    496428/**
    497429 * @}
  • uspace/drv/bus/isa/i8237.h

    rc6a7b3a r5d9fce4  
    3838#define DRV_BUS_ISA_I8237_H
    3939
    40 extern int dma_channel_setup(unsigned, uint32_t, uint16_t, uint8_t);
    41 extern int dma_channel_remain(unsigned, size_t *);
     40extern int dma_setup_channel(unsigned int, uint32_t, uint16_t, uint8_t);
    4241
    4342#endif
  • uspace/drv/bus/isa/isa.c

    rc6a7b3a r5d9fce4  
    8585        fibril_mutex_t mutex;
    8686        ddf_fun_t *fnode;
    87         hw_resource_t resources[ISA_MAX_HW_RES];
    8887        hw_resource_list_t hw_resources;
    8988        link_t bus_link;
     
    104103static hw_resource_list_t *isa_get_fun_resources(ddf_fun_t *fnode)
    105104{
    106         isa_fun_t *isa = isa_fun(fnode);
    107         assert(isa);
    108 
    109         return &isa->hw_resources;
    110 }
    111 
    112 static bool isa_fun_enable_interrupt(ddf_fun_t *fnode)
     105        isa_fun_t *fun = isa_fun(fnode);
     106        assert(fun != NULL);
     107
     108        return &fun->hw_resources;
     109}
     110
     111static bool isa_enable_fun_interrupt(ddf_fun_t *fnode)
    113112{
    114113        /* This is an old ugly way, copied from pci driver */
    115114        assert(fnode);
    116         isa_fun_t *isa = isa_fun(fnode);
    117         assert(isa);
     115        isa_fun_t *fun = isa_fun(fnode);
    118116
    119117        sysarg_t apic;
     
    131129                return false;
    132130
    133         const hw_resource_list_t *res = &isa->hw_resources;
     131        const hw_resource_list_t *res = &fun->hw_resources;
    134132        assert(res);
    135133        for (size_t i = 0; i < res->count; ++i) {
     
    153151}
    154152
    155 static int isa_fun_setup_dma(ddf_fun_t *fnode,
     153static int isa_dma_channel_fun_setup(ddf_fun_t *fnode,
    156154    unsigned int channel, uint32_t pa, uint16_t size, uint8_t mode)
    157155{
    158156        assert(fnode);
    159         isa_fun_t *isa = isa_fun(fnode);
    160         assert(isa);
    161         const hw_resource_list_t *res = &isa->hw_resources;
     157        isa_fun_t *fun = isa_fun(fnode);
     158        const hw_resource_list_t *res = &fun->hw_resources;
    162159        assert(res);
    163 
     160       
     161        const unsigned int ch = channel;
    164162        for (size_t i = 0; i < res->count; ++i) {
    165                 /* Check for assigned channel */
    166163                if (((res->resources[i].type == DMA_CHANNEL_16) &&
    167                     (res->resources[i].res.dma_channel.dma16 == channel)) ||
     164                    (res->resources[i].res.dma_channel.dma16 == ch)) ||
    168165                    ((res->resources[i].type == DMA_CHANNEL_8) &&
    169                     (res->resources[i].res.dma_channel.dma8 == channel))) {
    170                         return dma_channel_setup(channel, pa, size, mode);
     166                    (res->resources[i].res.dma_channel.dma8 == ch))) {
     167                        return dma_setup_channel(channel, pa, size, mode);
    171168                }
    172169        }
    173 
    174         return EINVAL;
    175 }
    176 
    177 static int isa_fun_remain_dma(ddf_fun_t *fnode,
    178     unsigned channel, size_t *size)
    179 {
    180         assert(size);
    181         assert(fnode);
    182         isa_fun_t *isa = isa_fun(fnode);
    183         assert(isa);
    184         const hw_resource_list_t *res = &isa->hw_resources;
    185         assert(res);
    186 
    187         for (size_t i = 0; i < res->count; ++i) {
    188                 /* Check for assigned channel */
    189                 if (((res->resources[i].type == DMA_CHANNEL_16) &&
    190                     (res->resources[i].res.dma_channel.dma16 == channel)) ||
    191                     ((res->resources[i].type == DMA_CHANNEL_8) &&
    192                     (res->resources[i].res.dma_channel.dma8 == channel))) {
    193                         return dma_channel_remain(channel, size);
    194                 }
    195         }
    196 
     170       
    197171        return EINVAL;
    198172}
     
    200174static hw_res_ops_t isa_fun_hw_res_ops = {
    201175        .get_resource_list = isa_get_fun_resources,
    202         .enable_interrupt = isa_fun_enable_interrupt,
    203         .dma_channel_setup = isa_fun_setup_dma,
    204         .dma_channel_remain = isa_fun_remain_dma,
     176        .enable_interrupt = isa_enable_fun_interrupt,
     177        .dma_channel_setup = isa_dma_channel_fun_setup,
    205178};
    206179
    207 static ddf_dev_ops_t isa_fun_ops= {
    208         .interfaces[HW_RES_DEV_IFACE] = &isa_fun_hw_res_ops,
    209 };
     180static ddf_dev_ops_t isa_fun_ops;
    210181
    211182static int isa_dev_add(ddf_dev_t *dev);
     
    241212
    242213        fibril_mutex_initialize(&fun->mutex);
    243         fun->hw_resources.resources = fun->resources;
    244 
    245214        fun->fnode = fnode;
    246215        return fun;
     
    301270{
    302271        char *line = str;
    303         *next = NULL;
    304272
    305273        if (str == NULL) {
     274                *next = NULL;
    306275                return NULL;
    307276        }
     
    313282        if (*str != '\0') {
    314283                *next = str + 1;
     284        } else {
     285                *next = NULL;
    315286        }
    316287
     
    339310        /* Get the name part of the rest of the line. */
    340311        strtok(line, ":");
    341         return line;
    342 }
    343 
    344 static inline const char *skip_spaces(const char *line)
     312
     313        /* Allocate output buffer. */
     314        size_t size = str_size(line) + 1;
     315        char *name = malloc(size);
     316
     317        if (name != NULL) {
     318                /* Copy the result to the output buffer. */
     319                str_cpy(name, size, line);
     320        }
     321
     322        return name;
     323}
     324
     325static inline char *skip_spaces(char *line)
    345326{
    346327        /* Skip leading spaces. */
     
    351332}
    352333
    353 static void isa_fun_add_irq(isa_fun_t *fun, int irq)
     334static void isa_fun_set_irq(isa_fun_t *fun, int irq)
    354335{
    355336        size_t count = fun->hw_resources.count;
     
    367348}
    368349
    369 static void isa_fun_add_dma(isa_fun_t *fun, int dma)
     350static void isa_fun_set_dma(isa_fun_t *fun, int dma)
    370351{
    371352        size_t count = fun->hw_resources.count;
     
    400381}
    401382
    402 static void isa_fun_add_io_range(isa_fun_t *fun, size_t addr, size_t len)
     383static void isa_fun_set_io_range(isa_fun_t *fun, size_t addr, size_t len)
    403384{
    404385        size_t count = fun->hw_resources.count;
     
    419400}
    420401
    421 static void fun_parse_irq(isa_fun_t *fun, const char *val)
     402static void fun_parse_irq(isa_fun_t *fun, char *val)
    422403{
    423404        int irq = 0;
     
    428409
    429410        if (val != end)
    430                 isa_fun_add_irq(fun, irq);
    431 }
    432 
    433 static void fun_parse_dma(isa_fun_t *fun, const char *val)
    434 {
     411                isa_fun_set_irq(fun, irq);
     412}
     413
     414static void fun_parse_dma(isa_fun_t *fun, char *val)
     415{
     416        unsigned int dma = 0;
    435417        char *end = NULL;
    436418       
    437419        val = skip_spaces(val);
    438         const int dma = strtol(val, &end, 10);
     420        dma = (unsigned int) strtol(val, &end, 10);
    439421       
    440422        if (val != end)
    441                 isa_fun_add_dma(fun, dma);
    442 }
    443 
    444 static void fun_parse_io_range(isa_fun_t *fun, const char *val)
     423                isa_fun_set_dma(fun, dma);
     424}
     425
     426static void fun_parse_io_range(isa_fun_t *fun, char *val)
    445427{
    446428        size_t addr, len;
     
    459441                return;
    460442
    461         isa_fun_add_io_range(fun, addr, len);
    462 }
    463 
    464 static void get_match_id(char **id, const char *val)
    465 {
    466         const char *end = val;
     443        isa_fun_set_io_range(fun, addr, len);
     444}
     445
     446static void get_match_id(char **id, char *val)
     447{
     448        char *end = val;
    467449
    468450        while (!isspace(*end))
     
    474456}
    475457
    476 static void fun_parse_match_id(isa_fun_t *fun, const char *val)
     458static void fun_parse_match_id(isa_fun_t *fun, char *val)
    477459{
    478460        char *id = NULL;
     461        int score = 0;
    479462        char *end = NULL;
     463        int rc;
    480464
    481465        val = skip_spaces(val);
    482466
    483         int score = (int)strtol(val, &end, 10);
     467        score = (int)strtol(val, &end, 10);
    484468        if (val == end) {
    485469                ddf_msg(LVL_ERROR, "Cannot read match score for function "
     
    499483            "function %s", id, score, ddf_fun_get_name(fun->fnode));
    500484
    501         int rc = ddf_fun_add_match_id(fun->fnode, id, score);
     485        rc = ddf_fun_add_match_id(fun->fnode, id, score);
    502486        if (rc != EOK) {
    503487                ddf_msg(LVL_ERROR, "Failed adding match ID: %s",
     
    508492}
    509493
    510 static bool prop_parse(isa_fun_t *fun, const char *line, const char *prop,
    511     void (*read_fn)(isa_fun_t *, const char *))
     494static bool prop_parse(isa_fun_t *fun, char *line, const char *prop,
     495    void (*read_fn)(isa_fun_t *, char *))
    512496{
    513497        size_t proplen = str_size(prop);
     
    524508}
    525509
    526 static void fun_prop_parse(isa_fun_t *fun, const char *line)
     510static void fun_prop_parse(isa_fun_t *fun, char *line)
    527511{
    528512        /* Skip leading spaces. */
     
    539523}
    540524
     525static void fun_hw_res_alloc(isa_fun_t *fun)
     526{
     527        fun->hw_resources.resources =
     528            (hw_resource_t *) malloc(sizeof(hw_resource_t) * ISA_MAX_HW_RES);
     529}
     530
     531static void fun_hw_res_free(isa_fun_t *fun)
     532{
     533        free(fun->hw_resources.resources);
     534        fun->hw_resources.resources = NULL;
     535}
     536
    541537static char *isa_fun_read_info(char *fun_conf, isa_bus_t *isa)
    542538{
    543539        char *line;
     540        char *fun_name = NULL;
    544541
    545542        /* Skip empty lines. */
    546         do {
     543        while (true) {
    547544                line = str_get_line(fun_conf, &fun_conf);
    548545
     
    552549                }
    553550
    554         } while (line_empty(line));
     551                if (!line_empty(line))
     552                        break;
     553        }
    555554
    556555        /* Get device name. */
    557         const char *fun_name = get_device_name(line);
     556        fun_name = get_device_name(line);
    558557        if (fun_name == NULL)
    559558                return NULL;
    560559
    561560        isa_fun_t *fun = isa_fun_create(isa, fun_name);
     561        free(fun_name);
    562562        if (fun == NULL) {
    563563                return NULL;
    564564        }
     565
     566        /* Allocate buffer for the list of hardware resources of the device. */
     567        fun_hw_res_alloc(fun);
    565568
    566569        /* Get properties of the device (match ids, irq and io range). */
     
    593596}
    594597
    595 static void isa_functions_add(isa_bus_t *isa)
    596 {
    597         char *conf = fun_conf_read(CHILD_FUN_CONF_PATH);
     598static void fun_conf_parse(char *conf, isa_bus_t *isa)
     599{
    598600        while (conf != NULL && *conf != '\0') {
    599601                conf = isa_fun_read_info(conf, isa);
    600602        }
    601         free(conf);
     603}
     604
     605static void isa_functions_add(isa_bus_t *isa)
     606{
     607        char *fun_conf;
     608
     609        fun_conf = fun_conf_read(CHILD_FUN_CONF_PATH);
     610        if (fun_conf != NULL) {
     611                fun_conf_parse(fun_conf, isa);
     612                free(fun_conf);
     613        }
    602614}
    603615
    604616static int isa_dev_add(ddf_dev_t *dev)
    605617{
     618        isa_bus_t *isa;
     619
    606620        ddf_msg(LVL_DEBUG, "isa_dev_add, device handle = %d",
    607621            (int) ddf_dev_get_handle(dev));
    608622
    609         isa_bus_t *isa = ddf_dev_data_alloc(dev, sizeof(isa_bus_t));
     623        isa = ddf_dev_data_alloc(dev, sizeof(isa_bus_t));
    610624        if (isa == NULL)
    611625                return ENOMEM;
     
    644658{
    645659        isa_bus_t *isa = isa_bus(dev);
     660        int rc;
    646661
    647662        fibril_mutex_lock(&isa->mutex);
     
    651666                    isa_fun_t, bus_link);
    652667
    653                 int rc = ddf_fun_offline(fun->fnode);
     668                rc = ddf_fun_offline(fun->fnode);
    654669                if (rc != EOK) {
    655670                        fibril_mutex_unlock(&isa->mutex);
     
    667682                list_remove(&fun->bus_link);
    668683
     684                fun_hw_res_free(fun);
    669685                ddf_fun_destroy(fun->fnode);
    670686        }
     
    693709}
    694710
     711
     712static void isa_init()
     713{
     714        ddf_log_init(NAME);
     715        isa_fun_ops.interfaces[HW_RES_DEV_IFACE] = &isa_fun_hw_res_ops;
     716}
     717
    695718int main(int argc, char *argv[])
    696719{
    697720        printf(NAME ": HelenOS ISA bus driver\n");
    698         ddf_log_init(NAME);
     721        isa_init();
    699722        return ddf_driver_main(&isa_driver);
    700723}
  • uspace/drv/infrastructure/root/root.c

    rc6a7b3a r5d9fce4  
    208208        /*
    209209         * Register virtual devices root.
    210          * We warn on error occurrence because virtual devices shall not be
     210         * We ignore error occurrence because virtual devices shall not be
    211211         * vital for the system.
    212212         */
    213         int res = add_virtual_root_fun(dev);
    214         if (res != EOK)
    215                 ddf_msg(LVL_WARN, "Failed to add virtual child.");
     213        (void) add_virtual_root_fun(dev);
    216214
    217215        /* Register root device's children. */
    218         res = add_platform_fun(dev);
     216        int res = add_platform_fun(dev);
    219217        if (EOK != res)
    220218                ddf_msg(LVL_ERROR, "Failed adding child device for platform.");
  • uspace/lib/c/generic/async.c

    rc6a7b3a r5d9fce4  
    22792279bool async_data_read_receive(ipc_callid_t *callid, size_t *size)
    22802280{
     2281        assert(callid);
     2282       
    22812283        ipc_call_t data;
    2282         return async_data_read_receive_call(callid, &data, size);
    2283 }
    2284 
    2285 /** Wrapper for receiving the IPC_M_DATA_READ calls using the async framework.
    2286  *
    2287  * This wrapper only makes it more comfortable to receive IPC_M_DATA_READ
    2288  * calls so that the user doesn't have to remember the meaning of each IPC
    2289  * argument.
    2290  *
    2291  * So far, this wrapper is to be used from within a connection fibril.
    2292  *
    2293  * @param callid Storage for the hash of the IPC_M_DATA_READ.
    2294  * @param size   Storage for the maximum size. Can be NULL.
    2295  *
    2296  * @return True on success, false on failure.
    2297  *
    2298  */
    2299 bool async_data_read_receive_call(ipc_callid_t *callid, ipc_call_t *data,
    2300     size_t *size)
    2301 {
    2302         assert(callid);
    2303         assert(data);
    2304        
    2305         *callid = async_get_call(data);
    2306        
    2307         if (IPC_GET_IMETHOD(*data) != IPC_M_DATA_READ)
     2284        *callid = async_get_call(&data);
     2285       
     2286        if (IPC_GET_IMETHOD(data) != IPC_M_DATA_READ)
    23082287                return false;
    23092288       
    23102289        if (size)
    2311                 *size = (size_t) IPC_GET_ARG2(*data);
     2290                *size = (size_t) IPC_GET_ARG2(data);
    23122291       
    23132292        return true;
     
    24042383bool async_data_write_receive(ipc_callid_t *callid, size_t *size)
    24052384{
     2385        assert(callid);
     2386       
    24062387        ipc_call_t data;
    2407         return async_data_write_receive_call(callid, &data, size);
    2408 }
    2409 
    2410 /** Wrapper for receiving the IPC_M_DATA_WRITE calls using the async framework.
    2411  *
    2412  * This wrapper only makes it more comfortable to receive IPC_M_DATA_WRITE
    2413  * calls so that the user doesn't have to remember the meaning of each IPC
    2414  * argument.
    2415  *
    2416  * So far, this wrapper is to be used from within a connection fibril.
    2417  *
    2418  * @param callid Storage for the hash of the IPC_M_DATA_WRITE.
    2419  * @param data   Storage for the ipc call data.
    2420  * @param size   Storage for the suggested size. May be NULL.
    2421  *
    2422  * @return True on success, false on failure.
    2423  *
    2424  */
    2425 bool async_data_write_receive_call(ipc_callid_t *callid, ipc_call_t *data,
    2426     size_t *size)
    2427 {
    2428         assert(callid);
    2429         assert(data);
    2430        
    2431         *callid = async_get_call(data);
    2432        
    2433         if (IPC_GET_IMETHOD(*data) != IPC_M_DATA_WRITE)
     2388        *callid = async_get_call(&data);
     2389       
     2390        if (IPC_GET_IMETHOD(data) != IPC_M_DATA_WRITE)
    24342391                return false;
    24352392       
    24362393        if (size)
    2437                 *size = (size_t) IPC_GET_ARG2(*data);
     2394                *size = (size_t) IPC_GET_ARG2(data);
    24382395       
    24392396        return true;
  • uspace/lib/c/generic/device/hw_res.c

    rc6a7b3a r5d9fce4  
    4242{
    4343        sysarg_t count = 0;
    44 
     44       
    4545        async_exch_t *exch = async_exchange_begin(sess);
    46         if (exch == NULL)
    47                 return ENOMEM;
    4846        int rc = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    4947            HW_RES_GET_RESOURCE_LIST, &count);
    50 
     48       
    5149        if (rc != EOK) {
    5250                async_exchange_end(exch);
    5351                return rc;
    5452        }
    55 
     53       
    5654        size_t size = count * sizeof(hw_resource_t);
    5755        hw_resource_t *resources = (hw_resource_t *) malloc(size);
     
    6159                return ENOMEM;
    6260        }
    63 
     61       
    6462        rc = async_data_read_start(exch, resources, size);
    6563        async_exchange_end(exch);
    66 
     64       
    6765        if (rc != EOK) {
    6866                free(resources);
    6967                return rc;
    7068        }
    71 
     69       
    7270        hw_resources->resources = resources;
    7371        hw_resources->count = count;
    74 
     72       
    7573        return EOK;
    7674}
     
    7977{
    8078        async_exch_t *exch = async_exchange_begin(sess);
    81         if (exch == NULL)
    82                 return false;
    8379        int rc = async_req_1_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    8480            HW_RES_ENABLE_INTERRUPT);
    8581        async_exchange_end(exch);
    86 
     82       
    8783        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  */
    103 int 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;
    115 }
    116 
    117 /**
    118  * Query remaining bytes in the buffer.
    119  * @param channel DMA Channel 1,2,3 for 8 bit transfers, 5,6,7 for 16 bit.
    120  * @return Number of bytes remaining in the buffer(>=0) or error code(<0).
    121  */
    122 int hw_res_dma_channel_remain(async_sess_t *sess, unsigned channel)
    123 {
    124         async_exch_t *exch = async_exchange_begin(sess);
    125         if (exch == NULL)
    126                 return ENOMEM;
    127         sysarg_t remain;
    128         const int ret = async_req_2_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    129             HW_RES_DMA_CHANNEL_REMAIN, channel, &remain);
    130         async_exchange_end(exch);
    131         if (ret == EOK)
    132                 return remain;
    133         return ret;
    13484}
    13585
  • uspace/lib/c/generic/device/hw_res_parsed.c

    rc6a7b3a r5d9fce4  
    3838#include <errno.h>
    3939
    40 static 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 
    62 static void hw_res_parse_add_irq(hw_res_list_parsed_t *out,
    63     const hw_resource_t *res, int flags)
     40static void hw_res_parse_add_irq(hw_res_list_parsed_t *out, hw_resource_t *res,
     41    int flags)
    6442{
    6543        assert(res && (res->type == INTERRUPT));
     
    8159
    8260static void hw_res_parse_add_io_range(hw_res_list_parsed_t *out,
    83     const hw_resource_t *res, int flags)
     61    hw_resource_t *res, int flags)
    8462{
    8563        assert(res && (res->type == IO_RANGE));
     
    11290
    11391static void hw_res_parse_add_mem_range(hw_res_list_parsed_t *out,
    114     const hw_resource_t *res, int flags)
     92    hw_resource_t *res, int flags)
    11593{
    11694        assert(res && (res->type == MEM_RANGE));
     
    154132 *
    155133 */
    156 int hw_res_list_parse(const hw_resource_list_t *hw_resources,
     134int hw_res_list_parse(hw_resource_list_t *hw_resources,
    157135    hw_res_list_parsed_t *out, int flags)
    158136{
     
    163141        hw_res_list_parsed_clean(out);
    164142       
    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         }
     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));
    174146       
    175147        for (size_t i = 0; i < res_count; ++i) {
    176                 const hw_resource_t *resource = &(hw_resources->resources[i]);
    177 
     148                hw_resource_t *resource = &(hw_resources->resources[i]);
     149               
    178150                switch (resource->type) {
    179151                case INTERRUPT:
     
    186158                        hw_res_parse_add_mem_range(out, resource, flags);
    187159                        break;
    188                 case DMA_CHANNEL_8:
    189                 case DMA_CHANNEL_16:
    190                         hw_res_parse_add_dma_channel(out, resource, flags);
    191                         break;
    192160                default:
    193                         hw_res_list_parsed_clean(out);
    194161                        return EINVAL;
    195162                }
    196163        }
    197 
     164       
    198165        return EOK;
    199166};
  • uspace/lib/c/include/async.h

    rc6a7b3a r5d9fce4  
    399399extern int async_data_read_start(async_exch_t *, void *, size_t);
    400400extern bool async_data_read_receive(ipc_callid_t *, size_t *);
    401 extern bool async_data_read_receive_call(ipc_callid_t *, ipc_call_t *, size_t *);
    402401extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
    403402
     
    438437extern int async_data_write_start(async_exch_t *, const void *, size_t);
    439438extern bool async_data_write_receive(ipc_callid_t *, size_t *);
    440 extern bool async_data_write_receive_call(ipc_callid_t *, ipc_call_t *, size_t *);
    441439extern int async_data_write_finalize(ipc_callid_t, void *, size_t);
    442440
  • uspace/lib/c/include/device/hw_res.h

    rc6a7b3a r5d9fce4  
    5353        HW_RES_ENABLE_INTERRUPT,
    5454        HW_RES_DMA_CHANNEL_SETUP,
    55         HW_RES_DMA_CHANNEL_REMAIN,
    5655} hw_res_method_t;
    5756
     
    117116extern int hw_res_dma_channel_setup(async_sess_t *, unsigned int, uint32_t,
    118117    uint16_t, uint8_t);
    119 extern int hw_res_dma_channel_remain(async_sess_t *, unsigned);
    120118
    121119#endif
  • uspace/lib/c/include/device/hw_res_parsed.h

    rc6a7b3a r5d9fce4  
    139139}
    140140
    141 extern int hw_res_list_parse(
    142     const hw_resource_list_t *, hw_res_list_parsed_t *, int);
     141extern int hw_res_list_parse(hw_resource_list_t *, hw_res_list_parsed_t *, int);
    143142extern int hw_res_get_list_parsed(async_sess_t *, hw_res_list_parsed_t *, int);
    144143
  • uspace/lib/c/include/ipc/dev_iface.h

    rc6a7b3a r5d9fce4  
    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 
    4438        /** Character device interface */
    4539        CHAR_DEV_IFACE,
  • uspace/lib/c/include/macros.h

    rc6a7b3a r5d9fce4  
    4040#define abs(a)     ((a) >= 0 ? (a) : -(a))
    4141
    42 #define ARRAY_SIZE(array)   (sizeof(array) / sizeof(array[0]))
    4342
    4443#define KiB2SIZE(kb)  ((kb) << 10)
  • uspace/lib/drv/Makefile

    rc6a7b3a r5d9fce4  
    2929
    3030USPACE_PREFIX = ../..
    31 EXTRA_CFLAGS = -Iinclude -I$(LIBUSB_PREFIX)/include -I$(LIBPCM_PREFIX)/include
     31EXTRA_CFLAGS = -Iinclude -I$(LIBUSB_PREFIX)/include
    3232LIBRARY = libdrv
    3333
     
    3838        generic/log.c \
    3939        generic/logbuf.c \
    40         generic/remote_audio_mixer.c \
    41         generic/remote_audio_pcm.c \
    4240        generic/remote_hw_res.c \
    4341        generic/remote_char_dev.c \
  • uspace/lib/drv/generic/dev_iface.c

    rc6a7b3a r5d9fce4  
    4949#include "remote_usbhid.h"
    5050#include "remote_pci.h"
    51 #include "remote_audio_mixer.h"
    52 #include "remote_audio_pcm.h"
    5351#include "remote_ahci.h"
    5452
    55 static const iface_dipatch_table_t remote_ifaces = {
     53static iface_dipatch_table_t remote_ifaces = {
    5654        .ifaces = {
    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,
     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
    7066        }
    7167};
  • uspace/lib/drv/generic/remote_hw_res.c

    rc6a7b3a r5d9fce4  
    11/*
    22 * Copyright (c) 2010 Lenka Trochtova
    3  * Copyright (c) 2011 Jan Vesely
    43 * All rights reserved.
    54 *
     
    4443static void remote_hw_res_enable_interrupt(ddf_fun_t *, void *, ipc_callid_t,
    4544    ipc_call_t *);
    46 static void remote_hw_res_dma_channel_setup(ddf_fun_t *, void *, ipc_callid_t,
    47     ipc_call_t *);
    48 static void remote_hw_res_dma_channel_remain(ddf_fun_t *, void *, ipc_callid_t,
    49     ipc_call_t *);
    5045
    5146static remote_iface_func_ptr_t remote_hw_res_iface_ops [] = {
    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,
     47        &remote_hw_res_get_resource_list,
     48        &remote_hw_res_enable_interrupt
    5649};
    5750
     
    10194}
    10295
    103 static 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);
    113         const uint32_t address = DEV_IPC_GET_ARG2(*call);
    114         const uint16_t size = DEV_IPC_GET_ARG3(*call) & 0xffff;
    115         const uint8_t mode = DEV_IPC_GET_ARG3(*call) >> 16;
    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 
    122 static 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 }
    13696/**
    13797 * @}
  • uspace/lib/drv/include/ops/hw_res.h

    rc6a7b3a r5d9fce4  
    4545        bool (*enable_interrupt)(ddf_fun_t *);
    4646        int (*dma_channel_setup)(ddf_fun_t *, unsigned, uint32_t, uint16_t, uint8_t);
    47         int (*dma_channel_remain)(ddf_fun_t *, unsigned, size_t *);
    4847} hw_res_ops_t;
    4948
  • uspace/srv/hid/compositor/compositor.c

    rc6a7b3a r5d9fce4  
    20922092        /* Establish input bidirectional connection. */
    20932093        rc = input_connect(input_svc);
    2094         if (rc != EOK) {
    2095                 printf("%s: Failed to connect to input service.\n", NAME);
     2094        if (rc != EOK)
    20962095                return rc;
    2097         }
    20982096
    20992097        /* Create viewports and connect them to visualizers. */
     
    21012099        rc = loc_category_get_id("visualizer", &cat_id, IPC_FLAG_BLOCKING);
    21022100        if (rc != EOK) {
    2103                 printf("%s: Failed to get visualizer category.\n", NAME);
    21042101                input_disconnect();
    21052102                return -1;
     
    21102107        rc = loc_category_get_svcs(cat_id, &svcs, &svcs_cnt);
    21112108        if (rc != EOK || svcs_cnt == 0) {
    2112                 printf("%s: Failed to get visualizer category services.\n", NAME);
    21132109                input_disconnect();
    21142110                return -1;
     
    21272123       
    21282124        if (list_empty(&viewport_list)) {
    2129                 printf("%s: Failed to get view ports.\n", NAME);
    21302125                input_disconnect();
    21312126                return -1;
  • uspace/srv/locsrv/locsrv.c

    rc6a7b3a r5d9fce4  
    13771377        categ_dir_add_cat(&cdir, cat);
    13781378       
    1379         cat = category_new("audio-pcm");
    1380         categ_dir_add_cat(&cdir, cat);
    1381        
    13821379        return true;
    13831380}
Note: See TracChangeset for help on using the changeset viewer.