drv_headset.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _DRV_HEADSET_H_
  13. #define _DRV_HEADSET_H_
  14. #include <stdint.h>
  15. #include <stdbool.h>
  16. #include <stddef.h>
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. typedef enum
  21. {
  22. DRV_HEADSET_TYPE_UNKNOWN_MIC_TYPE,
  23. DRV_HEADSET_TYPE_NO_MIC,
  24. DRV_HEADSET_TYPE_4POLE_NORMAL,
  25. DRV_HEADSET_TYPE_4POLE_NOT_NORMAL,
  26. DRV_HEADSET_TYPE_APPLE,
  27. DRV_HEADSET_TYPE_ERR
  28. } drvHeadsetType_t;
  29. typedef enum
  30. {
  31. HEADSET_DISCONNECT = 0,
  32. HEADSET_CONNECT = 1,
  33. } drvHeadsetStus_t;
  34. typedef enum
  35. {
  36. MSG_HEADSET_PLUGIN = 1,
  37. MSG_HEADSET_PLUGOUT = 2,
  38. MSG_HEADSET_BTN_DOWN = 3,
  39. MSG_HEADSET_BTN_UP = 4,
  40. MSG_HEADSET_MAX_COUNT ///< total count
  41. } drvHeadsetNotifyMsg_t;
  42. typedef struct
  43. {
  44. drvHeadsetStus_t isplugin;
  45. drvHeadsetType_t mictype;
  46. } drvHeadSetStatus_t;
  47. typedef struct drvHeadsetState HEADSET_T;
  48. typedef struct drvHeadsetContext drvHeadsetContext_t;
  49. /**
  50. * get the status of headset and mic
  51. * this function can be called after Handset Init
  52. */
  53. void drvGetHeadsetStatus(drvHeadSetStatus_t *status);
  54. /**
  55. * callback function for HeadsetPlug detect work result notify
  56. *
  57. * It is called in headset detect work.
  58. */
  59. typedef void (*drvHeadsetNotifyCB_t)(void *ctx, drvHeadsetNotifyMsg_t id, uint32_t param);
  60. /**
  61. * customer can set callback function for HeadsetPlugin out event
  62. *
  63. *
  64. */
  65. void drvHandsetSetNotifyCustCB(drvHeadsetNotifyCB_t cb, void *ctx);
  66. /**
  67. * Handset Init call when system poweron
  68. *
  69. */
  70. void drvHandsetInit(void);
  71. #ifdef __cplusplus
  72. }
  73. #endif
  74. #endif