zd_rf.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* zd_rf.h
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. */
  17. #ifndef _ZD_RF_H
  18. #define _ZD_RF_H
  19. #define UW2451_RF 0x2
  20. #define UCHIP_RF 0x3
  21. #define AL2230_RF 0x4
  22. #define AL7230B_RF 0x5 /* a,b,g */
  23. #define THETA_RF 0x6
  24. #define AL2210_RF 0x7
  25. #define MAXIM_NEW_RF 0x8
  26. #define UW2453_RF 0x9
  27. #define UNKNOWN_A_RF 0xa
  28. #define RALINK_RF 0xb
  29. #define INTERSIL_RF 0xc
  30. #define RF2959_RF 0xd
  31. #define MAXIM_NEW2_RF 0xe
  32. #define PHILIPS_RF 0xf
  33. #define RF_CHANNEL(ch) [(ch)-1]
  34. /* Provides functions of the RF transceiver. */
  35. enum {
  36. RF_REG_BITS = 6,
  37. RF_VALUE_BITS = 18,
  38. RF_RV_BITS = RF_REG_BITS + RF_VALUE_BITS,
  39. };
  40. struct zd_rf {
  41. u8 type;
  42. u8 channel;
  43. /* whether channel integration and calibration should be updated
  44. * defaults to 1 (yes) */
  45. u8 update_channel_int:1;
  46. /* private RF driver data */
  47. void *priv;
  48. /* RF-specific functions */
  49. int (*init_hw)(struct zd_rf *rf);
  50. int (*set_channel)(struct zd_rf *rf, u8 channel);
  51. int (*switch_radio_on)(struct zd_rf *rf);
  52. int (*switch_radio_off)(struct zd_rf *rf);
  53. int (*patch_6m_band_edge)(struct zd_rf *rf, u8 channel);
  54. void (*clear)(struct zd_rf *rf);
  55. };
  56. const char *zd_rf_name(u8 type);
  57. void zd_rf_init(struct zd_rf *rf);
  58. void zd_rf_clear(struct zd_rf *rf);
  59. int zd_rf_init_hw(struct zd_rf *rf, u8 type);
  60. int zd_rf_scnprint_id(struct zd_rf *rf, char *buffer, size_t size);
  61. int zd_rf_set_channel(struct zd_rf *rf, u8 channel);
  62. int zd_switch_radio_on(struct zd_rf *rf);
  63. int zd_switch_radio_off(struct zd_rf *rf);
  64. int zd_rf_patch_6m_band_edge(struct zd_rf *rf, u8 channel);
  65. int zd_rf_generic_patch_6m(struct zd_rf *rf, u8 channel);
  66. static inline int zd_rf_should_update_pwr_int(struct zd_rf *rf)
  67. {
  68. return rf->update_channel_int;
  69. }
  70. /* Functions for individual RF chips */
  71. int zd_rf_init_rf2959(struct zd_rf *rf);
  72. int zd_rf_init_al2230(struct zd_rf *rf);
  73. int zd_rf_init_al7230b(struct zd_rf *rf);
  74. int zd_rf_init_uw2453(struct zd_rf *rf);
  75. #endif /* _ZD_RF_H */