~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/firewire/tascam/tascam.h

Version: ~ [ linux-5.10-rc1 ] ~ [ linux-5.9.1 ] ~ [ linux-5.8.16 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.72 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.152 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.202 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.240 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.240 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * tascam.h - a part of driver for TASCAM FireWire series
  3  *
  4  * Copyright (c) 2015 Takashi Sakamoto
  5  *
  6  * Licensed under the terms of the GNU General Public License, version 2.
  7  */
  8 
  9 #ifndef SOUND_TASCAM_H_INCLUDED
 10 #define SOUND_TASCAM_H_INCLUDED
 11 
 12 #include <linux/device.h>
 13 #include <linux/firewire.h>
 14 #include <linux/firewire-constants.h>
 15 #include <linux/module.h>
 16 #include <linux/mod_devicetable.h>
 17 #include <linux/mutex.h>
 18 #include <linux/slab.h>
 19 #include <linux/compat.h>
 20 
 21 #include <sound/core.h>
 22 #include <sound/initval.h>
 23 #include <sound/info.h>
 24 #include <sound/pcm.h>
 25 #include <sound/pcm_params.h>
 26 #include <sound/firewire.h>
 27 #include <sound/hwdep.h>
 28 #include <sound/rawmidi.h>
 29 
 30 #include "../lib.h"
 31 #include "../amdtp-stream.h"
 32 #include "../iso-resources.h"
 33 
 34 struct snd_tscm_spec {
 35         const char *const name;
 36         bool has_adat;
 37         bool has_spdif;
 38         unsigned int pcm_capture_analog_channels;
 39         unsigned int pcm_playback_analog_channels;
 40         unsigned int midi_capture_ports;
 41         unsigned int midi_playback_ports;
 42 };
 43 
 44 #define TSCM_MIDI_IN_PORT_MAX   4
 45 #define TSCM_MIDI_OUT_PORT_MAX  4
 46 
 47 struct snd_tscm {
 48         struct snd_card *card;
 49         struct fw_unit *unit;
 50 
 51         struct mutex mutex;
 52         spinlock_t lock;
 53 
 54         bool registered;
 55         struct delayed_work dwork;
 56         const struct snd_tscm_spec *spec;
 57 
 58         struct fw_iso_resources tx_resources;
 59         struct fw_iso_resources rx_resources;
 60         struct amdtp_stream tx_stream;
 61         struct amdtp_stream rx_stream;
 62         unsigned int substreams_counter;
 63 
 64         int dev_lock_count;
 65         bool dev_lock_changed;
 66         wait_queue_head_t hwdep_wait;
 67 
 68         /* For MIDI message incoming transactions. */
 69         struct fw_address_handler async_handler;
 70         struct snd_rawmidi_substream *tx_midi_substreams[TSCM_MIDI_IN_PORT_MAX];
 71 
 72         /* For MIDI message outgoing transactions. */
 73         struct snd_fw_async_midi_port out_ports[TSCM_MIDI_OUT_PORT_MAX];
 74         u8 running_status[TSCM_MIDI_OUT_PORT_MAX];
 75         bool on_sysex[TSCM_MIDI_OUT_PORT_MAX];
 76 };
 77 
 78 #define TSCM_ADDR_BASE                  0xffff00000000ull
 79 
 80 #define TSCM_OFFSET_FIRMWARE_REGISTER   0x0000
 81 #define TSCM_OFFSET_FIRMWARE_FPGA       0x0004
 82 #define TSCM_OFFSET_FIRMWARE_ARM        0x0008
 83 #define TSCM_OFFSET_FIRMWARE_HW         0x000c
 84 
 85 #define TSCM_OFFSET_ISOC_TX_CH          0x0200
 86 #define TSCM_OFFSET_UNKNOWN             0x0204
 87 #define TSCM_OFFSET_START_STREAMING     0x0208
 88 #define TSCM_OFFSET_ISOC_RX_CH          0x020c
 89 #define TSCM_OFFSET_ISOC_RX_ON          0x0210  /* Little conviction. */
 90 #define TSCM_OFFSET_TX_PCM_CHANNELS     0x0214
 91 #define TSCM_OFFSET_RX_PCM_CHANNELS     0x0218
 92 #define TSCM_OFFSET_MULTIPLEX_MODE      0x021c
 93 #define TSCM_OFFSET_ISOC_TX_ON          0x0220
 94 /* Unknown                              0x0224 */
 95 #define TSCM_OFFSET_CLOCK_STATUS        0x0228
 96 #define TSCM_OFFSET_SET_OPTION          0x022c
 97 
 98 #define TSCM_OFFSET_MIDI_TX_ON          0x0300
 99 #define TSCM_OFFSET_MIDI_TX_ADDR_HI     0x0304
100 #define TSCM_OFFSET_MIDI_TX_ADDR_LO     0x0308
101 
102 #define TSCM_OFFSET_LED_POWER           0x0404
103 
104 #define TSCM_OFFSET_MIDI_RX_QUAD        0x4000
105 
106 enum snd_tscm_clock {
107         SND_TSCM_CLOCK_INTERNAL = 0,
108         SND_TSCM_CLOCK_WORD     = 1,
109         SND_TSCM_CLOCK_SPDIF    = 2,
110         SND_TSCM_CLOCK_ADAT     = 3,
111 };
112 
113 int amdtp_tscm_init(struct amdtp_stream *s, struct fw_unit *unit,
114                   enum amdtp_stream_direction dir, unsigned int pcm_channels);
115 int amdtp_tscm_set_parameters(struct amdtp_stream *s, unsigned int rate);
116 int amdtp_tscm_add_pcm_hw_constraints(struct amdtp_stream *s,
117                                       struct snd_pcm_runtime *runtime);
118 void amdtp_tscm_set_pcm_format(struct amdtp_stream *s, snd_pcm_format_t format);
119 
120 int snd_tscm_stream_get_rate(struct snd_tscm *tscm, unsigned int *rate);
121 int snd_tscm_stream_get_clock(struct snd_tscm *tscm,
122                               enum snd_tscm_clock *clock);
123 int snd_tscm_stream_init_duplex(struct snd_tscm *tscm);
124 void snd_tscm_stream_update_duplex(struct snd_tscm *tscm);
125 void snd_tscm_stream_destroy_duplex(struct snd_tscm *tscm);
126 int snd_tscm_stream_start_duplex(struct snd_tscm *tscm, unsigned int rate);
127 void snd_tscm_stream_stop_duplex(struct snd_tscm *tscm);
128 
129 void snd_tscm_stream_lock_changed(struct snd_tscm *tscm);
130 int snd_tscm_stream_lock_try(struct snd_tscm *tscm);
131 void snd_tscm_stream_lock_release(struct snd_tscm *tscm);
132 
133 int snd_tscm_transaction_register(struct snd_tscm *tscm);
134 int snd_tscm_transaction_reregister(struct snd_tscm *tscm);
135 void snd_tscm_transaction_unregister(struct snd_tscm *tscm);
136 
137 void snd_tscm_proc_init(struct snd_tscm *tscm);
138 
139 int snd_tscm_create_pcm_devices(struct snd_tscm *tscm);
140 
141 int snd_tscm_create_midi_devices(struct snd_tscm *tscm);
142 
143 int snd_tscm_create_hwdep_device(struct snd_tscm *tscm);
144 
145 #endif
146 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp