162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Driver for Digigram VX soundcards 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Definitions of DSP commands 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de> 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#ifndef __VX_CMD_H 1162306a36Sopenharmony_ci#define __VX_CMD_H 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_cienum { 1462306a36Sopenharmony_ci CMD_VERSION, 1562306a36Sopenharmony_ci CMD_SUPPORTED, 1662306a36Sopenharmony_ci CMD_TEST_IT, 1762306a36Sopenharmony_ci CMD_SEND_IRQA, 1862306a36Sopenharmony_ci CMD_IBL, 1962306a36Sopenharmony_ci CMD_ASYNC, 2062306a36Sopenharmony_ci CMD_RES_PIPE, 2162306a36Sopenharmony_ci CMD_FREE_PIPE, 2262306a36Sopenharmony_ci CMD_CONF_PIPE, 2362306a36Sopenharmony_ci CMD_ABORT_CONF_PIPE, 2462306a36Sopenharmony_ci CMD_PARAM_OUTPUT_PIPE, 2562306a36Sopenharmony_ci CMD_STOP_PIPE, 2662306a36Sopenharmony_ci CMD_PIPE_STATE, 2762306a36Sopenharmony_ci CMD_PIPE_SPL_COUNT, 2862306a36Sopenharmony_ci CMD_CAN_START_PIPE, 2962306a36Sopenharmony_ci CMD_SIZE_HBUFFER, 3062306a36Sopenharmony_ci CMD_START_STREAM, 3162306a36Sopenharmony_ci CMD_START_ONE_STREAM, 3262306a36Sopenharmony_ci CMD_PAUSE_STREAM, 3362306a36Sopenharmony_ci CMD_PAUSE_ONE_STREAM, 3462306a36Sopenharmony_ci CMD_STREAM_OUT_LEVEL_ADJUST, 3562306a36Sopenharmony_ci CMD_STOP_STREAM, 3662306a36Sopenharmony_ci CMD_FORMAT_STREAM_OUT, 3762306a36Sopenharmony_ci CMD_FORMAT_STREAM_IN, 3862306a36Sopenharmony_ci CMD_GET_STREAM_STATE, 3962306a36Sopenharmony_ci CMD_DROP_BYTES_AWAY, 4062306a36Sopenharmony_ci CMD_GET_REMAINING_BYTES, 4162306a36Sopenharmony_ci CMD_CONNECT_AUDIO, 4262306a36Sopenharmony_ci CMD_AUDIO_LEVEL_ADJUST, 4362306a36Sopenharmony_ci CMD_AUDIO_VU_PIC_METER, 4462306a36Sopenharmony_ci CMD_GET_AUDIO_LEVELS, 4562306a36Sopenharmony_ci CMD_GET_NOTIFY_EVENT, 4662306a36Sopenharmony_ci CMD_INFO_NOTIFIED, 4762306a36Sopenharmony_ci CMD_ACCESS_IO_FCT, 4862306a36Sopenharmony_ci CMD_STATUS_R_BUFFERS, 4962306a36Sopenharmony_ci CMD_UPDATE_R_BUFFERS, 5062306a36Sopenharmony_ci CMD_LOAD_EFFECT_CONTEXT, 5162306a36Sopenharmony_ci CMD_EFFECT_ONE_PIPE, 5262306a36Sopenharmony_ci CMD_MODIFY_CLOCK, 5362306a36Sopenharmony_ci CMD_STREAM1_OUT_SET_N_LEVELS, 5462306a36Sopenharmony_ci CMD_PURGE_STREAM_DCMDS, 5562306a36Sopenharmony_ci CMD_NOTIFY_PIPE_TIME, 5662306a36Sopenharmony_ci CMD_LOAD_EFFECT_CONTEXT_PACKET, 5762306a36Sopenharmony_ci CMD_RELIC_R_BUFFER, 5862306a36Sopenharmony_ci CMD_RESYNC_AUDIO_INPUTS, 5962306a36Sopenharmony_ci CMD_NOTIFY_STREAM_TIME, 6062306a36Sopenharmony_ci CMD_STREAM_SAMPLE_COUNT, 6162306a36Sopenharmony_ci CMD_CONFIG_TIME_CODE, 6262306a36Sopenharmony_ci CMD_GET_TIME_CODE, 6362306a36Sopenharmony_ci CMD_MANAGE_SIGNAL, 6462306a36Sopenharmony_ci CMD_PARAMETER_STREAM_OUT, 6562306a36Sopenharmony_ci CMD_READ_BOARD_FREQ, 6662306a36Sopenharmony_ci CMD_GET_STREAM_LEVELS, 6762306a36Sopenharmony_ci CMD_PURGE_PIPE_DCMDS, 6862306a36Sopenharmony_ci // CMD_SET_STREAM_OUT_EFFECTS, 6962306a36Sopenharmony_ci // CMD_GET_STREAM_OUT_EFFECTS, 7062306a36Sopenharmony_ci CMD_CONNECT_MONITORING, 7162306a36Sopenharmony_ci CMD_STREAM2_OUT_SET_N_LEVELS, 7262306a36Sopenharmony_ci CMD_CANCEL_R_BUFFERS, 7362306a36Sopenharmony_ci CMD_NOTIFY_END_OF_BUFFER, 7462306a36Sopenharmony_ci CMD_GET_STREAM_VU_METER, 7562306a36Sopenharmony_ci CMD_LAST_INDEX 7662306a36Sopenharmony_ci}; 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_cistruct vx_cmd_info { 7962306a36Sopenharmony_ci unsigned int opcode; /* command word */ 8062306a36Sopenharmony_ci int length; /* command length (in words) */ 8162306a36Sopenharmony_ci int st_type; /* status type (RMH_SSIZE_XXX) */ 8262306a36Sopenharmony_ci int st_length; /* fixed length */ 8362306a36Sopenharmony_ci}; 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci/* Family and code op of some DSP requests. */ 8662306a36Sopenharmony_ci#define CODE_OP_PIPE_TIME 0x004e0000 8762306a36Sopenharmony_ci#define CODE_OP_START_STREAM 0x00800000 8862306a36Sopenharmony_ci#define CODE_OP_PAUSE_STREAM 0x00810000 8962306a36Sopenharmony_ci#define CODE_OP_OUT_STREAM_LEVEL 0x00820000 9062306a36Sopenharmony_ci#define CODE_OP_UPDATE_R_BUFFERS 0x00840000 9162306a36Sopenharmony_ci#define CODE_OP_OUT_STREAM1_LEVEL_CURVE 0x00850000 9262306a36Sopenharmony_ci#define CODE_OP_OUT_STREAM2_LEVEL_CURVE 0x00930000 9362306a36Sopenharmony_ci#define CODE_OP_OUT_STREAM_FORMAT 0x00860000 9462306a36Sopenharmony_ci#define CODE_OP_STREAM_TIME 0x008f0000 9562306a36Sopenharmony_ci#define CODE_OP_OUT_STREAM_EXTRAPARAMETER 0x00910000 9662306a36Sopenharmony_ci#define CODE_OP_OUT_AUDIO_LEVEL 0x00c20000 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci#define NOTIFY_LAST_COMMAND 0x00400000 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci/* Values for a user delay */ 10162306a36Sopenharmony_ci#define DC_DIFFERED_DELAY (1<<BIT_DIFFERED_COMMAND) 10262306a36Sopenharmony_ci#define DC_NOTIFY_DELAY (1<<BIT_NOTIFIED_COMMAND) 10362306a36Sopenharmony_ci#define DC_HBUFFER_DELAY (1<<BIT_TIME_RELATIVE_TO_BUFFER) 10462306a36Sopenharmony_ci#define DC_MULTIPLE_DELAY (1<<BIT_RESERVED) 10562306a36Sopenharmony_ci#define DC_STREAM_TIME_DELAY (1<<BIT_STREAM_TIME) 10662306a36Sopenharmony_ci#define DC_CANCELLED_DELAY (1<<BIT_CANCELLED_COMMAND) 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci/* Values for tiDelayed field in TIME_INFO structure, 10962306a36Sopenharmony_ci * and for pbPause field in PLAY_BUFFER_INFO structure 11062306a36Sopenharmony_ci */ 11162306a36Sopenharmony_ci#define BIT_DIFFERED_COMMAND 0 11262306a36Sopenharmony_ci#define BIT_NOTIFIED_COMMAND 1 11362306a36Sopenharmony_ci#define BIT_TIME_RELATIVE_TO_BUFFER 2 11462306a36Sopenharmony_ci#define BIT_RESERVED 3 11562306a36Sopenharmony_ci#define BIT_STREAM_TIME 4 11662306a36Sopenharmony_ci#define BIT_CANCELLED_COMMAND 5 11762306a36Sopenharmony_ci 11862306a36Sopenharmony_ci/* Access to the "Size" field of the response of the CMD_GET_NOTIFY_EVENT request. */ 11962306a36Sopenharmony_ci#define GET_NOTIFY_EVENT_SIZE_FIELD_MASK 0x000000ff 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci/* DSP commands general masks */ 12262306a36Sopenharmony_ci#define OPCODE_MASK 0x00ff0000 12362306a36Sopenharmony_ci#define DSP_DIFFERED_COMMAND_MASK 0x0000C000 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci/* Notifications (NOTIFY_INFO) */ 12662306a36Sopenharmony_ci#define ALL_CMDS_NOTIFIED 0x0000 // reserved 12762306a36Sopenharmony_ci#define START_STREAM_NOTIFIED 0x0001 12862306a36Sopenharmony_ci#define PAUSE_STREAM_NOTIFIED 0x0002 12962306a36Sopenharmony_ci#define OUT_STREAM_LEVEL_NOTIFIED 0x0003 13062306a36Sopenharmony_ci#define OUT_STREAM_PARAMETER_NOTIFIED 0x0004 // left for backward compatibility 13162306a36Sopenharmony_ci#define OUT_STREAM_FORMAT_NOTIFIED 0x0004 13262306a36Sopenharmony_ci#define PIPE_TIME_NOTIFIED 0x0005 13362306a36Sopenharmony_ci#define OUT_AUDIO_LEVEL_NOTIFIED 0x0006 13462306a36Sopenharmony_ci#define OUT_STREAM_LEVEL_CURVE_NOTIFIED 0x0007 13562306a36Sopenharmony_ci#define STREAM_TIME_NOTIFIED 0x0008 13662306a36Sopenharmony_ci#define OUT_STREAM_EXTRAPARAMETER_NOTIFIED 0x0009 13762306a36Sopenharmony_ci#define UNKNOWN_COMMAND_NOTIFIED 0xffff 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_ci/* Output pipe parameters setting */ 14062306a36Sopenharmony_ci#define MASK_VALID_PIPE_MPEG_PARAM 0x000040 14162306a36Sopenharmony_ci#define MASK_VALID_PIPE_BACKWARD_PARAM 0x000020 14262306a36Sopenharmony_ci#define MASK_SET_PIPE_MPEG_PARAM 0x000002 14362306a36Sopenharmony_ci#define MASK_SET_PIPE_BACKWARD_PARAM 0x000001 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_ci#define MASK_DSP_WORD 0x00FFFFFF 14662306a36Sopenharmony_ci#define MASK_ALL_STREAM 0x00FFFFFF 14762306a36Sopenharmony_ci#define MASK_DSP_WORD_LEVEL 0x000001FF 14862306a36Sopenharmony_ci#define MASK_FIRST_FIELD 0x0000001F 14962306a36Sopenharmony_ci#define FIELD_SIZE 5 15062306a36Sopenharmony_ci 15162306a36Sopenharmony_ci#define COMMAND_RECORD_MASK 0x000800 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ci/* PipeManagement definition bits (PIPE_DECL_INFO) */ 15462306a36Sopenharmony_ci#define P_UNDERRUN_SKIP_SOUND_MASK 0x01 15562306a36Sopenharmony_ci#define P_PREPARE_FOR_MPEG3_MASK 0x02 15662306a36Sopenharmony_ci#define P_DO_NOT_RESET_ANALOG_LEVELS 0x04 15762306a36Sopenharmony_ci#define P_ALLOW_UNDER_ALLOCATION_MASK 0x08 15862306a36Sopenharmony_ci#define P_DATA_MODE_MASK 0x10 15962306a36Sopenharmony_ci#define P_ASIO_BUFFER_MANAGEMENT_MASK 0x20 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ci#define BIT_SKIP_SOUND 0x08 // bit 3 16262306a36Sopenharmony_ci#define BIT_DATA_MODE 0x10 // bit 4 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_ci/* Bits in the CMD_MODIFY_CLOCK request. */ 16562306a36Sopenharmony_ci#define CMD_MODIFY_CLOCK_FD_BIT 0x00000001 16662306a36Sopenharmony_ci#define CMD_MODIFY_CLOCK_T_BIT 0x00000002 16762306a36Sopenharmony_ci#define CMD_MODIFY_CLOCK_S_BIT 0x00000004 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci/* Access to the results of the CMD_GET_TIME_CODE RMH. */ 17062306a36Sopenharmony_ci#define TIME_CODE_V_MASK 0x00800000 17162306a36Sopenharmony_ci#define TIME_CODE_N_MASK 0x00400000 17262306a36Sopenharmony_ci#define TIME_CODE_B_MASK 0x00200000 17362306a36Sopenharmony_ci#define TIME_CODE_W_MASK 0x00100000 17462306a36Sopenharmony_ci 17562306a36Sopenharmony_ci/* Values for the CMD_MANAGE_SIGNAL RMH. */ 17662306a36Sopenharmony_ci#define MANAGE_SIGNAL_TIME_CODE 0x01 17762306a36Sopenharmony_ci#define MANAGE_SIGNAL_MIDI 0x02 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ci/* Values for the CMD_CONFIG_TIME_CODE RMH. */ 18062306a36Sopenharmony_ci#define CONFIG_TIME_CODE_CANCEL 0x00001000 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ci/* Mask to get only the effective time from the 18362306a36Sopenharmony_ci * high word out of the 2 returned by the DSP 18462306a36Sopenharmony_ci */ 18562306a36Sopenharmony_ci#define PCX_TIME_HI_MASK 0x000fffff 18662306a36Sopenharmony_ci 18762306a36Sopenharmony_ci/* Values for setting a H-Buffer time */ 18862306a36Sopenharmony_ci#define HBUFFER_TIME_HIGH 0x00200000 18962306a36Sopenharmony_ci#define HBUFFER_TIME_LOW 0x00000000 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_ci#define NOTIFY_MASK_TIME_HIGH 0x00400000 19262306a36Sopenharmony_ci#define MULTIPLE_MASK_TIME_HIGH 0x00100000 19362306a36Sopenharmony_ci#define STREAM_MASK_TIME_HIGH 0x00800000 19462306a36Sopenharmony_ci 19562306a36Sopenharmony_ci 19662306a36Sopenharmony_ci/* 19762306a36Sopenharmony_ci * 19862306a36Sopenharmony_ci */ 19962306a36Sopenharmony_civoid vx_init_rmh(struct vx_rmh *rmh, unsigned int cmd); 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci/** 20262306a36Sopenharmony_ci * vx_send_pipe_cmd_params - fill first command word for pipe commands 20362306a36Sopenharmony_ci * @rmh: the rmh to be modified 20462306a36Sopenharmony_ci * @is_capture: 0 = playback, 1 = capture operation 20562306a36Sopenharmony_ci * @param1: first pipe-parameter 20662306a36Sopenharmony_ci * @param2: second pipe-parameter 20762306a36Sopenharmony_ci */ 20862306a36Sopenharmony_cistatic inline void vx_set_pipe_cmd_params(struct vx_rmh *rmh, int is_capture, 20962306a36Sopenharmony_ci int param1, int param2) 21062306a36Sopenharmony_ci{ 21162306a36Sopenharmony_ci if (is_capture) 21262306a36Sopenharmony_ci rmh->Cmd[0] |= COMMAND_RECORD_MASK; 21362306a36Sopenharmony_ci rmh->Cmd[0] |= (((u32)param1 & MASK_FIRST_FIELD) << FIELD_SIZE) & MASK_DSP_WORD; 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_ci if (param2) 21662306a36Sopenharmony_ci rmh->Cmd[0] |= ((u32)param2 & MASK_FIRST_FIELD) & MASK_DSP_WORD; 21762306a36Sopenharmony_ci 21862306a36Sopenharmony_ci} 21962306a36Sopenharmony_ci 22062306a36Sopenharmony_ci/** 22162306a36Sopenharmony_ci * vx_set_stream_cmd_params - fill first command word for stream commands 22262306a36Sopenharmony_ci * @rmh: the rmh to be modified 22362306a36Sopenharmony_ci * @is_capture: 0 = playback, 1 = capture operation 22462306a36Sopenharmony_ci * @pipe: the pipe index (zero-based) 22562306a36Sopenharmony_ci */ 22662306a36Sopenharmony_cistatic inline void vx_set_stream_cmd_params(struct vx_rmh *rmh, int is_capture, int pipe) 22762306a36Sopenharmony_ci{ 22862306a36Sopenharmony_ci if (is_capture) 22962306a36Sopenharmony_ci rmh->Cmd[0] |= COMMAND_RECORD_MASK; 23062306a36Sopenharmony_ci rmh->Cmd[0] |= (((u32)pipe & MASK_FIRST_FIELD) << FIELD_SIZE) & MASK_DSP_WORD; 23162306a36Sopenharmony_ci} 23262306a36Sopenharmony_ci 23362306a36Sopenharmony_ci#endif /* __VX_CMD_H */ 234