mailbox.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*++
  2. Copyright (c) 2015 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. mailbox.h
  5. Abstract:
  6. This header contains definitions for the AM335x mailbox facilities.
  7. Author:
  8. Evan Green 1-Oct-2015
  9. --*/
  10. //
  11. // ------------------------------------------------------------------- Includes
  12. //
  13. //
  14. // ---------------------------------------------------------------- Definitions
  15. //
  16. //
  17. // Define the mailbox number reserved for the Cortex M3.
  18. //
  19. #define AM335_WAKEM3_MAILBOX 0
  20. //
  21. // ------------------------------------------------------ Data Type Definitions
  22. //
  23. /*++
  24. Structure Description:
  25. This structure defines the context for the AM33xx mailbox controller.
  26. Members:
  27. ControllerBase - Stores the virtual address of the controller registers.
  28. InterruptLine - Stores the interrupt line the controller is connected to.
  29. InterruptVector - Stores the interrupt vector the controller interrupts on.
  30. InterruptHandle - Stores the interrupt connection handle.
  31. --*/
  32. typedef struct _AM3_MAILBOX {
  33. PVOID ControllerBase;
  34. ULONGLONG InterruptLine;
  35. ULONGLONG InterruptVector;
  36. HANDLE InterruptHandle;
  37. } AM3_MAILBOX, *PAM3_MAILBOX;
  38. //
  39. // -------------------------------------------------------------------- Globals
  40. //
  41. //
  42. // -------------------------------------------------------- Function Prototypes
  43. //
  44. KSTATUS
  45. Am3MailboxInitialize (
  46. PAM3_MAILBOX Mailbox,
  47. PIRP Irp,
  48. PRESOURCE_ALLOCATION ControllerPhysical,
  49. ULONGLONG InterruptLine,
  50. ULONGLONG InterruptVector
  51. );
  52. /*++
  53. Routine Description:
  54. This routine initializes support for the mailbox.
  55. Arguments:
  56. Irp - Supplies a pointer to the start IRP.
  57. Mailbox - Supplies a pointer to the controller, which is assumed to have
  58. been zeroed.
  59. ControllerPhysical - Supplies a pointer to the physical resource allocation
  60. of the mailbox controller.
  61. InterruptLine - Supplies the interrupt line the mailbox is connected on.
  62. InterruptVector - Supplies the interrupt vector the mailbox should use.
  63. Return Value:
  64. Status code.
  65. --*/
  66. VOID
  67. Am3MailboxDestroy (
  68. PAM3_MAILBOX Mailbox
  69. );
  70. /*++
  71. Routine Description:
  72. This routine tears down a mailbox controller.
  73. Arguments:
  74. Mailbox - Supplies a pointer to the initialized controller.
  75. Return Value:
  76. None.
  77. --*/
  78. VOID
  79. Am3MailboxSend (
  80. PAM3_MAILBOX Mailbox,
  81. ULONG Index,
  82. ULONG Message
  83. );
  84. /*++
  85. Routine Description:
  86. This routine writes a new message to the AM3 mailbox.
  87. Arguments:
  88. Mailbox - Supplies a pointer to the controller.
  89. Index - Supplies the mailbox number to write to. Valid values are 0-7.
  90. Message - Supplies the value to write.
  91. Return Value:
  92. None.
  93. --*/
  94. VOID
  95. Am3MailboxFlush (
  96. PAM3_MAILBOX Mailbox,
  97. ULONG Index
  98. );
  99. /*++
  100. Routine Description:
  101. This routine reads all messages back out of the mailbox and discards them.
  102. Arguments:
  103. Mailbox - Supplies a pointer to the controller.
  104. Index - Supplies the mailbox number to write to. Valid values are 0-7.
  105. Return Value:
  106. None.
  107. --*/