Linux Audio

Check our new training course

Embedded Linux training

Mar 10-20, 2025, special US time zones
Register
Loading...
v3.15
 
  1/*
  2 * Driver for Digigram VX soundcards
  3 *
  4 * Definitions of DSP commands
  5 *
  6 * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de>
  7 *
  8 *   This program is free software; you can redistribute it and/or modify
  9 *   it under the terms of the GNU General Public License as published by
 10 *   the Free Software Foundation; either version 2 of the License, or
 11 *   (at your option) any later version.
 12 *
 13 *   This program is distributed in the hope that it will be useful,
 14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16 *   GNU General Public License for more details.
 17 *
 18 *   You should have received a copy of the GNU General Public License
 19 *   along with this program; if not, write to the Free Software
 20 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 21 */
 22
 23#ifndef __VX_CMD_H
 24#define __VX_CMD_H
 25
 26enum {
 27	CMD_VERSION,
 28	CMD_SUPPORTED,
 29	CMD_TEST_IT,
 30	CMD_SEND_IRQA,
 31	CMD_IBL,
 32	CMD_ASYNC,
 33	CMD_RES_PIPE,
 34	CMD_FREE_PIPE,
 35	CMD_CONF_PIPE,
 36	CMD_ABORT_CONF_PIPE,
 37	CMD_PARAM_OUTPUT_PIPE,
 38	CMD_STOP_PIPE,
 39	CMD_PIPE_STATE,
 40	CMD_PIPE_SPL_COUNT,
 41	CMD_CAN_START_PIPE,
 42	CMD_SIZE_HBUFFER,
 43	CMD_START_STREAM,
 44	CMD_START_ONE_STREAM,
 45	CMD_PAUSE_STREAM,
 46	CMD_PAUSE_ONE_STREAM,
 47	CMD_STREAM_OUT_LEVEL_ADJUST,
 48	CMD_STOP_STREAM,
 49	CMD_FORMAT_STREAM_OUT,
 50	CMD_FORMAT_STREAM_IN,
 51	CMD_GET_STREAM_STATE,
 52	CMD_DROP_BYTES_AWAY,
 53	CMD_GET_REMAINING_BYTES,
 54	CMD_CONNECT_AUDIO,
 55	CMD_AUDIO_LEVEL_ADJUST,
 56	CMD_AUDIO_VU_PIC_METER,
 57	CMD_GET_AUDIO_LEVELS,
 58	CMD_GET_NOTIFY_EVENT,
 59	CMD_INFO_NOTIFIED,
 60	CMD_ACCESS_IO_FCT,
 61	CMD_STATUS_R_BUFFERS,
 62	CMD_UPDATE_R_BUFFERS,
 63	CMD_LOAD_EFFECT_CONTEXT,
 64	CMD_EFFECT_ONE_PIPE,
 65	CMD_MODIFY_CLOCK,
 66	CMD_STREAM1_OUT_SET_N_LEVELS,
 67	CMD_PURGE_STREAM_DCMDS,
 68	CMD_NOTIFY_PIPE_TIME,
 69	CMD_LOAD_EFFECT_CONTEXT_PACKET,
 70	CMD_RELIC_R_BUFFER,
 71	CMD_RESYNC_AUDIO_INPUTS,
 72	CMD_NOTIFY_STREAM_TIME,
 73	CMD_STREAM_SAMPLE_COUNT,
 74	CMD_CONFIG_TIME_CODE,
 75	CMD_GET_TIME_CODE,
 76	CMD_MANAGE_SIGNAL,
 77	CMD_PARAMETER_STREAM_OUT,
 78	CMD_READ_BOARD_FREQ,
 79	CMD_GET_STREAM_LEVELS,
 80	CMD_PURGE_PIPE_DCMDS,
 81	// CMD_SET_STREAM_OUT_EFFECTS,
 82	// CMD_GET_STREAM_OUT_EFFECTS,
 83	CMD_CONNECT_MONITORING,
 84	CMD_STREAM2_OUT_SET_N_LEVELS,
 85	CMD_CANCEL_R_BUFFERS,
 86	CMD_NOTIFY_END_OF_BUFFER,
 87	CMD_GET_STREAM_VU_METER,
 88	CMD_LAST_INDEX
 89};
 90
 91struct vx_cmd_info {
 92	unsigned int opcode;	/* command word */
 93	int length;		/* command length (in words) */
 94	int st_type;		/* status type (RMH_SSIZE_XXX) */
 95	int st_length;		/* fixed length */
 96};
 97
 98/* Family and code op of some DSP requests. */
 99#define CODE_OP_PIPE_TIME                       0x004e0000
