arch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. .TH ARCH 3
  2. .SH NAME
  3. arch \- architecture-specific information and control
  4. .SH SYNOPSIS
  5. .nf
  6. .B bind -a #P /dev
  7. .B /dev/cputype
  8. .B /dev/ioalloc
  9. .B /dev/iob
  10. .B /dev/iol
  11. .B /dev/iow
  12. .B /dev/irqalloc
  13. .SH DESCRIPTION
  14. .PP
  15. This device presents textual information about PC hardware and allows
  16. user-level control of the I/O ports on x86-class and DEC Alpha machines.
  17. .PP
  18. Reads from
  19. .I cputype
  20. recover the processor type and clock rate.
  21. .PP
  22. Reads from
  23. .I ioalloc
  24. return I/O ranges used by each device, one line
  25. per range. Each line contains three fields separated by white space: first address
  26. in hexadecimal,
  27. last address, name of device.
  28. .PP
  29. Reads from
  30. .I irqalloc
  31. return the enabled interrupts, one line per
  32. interrupt. Each line contains three fields separated by white space:
  33. the trap number, the IRQ it is assigned to, and the name of
  34. the device using it.
  35. .PP
  36. Reads and writes to
  37. .IR iob ,
  38. .IR iow ,
  39. and
  40. .I iol
  41. cause 8-bit wide, 16-bit wide, and 32-bit wide requests to
  42. I/O ports.
  43. The port accessed is determined by the byte offset of the
  44. file descriptor.
  45. .SH EXAMPLE
  46. The following code reads from an x86 byte I/O port.
  47. .IP
  48. .EX
  49. uchar
  50. inportb(long port)
  51. {
  52. uchar data;
  53. if(iobfd == -1)
  54. iobfd = open("#P/iob", ORDWR);
  55. seek(iobfd, port, 0);
  56. if(read(iobfd, &data, sizeof(data)) != sizeof(data))
  57. sysfatal("inportb(0x%4.4x): %r\en", port);
  58. return data;
  59. }
  60. .EE
  61. .SH SOURCE
  62. .B /sys/src/9/pc/devarch.c