Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /* -*- linux-c -*- *
0003  *
0004  * ALSA driver for the digigram lx6464es interface
0005  *
0006  * Copyright (c) 2009 Tim Blechmann <tim@klingt.org>
0007  */
0008 
0009 #ifndef LX6464ES_H
0010 #define LX6464ES_H
0011 
0012 #include <linux/spinlock.h>
0013 #include <linux/atomic.h>
0014 
0015 #include <sound/core.h>
0016 #include <sound/pcm.h>
0017 
0018 #include "lx_core.h"
0019 
0020 #define LXP "LX6464ES: "
0021 
0022 enum {
0023     ES_cmd_free         = 0,    /* no command executing */
0024     ES_cmd_processing   = 1,    /* execution of a read/write command */
0025     ES_read_pending     = 2,    /* a asynchron read command is pending */
0026     ES_read_finishing   = 3,    /* a read command has finished waiting (set by
0027                  * Interrupt or CancelIrp) */
0028 };
0029 
0030 enum lx_stream_status {
0031     LX_STREAM_STATUS_FREE,
0032 /*  LX_STREAM_STATUS_OPEN, */
0033     LX_STREAM_STATUS_SCHEDULE_RUN,
0034 /*  LX_STREAM_STATUS_STARTED, */
0035     LX_STREAM_STATUS_RUNNING,
0036     LX_STREAM_STATUS_SCHEDULE_STOP,
0037 /*  LX_STREAM_STATUS_STOPPED, */
0038 /*  LX_STREAM_STATUS_PAUSED */
0039 };
0040 
0041 
0042 struct lx_stream {
0043     struct snd_pcm_substream  *stream;
0044     snd_pcm_uframes_t          frame_pos;
0045     enum lx_stream_status      status; /* free, open, running, draining
0046                         * pause */
0047     unsigned int               is_capture:1;
0048 };
0049 
0050 
0051 struct lx6464es {
0052     struct snd_card        *card;
0053     struct pci_dev         *pci;
0054     int         irq;
0055 
0056     u8          mac_address[6];
0057 
0058     struct mutex        lock;        /* interrupt lock */
0059     struct mutex            setup_mutex; /* mutex used in hw_params, open
0060                           * and close */
0061 
0062     /* ports */
0063     unsigned long       port_plx;      /* io port (size=256) */
0064     void __iomem           *port_plx_remapped; /* remapped plx port */
0065     void __iomem           *port_dsp_bar;      /* memory port (32-bit,
0066                             * non-prefetchable,
0067                             * size=8K) */
0068 
0069     /* messaging */
0070     struct mutex        msg_lock;          /* message lock */
0071     struct lx_rmh           rmh;
0072     u32         irqsrc;
0073 
0074     /* configuration */
0075     uint            freq_ratio : 2;
0076     uint                    playback_mute : 1;
0077     uint                    hardware_running[2];
0078     u32                     board_sample_rate; /* sample rate read from
0079                             * board */
0080     u16                     pcm_granularity;   /* board blocksize */
0081 
0082     /* dma */
0083     struct snd_dma_buffer   capture_dma_buf;
0084     struct snd_dma_buffer   playback_dma_buf;
0085 
0086     /* pcm */
0087     struct snd_pcm         *pcm;
0088 
0089     /* streams */
0090     struct lx_stream        capture_stream;
0091     struct lx_stream        playback_stream;
0092 };
0093 
0094 
0095 #endif /* LX6464ES_H */