halmac_pwr_seq_cmd.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #ifndef HALMAC_POWER_SEQUENCE_CMD
  2. #define HALMAC_POWER_SEQUENCE_CMD
  3. #include "halmac_2_platform.h"
  4. #include "halmac_type.h"
  5. #define HALMAC_POLLING_READY_TIMEOUT_COUNT 20000
  6. /*
  7. * The value of cmd : 4 bits
  8. */
  9. /*
  10. * offset : the read register offset
  11. * msk : the mask of the read value
  12. * value : N/A, left by 0
  13. * Note : dirver shall implement this function by read & msk
  14. */
  15. #define HALMAC_PWR_CMD_READ 0x00
  16. /*
  17. * offset: the read register offset
  18. * msk: the mask of the write bits
  19. * value: write value
  20. * Note: driver shall implement this cmd by read & msk after write
  21. */
  22. #define HALMAC_PWR_CMD_WRITE 0x01
  23. /*
  24. * offset: the read register offset
  25. * msk: the mask of the polled value
  26. * value: the value to be polled, masked by the msd field.
  27. * Note: driver shall implement this cmd by
  28. * do{
  29. * if( (Read(offset) & msk) == (value & msk) )
  30. * break;
  31. * } while(not timeout);
  32. */
  33. #define HALMAC_PWR_CMD_POLLING 0x02
  34. /*
  35. * offset: the value to delay
  36. * msk: N/A
  37. * value: the unit of delay, 0: us, 1: ms
  38. */
  39. #define HALMAC_PWR_CMD_DELAY 0x03
  40. /*
  41. * offset: N/A
  42. * msk: N/A
  43. * value: N/A
  44. */
  45. #define HALMAC_PWR_CMD_END 0x04
  46. /*
  47. * The value of base : 4 bits
  48. */
  49. /* define the base address of each block */
  50. #define HALMAC_PWR_BASEADDR_MAC 0x00
  51. #define HALMAC_PWR_BASEADDR_USB 0x01
  52. #define HALMAC_PWR_BASEADDR_PCIE 0x02
  53. #define HALMAC_PWR_BASEADDR_SDIO 0x03
  54. /*
  55. * The value of interface_msk : 4 bits
  56. */
  57. #define HALMAC_PWR_INTF_SDIO_MSK BIT(0)
  58. #define HALMAC_PWR_INTF_USB_MSK BIT(1)
  59. #define HALMAC_PWR_INTF_PCI_MSK BIT(2)
  60. #define HALMAC_PWR_INTF_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3))
  61. /*
  62. * The value of fab_msk : 4 bits
  63. */
  64. #define HALMAC_PWR_FAB_TSMC_MSK BIT(0)
  65. #define HALMAC_PWR_FAB_UMC_MSK BIT(1)
  66. #define HALMAC_PWR_FAB_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3))
  67. /*
  68. * The value of cut_msk : 8 bits
  69. */
  70. #define HALMAC_PWR_CUT_TESTCHIP_MSK BIT(0)
  71. #define HALMAC_PWR_CUT_A_MSK BIT(1)
  72. #define HALMAC_PWR_CUT_B_MSK BIT(2)
  73. #define HALMAC_PWR_CUT_C_MSK BIT(3)
  74. #define HALMAC_PWR_CUT_D_MSK BIT(4)
  75. #define HALMAC_PWR_CUT_E_MSK BIT(5)
  76. #define HALMAC_PWR_CUT_F_MSK BIT(6)
  77. #define HALMAC_PWR_CUT_G_MSK BIT(7)
  78. #define HALMAC_PWR_CUT_ALL_MSK 0xFF
  79. typedef enum _HALMAC_PWRSEQ_CMD_DELAY_UNIT_ {
  80. HALMAC_PWRSEQ_DELAY_US,
  81. HALMAC_PWRSEQ_DELAY_MS,
  82. } HALMAC_PWRSEQ_DELAY_UNIT;
  83. /* Don't care endian issue, because element of pwer seq vector is fixed address */
  84. typedef struct _HALMAC_WL_PWR_CFG_ {
  85. u16 offset;
  86. u8 cut_msk;
  87. u8 fab_msk:4;
  88. u8 interface_msk:4;
  89. u8 base:4;
  90. u8 cmd:4;
  91. u8 msk;
  92. u8 value;
  93. } HALMAC_WLAN_PWR_CFG, *PHALMAC_WLAN_PWR_CFG;
  94. #endif