100#define CODE_OP_START_STREAM                    0x00800000
101#define CODE_OP_PAUSE_STREAM                    0x00810000
102#define CODE_OP_OUT_STREAM_LEVEL                0x00820000
103#define CODE_OP_UPDATE_R_BUFFERS                0x00840000
104#define CODE_OP_OUT_STREAM1_LEVEL_CURVE         0x00850000
105#define CODE_OP_OUT_STREAM2_LEVEL_CURVE         0x00930000
106#define CODE_OP_OUT_STREAM_FORMAT               0x00860000
107#define CODE_OP_STREAM_TIME                     0x008f0000
108#define CODE_OP_OUT_STREAM_EXTRAPARAMETER       0x00910000
109#define CODE_OP_OUT_AUDIO_LEVEL                 0x00c20000
110
111#define NOTIFY_LAST_COMMAND     0x00400000
112
113/* Values for a user delay */
114#define DC_DIFFERED_DELAY       (1<<BIT_DIFFERED_COMMAND)
115#define DC_NOTIFY_DELAY         (1<<BIT_NOTIFIED_COMMAND)
116#define DC_HBUFFER_DELAY        (1<<BIT_TIME_RELATIVE_TO_BUFFER)
117#define DC_MULTIPLE_DELAY       (1<<BIT_RESERVED)
118#define DC_STREAM_TIME_DELAY    (1<<BIT_STREAM_TIME)
119#define DC_CANCELLED_DELAY      (1<<BIT_CANCELLED_COMMAND)
120
121/* Values for tiDelayed field in TIME_INFO structure,
122 * and for pbPause field in PLAY_BUFFER_INFO structure
123 */
124#define BIT_DIFFERED_COMMAND                0
125#define BIT_NOTIFIED_COMMAND                1
126#define BIT_TIME_RELATIVE_TO_BUFFER         2
127#define BIT_RESERVED                        3
128#define BIT_STREAM_TIME                     4
129#define BIT_CANCELLED_COMMAND               5
130
131/* Access to the "Size" field of the response of the CMD_GET_NOTIFY_EVENT request. */
132#define GET_NOTIFY_EVENT_SIZE_FIELD_MASK    0x000000ff
133
134/* DSP commands general masks */
135#define OPCODE_MASK                 0x00ff0000
136#define DSP_DIFFERED_COMMAND_MASK   0x0000C000
137
138/* Notifications (NOTIFY_INFO) */
139#define ALL_CMDS_NOTIFIED                   0x0000  // reserved
140#define START_STREAM_NOTIFIED               0x0001
141#define PAUSE_STREAM_NOTIFIED               0x0002
142#define OUT_STREAM_LEVEL_NOTIFIED           0x0003
143#define OUT_STREAM_PARAMETER_NOTIFIED       0x0004  // left for backward compatibility
144#define OUT_STREAM_FORMAT_NOTIFIED          0x0004
145#define PIPE_TIME_NOTIFIED                  0x0005
146#define OUT_AUDIO_LEVEL_NOTIFIED            0x0006
147#define OUT_STREAM_LEVEL_CURVE_NOTIFIED     0x0007
148#define STREAM_TIME_NOTIFIED                0x0008
149#define OUT_STREAM_EXTRAPARAMETER_NOTIFIED  0x0009
150#define UNKNOWN_COMMAND_NOTIFIED            0xffff
151
152/* Output pipe parameters setting */
153#define MASK_VALID_PIPE_MPEG_PARAM      0x000040
154#define MASK_VALID_PIPE_BACKWARD_PARAM  0x000020
155#define MASK_SET_PIPE_MPEG_PARAM        0x000002
156#define MASK_SET_PIPE_BACKWARD_PARAM    0x000001
157
158#define MASK_DSP_WORD           0x00FFFFFF
159#define MASK_ALL_STREAM         0x00FFFFFF
160#define MASK_DSP_WORD_LEVEL     0x000001FF
161#define MASK_FIRST_FIELD        0x0000001F
162#define FIELD_SIZE              5
163
164#define COMMAND_RECORD_MASK     0x000800
165
166/* PipeManagement definition bits (PIPE_DECL_INFO) */
167#define P_UNDERRUN_SKIP_SOUND_MASK				0x01
168#define P_PREPARE_FOR_MPEG3_MASK				0x02
169#define P_DO_NOT_RESET_ANALOG_LEVELS			0x04
170#define P_ALLOW_UNDER_ALLOCATION_MASK			0x08
171#define P_DATA_MODE_MASK				0x10
172#define P_ASIO_BUFFER_MANAGEMENT_MASK			0x20
173
174#define BIT_SKIP_SOUND					0x08	// bit 3
175#define BIT_DATA_MODE					0x10	// bit 4
176    
177/* Bits in the CMD_MODIFY_CLOCK request. */
178#define CMD_MODIFY_CLOCK_FD_BIT     0x00000001
179#define CMD_MODIFY_CLOCK_T_BIT      0x00000002
180#define CMD_MODIFY_CLOCK_S_BIT      0x00000004
181
182/* Access to the results of the CMD_GET_TIME_CODE RMH. */
183#define TIME_CODE_V_MASK            0x00800000
184#define TIME_CODE_N_MASK            0x00400000
185#define TIME_CODE_B_MASK            0x00200000
186#define TIME_CODE_W_MASK            0x00100000
187
188/* Values for the CMD_MANAGE_SIGNAL RMH. */
189#define MANAGE_SIGNAL_TIME_CODE     0x01
190#define MANAGE_SIGNAL_MIDI          0x02
191
192/* Values for the CMD_CONFIG_TIME_CODE RMH. */
193#define CONFIG_TIME_CODE_CANCEL     0x00001000
194    
195/* Mask to get only the effective time from the
196 * high word out of the 2 returned by the DSP
197 */
198#define PCX_TIME_HI_MASK        0x000fffff
199
200/* Values for setting a H-Buffer time */
201#define HBUFFER_TIME_HIGH       0x00200000
202#define HBUFFER_TIME_LOW        0x00000000
203
204#define NOTIFY_MASK_TIME_HIGH   0x00400000
205#define MULTIPLE_MASK_TIME_HIGH 0x00100000
206#define STREAM_MASK_TIME_HIGH   0x00800000
207
208
209/*
210 *
211 */
212void vx_init_rmh(struct vx_rmh *rmh, unsigned int cmd);
213
214/**
215 * vx_send_pipe_cmd_params - fill first command word for pipe commands
216 * @rmh: the rmh to be modified
217 * @is_capture: 0 = playback, 1 = capture operation
218 * @param1: first pipe-parameter
219 * @param2: second pipe-parameter
220 */
221static inline void vx_set_pipe_cmd_params(struct vx_rmh *rmh, int is_capture,
222					  int param1, int param2)
223{
224	if (is_capture)
225		rmh->Cmd[0] |= COMMAND_RECORD_MASK;
226	rmh->Cmd[0] |= (((u32)param1 & MASK_FIRST_FIELD) << FIELD_SIZE) & MASK_DSP_WORD;
227		
228	if (param2)
229		rmh->Cmd[0] |= ((u32)param2 & MASK_FIRST_FIELD) & MASK_DSP_WORD;
230	
231}
232
233/**
234 * vx_set_stream_cmd_params - fill first command word for stream commands
235 * @rmh: the rmh to be modified
236 * @is_capture: 0 = playback, 1 = capture operation
237 * @pipe: the pipe index (zero-based)
238 */
239static inline void vx_set_stream_cmd_params(struct vx_rmh *rmh, int is_capture, int pipe)
240{
241	if (is_capture)
242		rmh->Cmd[0] |= COMMAND_RECORD_MASK;
243	rmh->Cmd[0] |= (((u32)pipe & MASK_FIRST_FIELD) << FIELD_SIZE) & MASK_DSP_WORD;
244}
245
246#endif /* __VX_CMD_H */
v6.2
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/*
  3 * Driver for Digigram VX soundcards
  4 *
  5 * Definitions of DSP commands
  6 *
  7 * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  8 */
  9
 10#ifndef __VX_CMD_H
 11#define __VX_CMD_H
 12
 13enum {
 14	CMD_VERSION,
 15	CMD_SUPPORTED,
 16	CMD_TEST_IT,
 17	CMD_SEND_IRQA,
 18	CMD_IBL,
 19	CMD_ASYNC,
 20	CMD_RES_PIPE,
 21	CMD_FREE_PIPE,
 22	CMD_CONF_PIPE,
 23	CMD_ABORT_CONF_PIPE,
 24	CMD_PARAM_OUTPUT_PIPE,
 25	CMD_STOP_PIPE,
 26	CMD_PIPE_STATE,
 27	CMD_PIPE_SPL_COUNT,
 28	CMD_CAN_START_PIPE,
 29	CMD_SIZE_HBUFFER,
 30	CMD_START_STREAM,
 31	CMD_START_ONE_STREAM,
 32	CMD_PAUSE_STREAM,
 33	CMD_PAUSE_ONE_STREAM,
 34	CMD_STREAM_OUT_LEVEL_ADJUST,
 35	CMD_STOP_STREAM,
 36	CMD_FORMAT_STREAM_OUT,
 37	CMD_FORMAT_STREAM_IN,
 38	CMD_GET_STREAM_STATE,
 39	CMD_DROP_BYTES_AWAY,
 40	CMD_GET_REMAINING_BYTES,
 41	CMD_CONNECT_AUDIO,
 42	CMD_AUDIO_LEVEL_ADJUST,
 43	CMD_AUDIO_VU_PIC_METER,
 44	CMD_GET_AUDIO_LEVELS,
 45	CMD_GET_NOTIFY_EVENT,
 46	CMD_INFO_NOTIFIED,
 47	CMD_ACCESS_IO_FCT,
 48	CMD_STATUS_R_BUFFERS,
 49	CMD_UPDATE_R_BUFFERS,
 50	CMD_LOAD_EFFECT_CONTEXT,
 51	CMD_EFFECT_ONE_PIPE,
 52	CMD_MODIFY_CLOCK,
 53	CMD_STREAM1_OUT_SET_N_LEVELS,
 54	CMD_PURGE_STREAM_DCMDS,
 55	CMD_NOTIFY_PIPE_TIME,
 56	CMD_LOAD_EFFECT_CONTEXT_PACKET,
 57	CMD_RELIC_R_BUFFER,
 58	CMD_RESYNC_AUDIO_INPUTS,
 59	CMD_NOTIFY_STREAM_TIME,
 60	CMD_STREAM_SAMPLE_COUNT,
 61	CMD_CONFIG_TIME_CODE,
 62	CMD_GET_TIME_CODE,
 63	CMD_MANAGE_SIGNAL,
 64	CMD_PARAMETER_STREAM_OUT,
 65	CMD_READ_BOARD_FREQ,
 66	CMD_GET_STREAM_LEVELS,
 67	CMD_PURGE_PIPE_DCMDS,
 68	// CMD_SET_STREAM_OUT_EFFECTS,
 69	// CMD_GET_STREAM_OUT_EFFECTS,
 70	CMD_CONNECT_MONITORING,
 71	CMD_STREAM2_OUT_SET_N_LEVELS,
 72	CMD_CANCEL_R_BUFFERS,
 73	CMD_NOTIFY_END_OF_BUFFER,
 74	CMD_GET_STREAM_VU_METER,
 75	CMD_LAST_INDEX
 76};
 77
 78struct vx_cmd_info {
 79	unsigned int opcode;	/* command word */
 80	int length;		/* command length (in words) */
 81	int st_type;		/* status type (RMH_SSIZE_XXX) */
 82	int st_length;		/* fixed length */
 83};
 84
 85/* Family and code op of some DSP requests. */
 86#define CODE_OP_PIPE_TIME                       0x004e0000
 87#define CODE_OP_START_STREAM                    0x00800000
 88#define CODE_OP_PAUSE_STREAM                    0x00810000
 89#define CODE_OP_OUT_STREAM_LEVEL                0x00820000
 90#define CODE_OP_UPDATE_R_BUFFERS                0x00840000
 91#define CODE_OP_OUT_STREAM1_LEVEL_CURVE         0x00850000
 92#define CODE_OP_OUT_STREAM2_LEVEL_CURVE         0x00930000
 93#define CODE_OP_OUT_STREAM_FORMAT               0x00860000
 94#define CODE_OP_STREAM_TIME                     0x008f0000
 95#define CODE_OP_OUT_STREAM_EXTRAPARAMETER       0x00910000
 96#define CODE_OP_OUT_AUDIO_LEVEL                 0x00c20000
 97
 98#define NOTIFY_LAST_COMMAND     0x00400000
 99
