/***********************************************************************/1/**23AudioScience HPI driver4Copyright (C) 1997-2010 AudioScience Inc. <[email protected]>56This program is free software; you can redistribute it and/or modify7it under the terms of version 2 of the GNU General Public License as8published by the Free Software Foundation;910This program is distributed in the hope that it will be useful,11but WITHOUT ANY WARRANTY; without even the implied warranty of12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13GNU General Public License for more details.1415You should have received a copy of the GNU General Public License16along with this program; if not, write to the Free Software17Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA1819\file20Functions for reading DSP code to load into DSP2122hpi_dspcode_defines HPI DSP code loading method23Define exactly one of these to select how the DSP code is supplied to24the adapter.2526End users writing applications that use the HPI interface do not have to27use any of the below defines; they are only necessary for building drivers2829HPI_DSPCODE_FILE:30DSP code is supplied as a file that is opened and read from by the driver.3132HPI_DSPCODE_FIRMWARE:33DSP code is read using the hotplug firmware loader module.34Only valid when compiling the HPI kernel driver under Linux.35*/36/***********************************************************************/37#ifndef _HPIDSPCD_H_38#define _HPIDSPCD_H_3940#include "hpi_internal.h"4142#ifndef DISABLE_PRAGMA_PACK143#pragma pack(push, 1)44#endif4546/** Descriptor for dspcode from firmware loader */47struct dsp_code {48/** Firmware descriptor */49const struct firmware *ps_firmware;50struct pci_dev *ps_dev;51/** Expected number of words in the whole dsp code,INCL header */52long int block_length;53/** Number of words read so far */54long int word_count;55/** Version read from dsp code file */56u32 version;57/** CRC read from dsp code file */58u32 crc;59};6061#ifndef DISABLE_PRAGMA_PACK162#pragma pack(pop)63#endif6465/** Prepare *psDspCode to refer to the requuested adapter.66Searches the file, or selects the appropriate linked array6768\return 0 for success, or error code if requested code is not available69*/70short hpi_dsp_code_open(71/** Code identifier, usually adapter family */72u32 adapter,73/** Pointer to DSP code control structure */74struct dsp_code *ps_dsp_code,75/** Pointer to dword to receive OS specific error code */76u32 *pos_error_code);7778/** Close the DSP code file */79void hpi_dsp_code_close(struct dsp_code *ps_dsp_code);8081/** Rewind to the beginning of the DSP code file (for verify) */82void hpi_dsp_code_rewind(struct dsp_code *ps_dsp_code);8384/** Read one word from the dsp code file85\return 0 for success, or error code if eof, or block length exceeded86*/87short hpi_dsp_code_read_word(struct dsp_code *ps_dsp_code,88/**< DSP code descriptor */89u32 *pword /**< Where to store the read word */90);9192/** Get a block of dsp code into an internal buffer, and provide a pointer to93that buffer. (If dsp code is already an array in memory, it is referenced,94not copied.)9596\return Error if requested number of words are not available97*/98short hpi_dsp_code_read_block(size_t words_requested,99struct dsp_code *ps_dsp_code,100/* Pointer to store (Pointer to code buffer) */101u32 **ppblock);102103#endif104105106