uartp8250 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. .TH UARTP8250 9
  2. .SH NAME
  3. uartp8250 \- portable 8250-style uarts
  4. .SH SYNOPSIS
  5. .EX
  6. #include "../port/uartp8250.h"
  7. typedef struct Ctlr Ctlr;
  8. struct Ctlr {
  9. void *reg;
  10. uint (*get)(void*, int);
  11. void (*set)(void*, int, uint);
  12. int (*itr)(Uart*, int);
  13. int irq;
  14. int tbdf;
  15. int iena;
  16. uchar sticky[8];
  17. Lock;
  18. int hasfifo;
  19. int checkfifo;
  20. int fena;
  21. };
  22. .EE
  23. .PP
  24. .ta \w'\fLPhysUart 'u
  25. .PP
  26. .B
  27. PhysUart p8250physuart;
  28. .PP
  29. .B
  30. void i8250interrupt(Ureg*, void*);
  31. .SH DESCRIPTION
  32. P8250 provides a portable interface for 8250-style uarts.
  33. All necessary functions are provided except for
  34. .BR get ,
  35. .BR set ,
  36. and
  37. .BR itr .
  38. These functions get or set an 8250 register or enable
  39. or disable the interrupt, respectively. Since the
  40. .B PhysUart
  41. structure is required for device discovery, a dummy
  42. version needs to be provided
  43. .IP
  44. .EX
  45. PhysUart myphysuart = {
  46. .name = "myuart",
  47. .pnp = mypnp,
  48. };
  49. .EE
  50. .PP
  51. On entry of the pnp function, the
  52. .B PhysUart
  53. can be filled out:
  54. .EX
  55. memmove(&myphysuart, &p8250physuart, sizeof(PhysUart));
  56. myphysuart.name = "myuart";
  57. myphysuart.pnp = mypnp;
  58. .EE
  59. .PP
  60. as can the
  61. .B Ctlr
  62. structure, which is assigned to
  63. .BR "uart->regs" .
  64. .SH SOURCE
  65. .B /sys/src/9/port/uartp8250.h
  66. .br
  67. .B /sys/src/9/port/uartp8250.c
  68. .SH "SEE ALSO"
  69. .IR uart (3).
  70. .SH BUGS
  71. The
  72. .B PhysUart
  73. is uncomfortable to use for device discovery.