chip.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2021 pureLiFi
  4. */
  5. #ifndef PLFXLC_CHIP_H
  6. #define PLFXLC_CHIP_H
  7. #include <net/mac80211.h>
  8. #include "usb.h"
  9. enum unit_type {
  10. STA = 0,
  11. AP = 1,
  12. };
  13. enum {
  14. PLFXLC_RADIO_OFF = 0,
  15. PLFXLC_RADIO_ON = 1,
  16. };
  17. struct plfxlc_chip {
  18. struct plfxlc_usb usb;
  19. struct mutex mutex; /* lock to protect chip data */
  20. enum unit_type unit_type;
  21. u16 link_led;
  22. u8 beacon_set;
  23. u16 beacon_interval;
  24. };
  25. struct plfxlc_mc_hash {
  26. u32 low;
  27. u32 high;
  28. };
  29. #define plfxlc_chip_dev(chip) (&(chip)->usb.intf->dev)
  30. void plfxlc_chip_init(struct plfxlc_chip *chip,
  31. struct ieee80211_hw *hw,
  32. struct usb_interface *intf);
  33. void plfxlc_chip_release(struct plfxlc_chip *chip);
  34. void plfxlc_chip_disable_rxtx(struct plfxlc_chip *chip);
  35. int plfxlc_chip_init_hw(struct plfxlc_chip *chip);
  36. int plfxlc_chip_enable_rxtx(struct plfxlc_chip *chip);
  37. int plfxlc_chip_set_rate(struct plfxlc_chip *chip, u8 rate);
  38. int plfxlc_set_beacon_interval(struct plfxlc_chip *chip, u16 interval,
  39. u8 dtim_period, int type);
  40. int plfxlc_chip_switch_radio(struct plfxlc_chip *chip, u16 value);
  41. static inline struct plfxlc_chip *plfxlc_usb_to_chip(struct plfxlc_usb
  42. *usb)
  43. {
  44. return container_of(usb, struct plfxlc_chip, usb);
  45. }
  46. static inline void plfxlc_mc_add_all(struct plfxlc_mc_hash *hash)
  47. {
  48. hash->low = 0xffffffff;
  49. hash->high = 0xffffffff;
  50. }
  51. #endif /* PLFXLC_CHIP_H */