as_dae_h.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * Copyright (c) 2017 Actions Semi Co., Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. * Author: jpl<jianpingliao@actions-semi.com>
  16. *
  17. * Change log:
  18. * 2019/12/16: Created by jpl.
  19. */
  20. #ifndef __AS_DAE_H_H__
  21. #define __AS_DAE_H_H__
  22. #include "as_dae_h_setting.h"
  23. typedef struct
  24. {
  25. /* [INPUT]: sample rate in Hz*/
  26. int sample_rate;
  27. short peq_max_num;
  28. short reserve;
  29. } as_dae_h_init_t;
  30. typedef struct
  31. {
  32. as_dae_h_init_t as_dae_h_init;
  33. /*! [INPUT] global memory block address array */
  34. void *global_buf_addr[3];
  35. /*! [INPUT] share memory block address array */
  36. void *share_buf_addr[3];
  37. } as_dae_h_open_t;
  38. #define MAX_CHANNEL_AS_DAE_H_INOUT 2
  39. /*!
  40. * \brief
  41. * dae process input/output pcm structure
  42. */
  43. typedef struct
  44. {
  45. /*! [INPUT]: input/output pcm array. only support 1 channel so far. */
  46. void *pcm[MAX_CHANNEL_AS_DAE_H_INOUT];
  47. /*! [INPUT] input pcm channels */
  48. int channels;
  49. /*! [INPUT] input pcm samples (pairs). must not greater than 128 so far. */
  50. int samples;
  51. /*! [INPUT] input pcm sample bits, 16, 24 or 32 */
  52. int sample_bits;
  53. /*! [INPUT] input pcm fraction bits */
  54. int frac_bits;
  55. } as_dae_h_inout_pcm_t;
  56. /*!
  57. * \brief
  58. * dae ops error code
  59. */
  60. typedef enum
  61. {
  62. /*! unexpected error */
  63. DAE_H_RET_UNEXPECTED = -3,
  64. /*! not enough memory */
  65. DAE_H_RET_OUTOFMEMORY,
  66. /*! unsupported format */
  67. DAE_H_RET_UNSUPPORTED,
  68. /*! no error */
  69. DAE_H_RET_OK,
  70. /*! data underflow */
  71. DAE_H_RET_DATAUNDERFLOW,
  72. } as_dae_h_ret_t;
  73. /*!
  74. * \brief
  75. * dae ops command
  76. */
  77. typedef enum
  78. {
  79. /* open, with argument as_dae_h_open_t */
  80. DAE_H_CMD_OPEN = 0,
  81. /* close */
  82. DAE_H_CMD_CLOSE,
  83. /* get status */
  84. DAE_H_CMD_GET_STATUS,
  85. /* SPEAKER frame process, with argument address of structure as_structure dae_h_inout_pcm_t */
  86. DAE_H_CMD_FRAME_PROCESS_SPEAKER,
  87. /* MIC frame process, with argument address of structure as_dae_h_inout_pcm_t*/
  88. DAE_H_CMD_FRAME_PROCESS_MIC,
  89. /* set dae parameter buffer address, with argument address of structure as_dae_h_para_info_t */
  90. DAE_H_CMD_SET_DAE_PARA,
  91. /** get memory require size(bytes) */
  92. DAE_H_CMD_MEM_REQUIRE,
  93. /** get codec verison */
  94. DAE_H_CMD_GET_VERSION,
  95. } as_dae_h_ex_ops_cmd_t;
  96. /**
  97. * @brief as dae operation
  98. *
  99. * This routine provides as dae operation
  100. *
  101. * @param hnd handle of as dae
  102. * @param cmd operation cmd, type of as_dae_h_ex_ops_cmd_t
  103. * for DAE_H_CMD_MEM_REQUIRE, args type is as_mem_info_t* in audio_codec.h
  104. * for DAE_H_CMD_OPEN, args type is as_dae_h_open_t*
  105. * for DAE_H_CMD_SET_DAE_PARA, args type is as_dae_h_para_info_t* in as_dae_h_setting.h
  106. * for DAE_H_CMD_FRAME_PROCESS_SPEAKER, args type is as_dae_h_inout_pcm_t*
  107. * for DAE_H_CMD_FRAME_PROCESS_MIC, args type is as_dae_h_inout_pcm_t*
  108. * @param args args of dae parama addr
  109. *
  110. * @return type of as_dae_h_ret_t;
  111. */
  112. int as_dae_h_ops(void *hnd, as_dae_h_ex_ops_cmd_t cmd, unsigned int args);
  113. #endif /* __AS_DAE_H_H__ */