audio_null.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /****************************************************************************
  2. * include/nuttx/audio/audio_null.h
  3. * A do-nothinig audio device driver to simplify testing of audio decoders.
  4. *
  5. * Copyright (C) 2014 Gregory Nutt. All rights reserved.
  6. * Author: Gregory Nutt <gnutt@nuttx.org>
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in
  16. * the documentation and/or other materials provided with the
  17. * distribution.
  18. * 3. Neither the name NuttX nor the names of its contributors may be
  19. * used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  25. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  26. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  27. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  28. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  29. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  30. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  31. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  32. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  33. * POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ****************************************************************************/
  36. #ifndef __INCLUDE_NUTTX_AUDIO_AUDIO_NULL_H
  37. #define __INCLUDE_NUTTX_AUDIO_AUDIO_NULL_H
  38. /****************************************************************************
  39. * Included Files
  40. ****************************************************************************/
  41. #include <stdint.h>
  42. #include <stdbool.h>
  43. #include <nuttx/irq.h>
  44. #ifdef CONFIG_AUDIO_NULL
  45. /****************************************************************************
  46. * Pre-processor Definitions
  47. ****************************************************************************/
  48. /* Configuration ************************************************************
  49. *
  50. * CONFIG_AUDIO_NULL - Enabled NULL audio device support
  51. * CONFIG_AUDIO_NULL_MSG_PRIO - Priority of messages sent to the NULL audio
  52. * device worker thread.
  53. * CONFIG_AUDIO_NULL_BUFFER_SIZE - Preferred buffer size
  54. * CONFIG_AUDIO_NULL_NUM_BUFFERS - Preferred number of buffers
  55. * CONFIG_AUDIO_NULL_WORKER_STACKSIZE - Stack size to use when creating the
  56. * NULL audio device worker thread.
  57. */
  58. /* Pre-requisites */
  59. #ifndef CONFIG_AUDIO
  60. # error CONFIG_AUDIO is required for audio subsystem support
  61. #endif
  62. /* Default configuration values */
  63. #ifndef CONFIG_AUDIO_NULL_MSG_PRIO
  64. # define CONFIG_AUDIO_NULL_MSG_PRIO 1
  65. #endif
  66. #ifndef CONFIG_AUDIO_NULL_BUFFER_SIZE
  67. # define CONFIG_AUDIO_NULL_BUFFER_SIZE 8192
  68. #endif
  69. #ifndef CONFIG_AUDIO_NULL_NUM_BUFFERS
  70. # define CONFIG_AUDIO_NULL_NUM_BUFFERS 4
  71. #endif
  72. #ifndef CONFIG_AUDIO_NULL_WORKER_STACKSIZE
  73. # define CONFIG_AUDIO_NULL_WORKER_STACKSIZE 768
  74. #endif
  75. /****************************************************************************
  76. * Public Types
  77. ****************************************************************************/
  78. /****************************************************************************
  79. * Public Data
  80. ****************************************************************************/
  81. #ifdef __cplusplus
  82. #define EXTERN extern "C"
  83. extern "C"
  84. {
  85. #else
  86. #define EXTERN extern
  87. #endif
  88. /****************************************************************************
  89. * Public Function Prototypes
  90. ****************************************************************************/
  91. /****************************************************************************
  92. * Name: audio_null_initialize
  93. *
  94. * Description:
  95. * Initialize the null audio device.
  96. *
  97. * Input Parameters:
  98. * i2c - An I2C driver instance
  99. * i2s - An I2S driver instance
  100. * lower - Persistent board configuration data
  101. *
  102. * Returned Value:
  103. * A new lower half audio interface for the NULL audio device is returned
  104. * on success; NULL is returned on failure.
  105. *
  106. ****************************************************************************/
  107. struct audio_lowerhalf_s; /* Forward reference. Defined in nuttx/audio/audio.h */
  108. FAR struct audio_lowerhalf_s *audio_null_initialize(void);
  109. #undef EXTERN
  110. #ifdef __cplusplus
  111. }
  112. #endif
  113. #endif /* CONFIG_AUDIO_NULL */
  114. #endif /* __INCLUDE_NUTTX_AUDIO_AUDIO_NULL_H */