btctrler_task.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #ifndef BTCTRLER_TASK_H
  2. #define BTCTRLER_TASK_H
  3. #include "typedef.h"
  4. #include "system/task.h"
  5. enum {
  6. LMP_EVENT = Q_USER + 1,
  7. LMP_HCI_CMD,
  8. LMP_HCI_CMD_TO_CONN,
  9. HCI_COMMON_CMD,
  10. LL_EVENT,
  11. HCI_CMD_TO_LL,
  12. TWS_LMP_EVENT,
  13. MSG_BT_UPDATA_START,
  14. MSG_BT_UPDATE_LOADER_DOWNLOAD_START,
  15. MSG_BLE_TEST_UPDATA_START,
  16. MSG_BLE_TEST_OTA_LOADER_DOWNLOAD_START,
  17. MSG_TASK_READY,
  18. MSG_TASK_DEL,
  19. };
  20. enum {
  21. BTCTRLER_EVENT_RESUME_REQ = 1,
  22. };
  23. #define SYS_EVENT_FROM_CTRLER (('C' << 24) | ('T' << 16) | ('R' << 8) | '\0')
  24. int bredr_link_event(void *link, int argc, ...);
  25. int bredr_tws_link_event(void *link, int argc, ...);
  26. int btctrler_hci_cmd_to_task(int cmd, int argc, ...);
  27. int lmp_hci_cmd_to_conn_for_handle(u16 handle, int argc, ...);
  28. int lmp_hci_cmd_to_conn_for_addr(u8 *addr, int argc, ...);
  29. int lmp_hci_cmd_to_conn(void *conn, int argc, ...);
  30. #define lmp_hci_cmd_to_task(argc, ...) btctrler_hci_cmd_to_task(LMP_HCI_CMD, argc, ## __VA_ARGS__)
  31. #define ll_hci_cmd_to_task(argc, ...) btctrler_hci_cmd_to_task(HCI_CMD_TO_LL, argc, ## __VA_ARGS__)
  32. int btctrler_task_init(const void *transport, const void *config);
  33. void btctrler_resume_req();
  34. void btctrler_resume();
  35. int btctrler_suspend(u8 suepend_rx_bulk);
  36. int btctrler_task_ready();
  37. int btctrler_task_exit();
  38. int btctrler_task_close_bredr();
  39. void btctrler_task_init_bredr();
  40. void set_idle_period_slot(u16 slot);
  41. enum {
  42. TESTBOX_INFO_VBAT_VALUE = 0, //(u16 (*handle)(void))
  43. TESTBOX_INFO_VBAT_PERCENT, //(u8 (*handle)(void))
  44. TESTBOX_INFO_BURN_CODE, //(u8 *(*handle)(u8 *len))
  45. TESTBOX_INFO_SDK_VERSION, //(u8 *(*handle)(u8 *len))
  46. };
  47. void bt_testbox_ex_info_get_handle_register(u8 info_type, void *handle);
  48. u8 bredr_bulk_change_rx_bulk(u8 mode);
  49. void lmp_set_features_req_step(u8 *addr);
  50. struct ble_dut_tx_param_t {
  51. u8 ch_index; //data[0]
  52. u8 payload_len; //data[1]
  53. u8 payload_type;//data[2]
  54. u8 phy_type; //data[3]
  55. };
  56. struct ble_dut_rx_param_t {
  57. u8 ch_index; //data[0]
  58. u8 phy_type; //data[1]
  59. };
  60. enum BLE_DUT_CTRL_TYPE {
  61. BLE_DUT_SET_RX_MODE = 0, //param1:struct ble_dut_rx_param_t *param;
  62. BLE_DUT_SET_TX_MODE, //param1:struct ble_dut_tx_param_t *param;
  63. BLE_DUT_SET_TEST_END, //param1:u16 *pkt_valid_cnt,param2:u16 *pkt_err_cnt;
  64. };
  65. struct ble_dut_ops_t {
  66. /* *****************************************************************************/
  67. /**
  68. * @brief : initialize the ble dut test module
  69. *
  70. * @param : void
  71. *
  72. * @return : pointer to instance of test module
  73. */
  74. /* *****************************************************************************/
  75. void *(*init)(void);
  76. /* *****************************************************************************/
  77. /**
  78. * @brief : ble dut test control api,such as setting rx/tx mode,stop testing
  79. *
  80. * @param : control type,using enum BLE_DUT_CTRL_TYPE value;
  81. * @param : vary from different control type;
  82. */
  83. /* *****************************************************************************/
  84. int (*ioctrl)(int ctrl, ...);
  85. /* *****************************************************************************/
  86. /**
  87. * @brief : exit the ble dut test module
  88. *
  89. * @param : poniter to instance of test module
  90. */
  91. /* *****************************************************************************/
  92. void (*exit)(void *priv);
  93. };
  94. extern const struct ble_dut_ops_t *__ble_dut_ops;
  95. #endif