Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ns8250/ns8250.c

    rfc51296 raf6b5157  
    5555#include <ddf/driver.h>
    5656#include <ddf/interrupt.h>
    57 #include <ddf/log.h>
    5857#include <ops/char_dev.h>
    5958
     
    276275static bool ns8250_pio_enable(ns8250_t *ns)
    277276{
    278         ddf_msg(LVL_DEBUG, "ns8250_pio_enable %s\n", ns->dev->name);
     277        printf(NAME ": ns8250_pio_enable %s\n", ns->dev->name);
    279278       
    280279        /* Gain control over port's registers. */
    281280        if (pio_enable((void *)(uintptr_t) ns->io_addr, REG_COUNT,
    282281            (void **) &ns->port)) {
    283                 ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIx32
    284                     " for device %s.\n", ns->io_addr, ns->dev->name);
     282                printf(NAME ": error - cannot gain the port %#" PRIx32 " for device "
     283                    "%s.\n", ns->io_addr, ns->dev->name);
    285284                return false;
    286285        }
     
    296295static bool ns8250_dev_probe(ns8250_t *ns)
    297296{
    298         ddf_msg(LVL_DEBUG, "ns8250_dev_probe %s\n", ns->dev->name);
     297        printf(NAME ": ns8250_dev_probe %s\n", ns->dev->name);
    299298       
    300299        ioport8_t *port_addr = ns->port;
     
    314313        pio_write_8(port_addr + 4, olddata);
    315314       
    316         if (!res) {
    317                 ddf_msg(LVL_DEBUG, "Device %s is not present.\n",
    318                     ns->dev->name);
    319         }
     315        if (!res)
     316                printf(NAME ": device %s is not present.\n", ns->dev->name);
    320317       
    321318        return res;
     
    329326static int ns8250_dev_initialize(ns8250_t *ns)
    330327{
    331         ddf_msg(LVL_DEBUG, "ns8250_dev_initialize %s\n", ns->dev->name);
     328        printf(NAME ": ns8250_dev_initialize %s\n", ns->dev->name);
    332329       
    333330        int ret = EOK;
     
    340337            IPC_FLAG_BLOCKING);
    341338        if (ns->dev->parent_phone < 0) {
    342                 ddf_msg(LVL_ERROR, "Failed to connect to parent driver of "
     339                printf(NAME ": failed to connect to the parent driver of the "
    343340                    "device %s.\n", ns->dev->name);
    344341                ret = ns->dev->parent_phone;
     
    349346        ret = hw_res_get_resource_list(ns->dev->parent_phone, &hw_resources);
    350347        if (ret != EOK) {
    351                 ddf_msg(LVL_ERROR, "Failed to get HW resources for device "
     348                printf(NAME ": failed to get hw resources for the device "
    352349                    "%s.\n", ns->dev->name);
    353350                goto failed;
     
    365362                        ns->irq = res->res.interrupt.irq;
    366363                        irq = true;
    367                         ddf_msg(LVL_NOTE, "Device %s was asigned irq = 0x%x.\n",
     364                        printf(NAME ": the %s device was asigned irq = 0x%x.\n",
    368365                            ns->dev->name, ns->irq);
    369366                        break;
     
    372369                        ns->io_addr = res->res.io_range.address;
    373370                        if (res->res.io_range.size < REG_COUNT) {
    374                                 ddf_msg(LVL_ERROR, "I/O range assigned to "
    375                                     "device %s is too small.\n", ns->dev->name);
     371                                printf(NAME ": i/o range assigned to the device "
     372                                    "%s is too small.\n", ns->dev->name);
    376373                                ret = ELIMIT;
    377374                                goto failed;
    378375                        }
    379376                        ioport = true;
    380                         ddf_msg(LVL_NOTE, "Device %s was asigned I/O address = "
     377                        printf(NAME ": the %s device was asigned i/o address = "
    381378                            "0x%x.\n", ns->dev->name, ns->io_addr);
    382379                        break;
     
    388385       
    389386        if (!irq || !ioport) {
    390                 ddf_msg(LVL_ERROR, "Missing HW resource(s) for device %s.\n",
     387                printf(NAME ": missing hw resource(s) for the device %s.\n",
    391388                    ns->dev->name);
    392389                ret = ENOENT;
     
    473470       
    474471        if (baud_rate < 50 || MAX_BAUD_RATE % baud_rate != 0) {
    475                 ddf_msg(LVL_ERROR, "Invalid baud rate %d requested.\n",
    476                     baud_rate);
     472                printf(NAME ": error - somebody tried to set invalid baud rate "
     473                    "%d\n", baud_rate);
    477474                return EINVAL;
    478475        }
     
    657654                        if (ns->client_connected) {
    658655                                if (!buf_push_back(&ns->input_buffer, val)) {
    659                                         ddf_msg(LVL_WARN, "Buffer overflow on "
     656                                        printf(NAME ": buffer overflow on "
    660657                                            "%s.\n", ns->dev->name);
    661658                                } else {
    662                                         ddf_msg(LVL_DEBUG2, "Character %c saved "
     659                                        printf(NAME ": the character %c saved "
    663660                                            "to the buffer of %s.\n",
    664661                                            val, ns->dev->name);
     
    717714        int rc;
    718715       
    719         ddf_msg(LVL_DEBUG, "ns8250_add_device %s (handle = %d)\n",
     716        printf(NAME ": ns8250_add_device %s (handle = %d)\n",
    720717            dev->name, (int) dev->handle);
    721718       
     
    752749        /* Register interrupt handler. */
    753750        if (ns8250_register_interrupt_handler(ns) != EOK) {
    754                 ddf_msg(LVL_ERROR, "Failed to register interrupt handler.\n");
     751                printf(NAME ": failed to register interrupt handler.\n");
    755752                rc = EADDRNOTAVAIL;
    756753                goto fail;
     
    760757        rc = ns8250_interrupt_enable(ns);
    761758        if (rc != EOK) {
    762                 ddf_msg(LVL_ERROR, "Failed to enable the interrupt. Error code = "
     759                printf(NAME ": failed to enable the interrupt. Error code = "
    763760                    "%d.\n", rc);
    764761                goto fail;
     
    767764        fun = ddf_fun_create(dev, fun_exposed, "a");
    768765        if (fun == NULL) {
    769                 ddf_msg(LVL_ERROR, "Failed creating function.\n");
     766                printf(NAME ": error creating function.\n");
    770767                goto fail;
    771768        }
     
    775772        rc = ddf_fun_bind(fun);
    776773        if (rc != EOK) {
    777                 ddf_msg(LVL_ERROR, "Failed binding function.\n");
     774                printf(NAME ": error binding function.\n");
    778775                goto fail;
    779776        }
     
    783780        ddf_fun_add_to_class(fun, "serial");
    784781       
    785         ddf_msg(LVL_NOTE, "Device %s successfully initialized.\n",
     782        printf(NAME ": the %s device has been successfully initialized.\n",
    786783            dev->name);
    787784       
     
    865862        fibril_mutex_unlock(&data->mutex);
    866863       
    867         ddf_msg(LVL_DEBUG, "ns8250_get_props: baud rate %d, parity 0x%x, word "
     864        printf(NAME ": ns8250_get_props: baud rate %d, parity 0x%x, word "
    868865            "length %d, stop bits %d\n", *baud_rate, *parity, *word_length,
    869866            *stop_bits);
     
    882879    unsigned int parity, unsigned int word_length, unsigned int stop_bits)
    883880{
    884         ddf_msg(LVL_DEBUG, "ns8250_set_props: baud rate %d, parity 0x%x, word "
     881        printf(NAME ": ns8250_set_props: baud rate %d, parity 0x%x, word "
    885882            "length %d, stop bits %d\n", baud_rate, parity, word_length,
    886883            stop_bits);
     
    943940static void ns8250_init(void)
    944941{
    945         ddf_log_init(NAME, LVL_ERROR);
    946        
    947942        ns8250_dev_ops.open = &ns8250_open;
    948943        ns8250_dev_ops.close = &ns8250_close;
Note: See TracChangeset for help on using the changeset viewer.