Changes in uspace/drv/ns8250/ns8250.c [fc51296:af6b5157] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ns8250/ns8250.c
rfc51296 raf6b5157 55 55 #include <ddf/driver.h> 56 56 #include <ddf/interrupt.h> 57 #include <ddf/log.h>58 57 #include <ops/char_dev.h> 59 58 … … 276 275 static bool ns8250_pio_enable(ns8250_t *ns) 277 276 { 278 ddf_msg(LVL_DEBUG, "ns8250_pio_enable %s\n", ns->dev->name);277 printf(NAME ": ns8250_pio_enable %s\n", ns->dev->name); 279 278 280 279 /* Gain control over port's registers. */ 281 280 if (pio_enable((void *)(uintptr_t) ns->io_addr, REG_COUNT, 282 281 (void **) &ns->port)) { 283 ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIx32284 " 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); 285 284 return false; 286 285 } … … 296 295 static bool ns8250_dev_probe(ns8250_t *ns) 297 296 { 298 ddf_msg(LVL_DEBUG, "ns8250_dev_probe %s\n", ns->dev->name);297 printf(NAME ": ns8250_dev_probe %s\n", ns->dev->name); 299 298 300 299 ioport8_t *port_addr = ns->port; … … 314 313 pio_write_8(port_addr + 4, olddata); 315 314 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); 320 317 321 318 return res; … … 329 326 static int ns8250_dev_initialize(ns8250_t *ns) 330 327 { 331 ddf_msg(LVL_DEBUG, "ns8250_dev_initialize %s\n", ns->dev->name);328 printf(NAME ": ns8250_dev_initialize %s\n", ns->dev->name); 332 329 333 330 int ret = EOK; … … 340 337 IPC_FLAG_BLOCKING); 341 338 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 " 343 340 "device %s.\n", ns->dev->name); 344 341 ret = ns->dev->parent_phone; … … 349 346 ret = hw_res_get_resource_list(ns->dev->parent_phone, &hw_resources); 350 347 if (ret != EOK) { 351 ddf_msg(LVL_ERROR, "Failed to get HW resources fordevice "348 printf(NAME ": failed to get hw resources for the device " 352 349 "%s.\n", ns->dev->name); 353 350 goto failed; … … 365 362 ns->irq = res->res.interrupt.irq; 366 363 irq = true; 367 ddf_msg(LVL_NOTE, "Device %swas asigned irq = 0x%x.\n",364 printf(NAME ": the %s device was asigned irq = 0x%x.\n", 368 365 ns->dev->name, ns->irq); 369 366 break; … … 372 369 ns->io_addr = res->res.io_range.address; 373 370 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); 376 373 ret = ELIMIT; 377 374 goto failed; 378 375 } 379 376 ioport = true; 380 ddf_msg(LVL_NOTE, "Device %s was asigned I/Oaddress = "377 printf(NAME ": the %s device was asigned i/o address = " 381 378 "0x%x.\n", ns->dev->name, ns->io_addr); 382 379 break; … … 388 385 389 386 if (!irq || !ioport) { 390 ddf_msg(LVL_ERROR, "Missing HW resource(s) fordevice %s.\n",387 printf(NAME ": missing hw resource(s) for the device %s.\n", 391 388 ns->dev->name); 392 389 ret = ENOENT; … … 473 470 474 471 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); 477 474 return EINVAL; 478 475 } … … 657 654 if (ns->client_connected) { 658 655 if (!buf_push_back(&ns->input_buffer, val)) { 659 ddf_msg(LVL_WARN, "Buffer overflow on "656 printf(NAME ": buffer overflow on " 660 657 "%s.\n", ns->dev->name); 661 658 } else { 662 ddf_msg(LVL_DEBUG2, "Character %c saved "659 printf(NAME ": the character %c saved " 663 660 "to the buffer of %s.\n", 664 661 val, ns->dev->name); … … 717 714 int rc; 718 715 719 ddf_msg(LVL_DEBUG, "ns8250_add_device %s (handle = %d)\n",716 printf(NAME ": ns8250_add_device %s (handle = %d)\n", 720 717 dev->name, (int) dev->handle); 721 718 … … 752 749 /* Register interrupt handler. */ 753 750 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"); 755 752 rc = EADDRNOTAVAIL; 756 753 goto fail; … … 760 757 rc = ns8250_interrupt_enable(ns); 761 758 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 = " 763 760 "%d.\n", rc); 764 761 goto fail; … … 767 764 fun = ddf_fun_create(dev, fun_exposed, "a"); 768 765 if (fun == NULL) { 769 ddf_msg(LVL_ERROR, "Failedcreating function.\n");766 printf(NAME ": error creating function.\n"); 770 767 goto fail; 771 768 } … … 775 772 rc = ddf_fun_bind(fun); 776 773 if (rc != EOK) { 777 ddf_msg(LVL_ERROR, "Failedbinding function.\n");774 printf(NAME ": error binding function.\n"); 778 775 goto fail; 779 776 } … … 783 780 ddf_fun_add_to_class(fun, "serial"); 784 781 785 ddf_msg(LVL_NOTE, "Device %ssuccessfully initialized.\n",782 printf(NAME ": the %s device has been successfully initialized.\n", 786 783 dev->name); 787 784 … … 865 862 fibril_mutex_unlock(&data->mutex); 866 863 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 " 868 865 "length %d, stop bits %d\n", *baud_rate, *parity, *word_length, 869 866 *stop_bits); … … 882 879 unsigned int parity, unsigned int word_length, unsigned int stop_bits) 883 880 { 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 " 885 882 "length %d, stop bits %d\n", baud_rate, parity, word_length, 886 883 stop_bits); … … 943 940 static void ns8250_init(void) 944 941 { 945 ddf_log_init(NAME, LVL_ERROR);946 947 942 ns8250_dev_ops.open = &ns8250_open; 948 943 ns8250_dev_ops.close = &ns8250_close;
Note:
See TracChangeset
for help on using the changeset viewer.