iwl-testmode.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /******************************************************************************
  2. *
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * GPL LICENSE SUMMARY
  7. *
  8. * Copyright(c) 2010 - 2011 Intel Corporation. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of version 2 of the GNU General Public License as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  22. * USA
  23. *
  24. * The full GNU General Public License is included in this distribution
  25. * in the file called LICENSE.GPL.
  26. *
  27. * Contact Information:
  28. * Intel Linux Wireless <ilw@linux.intel.com>
  29. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  30. *
  31. * BSD LICENSE
  32. *
  33. * Copyright(c) 2010 - 2011 Intel Corporation. All rights reserved.
  34. * All rights reserved.
  35. *
  36. * Redistribution and use in source and binary forms, with or without
  37. * modification, are permitted provided that the following conditions
  38. * are met:
  39. *
  40. * * Redistributions of source code must retain the above copyright
  41. * notice, this list of conditions and the following disclaimer.
  42. * * Redistributions in binary form must reproduce the above copyright
  43. * notice, this list of conditions and the following disclaimer in
  44. * the documentation and/or other materials provided with the
  45. * distribution.
  46. * * Neither the name Intel Corporation nor the names of its
  47. * contributors may be used to endorse or promote products derived
  48. * from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  51. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  52. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  53. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  54. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  55. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  56. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  57. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  58. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  59. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  60. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  61. *
  62. *****************************************************************************/
  63. #ifndef __IWL_TESTMODE_H__
  64. #define __IWL_TESTMODE_H__
  65. #include <linux/types.h>
  66. /* Commands from user space to kernel space(IWL_TM_CMD_ID_APP2DEV_XX) and
  67. * from and kernel space to user space(IWL_TM_CMD_ID_DEV2APP_XX).
  68. * The command ID is carried with IWL_TM_ATTR_COMMAND. There are three types of
  69. * of command from user space and two types of command from kernel space.
  70. * See below.
  71. */
  72. enum iwl_tm_cmd_t {
  73. /* commands from user application to the uCode,
  74. * the actual uCode host command ID is carried with
  75. * IWL_TM_ATTR_UCODE_CMD_ID */
  76. IWL_TM_CMD_APP2DEV_UCODE = 1,
  77. /* commands from user applicaiton to access register */
  78. IWL_TM_CMD_APP2DEV_REG_READ32,
  79. IWL_TM_CMD_APP2DEV_REG_WRITE32,
  80. IWL_TM_CMD_APP2DEV_REG_WRITE8,
  81. /* commands fom user space for pure driver level operations */
  82. IWL_TM_CMD_APP2DEV_GET_DEVICENAME,
  83. IWL_TM_CMD_APP2DEV_LOAD_INIT_FW,
  84. IWL_TM_CMD_APP2DEV_CFG_INIT_CALIB,
  85. IWL_TM_CMD_APP2DEV_LOAD_RUNTIME_FW,
  86. IWL_TM_CMD_APP2DEV_GET_EEPROM,
  87. IWL_TM_CMD_APP2DEV_FIXRATE_REQ,
  88. /* if there is other new command for the driver layer operation,
  89. * append them here */
  90. /* commands fom user space for uCode trace operations */
  91. IWL_TM_CMD_APP2DEV_BEGIN_TRACE,
  92. IWL_TM_CMD_APP2DEV_END_TRACE,
  93. IWL_TM_CMD_APP2DEV_READ_TRACE,
  94. /* commands from kernel space to carry the synchronous response
  95. * to user application */
  96. IWL_TM_CMD_DEV2APP_SYNC_RSP,
  97. /* commands from kernel space to multicast the spontaneous messages
  98. * to user application */
  99. IWL_TM_CMD_DEV2APP_UCODE_RX_PKT,
  100. /* commands from kernel space to carry the eeprom response
  101. * to user application */
  102. IWL_TM_CMD_DEV2APP_EEPROM_RSP,
  103. IWL_TM_CMD_MAX,
  104. };
  105. enum iwl_tm_attr_t {
  106. IWL_TM_ATTR_NOT_APPLICABLE = 0,
  107. /* From user space to kernel space:
  108. * the command either destines to ucode, driver, or register;
  109. * See enum iwl_tm_cmd_t.
  110. *
  111. * From kernel space to user space:
  112. * the command either carries synchronous response,
  113. * or the spontaneous message multicast from the device;
  114. * See enum iwl_tm_cmd_t. */
  115. IWL_TM_ATTR_COMMAND,
  116. /* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_UCODE,
  117. * The mandatory fields are :
  118. * IWL_TM_ATTR_UCODE_CMD_ID for recognizable command ID;
  119. * IWL_TM_ATTR_COMMAND_FLAG for the flags of the commands;
  120. * The optional fields are:
  121. * IWL_TM_ATTR_UCODE_CMD_DATA for the actual command payload
  122. * to the ucode */
  123. IWL_TM_ATTR_UCODE_CMD_ID,
  124. IWL_TM_ATTR_UCODE_CMD_DATA,
  125. /* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_REG_XXX,
  126. * The mandatory fields are:
  127. * IWL_TM_ATTR_REG_OFFSET for the offset of the target register;
  128. * IWL_TM_ATTR_REG_VALUE8 or IWL_TM_ATTR_REG_VALUE32 for value */
  129. IWL_TM_ATTR_REG_OFFSET,
  130. IWL_TM_ATTR_REG_VALUE8,
  131. IWL_TM_ATTR_REG_VALUE32,
  132. /* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_SYNC_RSP,
  133. * The mandatory fields are:
  134. * IWL_TM_ATTR_SYNC_RSP for the data content responding to the user
  135. * application command */
  136. IWL_TM_ATTR_SYNC_RSP,
  137. /* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_UCODE_RX_PKT,
  138. * The mandatory fields are:
  139. * IWL_TM_ATTR_UCODE_RX_PKT for the data content multicast to the user
  140. * application */
  141. IWL_TM_ATTR_UCODE_RX_PKT,
  142. /* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_DEV2APP_EEPROM,
  143. * The mandatory fields are:
  144. * IWL_TM_ATTR_EEPROM for the data content responging to the user
  145. * application */
  146. IWL_TM_ATTR_EEPROM,
  147. /* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_XXX_TRACE,
  148. * The mandatory fields are:
  149. * IWL_TM_ATTR_MEM_TRACE_ADDR for the trace address
  150. */
  151. IWL_TM_ATTR_TRACE_ADDR,
  152. IWL_TM_ATTR_TRACE_DATA,
  153. /* When IWL_TM_ATTR_COMMAND is IWL_TM_CMD_APP2DEV_FIXRATE_REQ,
  154. * The mandatory fields are:
  155. * IWL_TM_ATTR_FIXRATE for the fixed rate
  156. */
  157. IWL_TM_ATTR_FIXRATE,
  158. IWL_TM_ATTR_MAX,
  159. };
  160. /* uCode trace buffer */
  161. #define TRACE_BUFF_SIZE 0x20000
  162. #define TRACE_BUFF_PADD 0x2000
  163. #define TRACE_TOTAL_SIZE (TRACE_BUFF_SIZE + TRACE_BUFF_PADD)
  164. #endif