/* ** Name: void outw(unsigned short int port, unsigned long value); ** Function: Writes a word to specified i/o port. */ PUBLIC void outw(unsigned short port, unsigned long value) { int rc; if ((rc = sys_outw(port, value)) != OK) warning("outw", rc); return; }
static void my_outw(u16_t port, u16_t value) { int s; if ((s = sys_outw(port, value)) != OK) printf("RTL8169: warning, sys_outw failed: %d\n", s); }
ACPI_STATUS AcpiOsWritePort ( ACPI_IO_ADDRESS Address, UINT32 Value, UINT32 Width) { switch (Width) { case 8: sys_outb(Address, Value); break; case 16: sys_outw(Address, Value); break; case 32: sys_outl(Address, Value); break; } return AE_OK; return AE_OK; }
ACPI_STATUS AcpiOsWritePort ( ACPI_IO_ADDRESS Address, UINT32 Value, UINT32 Width) { switch (Width) { case 8: sys_outb(Address, Value); break; case 16: sys_outw(Address, Value); break; case 32: sys_outl(Address, Value); break; default: panic("unsupported width: %d", Width); } return AE_OK; }
static void pci_outw(u16_t port, u16_t value) { int s; if ((s=sys_outw(port, value)) !=OK) printf("ACPI: warning, sys_outw failed: %d\n", s); }
/* * Transfer words from a source buffer to hardware using port-based I/O. */ void netdriver_portoutw(struct netdriver_data * data, size_t off, long port, size_t size) { uint8_t buf[2]; size_t chunk; unsigned int i; int r, odd_byte; off = netdriver_prepare_copy(data, off, size, &i); odd_byte = 0; while (size > 0) { chunk = data->iovec[i].iov_size - off; if (chunk > size) chunk = size; assert(chunk > 0); if (odd_byte) { if ((r = sys_safecopyfrom(data->endpt, data->iovec[i].iov_grant, off, (vir_bytes)&buf[1], 1)) != OK) panic("netdriver: unable to copy data: %d", r); if ((r = sys_outw(port, *(uint16_t *)buf)) != OK) panic("netdriver: port output failed: %d", r); off++; size--; chunk--; } odd_byte = chunk & 1; chunk -= odd_byte; if (chunk > 0) { if ((r = sys_safe_outsw(port, data->endpt, data->iovec[i].iov_grant, off, chunk)) != OK) panic("netdriver: port output failed: %d", r); off += chunk; size -= chunk; } if (odd_byte) { if ((r = sys_safecopyfrom(data->endpt, data->iovec[i].iov_grant, off, (vir_bytes)&buf[0], 1)) != OK) panic("netdriver: unable to copy data: %d", r); size--; } i++; off = 0; } if (odd_byte) { buf[1] = 0; if ((r = sys_outw(port, *(uint16_t *)buf)) != OK) panic("netdriver: port output failed: %d", r); } }
PUBLIC void pci_outw(U16_t port, U16_t value) { int s; if ((s=sys_outw(port, value)) !=OK) printf("%s: warning, sys_outw failed: %d\n", DRIVER_NAME, s); }