Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _UAPI_SOUND_FIREWIRE_H_INCLUDED
0003 #define _UAPI_SOUND_FIREWIRE_H_INCLUDED
0004 
0005 #include <linux/ioctl.h>
0006 #include <linux/types.h>
0007 
0008 /* events can be read() from the hwdep device */
0009 
0010 #define SNDRV_FIREWIRE_EVENT_LOCK_STATUS    0x000010cc
0011 #define SNDRV_FIREWIRE_EVENT_DICE_NOTIFICATION  0xd1ce004e
0012 #define SNDRV_FIREWIRE_EVENT_EFW_RESPONSE   0x4e617475
0013 #define SNDRV_FIREWIRE_EVENT_DIGI00X_MESSAGE    0x746e736c
0014 #define SNDRV_FIREWIRE_EVENT_MOTU_NOTIFICATION  0x64776479
0015 #define SNDRV_FIREWIRE_EVENT_TASCAM_CONTROL 0x7473636d
0016 #define SNDRV_FIREWIRE_EVENT_MOTU_REGISTER_DSP_CHANGE   0x4d545244
0017 
0018 struct snd_firewire_event_common {
0019     unsigned int type; /* SNDRV_FIREWIRE_EVENT_xxx */
0020 };
0021 
0022 struct snd_firewire_event_lock_status {
0023     unsigned int type;
0024     unsigned int status; /* 0/1 = unlocked/locked */
0025 };
0026 
0027 struct snd_firewire_event_dice_notification {
0028     unsigned int type;
0029     unsigned int notification; /* DICE-specific bits */
0030 };
0031 
0032 #define SND_EFW_TRANSACTION_USER_SEQNUM_MAX ((__u32)((__u16)~0) - 1)
0033 /* each field should be in big endian */
0034 struct snd_efw_transaction {
0035     __be32 length;
0036     __be32 version;
0037     __be32 seqnum;
0038     __be32 category;
0039     __be32 command;
0040     __be32 status;
0041     __be32 params[];
0042 };
0043 struct snd_firewire_event_efw_response {
0044     unsigned int type;
0045     __be32 response[];  /* some responses */
0046 };
0047 
0048 struct snd_firewire_event_digi00x_message {
0049     unsigned int type;
0050     __u32 message;  /* Digi00x-specific message */
0051 };
0052 
0053 struct snd_firewire_event_motu_notification {
0054     unsigned int type;
0055     __u32 message;  /* MOTU-specific bits. */
0056 };
0057 
0058 struct snd_firewire_tascam_change {
0059     unsigned int index;
0060     __be32 before;
0061     __be32 after;
0062 };
0063 
0064 struct snd_firewire_event_tascam_control {
0065     unsigned int type;
0066     struct snd_firewire_tascam_change changes[];
0067 };
0068 
0069 struct snd_firewire_event_motu_register_dsp_change {
0070     unsigned int type;
0071     __u32 count;        /* The number of changes. */
0072     __u32 changes[];    /* Encoded event for change of register DSP. */
0073 };
0074 
0075 union snd_firewire_event {
0076     struct snd_firewire_event_common            common;
0077     struct snd_firewire_event_lock_status       lock_status;
0078     struct snd_firewire_event_dice_notification dice_notification;
0079     struct snd_firewire_event_efw_response      efw_response;
0080     struct snd_firewire_event_digi00x_message   digi00x_message;
0081     struct snd_firewire_event_tascam_control    tascam_control;
0082     struct snd_firewire_event_motu_notification motu_notification;
0083     struct snd_firewire_event_motu_register_dsp_change motu_register_dsp_change;
0084 };
0085 
0086 
0087 #define SNDRV_FIREWIRE_IOCTL_GET_INFO _IOR('H', 0xf8, struct snd_firewire_get_info)
0088 #define SNDRV_FIREWIRE_IOCTL_LOCK      _IO('H', 0xf9)
0089 #define SNDRV_FIREWIRE_IOCTL_UNLOCK    _IO('H', 0xfa)
0090 #define SNDRV_FIREWIRE_IOCTL_TASCAM_STATE _IOR('H', 0xfb, struct snd_firewire_tascam_state)
0091 #define SNDRV_FIREWIRE_IOCTL_MOTU_REGISTER_DSP_METER    _IOR('H', 0xfc, struct snd_firewire_motu_register_dsp_meter)
0092 #define SNDRV_FIREWIRE_IOCTL_MOTU_COMMAND_DSP_METER _IOR('H', 0xfd, struct snd_firewire_motu_command_dsp_meter)
0093 #define SNDRV_FIREWIRE_IOCTL_MOTU_REGISTER_DSP_PARAMETER    _IOR('H', 0xfe, struct snd_firewire_motu_register_dsp_parameter)
0094 
0095 #define SNDRV_FIREWIRE_TYPE_DICE    1
0096 #define SNDRV_FIREWIRE_TYPE_FIREWORKS   2
0097 #define SNDRV_FIREWIRE_TYPE_BEBOB   3
0098 #define SNDRV_FIREWIRE_TYPE_OXFW    4
0099 #define SNDRV_FIREWIRE_TYPE_DIGI00X 5
0100 #define SNDRV_FIREWIRE_TYPE_TASCAM  6
0101 #define SNDRV_FIREWIRE_TYPE_MOTU    7
0102 #define SNDRV_FIREWIRE_TYPE_FIREFACE    8
0103 
0104 struct snd_firewire_get_info {
0105     unsigned int type; /* SNDRV_FIREWIRE_TYPE_xxx */
0106     unsigned int card; /* same as fw_cdev_get_info.card */
0107     unsigned char guid[8];
0108     char device_name[16]; /* device node in /dev */
0109 };
0110 
0111 /*
0112  * SNDRV_FIREWIRE_IOCTL_LOCK prevents the driver from streaming.
0113  * Returns -EBUSY if the driver is already streaming.
0114  */
0115 
0116 #define SNDRV_FIREWIRE_TASCAM_STATE_COUNT   64
0117 
0118 struct snd_firewire_tascam_state {
0119     __be32 data[SNDRV_FIREWIRE_TASCAM_STATE_COUNT];
0120 };
0121 
0122 /*
0123  * In below MOTU models, software is allowed to control their DSP by accessing to registers.
0124  *  - 828mk2
0125  *  - 896hd
0126  *  - Traveler
0127  *  - 8 pre
0128  *  - Ultralite
0129  *  - 4 pre
0130  *  - Audio Express
0131  *
0132  * On the other hand, the status of DSP is split into specific messages included in the sequence of
0133  * isochronous packet. ALSA firewire-motu driver gathers the messages and allow userspace applications
0134  * to read it via ioctl. In 828mk2, 896hd, and Traveler, hardware meter for all of physical inputs
0135  * are put into the message, while one pair of physical outputs is selected. The selection is done by
0136  * LSB one byte in asynchronous write quadlet transaction to 0x'ffff'f000'0b2c.
0137  *
0138  * I note that V3HD/V4HD uses asynchronous transaction for the purpose. The destination address is
0139  * registered to 0x'ffff'f000'0b38 and '0b3c by asynchronous write quadlet request. The size of
0140  * message differs between 23 and 51 quadlets. For the case, the number of mixer bus can be extended
0141  * up to 12.
0142  */
0143 
0144 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_INPUT_COUNT  24
0145 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_OUTPUT_COUNT 24
0146 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_COUNT \
0147     (SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_INPUT_COUNT + SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_OUTPUT_COUNT)
0148 
0149 /**
0150  * struct snd_firewire_motu_register_dsp_meter - the container for meter information in DSP
0151  *                       controlled by register access
0152  * @data: Signal level meters. The mapping between position and input/output channel is
0153  *    model-dependent.
0154  *
0155  * The structure expresses the part of DSP status for hardware meter. The u8 storage includes linear
0156  * value for audio signal level between 0x00 and 0x7f.
0157  */
0158 struct snd_firewire_motu_register_dsp_meter {
0159     __u8 data[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_COUNT];
0160 };
0161 
0162 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT        4
0163 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT    20
0164 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_INPUT_COUNT        10
0165 #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT    (SNDRV_FIREWIRE_MOTU_REGISTER_DSP_INPUT_COUNT + 2)
0166 
0167 /**
0168  * snd_firewire_motu_register_dsp_parameter - the container for parameters of DSP controlled
0169  *                        by register access.
0170  * @mixer.source.gain: The gain of source to mixer.
0171  * @mixer.source.pan: The L/R balance of source to mixer.
0172  * @mixer.source.flag: The flag of source to mixer, including mute, solo.
0173  * @mixer.source.paired_balance: The L/R balance of paired source to mixer, only for 4 pre and
0174  *               Audio Express.
0175  * @mixer.source.paired_width: The width of paired source to mixer, only for 4 pre and
0176  *                 Audio Express.
0177  * @mixer.output.paired_volume: The volume of paired output from mixer.
0178  * @mixer.output.paired_flag: The flag of paired output from mixer.
0179  * @output.main_paired_volume: The volume of paired main output.
0180  * @output.hp_paired_volume: The volume of paired hp output.
0181  * @output.hp_paired_assignment: The source assigned to paired hp output.
0182  * @output.reserved: Padding for 32 bit alignment for future extension.
0183  * @line_input.boost_flag: The flags of boost for line inputs, only for 828mk2 and Traveler.
0184  * @line_input.nominal_level_flag: The flags of nominal level for line inputs, only for 828mk2 and
0185  *                 Traveler.
0186  * @line_input.reserved: Padding for 32 bit alignment for future extension.
0187  * @input.gain_and_invert: The value including gain and invert for input, only for Ultralite, 4 pre
0188  *             and Audio Express.
0189  * @input.flag: The flag of input; e.g. jack detection, phantom power, and pad, only for Ultralite,
0190  *      4 pre and Audio express.
0191  * @reserved: Padding so that the size of structure is kept to 512 byte, but for future extension.
0192  *
0193  * The structure expresses the set of parameters for DSP controlled by register access.
0194  */
0195 struct snd_firewire_motu_register_dsp_parameter {
0196     struct {
0197         struct {
0198             __u8 gain[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT];
0199             __u8 pan[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT];
0200             __u8 flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT];
0201             __u8 paired_balance[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT];
0202             __u8 paired_width[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT];
0203         } source[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT];
0204         struct {
0205             __u8 paired_volume[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT];
0206             __u8 paired_flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT];
0207         } output;
0208     } mixer;
0209     struct {
0210         __u8 main_paired_volume;
0211         __u8 hp_paired_volume;
0212         __u8 hp_paired_assignment;
0213         __u8 reserved[5];
0214     } output;
0215     struct {
0216         __u8 boost_flag;
0217         __u8 nominal_level_flag;
0218         __u8 reserved[6];
0219     } line_input;
0220     struct {
0221         __u8 gain_and_invert[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT];
0222         __u8 flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT];
0223     } input;
0224     __u8 reserved[64];
0225 };
0226 
0227 /*
0228  * In below MOTU models, software is allowed to control their DSP by command in frame of
0229  * asynchronous transaction to 0x'ffff'0001'0000:
0230  *
0231  *  - 828 mk3 (FireWire only and Hybrid)
0232  *  - 896 mk3 (FireWire only and Hybrid)
0233  *  - Ultralite mk3 (FireWire only and Hybrid)
0234  *  - Traveler mk3
0235  *  - Track 16
0236  *
0237  * On the other hand, the states of hardware meter is split into specific messages included in the
0238  * sequence of isochronous packet. ALSA firewire-motu driver gathers the message and allow userspace
0239  * application to read it via ioctl.
0240  */
0241 
0242 #define SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT 400
0243 
0244 /**
0245  * struct snd_firewire_motu_command_dsp_meter - the container for meter information in DSP
0246  *                      controlled by command
0247  * @data: Signal level meters. The mapping between position and signal channel is model-dependent.
0248  *
0249  * The structure expresses the part of DSP status for hardware meter. The 32 bit storage is
0250  * estimated to include IEEE 764 32 bit single precision floating point (binary32) value. It is
0251  * expected to be linear value (not logarithm) for audio signal level between 0.0 and +1.0.
0252  */
0253 struct snd_firewire_motu_command_dsp_meter {
0254 #ifdef __KERNEL__
0255     __u32 data[SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT];
0256 #else
0257     float data[SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT];
0258 #endif
0259 };
0260 
0261 #endif /* _UAPI_SOUND_FIREWIRE_H_INCLUDED */