linux_wlan_common.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. #ifndef LINUX_WLAN_COMMON_H
  2. #define LINUX_WLAN_COMMON_H
  3. enum debug_region {
  4. Generic_debug = 0,
  5. Hostapd_debug,
  6. Hostinf_debug,
  7. CFG80211_debug,
  8. Coreconfig_debug,
  9. Interrupt_debug,
  10. TX_debug,
  11. RX_debug,
  12. Lock_debug,
  13. Tcp_enhance,
  14. Spin_debug,
  15. Init_debug,
  16. Bus_debug,
  17. Mem_debug,
  18. Firmware_debug,
  19. COMP = 0xFFFFFFFF,
  20. };
  21. #define GENERIC_DBG (1 << Generic_debug)
  22. #define HOSTAPD_DBG (1 << Hostapd_debug)
  23. #define HOSTINF_DBG (1 << Hostinf_debug)
  24. #define CORECONFIG_DBG (1 << Coreconfig_debug)
  25. #define CFG80211_DBG (1 << CFG80211_debug)
  26. #define INT_DBG (1 << Interrupt_debug)
  27. #define TX_DBG (1 << TX_debug)
  28. #define RX_DBG (1 << RX_debug)
  29. #define LOCK_DBG (1 << Lock_debug)
  30. #define TCP_ENH (1 << Tcp_enhance)
  31. #define SPIN_DEBUG (1 << Spin_debug)
  32. #define INIT_DBG (1 << Init_debug)
  33. #define BUS_DBG (1 << Bus_debug)
  34. #define MEM_DBG (1 << Mem_debug)
  35. #define FIRM_DBG (1 << Firmware_debug)
  36. #if defined (WILC_DEBUGFS)
  37. int wilc_debugfs_init(void);
  38. void wilc_debugfs_remove(void);
  39. extern atomic_t REGION;
  40. extern atomic_t DEBUG_LEVEL;
  41. #define DEBUG BIT(0)
  42. #define INFO BIT(1)
  43. #define WRN BIT(2)
  44. #define ERR BIT(3)
  45. #define PRINT_D(region, ...) \
  46. do { \
  47. if ((atomic_read(&DEBUG_LEVEL) & DEBUG) && \
  48. ((atomic_read(&REGION)) & (region))) { \
  49. printk("DBG [%s: %d]", __func__, __LINE__); \
  50. printk(__VA_ARGS__); \
  51. } \
  52. } while (0)
  53. #define PRINT_INFO(region, ...) \
  54. do { \
  55. if ((atomic_read(&DEBUG_LEVEL) & INFO) && \
  56. ((atomic_read(&REGION)) & (region))) { \
  57. printk("INFO [%s]", __func__); \
  58. printk(__VA_ARGS__); \
  59. } \
  60. } while (0)
  61. #define PRINT_WRN(region, ...) \
  62. do { \
  63. if ((atomic_read(&DEBUG_LEVEL) & WRN) && \
  64. ((atomic_read(&REGION)) & (region))) { \
  65. printk("WRN [%s: %d]", __func__, __LINE__); \
  66. printk(__VA_ARGS__); \
  67. } \
  68. } while (0)
  69. #define PRINT_ER(...) \
  70. do { \
  71. if ((atomic_read(&DEBUG_LEVEL) & ERR)) { \
  72. printk("ERR [%s: %d]", __func__, __LINE__); \
  73. printk(__VA_ARGS__); \
  74. } \
  75. } while (0)
  76. #else
  77. #define REGION (INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG)
  78. #define DEBUG 1
  79. #define INFO 0
  80. #define WRN 0
  81. #define PRINT_D(region, ...) \
  82. do { \
  83. if (DEBUG == 1 && ((REGION)&(region))) { \
  84. printk("DBG [%s: %d]", __func__, __LINE__); \
  85. printk(__VA_ARGS__); \
  86. } \
  87. } while (0)
  88. #define PRINT_INFO(region, ...) \
  89. do { \
  90. if (INFO == 1 && ((REGION)&(region))) { \
  91. printk("INFO [%s]", __func__); \
  92. printk(__VA_ARGS__); \
  93. } \
  94. } while (0)
  95. #define PRINT_WRN(region, ...) \
  96. do { \
  97. if (WRN == 1 && ((REGION)&(region))) { \
  98. printk("WRN [%s: %d]", __func__, __LINE__); \
  99. printk(__VA_ARGS__); \
  100. } \
  101. } while (0)
  102. #define PRINT_ER(...) \
  103. do { \
  104. printk("ERR [%s: %d]", __func__, __LINE__); \
  105. printk(__VA_ARGS__); \
  106. } while (0)
  107. #endif
  108. #define FN_IN /* PRINT_D(">>> \n") */
  109. #define FN_OUT /* PRINT_D("<<<\n") */
  110. #ifdef MEMORY_STATIC
  111. #define LINUX_RX_SIZE (96 * 1024)
  112. #endif
  113. #define LINUX_TX_SIZE (64 * 1024)
  114. #define WILC_MULTICAST_TABLE_SIZE 8
  115. #if defined (BEAGLE_BOARD)
  116. #define SPI_CHANNEL 4
  117. #if SPI_CHANNEL == 4
  118. #define MODALIAS "wilc_spi4"
  119. #define GPIO_NUM 162
  120. #else
  121. #define MODALIAS "wilc_spi3"
  122. #define GPIO_NUM 133
  123. #endif
  124. #elif defined(PLAT_WMS8304) /* rachel */
  125. #define MODALIAS "wilc_spi"
  126. #define GPIO_NUM 139
  127. #elif defined (PLAT_RKXXXX)
  128. #define MODALIAS "WILC_IRQ"
  129. #define GPIO_NUM RK30_PIN3_PD2 /* RK30_PIN3_PA1 */
  130. /* RK30_PIN3_PD2 */
  131. /* RK2928_PIN1_PA7 */
  132. #elif defined(CUSTOMER_PLATFORM)
  133. /*
  134. TODO : specify MODALIAS name and GPIO number. This is certainly necessary for SPI interface.
  135. *
  136. * ex)
  137. * #define MODALIAS "WILC_SPI"
  138. * #define GPIO_NUM 139
  139. */
  140. #else
  141. /* base on SAMA5D3_Xplained Board */
  142. #define MODALIAS "WILC_SPI"
  143. #define GPIO_NUM 0x44
  144. #endif
  145. #endif