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