zephyr.c 929 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "hm_chipset.h"
  2. #include "hm_hci_transport_h4.h"
  3. static uint8_t init_commands[] = {
  4. // OGF: 0x3F, OCF: 0x09, Paramter Total Length: 0x00.
  5. // Zephyr Controller
  6. 0x09, 0xfc, 0x00,
  7. };
  8. int chipset_zephyr_init(void)
  9. {
  10. uint8_t event_buf[20];
  11. chip_send_hci_reset_cmd_until_ack();
  12. rt_kprintf("Zephyr controller start init\n");
  13. chip_hci_cmd_send(init_commands, ARRAY_SIZE(init_commands));
  14. chip_hci_event_read(event_buf, ARRAY_SIZE(event_buf), RT_WAITING_FOREVER);
  15. if (event_buf[0] != 0x0E) {
  16. rt_kprintf("Zephyr controller init fail\n");
  17. return HM_CHIPSET_INIT_ERROR;
  18. }
  19. chip_send_hci_reset_cmd_until_ack();
  20. rt_kprintf("Zephyr controller init success\n");
  21. return HM_SUCCESS;
  22. }
  23. static hm_chipset_t chipset_zephyr = {
  24. .name = "Zephyr",
  25. .init = chipset_zephyr_init,
  26. };
  27. hm_chipset_t* hm_chipset_get_instance(void)
  28. {
  29. return &chipset_zephyr;
  30. }