100/* Values for a user delay */
101#define DC_DIFFERED_DELAY       (1<<BIT_DIFFERED_COMMAND)
102#define DC_NOTIFY_DELAY         (1<<BIT_NOTIFIED_COMMAND)
103#define DC_HBUFFER_DELAY        (1<<BIT_TIME_RELATIVE_TO_BUFFER)
104#define DC_MULTIPLE_DELAY       (1<<BIT_RESERVED)
105#define DC_STREAM_TIME_DELAY    (1<<BIT_STREAM_TIME)
106#define DC_CANCELLED_DELAY      (1<<BIT_CANCELLED_COMMAND)
107
108/* Values for tiDelayed field in TIME_INFO structure,
109 * and for pbPause field in PLAY_BUFFER_INFO structure
110 */
111#define BIT_DIFFERED_COMMAND                0
112#define BIT_NOTIFIED_COMMAND                1
113#define BIT_TIME_RELATIVE_TO_BUFFER         2
114#define BIT_RESERVED                        3
115#define BIT_STREAM_TIME                     4
116#define BIT_CANCELLED_COMMAND               5
117
118/* Access to the "Size" field of the response of the CMD_GET_NOTIFY_EVENT request. */
119#define GET_NOTIFY_EVENT_SIZE_FIELD_MASK    0x000000ff
120
121/* DSP commands general masks */
122#define OPCODE_MASK                 0x00ff0000
123#define DSP_DIFFERED_COMMAND_MASK   0x0000C000
124
125/* Notifications (NOTIFY_INFO) */
126#define ALL_CMDS_NOTIFIED                   0x0000  // reserved
127#define START_STREAM_NOTIFIED               0x0001
128#define PAUSE_STREAM_NOTIFIED               0x0002
129#define OUT_STREAM_LEVEL_NOTIFIED           0x0003
130#define OUT_STREAM_PARAMETER_NOTIFIED       0x0004  // left for backward compatibility
131#define OUT_STREAM_FORMAT_NOTIFIED          0x0004
132#define PIPE_TIME_NOTIFIED                  0x0005
133#define OUT_AUDIO_LEVEL_NOTIFIED            0x0006
134#define OUT_STREAM_LEVEL_CURVE_NOTIFIED     0x0007
135#define STREAM_TIME_NOTIFIED                0x0008
136#define OUT_STREAM_EXTRAPARAMETER_NOTIFIED  0x0009
137#define UNKNOWN_COMMAND_NOTIFIED            0xffff
138
139/* Output pipe parameters setting */
140#define MASK_VALID_PIPE_MPEG_PARAM      0x000040
141#define MASK_VALID_PIPE_BACKWARD_PARAM  0x000020
142#define MASK_SET_PIPE_MPEG_PARAM        0x000002
143#define MASK_SET_PIPE_BACKWARD_PARAM    0x000001
144
145#define MASK_DSP_WORD           0x00FFFFFF
146#define MASK_ALL_STREAM         0x00FFFFFF
147#define MASK_DSP_WORD_LEVEL     0x000001FF
148#define MASK_FIRST_FIELD        0x0000001F
149#define FIELD_SIZE              5
150
151#define COMMAND_RECORD_MASK     0x000800
152
153/* PipeManagement definition bits (PIPE_DECL_INFO) */
154#define P_UNDERRUN_SKIP_SOUND_MASK				0x01
155#define P_PREPARE_FOR_MPEG3_MASK				0x02
156#define P_DO_NOT_RESET_ANALOG_LEVELS			0x04
157#define P_ALLOW_UNDER_ALLOCATION_MASK			0x08
158#define P_DATA_MODE_MASK				0x10
159#define P_ASIO_BUFFER_MANAGEMENT_MASK			0x20
160
161#define BIT_SKIP_SOUND					0x08	// bit 3
162#define BIT_DATA_MODE					0x10	// bit 4
163    
164/* Bits in the CMD_MODIFY_CLOCK request. */
165#define CMD_MODIFY_CLOCK_FD_BIT     0x00000001
166#define CMD_MODIFY_CLOCK_T_BIT      0x00000002
167#define CMD_MODIFY_CLOCK_S_BIT      0x00000004
168
169/* Access to the results of the CMD_GET_TIME_CODE RMH. */
170#define TIME_CODE_V_MASK            0x00800000
171#define TIME_CODE_N_MASK            0x00400000
172#define TIME_CODE_B_MASK            0x00200000
173#define TIME_CODE_W_MASK            0x00100000
174
175/* Values for the CMD_MANAGE_SIGNAL RMH. */
176#define MANAGE_SIGNAL_TIME_CODE     0x01
177#define MANAGE_SIGNAL_MIDI          0x02
178
179/* Values for the CMD_CONFIG_TIME_CODE RMH. */
180#define CONFIG_TIME_CODE_CANCEL     0x00001000
181    
182/* Mask to get only the effective time from the
183 * high word out of the 2 returned by the DSP
184 */
185#define PCX_TIME_HI_MASK        0x000fffff
186
187/* Values for setting a H-Buffer time */
188#define HBUFFER_TIME_HIGH       0x00200000
189#define HBUFFER_TIME_LOW        0x00000000
190
191#define NOTIFY_MASK_TIME_HIGH   0x00400000
192#define MULTIPLE_MASK_TIME_HIGH 0x00100000
193#define STREAM_MASK_TIME_HIGH   0x00800000
194
195
196/*
197 *
198 */
199void vx_init_rmh(struct vx_rmh *rmh, unsigned int cmd);
200
201/**
202 * vx_send_pipe_cmd_params - fill first command word for pipe commands
203 * @rmh: the rmh to be modified
204 * @is_capture: 0 = playback, 1 = capture operation
205 * @param1: first pipe-parameter
206 * @param2: second pipe-parameter
207 */
208static inline void vx_set_pipe_cmd_params(struct vx_rmh *rmh, int is_capture,
209					  int param1, int param2)
210{
211	if (is_capture)
212		rmh->Cmd[0] |= COMMAND_RECORD_MASK;
213	rmh->Cmd[0] |= (((u32)param1 & MASK_FIRST_FIELD) << FIELD_SIZE) & MASK_DSP_WORD;
214		
215	if (param2)
216		rmh->Cmd[0] |= ((u32)param2 & MASK_FIRST_FIELD) & MASK_DSP_WORD;
217	
218}
219
220/**
221 * vx_set_stream_cmd_params - fill first command word for stream commands
222 * @rmh: the rmh to be modified
223 * @is_capture: 0 = playback, 1 = capture operation
224 * @pipe: the pipe index (zero-based)
225 */
226static inline void vx_set_stream_cmd_params(struct vx_rmh *rmh, int is_capture, int pipe)
227{
228	if (is_capture)
229		rmh->Cmd[0] |= COMMAND_RECORD_MASK;
230	rmh->Cmd[0] |= (((u32)pipe & MASK_FIRST_FIELD) << FIELD_SIZE) & MASK_DSP_WORD;
231}
232
233#endif /* __VX_CMD_H */