iwl_fw.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* Firmware-layer dispatch: see iwl_fw.h. */
  2. #include "iwl_fw.h"
  3. #include "iwl_dvm.h"
  4. #include "iwl_mvm.h"
  5. #include "iwl_trans.h"
  6. int iwlfw_up(unsigned char mac[6])
  7. {
  8. if (iwl_probe() == 0 && iwl_is_dvm())
  9. return iwl_dvm_up(mac);
  10. return iwl_mvm_up(mac);
  11. }
  12. void iwlfw_down(void)
  13. {
  14. if (iwl_is_dvm())
  15. iwl_dvm_down();
  16. else
  17. iwl_mvm_down();
  18. }
  19. const char *iwlfw_state(void)
  20. {
  21. return iwl_is_dvm() ? iwl_dvm_state() : iwl_mvm_state();
  22. }
  23. int iwlfw_poll(void)
  24. {
  25. return iwl_is_dvm() ? iwl_dvm_poll() : iwl_mvm_poll();
  26. }
  27. int iwlfw_scan_start(void)
  28. {
  29. return iwl_is_dvm() ? iwl_dvm_scan_start() : iwl_mvm_scan_start();
  30. }
  31. int iwlfw_scan_running(void)
  32. {
  33. return iwl_is_dvm() ? iwl_dvm_scan_running() : iwl_mvm_scan_running();
  34. }
  35. int iwlfw_prepare_connect(const unsigned char bssid[6], unsigned int chan,
  36. unsigned int beacon_int)
  37. {
  38. return iwl_is_dvm() ? iwl_dvm_prepare_connect(bssid, chan, beacon_int)
  39. : iwl_mvm_prepare_connect(bssid, chan, beacon_int);
  40. }
  41. int iwlfw_set_assoc(unsigned short aid, unsigned int beacon_int,
  42. unsigned int dtim)
  43. {
  44. return iwl_is_dvm() ? iwl_dvm_set_assoc(aid, beacon_int, dtim)
  45. : iwl_mvm_set_assoc(aid, beacon_int, dtim);
  46. }
  47. void iwlfw_disconnect(void)
  48. {
  49. if (iwl_is_dvm())
  50. iwl_dvm_disconnect();
  51. else
  52. iwl_mvm_disconnect();
  53. }
  54. int iwlfw_tx_mgmt(const unsigned char *frame, unsigned int len)
  55. {
  56. return iwl_is_dvm() ? iwl_dvm_tx_mgmt(frame, len)
  57. : iwl_mvm_tx_mgmt(frame, len);
  58. }
  59. int iwlfw_tx_data(const unsigned char *frame, unsigned int len, int protect)
  60. {
  61. return iwl_is_dvm() ? iwl_dvm_tx_data(frame, len, protect)
  62. : iwl_mvm_tx_data(frame, len, protect);
  63. }
  64. int iwlfw_set_key(int pairwise, int keyidx, const unsigned char key[16],
  65. const unsigned char rsc[6])
  66. {
  67. return iwl_is_dvm() ? iwl_dvm_set_key(pairwise, keyidx, key, rsc)
  68. : iwl_mvm_set_key(pairwise, keyidx, key, rsc);
  69. }
  70. void iwlfw_clear_keys(void)
  71. {
  72. if (iwl_is_dvm())
  73. iwl_dvm_clear_keys();
  74. else
  75. iwl_mvm_clear_keys();
  76. }