wmfw.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. * wmfw.h - Wolfson firmware format information
  3. *
  4. * Copyright 2012 Wolfson Microelectronics plc
  5. *
  6. * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef __WMFW_H
  13. #define __WMFW_H
  14. #include <linux/types.h>
  15. #define WMFW_MAX_ALG_NAME 256
  16. #define WMFW_MAX_ALG_DESCR_NAME 256
  17. #define WMFW_MAX_COEFF_NAME 256
  18. #define WMFW_MAX_COEFF_DESCR_NAME 256
  19. #define WMFW_CTL_FLAG_SYS 0x8000
  20. #define WMFW_CTL_FLAG_VOLATILE 0x0004
  21. #define WMFW_CTL_FLAG_WRITEABLE 0x0002
  22. #define WMFW_CTL_FLAG_READABLE 0x0001
  23. struct wmfw_header {
  24. char magic[4];
  25. __le32 len;
  26. __le16 rev;
  27. u8 core;
  28. u8 ver;
  29. } __packed;
  30. struct wmfw_footer {
  31. __le64 timestamp;
  32. __le32 checksum;
  33. } __packed;
  34. struct wmfw_adsp1_sizes {
  35. __le32 dm;
  36. __le32 pm;
  37. __le32 zm;
  38. } __packed;
  39. struct wmfw_adsp2_sizes {
  40. __le32 xm;
  41. __le32 ym;
  42. __le32 pm;
  43. __le32 zm;
  44. } __packed;
  45. struct wmfw_region {
  46. union {
  47. __be32 type;
  48. __le32 offset;
  49. };
  50. __le32 len;
  51. u8 data[];
  52. } __packed;
  53. struct wmfw_id_hdr {
  54. __be32 core_id;
  55. __be32 core_rev;
  56. __be32 id;
  57. __be32 ver;
  58. } __packed;
  59. struct wmfw_adsp1_id_hdr {
  60. struct wmfw_id_hdr fw;
  61. __be32 zm;
  62. __be32 dm;
  63. __be32 n_algs;
  64. } __packed;
  65. struct wmfw_adsp2_id_hdr {
  66. struct wmfw_id_hdr fw;
  67. __be32 zm;
  68. __be32 xm;
  69. __be32 ym;
  70. __be32 n_algs;
  71. } __packed;
  72. struct wmfw_alg_hdr {
  73. __be32 id;
  74. __be32 ver;
  75. } __packed;
  76. struct wmfw_adsp1_alg_hdr {
  77. struct wmfw_alg_hdr alg;
  78. __be32 zm;
  79. __be32 dm;
  80. } __packed;
  81. struct wmfw_adsp2_alg_hdr {
  82. struct wmfw_alg_hdr alg;
  83. __be32 zm;
  84. __be32 xm;
  85. __be32 ym;
  86. } __packed;
  87. struct wmfw_adsp_alg_data {
  88. __le32 id;
  89. u8 name[WMFW_MAX_ALG_NAME];
  90. u8 descr[WMFW_MAX_ALG_DESCR_NAME];
  91. __le32 ncoeff;
  92. u8 data[];
  93. } __packed;
  94. struct wmfw_adsp_coeff_data {
  95. struct {
  96. __le16 offset;
  97. __le16 type;
  98. __le32 size;
  99. } hdr;
  100. u8 name[WMFW_MAX_COEFF_NAME];
  101. u8 descr[WMFW_MAX_COEFF_DESCR_NAME];
  102. __le16 ctl_type;
  103. __le16 flags;
  104. __le32 len;
  105. u8 data[];
  106. } __packed;
  107. struct wmfw_coeff_hdr {
  108. u8 magic[4];
  109. __le32 len;
  110. union {
  111. __be32 rev;
  112. __le32 ver;
  113. };
  114. union {
  115. __be32 core;
  116. __le32 core_ver;
  117. };
  118. u8 data[];
  119. } __packed;
  120. struct wmfw_coeff_item {
  121. __le16 offset;
  122. __le16 type;
  123. __le32 id;
  124. __le32 ver;
  125. __le32 sr;
  126. __le32 len;
  127. u8 data[];
  128. } __packed;
  129. #define WMFW_ADSP1 1
  130. #define WMFW_ADSP2 2
  131. #define WMFW_ABSOLUTE 0xf0
  132. #define WMFW_ALGORITHM_DATA 0xf2
  133. #define WMFW_NAME_TEXT 0xfe
  134. #define WMFW_INFO_TEXT 0xff
  135. #define WMFW_ADSP1_PM 2
  136. #define WMFW_ADSP1_DM 3
  137. #define WMFW_ADSP1_ZM 4
  138. #define WMFW_ADSP2_PM 2
  139. #define WMFW_ADSP2_ZM 4
  140. #define WMFW_ADSP2_XM 5
  141. #define WMFW_ADSP2_YM 6
  142. #endif