Changeset 85d2fe2e in mainline


Ignore:
Timestamp:
2012-04-07T16:37:05Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
089385e8
Parents:
ec351c3 (diff), 6bb169b5 (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:

Merge mainline changes

Files:
26 edited
3 moved

Legend:

Unmodified
Added
Removed
  • boot/Makefile.build

    rec351c3 r85d2fe2e  
    3434OPTIMIZATION = 3
    3535
    36 DEFS = -DRELEASE=$(RELEASE) "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
     36DEFS = -DRELEASE=$(RELEASE) "-DCOPYRIGHT=$(COPYRIGHT)" "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
    3737
    3838GCC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
  • boot/arch/ia64/src/main.c

    rec351c3 r85d2fe2e  
    189189        printf("\nInflating components ... ");
    190190       
     191        /*
     192         * We will use the next available address for a copy of each component to
     193         * make sure that inflate() works with disjunctive memory regions.
     194         */
     195        top = ALIGN_UP(top, PAGE_SIZE);
     196
    191197        for (i = cnt; i > 0; i--) {
    192198                printf("%s ", components[i - 1].name);
    193199               
    194                 int err = inflate(components[i - 1].start, components[i - 1].size,
     200                /*
     201                 * Copy the component to a location which is guaranteed not to
     202                 * overlap with the destination for inflate().
     203                 */
     204                memmove((void *) top, components[i - 1].start, components[i - 1].size);
     205               
     206                int err = inflate((void *) top, components[i - 1].size,
    195207                    dest[i - 1], components[i - 1].inflated);
    196208               
  • boot/generic/include/memstr.h

    rec351c3 r85d2fe2e  
    3636
    3737extern void *memcpy(void *, const void *, size_t);
     38extern void *memmove(void *, const void *, size_t);
    3839
    3940#endif
  • boot/generic/src/memstr.c

    rec351c3 r85d2fe2e  
    5151}
    5252
     53/** Move memory block with possible overlapping.
     54 *
     55 * Copy cnt bytes from src address to dst address. The source
     56 * and destination memory areas may overlap.
     57 *
     58 * @param dst Destination address to copy to.
     59 * @param src Source address to copy from.
     60 * @param cnt Number of bytes to copy.
     61 *
     62 * @return Destination address.
     63 *
     64 */
     65void *memmove(void *dst, const void *src, size_t cnt)
     66{
     67        /* Nothing to do? */
     68        if (src == dst)
     69                return dst;
     70       
     71        /* Non-overlapping? */
     72        if ((dst >= src + cnt) || (src >= dst + cnt))
     73                return memcpy(dst, src, cnt);
     74       
     75        uint8_t *dp;
     76        const uint8_t *sp;
     77       
     78        /* Which direction? */
     79        if (src > dst) {
     80                /* Forwards. */
     81                dp = dst;
     82                sp = src;
     83               
     84                while (cnt-- != 0)
     85                        *dp++ = *sp++;
     86        } else {
     87                /* Backwards. */
     88                dp = dst + (cnt - 1);
     89                sp = src + (cnt - 1);
     90               
     91                while (cnt-- != 0)
     92                        *dp-- = *sp--;
     93        }
     94       
     95        return dst;
     96}
     97
    5398/** @}
    5499 */
  • boot/generic/src/version.c

    rec351c3 r85d2fe2e  
    3232
    3333static const char *project = "HelenOS bootloader";
    34 static const char *copyright = "Copyright (c) 2001-2011 HelenOS project";
     34static const char *copyright = STRING(COPYRIGHT);
    3535static const char *release = STRING(RELEASE);
    3636static const char *name = STRING(NAME);
  • kernel/Makefile

    rec351c3 r85d2fe2e  
    9090endif
    9191
    92 DEFS = -DKERNEL -DRELEASE=$(RELEASE) "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
     92DEFS = -DKERNEL -DRELEASE=$(RELEASE) "-DCOPYRIGHT=$(COPYRIGHT)" "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
    9393
    9494GCC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
  • kernel/generic/src/main/version.c

    rec351c3 r85d2fe2e  
    3838
    3939static const char *project = "SPARTAN kernel";
    40 static const char *copyright = "Copyright (c) 2001-2011 HelenOS project";
     40static const char *copyright = STRING(COPYRIGHT);
    4141static const char *release = STRING(RELEASE);
    4242static const char *name = STRING(NAME);
  • uspace/app/getterm/Makefile

    rec351c3 r85d2fe2e  
    2929
    3030USPACE_PREFIX = ../..
    31 DEFS = -DRELEASE=$(RELEASE) "-DNAME=$(NAME)"
     31DEFS = -DRELEASE=$(RELEASE) "-DCOPYRIGHT=$(COPYRIGHT)" "-DNAME=$(NAME)"
    3232BINARY = getterm
    3333
  • uspace/app/getterm/version.c

    rec351c3 r85d2fe2e  
    4040#include "version.h"
    4141
     42static const char *copyright = STRING(COPYRIGHT);
    4243static const char *release = STRING(RELEASE);
    4344static const char *name = STRING(NAME);
     
    6162        printf("HelenOS release %s (%s)%s%s\n", release, name, revision, timestamp);
    6263        printf("Running on %s (%s)\n", arch, term);
    63         printf("Copyright (c) 2001-2011 HelenOS project\n\n");
     64        printf("%s\n\n", copyright);
    6465}
    6566
  • uspace/app/sportdmp/sportdmp.c

    rec351c3 r85d2fe2e  
    2727 */
    2828
     29#include <device/char_dev.h>
    2930#include <errno.h>
     31#include <ipc/serial_ctl.h>
     32#include <loc.h>
    3033#include <stdio.h>
    31 #include <devman.h>
    32 #include <ipc/devman.h>
    33 #include <device/char_dev.h>
    34 #include <ipc/serial_ctl.h>
    3534
    3635#define BUF_SIZE 1
    3736
    38 static void syntax_print() {
    39         fprintf(stderr, "Usage: sportdmp <baud> <device_path>\n");
     37static void syntax_print(void)
     38{
     39        fprintf(stderr, "Usage: sportdmp <baud> <device_service>\n");
    4040}
    4141
    4242int main(int argc, char **argv)
    4343{
    44         const char* devpath = "/hw/pci0/00:01.0/com1/a";
     44        const char* svc_path = "devices/\\hw\\pci0\\00:01.0\\com1\\a";
    4545        sysarg_t baud = 9600;
    4646       
     
    5656       
    5757        if (argc > 2) {
    58                 devpath = argv[2];
     58                svc_path = argv[2];
    5959        }
    6060       
     
    6464        }
    6565       
    66         devman_handle_t device;
    67         int rc = devman_fun_get_handle(devpath, &device, IPC_FLAG_BLOCKING);
     66        service_id_t svc_id;
     67        int rc = loc_service_get_id(svc_path, &svc_id, IPC_FLAG_BLOCKING);
    6868        if (rc != EOK) {
    69                 fprintf(stderr, "Cannot open device %s\n", devpath);
     69                fprintf(stderr, "Cannot find device service %s\n", svc_path);
    7070                return 1;
    7171        }
    7272       
    73         async_sess_t *sess = devman_device_connect(EXCHANGE_SERIALIZE, device,
     73        async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, svc_id,
    7474            IPC_FLAG_BLOCKING);
    7575        if (!sess) {
    76                 fprintf(stderr, "Cannot connect device\n");
     76                fprintf(stderr, "Failed connecting to service %s\n", svc_path);
    7777        }
    7878       
     
    8383       
    8484        if (rc != EOK) {
    85                 fprintf(stderr, "Cannot set serial properties\n");
     85                fprintf(stderr, "Failed setting serial properties\n");
    8686                return 2;
    8787        }
     
    8989        uint8_t *buf = (uint8_t *) malloc(BUF_SIZE);
    9090        if (buf == NULL) {
    91                 fprintf(stderr, "Cannot allocate buffer\n");
     91                fprintf(stderr, "Failed allocating buffer\n");
    9292                return 3;
    9393        }
  • uspace/app/tester/hw/serial/serial1.c

    rec351c3 r85d2fe2e  
    4242#include <async.h>
    4343#include <ipc/services.h>
    44 #include <ipc/devman.h>
    45 #include <devman.h>
     44#include <loc.h>
    4645#include <device/char_dev.h>
    4746#include <str.h>
     
    7170                }
    7271       
    73         devman_handle_t handle;
    74         int res = devman_fun_get_handle("/hw/pci0/00:01.0/com1/a", &handle,
    75             IPC_FLAG_BLOCKING);
     72        service_id_t svc_id;
     73        int res = loc_service_get_id("devices/\\hw\\pci0\\00:01.0\\com1\\a",
     74            &svc_id, IPC_FLAG_BLOCKING);
    7675        if (res != EOK)
    77                 return "Could not get serial device handle";
    78        
    79         async_sess_t *sess = devman_device_connect(EXCHANGE_SERIALIZE, handle,
     76                return "Failed getting serial port service ID";
     77       
     78        async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, svc_id,
    8079            IPC_FLAG_BLOCKING);
    8180        if (!sess)
    82                 return "Unable to connect to serial device";
     81                return "Failed connecting to serial device";
    8382       
    8483        char *buf = (char *) malloc(cnt + 1);
    8584        if (buf == NULL) {
    8685                async_hangup(sess);
    87                 return "Failed to allocate input buffer";
     86                return "Failed allocating input buffer";
    8887        }
    8988       
     
    112111                free(buf);
    113112                async_hangup(sess);
    114                 return "Failed to set serial communication parameters";
    115         }
    116        
    117         TPRINTF("Trying to read %zu characters from serial device "
    118             "(handle=%" PRIun ")\n", cnt, handle);
     113                return "Failed setting serial communication parameters";
     114        }
     115       
     116        TPRINTF("Trying reading %zu characters from serial device "
     117            "(svc_id=%" PRIun ")\n", cnt, svc_id);
    119118       
    120119        size_t total = 0;
     
    130129                        free(buf);
    131130                        async_hangup(sess);
    132                         return "Failed read from serial device";
     131                        return "Failed reading from serial device";
    133132                }
    134133               
     
    165164                                free(buf);
    166165                                async_hangup(sess);
    167                                 return "Failed write to serial device";
     166                                return "Failed writing to serial device";
    168167                        }
    169168                       
  • uspace/app/websrv/websrv.c

    rec351c3 r85d2fe2e  
    200200{
    201201        if (str_cmp(uri, "/") == 0)
    202                 uri = "/index.htm";
     202                uri = "/index.html";
    203203       
    204204        char *fname;
  • uspace/dist/data/web/index.html

    rec351c3 r85d2fe2e  
    1313        </p>
    1414        <p>
    15             Now <a href="foo.htm">go to page foo</a> or <a href="bar.htm">go
     15            Now <a href="foo.html">go to page foo</a> or <a href="bar.html">go
    1616            to bar</a>.
    1717        </p>
  • uspace/drv/bus/isa/isa.c

    rec351c3 r85d2fe2e  
    6666#include <ops/hw_res.h>
    6767
    68 #include <devman.h>
    69 #include <ipc/devman.h>
    7068#include <device/hw_res.h>
    7169
  • uspace/drv/bus/usb/uhcirh/port.c

    rec351c3 r85d2fe2e  
    3737#include <str_error.h>
    3838#include <async.h>
    39 #include <devman.h>
    4039
    4140#include <usb/usb.h>    /* usb_address_t */
  • uspace/drv/bus/usb/usbhub/port.c

    rec351c3 r85d2fe2e  
    3535
    3636#include <bool.h>
    37 #include <devman.h>
    3837#include <errno.h>
    3938#include <str_error.h>
  • uspace/drv/char/ns8250/ns8250.c

    rec351c3 r85d2fe2e  
    7474#define DLAB_MASK (1 << 7)
    7575
     76/** Interrupt Enable Register definition. */
     77#define NS8250_IER_RXREADY      (1 << 0)
     78#define NS8250_IER_THRE         (1 << 1)
     79#define NS8250_IER_RXSTATUS     (1 << 2)
     80#define NS8250_IER_MODEM_STATUS (1 << 3)
     81
     82/** Interrupt ID Register definition. */
     83#define NS8250_IID_ACTIVE       (1 << 0)
     84
     85/** FIFO Control Register definition. */
     86#define NS8250_FCR_FIFOENABLE   (1 << 0)
     87#define NS8250_FCR_RXFIFORESET  (1 << 1)
     88#define NS8250_FCR_TXFIFORESET  (1 << 2)
     89#define NS8250_FCR_DMAMODE      (1 << 3)
     90#define NS8250_FCR_RXTRIGGERLOW (1 << 6)
     91#define NS8250_FCR_RXTRIGGERHI  (1 << 7)
     92
     93/** Line Control Register definition. */
     94#define NS8250_LCR_STOPBITS     (1 << 2)
     95#define NS8250_LCR_PARITY       (1 << 3)
     96#define NS8250_LCR_SENDBREAK    (1 << 6)
     97#define NS8250_LCR_DLAB         (1 << 7)
     98
     99/** Modem Control Register definition. */
     100#define NS8250_MCR_DTR          (1 << 0)
     101#define NS8250_MCR_RTS          (1 << 1)
     102#define NS8250_MCR_OUT1         (1 << 2)
     103#define NS8250_MCR_OUT2         (1 << 3)
     104#define NS8250_MCR_LOOPBACK     (1 << 4)
     105#define NS8250_MCR_ALL          (0x1f)
     106
     107/** Line Status Register definition. */
     108#define NS8250_LSR_RXREADY      (1 << 0)
     109#define NS8250_LSR_OE           (1 << 1)
     110#define NS8250_LSR_PE           (1 << 2)
     111#define NS8250_LSR_FE           (1 << 3)
     112#define NS8250_LSR_BREAK        (1 << 4)
     113#define NS8250_LSR_THRE         (1 << 5)
     114#define NS8250_LSR_TSE          (1 << 6)
     115
     116/** Modem Status Register definition. */
     117#define NS8250_MSR_DELTACTS     (1 << 0)
     118#define NS8250_MSR_DELTADSR     (1 << 1)
     119#define NS8250_MSR_RITRAILING   (1 << 2)
     120#define NS8250_MSR_DELTADCD     (1 << 3)
     121#define NS8250_MSR_CTS          (1 << 4)
     122#define NS8250_MSR_DSR          (1 << 5)
     123#define NS8250_MSR_RI           (1 << 6)
     124#define NS8250_MSR_DCD          (1 << 7)
     125#define NS8250_MSR_SIGNALS      (NS8250_MSR_CTS | NS8250_MSR_DSR \
     126    | NS8250_MSR_RI | NS8250_MSR_DCD)
     127
    76128/** Obtain soft-state structure from function node */
    77129#define NS8250(fnode) ((ns8250_t *) ((fnode)->dev->driver_data))
     
    96148} stop_bit_t;
    97149
     150/** 8250 UART registers layout. */
     151typedef struct {
     152        ioport8_t data;         /**< Data register. */
     153        ioport8_t ier;          /**< Interrupt Enable Reg. */
     154        ioport8_t iid;          /**< Interrupt ID Reg. */
     155        ioport8_t lcr;          /**< Line Control Reg. */
     156        ioport8_t mcr;          /**< Modem Control Reg. */
     157        ioport8_t lsr;          /**< Line Status Reg. */
     158        ioport8_t msr;          /**< Modem Status Reg. */
     159} ns8250_regs_t;
     160
    98161/** The driver data for the serial port devices. */
    99162typedef struct ns8250 {
     
    102165        /** DDF function node */
    103166        ddf_fun_t *fun;
     167        /** I/O registers **/
     168        ns8250_regs_t *regs;
    104169        /** Is there any client conntected to the device? */
    105170        bool client_connected;
     
    124189 *                      otherwise.
    125190 */
    126 static bool ns8250_received(ioport8_t *port)
    127 {
    128         return (pio_read_8(port + 5) & 1) != 0;
     191static bool ns8250_received(ns8250_regs_t *regs)
     192{
     193        return (pio_read_8(&regs->lsr) & NS8250_LSR_RXREADY) != 0;
    129194}
    130195
     
    134199 * @return              The data read.
    135200 */
    136 static uint8_t ns8250_read_8(ioport8_t *port)
    137 {
    138         return pio_read_8(port);
     201static uint8_t ns8250_read_8(ns8250_regs_t *regs)
     202{
     203        return pio_read_8(&regs->data);
    139204}
    140205
     
    143208 * @param port          The base address of the serial port device's ports.
    144209 */
    145 static bool is_transmit_empty(ioport8_t *port)
    146 {
    147         return (pio_read_8(port + 5) & 0x20) != 0;
     210static bool is_transmit_empty(ns8250_regs_t *regs)
     211{
     212        return (pio_read_8(&regs->lsr) & NS8250_LSR_THRE) != 0;
    148213}
    149214
     
    153218 * @param c             The character to be written to the serial port device.
    154219 */
    155 static void ns8250_write_8(ioport8_t *port, uint8_t c)
    156 {
    157         while (!is_transmit_empty(port))
     220static void ns8250_write_8(ns8250_regs_t *regs, uint8_t c)
     221{
     222        while (!is_transmit_empty(regs))
    158223                ;
    159224       
    160         pio_write_8(port, c);
     225        pio_write_8(&regs->data, c);
    161226}
    162227
     
    193258{
    194259        fibril_mutex_lock(&ns->mutex);
    195         ns8250_write_8(ns->port, c);
     260        ns8250_write_8(ns->regs, c);
    196261        fibril_mutex_unlock(&ns->mutex);
    197262}
     
    212277                ns8250_putchar(ns, (uint8_t) buf[idx]);
    213278       
    214         return 0;
     279        return count;
    215280}
    216281
     
    266331                return false;
    267332        }
     333
     334        ns->regs = (ns8250_regs_t *)ns->port;
    268335       
    269336        return true;
     
    279346        ddf_msg(LVL_DEBUG, "ns8250_dev_probe %s", ns->dev->name);
    280347       
    281         ioport8_t *port_addr = ns->port;
    282348        bool res = true;
    283349        uint8_t olddata;
    284350       
    285         olddata = pio_read_8(port_addr + 4);
    286        
    287         pio_write_8(port_addr + 4, 0x10);
    288         if (pio_read_8(port_addr + 6) & 0xf0)
     351        olddata = pio_read_8(&ns->regs->mcr);
     352       
     353        pio_write_8(&ns->regs->mcr, NS8250_MCR_LOOPBACK);
     354        if (pio_read_8(&ns->regs->msr) & NS8250_MSR_SIGNALS)
    289355                res = false;
    290356       
    291         pio_write_8(port_addr + 4, 0x1f);
    292         if ((pio_read_8(port_addr + 6) & 0xf0) != 0xf0)
     357        pio_write_8(&ns->regs->mcr, NS8250_MCR_ALL);
     358        if ((pio_read_8(&ns->regs->msr) & NS8250_MSR_SIGNALS)
     359            != NS8250_MSR_SIGNALS)
    293360                res = false;
    294361       
    295         pio_write_8(port_addr + 4, olddata);
     362        pio_write_8(&ns->regs->mcr, olddata);
    296363       
    297364        if (!res) {
     
    390457 * @param port          The base address of the serial port device's ports.
    391458 */
    392 static inline void ns8250_port_interrupts_enable(ioport8_t *port)
    393 {
    394         pio_write_8(port + 1, 0x1);     /* Interrupt when data received. */
    395         pio_write_8(port + 4, 0xB);
     459static inline void ns8250_port_interrupts_enable(ns8250_regs_t *regs)
     460{
     461        /* Interrupt when data received. */
     462        pio_write_8(&regs->ier, NS8250_IER_RXREADY);
     463        pio_write_8(&regs->mcr, NS8250_MCR_DTR | NS8250_MCR_RTS
     464            | NS8250_MCR_OUT2);
    396465}
    397466
     
    400469 * @param port          The base address of the serial port device's ports
    401470 */
    402 static inline void ns8250_port_interrupts_disable(ioport8_t *port)
    403 {
    404         pio_write_8(port + 1, 0x0);     /* Disable all interrupts. */
     471static inline void ns8250_port_interrupts_disable(ns8250_regs_t *regs)
     472{
     473        pio_write_8(&regs->ier, 0x0);   /* Disable all interrupts. */
    405474}
    406475
     
    431500
    432501        /* Enable interrupt on the serial port. */
    433         ns8250_port_interrupts_enable(ns->port);
     502        ns8250_port_interrupts_enable(ns->regs);
    434503       
    435504        return EOK;
     
    443512 * @param port          The base address of the serial port device's ports.
    444513 */
    445 static inline void enable_dlab(ioport8_t *port)
    446 {
    447         uint8_t val = pio_read_8(port + 3);
    448         pio_write_8(port + 3, val | DLAB_MASK);
     514static inline void enable_dlab(ns8250_regs_t *regs)
     515{
     516        uint8_t val = pio_read_8(&regs->lcr);
     517        pio_write_8(&regs->lcr, val | NS8250_LCR_DLAB);
    449518}
    450519
     
    453522 * @param port          The base address of the serial port device's ports.
    454523 */
    455 static inline void clear_dlab(ioport8_t *port)
    456 {
    457         uint8_t val = pio_read_8(port + 3);
    458         pio_write_8(port + 3, val & (~DLAB_MASK));
     524static inline void clear_dlab(ns8250_regs_t *regs)
     525{
     526        uint8_t val = pio_read_8(&regs->lcr);
     527        pio_write_8(&regs->lcr, val & (~NS8250_LCR_DLAB));
    459528}
    460529
     
    466535 *                      if the specified baud_rate is not valid).
    467536 */
    468 static int ns8250_port_set_baud_rate(ioport8_t *port, unsigned int baud_rate)
     537static int ns8250_port_set_baud_rate(ns8250_regs_t *regs, unsigned int baud_rate)
    469538{
    470539        uint16_t divisor;
     
    482551       
    483552        /* Enable DLAB to be able to access baud rate divisor. */
    484         enable_dlab(port);
     553        enable_dlab(regs);
    485554       
    486555        /* Set divisor low byte. */
    487         pio_write_8(port + 0, div_low);
     556        pio_write_8(&regs->data, div_low);
    488557        /* Set divisor high byte. */
    489         pio_write_8(port + 1, div_high);
    490        
    491         clear_dlab(port);
     558        pio_write_8(&regs->ier, div_high);
     559       
     560        clear_dlab(regs);
    492561       
    493562        return EOK;
     
    499568 * @param baud_rate     The ouput parameter to which the baud rate is stored.
    500569 */
    501 static unsigned int ns8250_port_get_baud_rate(ioport8_t *port)
     570static unsigned int ns8250_port_get_baud_rate(ns8250_regs_t *regs)
    502571{
    503572        uint16_t divisor;
     
    505574       
    506575        /* Enable DLAB to be able to access baud rate divisor. */
    507         enable_dlab(port);
     576        enable_dlab(regs);
    508577       
    509578        /* Get divisor low byte. */
    510         div_low = pio_read_8(port + 0);
     579        div_low = pio_read_8(&regs->data);
    511580        /* Get divisor high byte. */
    512         div_high = pio_read_8(port + 1);
    513        
    514         clear_dlab(port);
     581        div_high = pio_read_8(&regs->ier);
     582       
     583        clear_dlab(regs);
    515584       
    516585        divisor = (div_high << 8) | div_low;
     
    525594 * @param stop_bits     The number of stop bits used (one or two).
    526595 */
    527 static void ns8250_port_get_com_props(ioport8_t *port, unsigned int *parity,
     596static void ns8250_port_get_com_props(ns8250_regs_t *regs, unsigned int *parity,
    528597    unsigned int *word_length, unsigned int *stop_bits)
    529598{
    530599        uint8_t val;
    531600       
    532         val = pio_read_8(port + 3);
    533         *parity = ((val >> 3) & 7);
     601        val = pio_read_8(&regs->lcr);
     602        *parity = ((val >> NS8250_LCR_PARITY) & 7);
    534603       
    535604        switch (val & 3) {
     
    548617        }
    549618       
    550         if ((val >> 2) & 1)
     619        if ((val >> NS8250_LCR_STOPBITS) & 1)
    551620                *stop_bits = 2;
    552621        else
     
    562631 *                      is invalid.
    563632 */
    564 static int ns8250_port_set_com_props(ioport8_t *port, unsigned int parity,
     633static int ns8250_port_set_com_props(ns8250_regs_t *regs, unsigned int parity,
    565634    unsigned int word_length, unsigned int stop_bits)
    566635{
     
    586655        switch (stop_bits) {
    587656        case 1:
    588                 val |= ONE_STOP_BIT << 2;
     657                val |= ONE_STOP_BIT << NS8250_LCR_STOPBITS;
    589658                break;
    590659        case 2:
    591                 val |= TWO_STOP_BITS << 2;
     660                val |= TWO_STOP_BITS << NS8250_LCR_STOPBITS;
    592661                break;
    593662        default:
     
    601670        case SERIAL_MARK_PARITY:
    602671        case SERIAL_SPACE_PARITY:
    603                 val |= parity << 3;
     672                val |= parity << NS8250_LCR_PARITY;
    604673                break;
    605674        default:
     
    607676        }
    608677       
    609         pio_write_8(port + 3, val);
     678        pio_write_8(&regs->lcr, val);
    610679       
    611680        return EOK;
     
    620689static void ns8250_initialize_port(ns8250_t *ns)
    621690{
    622         ioport8_t *port = ns->port;
    623        
    624691        /* Disable interrupts. */
    625         ns8250_port_interrupts_disable(port);
     692        ns8250_port_interrupts_disable(ns->regs);
    626693        /* Set baud rate. */
    627         ns8250_port_set_baud_rate(port, 38400);
     694        ns8250_port_set_baud_rate(ns->regs, 38400);
    628695        /* 8 bits, no parity, two stop bits. */
    629         ns8250_port_set_com_props(port, SERIAL_NO_PARITY, 8, 2);
     696        ns8250_port_set_com_props(ns->regs, SERIAL_NO_PARITY, 8, 2);
    630697        /* Enable FIFO, clear them, with 14-byte threshold. */
    631         pio_write_8(port + 2, 0xC7);
     698        pio_write_8(&ns->regs->iid, NS8250_FCR_FIFOENABLE
     699            | NS8250_FCR_RXFIFORESET | NS8250_FCR_TXFIFORESET
     700            | NS8250_FCR_RXTRIGGERLOW | NS8250_FCR_RXTRIGGERHI);
    632701        /*
    633702         * RTS/DSR set (Request to Send and Data Terminal Ready lines enabled),
    634703         * Aux Output2 set - needed for interrupts.
    635704         */
    636         pio_write_8(port + 4, 0x0B);
     705        pio_write_8(&ns->regs->mcr, NS8250_MCR_DTR | NS8250_MCR_RTS
     706            | NS8250_MCR_OUT2);
    637707}
    638708
     
    644714{
    645715        /* Disable FIFO */
    646         pio_write_8(ns->port + 2, 0x00);
     716        pio_write_8(&ns->regs->iid, 0x00);
    647717        /* Disable DTR, RTS, OUT1, OUT2 (int. enable) */
    648         pio_write_8(ns->port + 4, 0x00);
     718        pio_write_8(&ns->regs->mcr, 0x00);
    649719        /* Disable all interrupts from the port */
    650         ns8250_port_interrupts_disable(ns->port);
     720        ns8250_port_interrupts_disable(ns->regs);
    651721}
    652722
     
    658728static void ns8250_read_from_device(ns8250_t *ns)
    659729{
    660         ioport8_t *port = ns->port;
     730        ns8250_regs_t *regs = ns->regs;
    661731        bool cont = true;
    662732       
     
    664734                fibril_mutex_lock(&ns->mutex);
    665735               
    666                 cont = ns8250_received(port);
     736                cont = ns8250_received(regs);
    667737                if (cont) {
    668                         uint8_t val = ns8250_read_8(port);
     738                        uint8_t val = ns8250_read_8(regs);
    669739                       
    670740                        if (ns->client_connected) {
     
    896966{
    897967        ns8250_t *data = (ns8250_t *) dev->driver_data;
    898         ioport8_t *port = data->port;
     968        ns8250_regs_t *regs = data->regs;
    899969       
    900970        fibril_mutex_lock(&data->mutex);
    901         ns8250_port_interrupts_disable(port);
    902         *baud_rate = ns8250_port_get_baud_rate(port);
    903         ns8250_port_get_com_props(port, parity, word_length, stop_bits);
    904         ns8250_port_interrupts_enable(port);
     971        ns8250_port_interrupts_disable(regs);
     972        *baud_rate = ns8250_port_get_baud_rate(regs);
     973        ns8250_port_get_com_props(regs, parity, word_length, stop_bits);
     974        ns8250_port_interrupts_enable(regs);
    905975        fibril_mutex_unlock(&data->mutex);
    906976       
     
    927997       
    928998        ns8250_t *data = (ns8250_t *) dev->driver_data;
    929         ioport8_t *port = data->port;
     999        ns8250_regs_t *regs = data->regs;
    9301000        int ret;
    9311001       
    9321002        fibril_mutex_lock(&data->mutex);
    933         ns8250_port_interrupts_disable(port);
    934         ret = ns8250_port_set_baud_rate(port, baud_rate);
     1003        ns8250_port_interrupts_disable(regs);
     1004        ret = ns8250_port_set_baud_rate(regs, baud_rate);
    9351005        if (ret == EOK)
    936                 ret = ns8250_port_set_com_props(port, parity, word_length, stop_bits);
    937         ns8250_port_interrupts_enable(port);
     1006                ret = ns8250_port_set_com_props(regs, parity, word_length, stop_bits);
     1007        ns8250_port_interrupts_enable(regs);
    9381008        fibril_mutex_unlock(&data->mutex);
    9391009       
  • uspace/drv/char/ps2mouse/main.c

    rec351c3 r85d2fe2e  
    3535#include <libarch/inttypes.h>
    3636#include <ddf/driver.h>
    37 #include <devman.h>
    3837#include <device/hw_res_parsed.h>
    3938#include <errno.h>
  • uspace/drv/char/xtkbd/main.c

    rec351c3 r85d2fe2e  
    3535#include <libarch/inttypes.h>
    3636#include <ddf/driver.h>
    37 #include <devman.h>
    3837#include <device/hw_res_parsed.h>
    3938#include <errno.h>
  • uspace/drv/infrastructure/root/root.c

    rec351c3 r85d2fe2e  
    5353#include <ddf/driver.h>
    5454#include <ddf/log.h>
    55 #include <devman.h>
    56 #include <ipc/devman.h>
    5755
    5856#define NAME "root"
  • uspace/drv/infrastructure/rootpc/rootpc.c

    rec351c3 r85d2fe2e  
    4848#include <ddf/driver.h>
    4949#include <ddf/log.h>
    50 #include <devman.h>
    51 #include <ipc/devman.h>
    5250#include <ipc/dev_iface.h>
    5351#include <ops/hw_res.h>
  • uspace/drv/nic/e1k/e1k.c

    rec351c3 r85d2fe2e  
    4646#include <ddf/log.h>
    4747#include <ddf/interrupt.h>
    48 #include <devman.h>
    4948#include <device/hw_res_parsed.h>
    5049#include <device/pci.h>
  • uspace/lib/net/generic/net_remote.c

    rec351c3 r85d2fe2e  
    4040#include <malloc.h>
    4141#include <async.h>
    42 #include <devman.h>
    4342#include <generic.h>
    4443#include <net/modules.h>
  • uspace/lib/usb/src/ddfiface.c

    rec351c3 r85d2fe2e  
    3333 * Implementations of DDF interfaces functions (actual implementation).
    3434 */
    35 #include <ipc/devman.h>
    3635#include <devman.h>
    3736#include <async.h>
  • uspace/lib/usbvirt/src/ipc_dev.c

    rec351c3 r85d2fe2e  
    3838#include <assert.h>
    3939#include <async.h>
    40 #include <devman.h>
    4140#include <usbvirt/device.h>
    4241#include <usbvirt/ipc.h>
  • uspace/lib/usbvirt/src/ipc_hc.c

    rec351c3 r85d2fe2e  
    3838#include <assert.h>
    3939#include <async.h>
    40 #include <devman.h>
    4140#include <usbvirt/device.h>
    4241#include <usbvirt/ipc.h>
  • version

    rec351c3 r85d2fe2e  
    4646
    4747NAME = Sashimi
     48COPYRIGHT = Copyright (c) 2001-2012 HelenOS project
Note: See TracChangeset for help on using the changeset viewer.