#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/io.h>
#include <sound/core.h>
#include "pcxhr.h"
#include "pcxhr_mixer.h"
#include "pcxhr_hwdep.h"
#include "pcxhr_core.h"
#define PCXHR_PLX_OFFSET_MIN …
#define PCXHR_PLX_MBOX0 …
#define PCXHR_PLX_MBOX1 …
#define PCXHR_PLX_MBOX2 …
#define PCXHR_PLX_MBOX3 …
#define PCXHR_PLX_MBOX4 …
#define PCXHR_PLX_MBOX5 …
#define PCXHR_PLX_MBOX6 …
#define PCXHR_PLX_MBOX7 …
#define PCXHR_PLX_L2PCIDB …
#define PCXHR_PLX_IRQCS …
#define PCXHR_PLX_CHIPSC …
#define PCXHR_DSP_ICR …
#define PCXHR_DSP_CVR …
#define PCXHR_DSP_ISR …
#define PCXHR_DSP_IVR …
#define PCXHR_DSP_RXH …
#define PCXHR_DSP_TXH …
#define PCXHR_DSP_RXM …
#define PCXHR_DSP_TXM …
#define PCXHR_DSP_RXL …
#define PCXHR_DSP_TXL …
#define PCXHR_DSP_RESET …
#define PCXHR_DSP_OFFSET_MAX …
#define PCXHR_PLX …
#define PCXHR_DSP …
#if (PCXHR_DSP_OFFSET_MAX > PCXHR_PLX_OFFSET_MIN)
#error PCXHR_REG_TO_PORT(x)
#else
#define PCXHR_REG_TO_PORT(x) …
#endif
#define PCXHR_INPB(mgr,x) …
#define PCXHR_INPL(mgr,x) …
#define PCXHR_OUTPB(mgr,x,data) …
#define PCXHR_OUTPL(mgr,x,data) …
#define PCXHR_MBOX0_HF5 …
#define PCXHR_MBOX0_HF4 …
#define PCXHR_MBOX0_BOOT_HERE …
#define PCXHR_IRQCS_ENABLE_PCIIRQ …
#define PCXHR_IRQCS_ENABLE_PCIDB …
#define PCXHR_IRQCS_ACTIVE_PCIDB …
#define PCXHR_CHIPSC_INIT_VALUE …
#define PCXHR_CHIPSC_RESET_XILINX …
#define PCXHR_CHIPSC_GPI_USERI …
#define PCXHR_CHIPSC_DATA_CLK …
#define PCXHR_CHIPSC_DATA_IN …
#define PCXHR_ICR_HI08_RREQ …
#define PCXHR_ICR_HI08_TREQ …
#define PCXHR_ICR_HI08_HDRQ …
#define PCXHR_ICR_HI08_HF0 …
#define PCXHR_ICR_HI08_HF1 …
#define PCXHR_ICR_HI08_HLEND …
#define PCXHR_ICR_HI08_INIT …
#define PCXHR_CVR_HI08_HC …
#define PCXHR_ISR_HI08_RXDF …
#define PCXHR_ISR_HI08_TXDE …
#define PCXHR_ISR_HI08_TRDY …
#define PCXHR_ISR_HI08_ERR …
#define PCXHR_ISR_HI08_CHK …
#define PCXHR_ISR_HI08_HREQ …
#define PCXHR_WAIT_DEFAULT …
#define PCXHR_WAIT_IT …
#define PCXHR_WAIT_IT_EXTRA …
static int pcxhr_check_reg_bit(struct pcxhr_mgr *mgr, unsigned int reg,
unsigned char mask, unsigned char bit, int time,
unsigned char* read)
{ … }
#define PCXHR_TIMEOUT_DSP …
#define PCXHR_MASK_EXTRA_INFO …
#define PCXHR_MASK_IT_HF0 …
#define PCXHR_MASK_IT_HF1 …
#define PCXHR_MASK_IT_NO_HF0_HF1 …
#define PCXHR_MASK_IT_MANAGE_HF5 …
#define PCXHR_MASK_IT_WAIT …
#define PCXHR_MASK_IT_WAIT_EXTRA …
#define PCXHR_IT_SEND_BYTE_XILINX …
#define PCXHR_IT_TEST_XILINX …
#define PCXHR_IT_DOWNLOAD_BOOT …
#define PCXHR_IT_RESET_BOARD_FUNC …
#define PCXHR_IT_DOWNLOAD_DSP …
#define PCXHR_IT_DEBUG …
#define PCXHR_IT_RESET_SEMAPHORE …
#define PCXHR_IT_MESSAGE …
#define PCXHR_IT_RESET_CHK …
#define PCXHR_IT_UPDATE_RBUFFER …
static int pcxhr_send_it_dsp(struct pcxhr_mgr *mgr,
unsigned int itdsp, int atomic)
{ … }
void pcxhr_reset_xilinx_com(struct pcxhr_mgr *mgr)
{ … }
static void pcxhr_enable_irq(struct pcxhr_mgr *mgr, int enable)
{ … }
void pcxhr_reset_dsp(struct pcxhr_mgr *mgr)
{ … }
void pcxhr_enable_dsp(struct pcxhr_mgr *mgr)
{ … }
int pcxhr_load_xilinx_binary(struct pcxhr_mgr *mgr,
const struct firmware *xilinx, int second)
{ … }
static int pcxhr_download_dsp(struct pcxhr_mgr *mgr, const struct firmware *dsp)
{ … }
int pcxhr_load_eeprom_binary(struct pcxhr_mgr *mgr,
const struct firmware *eeprom)
{ … }
int pcxhr_load_boot_binary(struct pcxhr_mgr *mgr, const struct firmware *boot)
{ … }
int pcxhr_load_dsp_binary(struct pcxhr_mgr *mgr, const struct firmware *dsp)
{ … }
struct pcxhr_cmd_info { … };
enum { … };
static const struct pcxhr_cmd_info pcxhr_dsp_cmds[] = …;
#ifdef CONFIG_SND_DEBUG_VERBOSE
static const char * const cmd_names[] = …;
#endif
static int pcxhr_read_rmh_status(struct pcxhr_mgr *mgr, struct pcxhr_rmh *rmh)
{ … }
static int pcxhr_send_msg_nolock(struct pcxhr_mgr *mgr, struct pcxhr_rmh *rmh)
{ … }
void pcxhr_init_rmh(struct pcxhr_rmh *rmh, int cmd)
{ … }
void pcxhr_set_pipe_cmd_params(struct pcxhr_rmh *rmh, int capture,
unsigned int param1, unsigned int param2,
unsigned int param3)
{ … }
int pcxhr_send_msg(struct pcxhr_mgr *mgr, struct pcxhr_rmh *rmh)
{ … }
static inline int pcxhr_pipes_running(struct pcxhr_mgr *mgr)
{ … }
#define PCXHR_PIPE_STATE_CAPTURE_OFFSET …
#define MAX_WAIT_FOR_DSP …
static int pcxhr_prepair_pipe_start(struct pcxhr_mgr *mgr,
int audio_mask, int *retry)
{ … }
static int pcxhr_stop_pipes(struct pcxhr_mgr *mgr, int audio_mask)
{ … }
static int pcxhr_toggle_pipes(struct pcxhr_mgr *mgr, int audio_mask)
{ … }
int pcxhr_set_pipe_state(struct pcxhr_mgr *mgr, int playback_mask,
int capture_mask, int start)
{ … }
int pcxhr_write_io_num_reg_cont(struct pcxhr_mgr *mgr, unsigned int mask,
unsigned int value, int *changed)
{ … }
#define PCXHR_IRQ_TIMER …
#define PCXHR_IRQ_FREQ_CHANGE …
#define PCXHR_IRQ_TIME_CODE …
#define PCXHR_IRQ_NOTIFY …
#define PCXHR_IRQ_ASYNC …
#define PCXHR_IRQ_MASK …
#define PCXHR_FATAL_DSP_ERR …
enum pcxhr_async_err_src { … };
static int pcxhr_handle_async_err(struct pcxhr_mgr *mgr, u32 err,
enum pcxhr_async_err_src err_src, int pipe,
int is_capture)
{ … }
static void pcxhr_msg_thread(struct pcxhr_mgr *mgr)
{ … }
static u_int64_t pcxhr_stream_read_position(struct pcxhr_mgr *mgr,
struct pcxhr_stream *stream)
{ … }
static void pcxhr_update_timer_pos(struct pcxhr_mgr *mgr,
struct pcxhr_stream *stream,
int samples_to_add)
{ … }
irqreturn_t pcxhr_interrupt(int irq, void *dev_id)
{ … }
irqreturn_t pcxhr_threaded_irq(int irq, void *dev_id)
{ … }