Changes in uspace/drv/char/ns8250/ns8250.c [956d4281:c4e30607] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/char/ns8250/ns8250.c
r956d4281 rc4e30607 57 57 #include <ops/char_dev.h> 58 58 59 #include <ns.h> 60 #include <ipc/services.h> 61 #include <ipc/irc.h> 59 #include <irc.h> 62 60 #include <device/hw_res.h> 63 61 #include <ipc/serial_ctl.h> … … 165 163 int irq; 166 164 /** The base i/o address of the devices registers. */ 167 uint 32_t io_addr;165 uintptr_t io_addr; 168 166 /** The i/o port used to access the serial ports registers. */ 169 167 ioport8_t *port; … … 332 330 333 331 /* Gain control over port's registers. */ 334 if (pio_enable((void *) (uintptr_t)ns->io_addr, REG_COUNT,332 if (pio_enable((void *) ns->io_addr, REG_COUNT, 335 333 (void **) &ns->port)) { 336 ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIx 32334 ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIxn 337 335 " for device %s.", ns->io_addr, ddf_dev_get_name(ns->dev)); 338 336 return false; … … 393 391 394 392 /* Connect to the parent's driver. */ 395 parent_sess = ddf_dev_parent_sess_create(ns->dev , EXCHANGE_SERIALIZE);393 parent_sess = ddf_dev_parent_sess_create(ns->dev); 396 394 if (parent_sess == NULL) { 397 395 ddf_msg(LVL_ERROR, "Failed to connect to parent driver of " … … 434 432 ioport = true; 435 433 ddf_msg(LVL_NOTE, "Device %s was assigned I/O address = " 436 "0x% x.", ddf_dev_get_name(ns->dev), ns->io_addr);434 "0x%#" PRIxn ".", ddf_dev_get_name(ns->dev), ns->io_addr); 437 435 break; 438 436 … … 488 486 static int ns8250_interrupt_enable(ns8250_t *ns) 489 487 { 490 /* 491 * Enable interrupt using IRC service. 492 * TODO: This is a temporary solution until the device framework 493 * takes care of this itself. 494 */ 495 async_sess_t *irc_sess = service_connect_blocking(EXCHANGE_SERIALIZE, 496 SERVICE_IRC, 0, 0); 497 if (!irc_sess) { 488 /* Enable interrupt using IRC service. */ 489 int rc = irc_enable_interrupt(ns->irq); 490 if (rc != EOK) 498 491 return EIO; 499 } 500 501 async_exch_t *exch = async_exchange_begin(irc_sess); 502 if (!exch) { 503 return EIO; 504 } 505 async_msg_1(exch, IRC_ENABLE_INTERRUPT, ns->irq); 506 async_exchange_end(exch); 507 492 508 493 /* Read LSR to clear possible previous LSR interrupt */ 509 494 pio_read_8(&ns->regs->lsr); 510 495 511 496 /* Enable interrupt on the serial port. */ 512 497 ns8250_port_interrupts_enable(ns->regs); … … 779 764 * data and reading the line status register. 780 765 * 781 * @param dev The serial port device. 782 */ 783 static inline void ns8250_interrupt_handler(ddf_dev_t *dev, ipc_callid_t iid, 784 ipc_call_t *icall) 766 * @param dev The serial port device. 767 * 768 */ 769 static inline void ns8250_interrupt_handler(ipc_callid_t iid, ipc_call_t *icall, 770 ddf_dev_t *dev) 785 771 { 786 772 ns8250_t *ns = dev_ns8250(dev); 787 788 773 uint8_t iir = pio_read_8(&ns->regs->iid); 789 774 if ((iir & NS8250_IID_CAUSE_MASK) == NS8250_IID_CAUSE_RXSTATUS) { … … 795 780 796 781 ns8250_read_from_device(ns); 782 irc_disable_interrupt(ns->irq); 797 783 } 798 784 … … 871 857 } 872 858 need_unreg_intr_handler = true; 873 859 874 860 /* Enable interrupt. */ 875 861 rc = ns8250_interrupt_enable(ns);
Note:
See TracChangeset
for help on using the changeset viewer.