root/sound/pci/asihpi/hpidspcd.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0-only */
   2 /***********************************************************************/
   3 /**
   4 
   5     AudioScience HPI driver
   6     Copyright (C) 1997-2011  AudioScience Inc. <support@audioscience.com>
   7 
   8 
   9 \file
  10 Functions for reading DSP code to load into DSP
  11 
  12 */
  13 /***********************************************************************/
  14 #ifndef _HPIDSPCD_H_
  15 #define _HPIDSPCD_H_
  16 
  17 #include "hpi_internal.h"
  18 
  19 /** Header structure for dsp firmware file
  20  This structure must match that used in s2bin.c for generation of asidsp.bin
  21  */
  22 /*#ifndef DISABLE_PRAGMA_PACK1 */
  23 /*#pragma pack(push, 1) */
  24 /*#endif */
  25 struct code_header {
  26         /** Size in bytes including header */
  27         u32 size;
  28         /** File type tag "CODE" == 0x45444F43 */
  29         u32 type;
  30         /** Adapter model number */
  31         u32 adapter;
  32         /** Firmware version*/
  33         u32 version;
  34         /** Data checksum */
  35         u32 checksum;
  36 };
  37 /*#ifndef DISABLE_PRAGMA_PACK1 */
  38 /*#pragma pack(pop) */
  39 /*#endif */
  40 
  41 /*? Don't need the pragmas? */
  42 compile_time_assert((sizeof(struct code_header) == 20), code_header_size);
  43 
  44 /** Descriptor for dspcode from firmware loader */
  45 struct dsp_code {
  46         /** copy of  file header */
  47         struct code_header header;
  48         /** Expected number of words in the whole dsp code,INCL header */
  49         u32 block_length;
  50         /** Number of words read so far */
  51         u32 word_count;
  52 
  53         /** internal state of DSP code reader */
  54         struct dsp_code_private *pvt;
  55 };
  56 
  57 /** Prepare *psDspCode to refer to the requested adapter's firmware.
  58 Code file name is obtained from HpiOs_GetDspCodePath
  59 
  60 \return 0 for success, or error code if requested code is not available
  61 */
  62 short hpi_dsp_code_open(
  63         /** Code identifier, usually adapter family */
  64         u32 adapter, void *pci_dev,
  65         /** Pointer to DSP code control structure */
  66         struct dsp_code *ps_dsp_code,
  67         /** Pointer to dword to receive OS specific error code */
  68         u32 *pos_error_code);
  69 
  70 /** Close the DSP code file */
  71 void hpi_dsp_code_close(struct dsp_code *ps_dsp_code);
  72 
  73 /** Rewind to the beginning of the DSP code file (for verify) */
  74 void hpi_dsp_code_rewind(struct dsp_code *ps_dsp_code);
  75 
  76 /** Read one word from the dsp code file
  77         \return 0 for success, or error code if eof, or block length exceeded
  78 */
  79 short hpi_dsp_code_read_word(struct dsp_code *ps_dsp_code,
  80                                       /**< DSP code descriptor */
  81         u32 *pword /**< Where to store the read word */
  82         );
  83 
  84 /** Get a block of dsp code into an internal buffer, and provide a pointer to
  85 that buffer. (If dsp code is already an array in memory, it is referenced,
  86 not copied.)
  87 
  88 \return Error if requested number of words are not available
  89 */
  90 short hpi_dsp_code_read_block(size_t words_requested,
  91         struct dsp_code *ps_dsp_code,
  92         /* Pointer to store (Pointer to code buffer) */
  93         u32 **ppblock);
  94 
  95 #endif

/* [<][>][^][v][top][bottom][index][help] */