spbp.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*++
  2. Copyright (c) 2015 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. spbp.h
  5. Abstract:
  6. This header contains internal definitions for the Simple Peripheral Bus
  7. core library driver.
  8. Author:
  9. Evan Green 14-Aug-2015
  10. --*/
  11. //
  12. // ------------------------------------------------------------------- Includes
  13. //
  14. #define SPB_API __DLLEXPORT
  15. #include <minoca/spb/spbhost.h>
  16. //
  17. // ---------------------------------------------------------------- Definitions
  18. //
  19. //
  20. // Define the Simple Peripheral Bus allocation Tag: SbpA.
  21. //
  22. #define SPB_ALLOCATION_TAG 0x41627053
  23. #define SPB_CONTROLLER_MAGIC SPB_ALLOCATION_TAG
  24. #define SPB_HANDLE_MAGIC 0x42627053
  25. #define SBP_CONTROLLER_INFORMATION_MAX_VERSION 0x0001000
  26. //
  27. // ------------------------------------------------------ Data Type Definitions
  28. //
  29. /*++
  30. Structure Description:
  31. This structure stores the internal data of a Simple Peripheral Bus
  32. device handle.
  33. Members:
  34. ListEntry - Stores pointers to the next and previous open handles in the
  35. controller.
  36. Magic - Stores the constant SPB_HANDLE_MAGIC.
  37. BusReferenceCount - Stores the number of references on the bus itself. If
  38. this changes to non-zero, then the bus lock is acquired. If this
  39. changes to zero, the bus lock is released.
  40. Controller - Stores a pointer back to the controller that owns this handle.
  41. Configuration - Stores a pointer to the configuration required by the
  42. device.
  43. Event - Stores a pointer to the event used for synchronous execution.
  44. --*/
  45. typedef struct _SPB_HANDLE_DATA {
  46. LIST_ENTRY ListEntry;
  47. ULONG Magic;
  48. volatile ULONG BusReferenceCount;
  49. PSPB_CONTROLLER Controller;
  50. PRESOURCE_SPB_DATA Configuration;
  51. PKEVENT Event;
  52. } SPB_HANDLE_DATA, *PSPB_HANDLE_DATA;
  53. /*++
  54. Structure Description:
  55. This structure stores the internal data of a Simple Peripheral Bus library
  56. controller.
  57. Members:
  58. Magic - Stores the constant SPB_CONTROLLER_MAGIC.
  59. Host - Stores the host controller information.
  60. Interface - Stores the public published interface.
  61. HandleList - Stores the head of the list of open bus handles.
  62. ArbiterCreated - Stores a boolean indicating whether or not the SPB
  63. arbiter has been created yet.
  64. Lock - Stores a pointer to the lock serializing access to internal data
  65. structures.
  66. BusLock - Stores a pointer to the lock representing whether or not the
  67. bus is claimed.
  68. CurrentConfiguration - Stores a pointer to the current configuration of
  69. the bus.
  70. TransferQueue - Stores the head of the list of transfer sets queued on the
  71. controller.
  72. CurrentSet - Stores a pointer to the current transfer set in progress. This
  73. is cleared when the transfer is finished. Setting this requires holding
  74. the controller lock.
  75. --*/
  76. struct _SPB_CONTROLLER {
  77. ULONG Magic;
  78. SPB_CONTROLLER_INFORMATION Host;
  79. SPB_INTERFACE Interface;
  80. LIST_ENTRY HandleList;
  81. BOOL ArbiterCreated;
  82. PQUEUED_LOCK Lock;
  83. PQUEUED_LOCK BusLock;
  84. PRESOURCE_SPB_DATA CurrentConfiguration;
  85. LIST_ENTRY TransferQueue;
  86. PSPB_TRANSFER_SET CurrentSet;
  87. };
  88. //
  89. // -------------------------------------------------------------------- Globals
  90. //
  91. //
  92. // -------------------------------------------------------- Function Prototypes
  93. //