diff options
author | Eliot Blennerhassett <eblennerhassett@audioscience.com> | 2011-07-21 23:52:42 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-07-22 01:49:23 -0400 |
commit | 95a4c6e785bf7e2e5cde7f92c9252877b4fcea46 (patch) | |
tree | 9215aad12e57eca88581390571630c29a1a3fcbc /sound/pci/asihpi/hpidspcd.h | |
parent | 58fbf77ff5d258a15a4084940e08219d7ee6f449 (diff) |
ALSA: asihpi - DSP code loader API now independent of OS
The loader API has been revised so that OS specific data is kept
local to hpidspcd.c, and the public API is unchanged across OSes.
Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/asihpi/hpidspcd.h')
-rw-r--r-- | sound/pci/asihpi/hpidspcd.h | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/sound/pci/asihpi/hpidspcd.h b/sound/pci/asihpi/hpidspcd.h index 65f0ca732704..b22881122f19 100644 --- a/sound/pci/asihpi/hpidspcd.h +++ b/sound/pci/asihpi/hpidspcd.h | |||
@@ -2,7 +2,7 @@ | |||
2 | /** | 2 | /** |
3 | 3 | ||
4 | AudioScience HPI driver | 4 | AudioScience HPI driver |
5 | Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> | 5 | Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 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 | 8 | it under the terms of version 2 of the GNU General Public License as |
@@ -20,19 +20,6 @@ | |||
20 | \file | 20 | \file |
21 | Functions for reading DSP code to load into DSP | 21 | Functions for reading DSP code to load into DSP |
22 | 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 | */ | 23 | */ |
37 | /***********************************************************************/ | 24 | /***********************************************************************/ |
38 | #ifndef _HPIDSPCD_H_ | 25 | #ifndef _HPIDSPCD_H_ |
@@ -40,37 +27,56 @@ DSP code is read using the hotplug firmware loader module. | |||
40 | 27 | ||
41 | #include "hpi_internal.h" | 28 | #include "hpi_internal.h" |
42 | 29 | ||
43 | #ifndef DISABLE_PRAGMA_PACK1 | 30 | /** Code header version is decimal encoded e.g. 4.06.10 is 40601 */ |
44 | #pragma pack(push, 1) | 31 | #define HPI_VER_DECIMAL ((int)(HPI_VER_MAJOR(HPI_VER) * 10000 + \ |
45 | #endif | 32 | HPI_VER_MINOR(HPI_VER) * 100 + HPI_VER_RELEASE(HPI_VER))) |
33 | |||
34 | /** Header structure for dsp firmware file | ||
35 | This structure must match that used in s2bin.c for generation of asidsp.bin | ||
36 | */ | ||
37 | /*#ifndef DISABLE_PRAGMA_PACK1 */ | ||
38 | /*#pragma pack(push, 1) */ | ||
39 | /*#endif */ | ||
40 | struct code_header { | ||
41 | /** Size in bytes including header */ | ||
42 | u32 size; | ||
43 | /** File type tag "CODE" == 0x45444F43 */ | ||
44 | u32 type; | ||
45 | /** Adapter model number */ | ||
46 | u32 adapter; | ||
47 | /** Firmware version*/ | ||
48 | u32 version; | ||
49 | /** Data checksum */ | ||
50 | u32 checksum; | ||
51 | }; | ||
52 | /*#ifndef DISABLE_PRAGMA_PACK1 */ | ||
53 | /*#pragma pack(pop) */ | ||
54 | /*#endif */ | ||
55 | |||
56 | /*? Don't need the pragmas? */ | ||
57 | compile_time_assert((sizeof(struct code_header) == 20), code_header_size); | ||
46 | 58 | ||
47 | /** Descriptor for dspcode from firmware loader */ | 59 | /** Descriptor for dspcode from firmware loader */ |
48 | struct dsp_code { | 60 | struct dsp_code { |
49 | /** Firmware descriptor */ | 61 | /** copy of file header */ |
50 | const struct firmware *ps_firmware; | 62 | struct code_header header; |
51 | struct pci_dev *ps_dev; | ||
52 | /** Expected number of words in the whole dsp code,INCL header */ | 63 | /** Expected number of words in the whole dsp code,INCL header */ |
53 | long int block_length; | 64 | u32 block_length; |
54 | /** Number of words read so far */ | 65 | /** Number of words read so far */ |
55 | long int word_count; | 66 | u32 word_count; |
56 | /** Version read from dsp code file */ | ||
57 | u32 version; | ||
58 | /** CRC read from dsp code file */ | ||
59 | u32 crc; | ||
60 | }; | ||
61 | 67 | ||
62 | #ifndef DISABLE_PRAGMA_PACK1 | 68 | /** internal state of DSP code reader */ |
63 | #pragma pack(pop) | 69 | struct dsp_code_private *pvt; |
64 | #endif | 70 | }; |
65 | 71 | ||
66 | /** Prepare *psDspCode to refer to the requuested adapter. | 72 | /** Prepare *psDspCode to refer to the requested adapter's firmware. |
67 | Searches the file, or selects the appropriate linked array | 73 | Code file name is obtained from HpiOs_GetDspCodePath |
68 | 74 | ||
69 | \return 0 for success, or error code if requested code is not available | 75 | \return 0 for success, or error code if requested code is not available |
70 | */ | 76 | */ |
71 | short hpi_dsp_code_open( | 77 | short hpi_dsp_code_open( |
72 | /** Code identifier, usually adapter family */ | 78 | /** Code identifier, usually adapter family */ |
73 | u32 adapter, | 79 | u32 adapter, void *pci_dev, |
74 | /** Pointer to DSP code control structure */ | 80 | /** Pointer to DSP code control structure */ |
75 | struct dsp_code *ps_dsp_code, | 81 | struct dsp_code *ps_dsp_code, |
76 | /** Pointer to dword to receive OS specific error code */ | 82 | /** Pointer to dword to receive OS specific error code */ |