Changeset eb522e8 in mainline for uspace/srv/hw


Ignore:
Timestamp:
2011-06-01T08:43:42Z (14 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8d6c1f1
Parents:
9e2e715 (diff), e51a514 (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:

Huuuuuge merge from development - all the work actually :)

Location:
uspace/srv/hw
Files:
5 added
5 deleted
6 edited
11 moved

Legend:

Unmodified
Added
Removed
  • uspace/srv/hw/bus/cuda_adb/cuda_adb.c

    r9e2e715 reb522e8  
    143143int main(int argc, char *argv[])
    144144{
    145         dev_handle_t dev_handle;
     145        devmap_handle_t devmap_handle;
    146146        int rc;
    147147        int i;
     
    151151        for (i = 0; i < ADB_MAX_ADDR; ++i) {
    152152                adb_dev[i].client_phone = -1;
    153                 adb_dev[i].dev_handle = 0;
     153                adb_dev[i].devmap_handle = 0;
    154154        }
    155155
     
    160160        }
    161161
    162         rc = devmap_device_register("adb/kbd", &dev_handle);
     162        rc = devmap_device_register("adb/kbd", &devmap_handle);
    163163        if (rc != EOK) {
    164                 devmap_hangup_phone(DEVMAP_DRIVER);
    165164                printf(NAME ": Unable to register device %s.\n", "adb/kdb");
    166165                return rc;
    167166        }
    168167
    169         adb_dev[2].dev_handle = dev_handle;
    170         adb_dev[8].dev_handle = dev_handle;
    171 
    172         rc = devmap_device_register("adb/mouse", &dev_handle);
     168        adb_dev[2].devmap_handle = devmap_handle;
     169        adb_dev[8].devmap_handle = devmap_handle;
     170
     171        rc = devmap_device_register("adb/mouse", &devmap_handle);
    173172        if (rc != EOK) {
    174                 devmap_hangup_phone(DEVMAP_DRIVER);
    175173                printf(NAME ": Unable to register device %s.\n", "adb/mouse");
    176174                return rc;
    177175        }
    178176
    179         adb_dev[9].dev_handle = dev_handle;
     177        adb_dev[9].devmap_handle = devmap_handle;
    180178
    181179        if (cuda_init() < 0) {
     
    195193        ipc_callid_t callid;
    196194        ipc_call_t call;
    197         ipcarg_t method;
    198         dev_handle_t dh;
     195        sysarg_t method;
     196        devmap_handle_t dh;
    199197        int retval;
    200198        int dev_addr, i;
     
    206204        dev_addr = -1;
    207205        for (i = 0; i < ADB_MAX_ADDR; i++) {
    208                 if (adb_dev[i].dev_handle == dh)
     206                if (adb_dev[i].devmap_handle == dh)
    209207                        dev_addr = i;
    210208        }
    211209
    212210        if (dev_addr < 0) {
    213                 ipc_answer_0(iid, EINVAL);
     211                async_answer_0(iid, EINVAL);
    214212                return;
    215213        }
    216214
    217215        /* Answer the IPC_M_CONNECT_ME_TO call. */
    218         ipc_answer_0(iid, EOK);
     216        async_answer_0(iid, EOK);
    219217
    220218        while (1) {
    221219                callid = async_get_call(&call);
    222                 method = IPC_GET_METHOD(call);
     220                method = IPC_GET_IMETHOD(call);
    223221                switch (method) {
    224222                case IPC_M_PHONE_HUNGUP:
    225223                        /* The other side has hung up. */
    226                         ipc_answer_0(callid, EOK);
     224                        async_answer_0(callid, EOK);
    227225                        return;
    228226                case IPC_M_CONNECT_TO_ME:
     
    237235                         */
    238236                        for (i = 0; i < ADB_MAX_ADDR; ++i) {
    239                                 if (adb_dev[i].dev_handle == dh) {
     237                                if (adb_dev[i].devmap_handle == dh) {
    240238                                        adb_dev[i].client_phone = IPC_GET_ARG5(call);
    241239                                }
     
    247245                        break;
    248246                }
    249                 ipc_answer_0(callid, retval);
     247                async_answer_0(callid, retval);
    250248        }
    251249}
     
    278276        cuda_irq_code.cmds[0].addr = (void *) &((cuda_t *) instance->cuda_kernel)->ifr;
    279277        async_set_interrupt_received(cuda_irq_handler);
    280         ipc_register_irq(10, device_assign_devno(), 0, &cuda_irq_code);
     278        register_irq(10, device_assign_devno(), 0, &cuda_irq_code);
    281279
    282280        /* Enable SR interrupt. */
     
    369367static void cuda_irq_rcv_end(void *buf, size_t *len)
    370368{
    371         uint8_t data, b;
    372 
     369        uint8_t b;
     370       
    373371        b = pio_read_8(&dev->b);
    374         data = pio_read_8(&dev->sr);
    375 
     372        pio_read_8(&dev->sr);
     373       
    376374        if ((b & TREQ) == 0) {
    377375                instance->xstate = cx_receive;
     
    381379                cuda_send_start();
    382380        }
    383 
    384         memcpy(buf, instance->rcv_buf, instance->bidx);
    385         *len = instance->bidx;
     381       
     382        memcpy(buf, instance->rcv_buf, instance->bidx);
     383        *len = instance->bidx;
    386384        instance->bidx = 0;
    387385}
  • uspace/srv/hw/bus/cuda_adb/cuda_adb.h

    r9e2e715 reb522e8  
    104104
    105105typedef struct {
    106         dev_handle_t dev_handle;
     106        devmap_handle_t devmap_handle;
    107107        int client_phone;
    108108} adb_dev_t;
  • uspace/srv/hw/char/i8042/i8042.c

    r9e2e715 reb522e8  
    4040#include <libarch/ddi.h>
    4141#include <devmap.h>
    42 #include <ipc/ipc.h>
    4342#include <async.h>
    4443#include <unistd.h>
     
    4645#include <stdio.h>
    4746#include <errno.h>
     47#include <inttypes.h>
    4848
    4949#include "i8042.h"
     
    145145
    146146                snprintf(name, 16, "%s/ps2%c", NAMESPACE, dchar[i]);
    147                 rc = devmap_device_register(name, &i8042_port[i].dev_handle);
     147                rc = devmap_device_register(name, &i8042_port[i].devmap_handle);
    148148                if (rc != EOK) {
    149                         devmap_hangup_phone(DEVMAP_DRIVER);
    150149                        printf(NAME ": Unable to register device %s.\n", name);
    151150                        return rc;
     
    199198        i8042_kbd.cmds[0].addr = (void *) &((i8042_t *) i8042_kernel)->status;
    200199        i8042_kbd.cmds[3].addr = (void *) &((i8042_t *) i8042_kernel)->data;
    201         ipc_register_irq(inr_a, device_assign_devno(), 0, &i8042_kbd);
    202         ipc_register_irq(inr_b, device_assign_devno(), 0, &i8042_kbd);
    203         printf("%s: registered for interrupts %d and %d\n", NAME, inr_a, inr_b);
     200        register_irq(inr_a, device_assign_devno(), 0, &i8042_kbd);
     201        register_irq(inr_b, device_assign_devno(), 0, &i8042_kbd);
     202        printf("%s: registered for interrupts %" PRIun " and %" PRIun "\n",
     203            NAME, inr_a, inr_b);
    204204
    205205        wait_ready();
     
    217217        ipc_callid_t callid;
    218218        ipc_call_t call;
    219         ipcarg_t method;
    220         dev_handle_t dh;
     219        sysarg_t method;
     220        devmap_handle_t dh;
    221221        int retval;
    222222        int dev_id, i;
     
    230230        dev_id = -1;
    231231        for (i = 0; i < MAX_DEVS; i++) {
    232                 if (i8042_port[i].dev_handle == dh)
     232                if (i8042_port[i].devmap_handle == dh)
    233233                        dev_id = i;
    234234        }
    235235
    236236        if (dev_id < 0) {
    237                 ipc_answer_0(iid, EINVAL);
     237                async_answer_0(iid, EINVAL);
    238238                return;
    239239        }
    240240
    241241        /* Answer the IPC_M_CONNECT_ME_TO call. */
    242         ipc_answer_0(iid, EOK);
     242        async_answer_0(iid, EOK);
    243243
    244244        printf(NAME ": accepted connection\n");
     
    246246        while (1) {
    247247                callid = async_get_call(&call);
    248                 method = IPC_GET_METHOD(call);
     248                method = IPC_GET_IMETHOD(call);
    249249                switch (method) {
    250250                case IPC_M_PHONE_HUNGUP:
    251251                        /* The other side has hung up. */
    252                         ipc_answer_0(callid, EOK);
     252                        async_answer_0(callid, EOK);
    253253                        return;
    254254                case IPC_M_CONNECT_TO_ME:
     
    262262                        break;
    263263                case IPC_FIRST_USER_METHOD:
    264                         printf(NAME ": write %d to devid %d\n",
     264                        printf(NAME ": write %" PRIun " to devid %d\n",
    265265                            IPC_GET_ARG1(call), dev_id);
    266266                        i8042_port_write(dev_id, IPC_GET_ARG1(call));
     
    271271                        break;
    272272                }
    273                 ipc_answer_0(callid, retval);
     273                async_answer_0(callid, retval);
    274274        }
    275275}
  • uspace/srv/hw/char/i8042/i8042.h

    r9e2e715 reb522e8  
    5252/** Softstate structure, one for each serial port (primary and aux). */
    5353typedef struct {
    54         dev_handle_t dev_handle;
     54        devmap_handle_t devmap_handle;
    5555        int client_phone;
    5656} i8042_port_t;
  • uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c

    r9e2e715 reb522e8  
    4040#include <libarch/ddi.h>
    4141#include <devmap.h>
    42 #include <ipc/ipc.h>
    4342#include <ipc/char.h>
    4443#include <async.h>
     
    4847#include <sysinfo.h>
    4948#include <errno.h>
     49#include <inttypes.h>
    5050
    5151#include "s3c24xx_uart.h"
     
    9292                return -1;
    9393
    94         rc = devmap_device_register(NAMESPACE "/" NAME, &uart->dev_handle);
     94        rc = devmap_device_register(NAMESPACE "/" NAME, &uart->devmap_handle);
    9595        if (rc != EOK) {
    96                 devmap_hangup_phone(DEVMAP_DRIVER);
    97                 printf(NAME ": Unable to register device %s.\n");
     96                printf(NAME ": Unable to register device %s.\n",
     97                    NAMESPACE "/" NAME);
    9898                return -1;
    9999        }
     
    114114        ipc_callid_t callid;
    115115        ipc_call_t call;
    116         ipcarg_t method;
     116        sysarg_t method;
    117117        int retval;
    118118
    119119        /* Answer the IPC_M_CONNECT_ME_TO call. */
    120         ipc_answer_0(iid, EOK);
     120        async_answer_0(iid, EOK);
    121121
    122122        while (1) {
    123123                callid = async_get_call(&call);
    124                 method = IPC_GET_METHOD(call);
     124                method = IPC_GET_IMETHOD(call);
    125125                switch (method) {
    126126                case IPC_M_PHONE_HUNGUP:
    127127                        /* The other side has hung up. */
    128                         ipc_answer_0(callid, EOK);
     128                        async_answer_0(callid, EOK);
    129129                        return;
    130130                case IPC_M_CONNECT_TO_ME:
     
    134134                        break;
    135135                case CHAR_WRITE_BYTE:
    136                         printf(NAME ": write %d to device\n",
     136                        printf(NAME ": write %" PRIun " to device\n",
    137137                            IPC_GET_ARG1(call));
    138138                        s3c24xx_uart_sendb(uart, (uint8_t) IPC_GET_ARG1(call));
     
    143143                        break;
    144144                }
    145                 ipc_answer_0(callid, retval);
     145                async_answer_0(callid, retval);
    146146        }
    147147}
     
    185185        uart->client_phone = -1;
    186186
    187         printf(NAME ": device at physical address 0x%x, inr %d.\n",
    188             uart->paddr, inr);
     187        printf(NAME ": device at physical address %p, inr %" PRIun ".\n",
     188            (void *) uart->paddr, inr);
    189189
    190190        async_set_interrupt_received(s3c24xx_uart_irq_handler);
    191191
    192         ipc_register_irq(inr, device_assign_devno(), 0, &uart_irq_code);
     192        register_irq(inr, device_assign_devno(), 0, &uart_irq_code);
    193193
    194194        /* Enable FIFO, Tx trigger level: empty, Rx trigger level: 1 byte. */
  • uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.h

    r9e2e715 reb522e8  
    8888
    8989        /** Device handle */
    90         dev_handle_t dev_handle;
     90        devmap_handle_t devmap_handle;
    9191} s3c24xx_uart_t;
    9292
  • uspace/srv/hw/irc/apic/Makefile

    r9e2e715 reb522e8  
    11#
    2 # Copyright (c) 2008 Jiri Svoboda
     2# Copyright (c) 2011 Martin Decky
    33# All rights reserved.
    44#
     
    2727#
    2828
    29 ARCH_SOURCES = arch/$(UARCH)/abs32le.c
     29USPACE_PREFIX = ../../../..
     30BINARY = apic
     31
     32SOURCES = \
     33        apic.c
     34
     35include $(USPACE_PREFIX)/Makefile.common
  • uspace/srv/hw/irc/fhc/fhc.c

    r9e2e715 reb522e8  
    2929/** @addtogroup fhc
    3030 * @{
    31  */ 
     31 */
    3232
    3333/**
    34  * @file        fhc.c
    35  * @brief       FHC bus controller driver.
     34 * @file fhc.c
     35 * @brief FHC bus controller driver.
    3636 */
    3737
    38 #include <ipc/ipc.h>
    3938#include <ipc/services.h>
    40 #include <ipc/bus.h>
     39#include <ipc/irc.h>
    4140#include <ipc/ns.h>
    4241#include <sysinfo.h>
     
    7675         * Answer the first IPC_M_CONNECT_ME_TO call.
    7776         */
    78         ipc_answer_0(iid, EOK);
     77        async_answer_0(iid, EOK);
    7978
    8079        while (1) {
     
    8281       
    8382                callid = async_get_call(&call);
    84                 switch (IPC_GET_METHOD(call)) {
    85                 case BUS_CLEAR_INTERRUPT:
     83                switch (IPC_GET_IMETHOD(call)) {
     84                case IRC_ENABLE_INTERRUPT:
     85                        /* Noop */
     86                        async_answer_0(callid, EOK);
     87                        break;
     88                case IRC_CLEAR_INTERRUPT:
    8689                        inr = IPC_GET_ARG1(call);
    8790                        switch (inr) {
    8891                        case FHC_UART_INR:
    8992                                fhc_uart_virt[FHC_UART_ICLR] = 0;
    90                                 ipc_answer_0(callid, EOK);
     93                                async_answer_0(callid, EOK);
    9194                                break;
    9295                        default:
    93                                 ipc_answer_0(callid, ENOTSUP);
     96                                async_answer_0(callid, ENOTSUP);
    9497                                break;
    9598                        }
    9699                        break;
    97100                default:
    98                         ipc_answer_0(callid, EINVAL);
     101                        async_answer_0(callid, EINVAL);
    99102                        break;
    100103                }
     
    129132        }
    130133       
    131         printf(NAME ": FHC UART registers at %p, %d bytes\n", fhc_uart_phys,
     134        printf(NAME ": FHC UART registers at %p, %zu bytes\n", fhc_uart_phys,
    132135            fhc_uart_size);
    133136       
    134137        async_set_client_connection(fhc_connection);
    135         ipcarg_t phonead;
    136         ipc_connect_to_me(PHONE_NS, SERVICE_FHC, 0, 0, &phonead);
     138        service_register(SERVICE_IRC);
    137139       
    138140        return true;
  • uspace/srv/hw/irc/i8259/Makefile

    r9e2e715 reb522e8  
    11#
    2 # Copyright (c) 2008 Jiri Svoboda
     2# Copyright (c) 2011 Martin Decky
    33# All rights reserved.
    44#
     
    2727#
    2828
    29 ARCH_SOURCES = arch/$(UARCH)/amd64.s
     29USPACE_PREFIX = ../../../..
     30BINARY = i8259
     31
     32SOURCES = \
     33        i8259.c
     34
     35include $(USPACE_PREFIX)/Makefile.common
  • uspace/srv/hw/irc/obio/obio.c

    r9e2e715 reb522e8  
    2727 */
    2828
    29 /** @addtogroup obio 
     29/** @addtogroup obio
    3030 * @{
    31  */ 
     31 */
    3232
    3333/**
    34  * @file        obio.c
    35  * @brief       OBIO driver.
     34 * @file obio.c
     35 * @brief OBIO driver.
    3636 *
    3737 * OBIO is a short for on-board I/O. On UltraSPARC IIi and systems with U2P,
     
    4242 */
    4343
    44 #include <ipc/ipc.h>
    4544#include <ipc/services.h>
    46 #include <ipc/bus.h>
     45#include <ipc/irc.h>
    4746#include <ipc/ns.h>
    4847#include <sysinfo.h>
     
    8685         * Answer the first IPC_M_CONNECT_ME_TO call.
    8786         */
    88         ipc_answer_0(iid, EOK);
     87        async_answer_0(iid, EOK);
    8988
    9089        while (1) {
     
    9291       
    9392                callid = async_get_call(&call);
    94                 switch (IPC_GET_METHOD(call)) {
    95                 case BUS_CLEAR_INTERRUPT:
     93                switch (IPC_GET_IMETHOD(call)) {
     94                case IRC_ENABLE_INTERRUPT:
     95                        /* Noop */
     96                        async_answer_0(callid, EOK);
     97                        break;
     98                case IRC_CLEAR_INTERRUPT:
    9699                        inr = IPC_GET_ARG1(call);
    97100                        base_virt[OBIO_CIR(inr & INO_MASK)] = 0;
    98                         ipc_answer_0(callid, EOK);
     101                        async_answer_0(callid, EOK);
    99102                        break;
    100103                default:
    101                         ipc_answer_0(callid, EINVAL);
     104                        async_answer_0(callid, EINVAL);
    102105                        break;
    103106                }
     
    134137       
    135138        async_set_client_connection(obio_connection);
    136         ipcarg_t phonead;
    137         ipc_connect_to_me(PHONE_NS, SERVICE_OBIO, 0, 0, &phonead);
     139        service_register(SERVICE_IRC);
    138140       
    139141        return true;
  • uspace/srv/hw/netif/ne2000/Makefile

    r9e2e715 reb522e8  
    3939-include $(CONFIG_MAKEFILE)
    4040
    41 ifeq ($(CONFIG_NETIF_NIL_BUNDLE),y)
    42         LIBS += $(USPACE_PREFIX)/srv/net/nil/eth/libeth.a
    43 endif
    44 
    45 BINARY = dp8390
     41BINARY = ne2000
    4642
    4743SOURCES = \
    4844        dp8390.c \
    49         dp8390_module.c \
    5045        ne2000.c
    5146
Note: See TracChangeset for help on using the changeset viewer.