Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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