hpidspcd.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /***********************************************************************/
  2. /**
  3. AudioScience HPI driver
  4. Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of version 2 of the GNU General Public License as
  7. published by the Free Software Foundation;
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  15. \file
  16. Functions for reading DSP code to load into DSP
  17. hpi_dspcode_defines HPI DSP code loading method
  18. Define exactly one of these to select how the DSP code is supplied to
  19. the adapter.
  20. End users writing applications that use the HPI interface do not have to
  21. use any of the below defines; they are only necessary for building drivers
  22. HPI_DSPCODE_FILE:
  23. DSP code is supplied as a file that is opened and read from by the driver.
  24. HPI_DSPCODE_FIRMWARE:
  25. DSP code is read using the hotplug firmware loader module.
  26. Only valid when compiling the HPI kernel driver under Linux.
  27. */
  28. /***********************************************************************/
  29. #ifndef _HPIDSPCD_H_
  30. #define _HPIDSPCD_H_
  31. #include "hpi_internal.h"
  32. #ifndef DISABLE_PRAGMA_PACK1
  33. #pragma pack(push, 1)
  34. #endif
  35. /** Descriptor for dspcode from firmware loader */
  36. struct dsp_code {
  37. /** Firmware descriptor */
  38. const struct firmware *ps_firmware;
  39. struct pci_dev *ps_dev;
  40. /** Expected number of words in the whole dsp code,INCL header */
  41. long int block_length;
  42. /** Number of words read so far */
  43. long int word_count;
  44. /** Version read from dsp code file */
  45. u32 version;
  46. /** CRC read from dsp code file */
  47. u32 crc;
  48. };
  49. #ifndef DISABLE_PRAGMA_PACK1
  50. #pragma pack(pop)
  51. #endif
  52. /** Prepare *psDspCode to refer to the requuested adapter.
  53. Searches the file, or selects the appropriate linked array
  54. \return 0 for success, or error code if requested code is not available
  55. */
  56. short hpi_dsp_code_open(
  57. /** Code identifier, usually adapter family */
  58. u32 adapter,
  59. /** Pointer to DSP code control structure */
  60. struct dsp_code *ps_dsp_code,
  61. /** Pointer to dword to receive OS specific error code */
  62. u32 *pos_error_code);
  63. /** Close the DSP code file */
  64. void hpi_dsp_code_close(struct dsp_code *ps_dsp_code);
  65. /** Rewind to the beginning of the DSP code file (for verify) */
  66. void hpi_dsp_code_rewind(struct dsp_code *ps_dsp_code);
  67. /** Read one word from the dsp code file
  68. \return 0 for success, or error code if eof, or block length exceeded
  69. */
  70. short hpi_dsp_code_read_word(struct dsp_code *ps_dsp_code,
  71. /**< DSP code descriptor */
  72. u32 *pword /**< Where to store the read word */
  73. );
  74. /** Get a block of dsp code into an internal buffer, and provide a pointer to
  75. that buffer. (If dsp code is already an array in memory, it is referenced,
  76. not copied.)
  77. \return Error if requested number of words are not available
  78. */
  79. short hpi_dsp_code_read_block(size_t words_requested,
  80. struct dsp_code *ps_dsp_code,
  81. /* Pointer to store (Pointer to code buffer) */
  82. u32 **ppblock);
  83. #endif