/* SPDX-License-Identifier: GPL-2.0-only */1/***********************************************************************/2/*34AudioScience HPI driver5Copyright (C) 1997-2011 AudioScience Inc. <[email protected]>678\file9Functions for reading DSP code to load into DSP1011*/12/***********************************************************************/13#ifndef _HPIDSPCD_H_14#define _HPIDSPCD_H_1516#include "hpi_internal.h"1718/** Header structure for dsp firmware file19This structure must match that used in s2bin.c for generation of asidsp.bin20*/21/*#ifndef DISABLE_PRAGMA_PACK1 */22/*#pragma pack(push, 1) */23/*#endif */24struct code_header {25/** Size in bytes including header */26u32 size;27/** File type tag "CODE" == 0x45444F43 */28u32 type;29/** Adapter model number */30u32 adapter;31/** Firmware version*/32u32 version;33/** Data checksum */34u32 checksum;35};36/*#ifndef DISABLE_PRAGMA_PACK1 */37/*#pragma pack(pop) */38/*#endif */3940/*? Don't need the pragmas? */41compile_time_assert((sizeof(struct code_header) == 20), code_header_size);4243/** Descriptor for dspcode from firmware loader */44struct dsp_code {45/** copy of file header */46struct code_header header;47/** Expected number of words in the whole dsp code,INCL header */48u32 block_length;49/** Number of words read so far */50u32 word_count;5152/** internal state of DSP code reader */53struct dsp_code_private *pvt;54};5556/** Prepare *psDspCode to refer to the requested adapter's firmware.57Code file name is obtained from HpiOs_GetDspCodePath5859\return 0 for success, or error code if requested code is not available60*/61short hpi_dsp_code_open(62/** Code identifier, usually adapter family */63u32 adapter, void *pci_dev,64/** Pointer to DSP code control structure */65struct dsp_code *ps_dsp_code,66/** Pointer to dword to receive OS specific error code */67u32 *pos_error_code);6869/** Close the DSP code file */70void hpi_dsp_code_close(struct dsp_code *ps_dsp_code);7172/** Rewind to the beginning of the DSP code file (for verify) */73void hpi_dsp_code_rewind(struct dsp_code *ps_dsp_code);7475/** Read one word from the dsp code file76\return 0 for success, or error code if eof, or block length exceeded77*/78short hpi_dsp_code_read_word(struct dsp_code *ps_dsp_code,79/**< DSP code descriptor */80u32 *pword /**< Where to store the read word */81);8283/** Get a block of dsp code into an internal buffer, and provide a pointer to84that buffer. (If dsp code is already an array in memory, it is referenced,85not copied.)8687\return Error if requested number of words are not available88*/89short hpi_dsp_code_read_block(size_t words_requested,90struct dsp_code *ps_dsp_code,91/* Pointer to store (Pointer to code buffer) */92u32 **ppblock);9394#endif959697