dwc_cfi_common.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /* ==========================================================================
  2. * Synopsys HS OTG Linux Software Driver and documentation (hereinafter,
  3. * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless
  4. * otherwise expressly agreed to in writing between Synopsys and you.
  5. *
  6. * The Software IS NOT an item of Licensed Software or Licensed Product under
  7. * any End User Software License Agreement or Agreement for Licensed Product
  8. * with Synopsys or any supplement thereto. You are permitted to use and
  9. * redistribute this Software in source and binary forms, with or without
  10. * modification, provided that redistributions of source code must retain this
  11. * notice. You may not view, use, disclose, copy or distribute this file or
  12. * any information contained herein except pursuant to this license grant from
  13. * Synopsys. If you do not agree with this notice, including the disclaimer
  14. * below, then you are not authorized to use the Software.
  15. *
  16. * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS
  17. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT,
  20. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  22. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  23. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  24. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  25. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  26. * DAMAGE.
  27. * ========================================================================== */
  28. #if !defined(__DWC_CFI_COMMON_H__)
  29. #define __DWC_CFI_COMMON_H__
  30. //#include <linux/types.h>
  31. /**
  32. * @file
  33. *
  34. * This file contains the CFI specific common constants, interfaces
  35. * (functions and macros) and structures for Linux. No PCD specific
  36. * data structure or definition is to be included in this file.
  37. *
  38. */
  39. /** This is a request for all Core Features */
  40. #define VEN_CORE_GET_FEATURES 0xB1
  41. /** This is a request to get the value of a specific Core Feature */
  42. #define VEN_CORE_GET_FEATURE 0xB2
  43. /** This command allows the host to set the value of a specific Core Feature */
  44. #define VEN_CORE_SET_FEATURE 0xB3
  45. /** This command allows the host to set the default values of
  46. * either all or any specific Core Feature
  47. */
  48. #define VEN_CORE_RESET_FEATURES 0xB4
  49. /** This command forces the PCD to write the deferred values of a Core Features */
  50. #define VEN_CORE_ACTIVATE_FEATURES 0xB5
  51. /** This request reads a DWORD value from a register at the specified offset */
  52. #define VEN_CORE_READ_REGISTER 0xB6
  53. /** This request writes a DWORD value into a register at the specified offset */
  54. #define VEN_CORE_WRITE_REGISTER 0xB7
  55. /** This structure is the header of the Core Features dataset returned to
  56. * the Host
  57. */
  58. struct cfi_all_features_header {
  59. /** The features header structure length is */
  60. #define CFI_ALL_FEATURES_HDR_LEN 8
  61. /**
  62. * The total length of the features dataset returned to the Host
  63. */
  64. uint16_t wTotalLen;
  65. /**
  66. * CFI version number inBinary-Coded Decimal (i.e., 1.00 is 100H).
  67. * This field identifies the version of the CFI Specification with which
  68. * the device is compliant.
  69. */
  70. uint16_t wVersion;
  71. /** The ID of the Core */
  72. uint16_t wCoreID;
  73. #define CFI_CORE_ID_UDC 1
  74. #define CFI_CORE_ID_OTG 2
  75. #define CFI_CORE_ID_WUDEV 3
  76. /** Number of features returned by VEN_CORE_GET_FEATURES request */
  77. uint16_t wNumFeatures;
  78. } UPACKED;
  79. typedef struct cfi_all_features_header cfi_all_features_header_t;
  80. /** This structure is a header of the Core Feature descriptor dataset returned to
  81. * the Host after the VEN_CORE_GET_FEATURES request
  82. */
  83. struct cfi_feature_desc_header {
  84. #define CFI_FEATURE_DESC_HDR_LEN 8
  85. /** The feature ID */
  86. uint16_t wFeatureID;
  87. /** Length of this feature descriptor in bytes - including the
  88. * length of the feature name string
  89. */
  90. uint16_t wLength;
  91. /** The data length of this feature in bytes */
  92. uint16_t wDataLength;
  93. /**
  94. * Attributes of this features
  95. * D0: Access rights
  96. * 0 - Read/Write
  97. * 1 - Read only
  98. */
  99. uint8_t bmAttributes;
  100. #define CFI_FEATURE_ATTR_RO 1
  101. #define CFI_FEATURE_ATTR_RW 0
  102. /** Length of the feature name in bytes */
  103. uint8_t bNameLen;
  104. /** The feature name buffer */
  105. //uint8_t *name;
  106. } UPACKED;
  107. typedef struct cfi_feature_desc_header cfi_feature_desc_header_t;
  108. /**
  109. * This structure describes a NULL terminated string referenced by its id field.
  110. * It is very similar to usb_string structure but has the id field type set to 16-bit.
  111. */
  112. struct cfi_string {
  113. uint16_t id;
  114. const uint8_t *s;
  115. };
  116. typedef struct cfi_string cfi_string_t;
  117. #endif