Lines Matching refs:scs
55 static void midi_input_byte(struct fw_scs1x *scs, in midi_input_byte() argument
60 if (scs->input_escape_count > 0) { in midi_input_byte()
62 scs->input_escape_count--; in midi_input_byte()
63 if (scs->input_escape_count == 0) in midi_input_byte()
70 scs->input_escape_count = 3; in midi_input_byte()
76 static void midi_input_packet(struct fw_scs1x *scs, in midi_input_packet() argument
85 midi_input_byte(scs, stream, data[i]); in midi_input_packet()
100 struct fw_scs1x *scs = callback_data; in handle_hss() local
104 if (offset != scs->hss_handler.offset) { in handle_hss()
115 stream = READ_ONCE(scs->input); in handle_hss()
117 midi_input_packet(scs, stream, data, length); in handle_hss()
128 struct fw_scs1x *scs = callback_data; in scs_write_callback() local
133 scs->transaction_bytes = 0; in scs_write_callback()
135 scs->error = true; in scs_write_callback()
138 scs->transaction_running = false; in scs_write_callback()
139 schedule_work(&scs->work); in scs_write_callback()
177 struct fw_scs1x *scs = container_of(work, struct fw_scs1x, work); in scs_output_work() local
183 if (scs->transaction_running) in scs_output_work()
186 stream = READ_ONCE(scs->output); in scs_output_work()
187 if (!stream || scs->error) { in scs_output_work()
188 scs->output_idle = true; in scs_output_work()
189 wake_up(&scs->idle_wait); in scs_output_work()
193 if (scs->transaction_bytes > 0) in scs_output_work()
196 i = scs->output_bytes; in scs_output_work()
199 scs->output_bytes = i; in scs_output_work()
200 scs->output_idle = true; in scs_output_work()
201 wake_up(&scs->idle_wait); in scs_output_work()
208 if (scs->output_escaped && byte < 0x80) { in scs_output_work()
209 if (scs->output_escape_high_nibble) { in scs_output_work()
211 scs->buffer[i] = byte << 4; in scs_output_work()
212 scs->output_escape_high_nibble = false; in scs_output_work()
215 scs->buffer[i++] |= byte & 0x0f; in scs_output_work()
216 scs->output_escape_high_nibble = true; in scs_output_work()
221 scs->output_status)) in scs_output_work()
223 scs->buffer[0] = HSS1394_TAG_USER_DATA; in scs_output_work()
224 scs->buffer[i++] = scs->output_status; in scs_output_work()
226 scs->buffer[i++] = byte; in scs_output_work()
227 if ((i == 3 && is_two_bytes_cmd(scs->output_status)) || in scs_output_work()
228 (i == 4 && is_three_bytes_cmd(scs->output_status))) in scs_output_work()
231 !memcmp(scs->buffer + 1, sysex_escape_prefix, in scs_output_work()
233 scs->output_escaped = true; in scs_output_work()
234 scs->output_escape_high_nibble = true; in scs_output_work()
240 if (scs->output_escaped) { in scs_output_work()
241 if (i >= 1 && scs->output_escape_high_nibble && in scs_output_work()
242 scs->buffer[0] != in scs_output_work()
246 if (i > 1 && scs->output_status == 0xf0) { in scs_output_work()
247 scs->buffer[i++] = 0xf7; in scs_output_work()
252 scs->output_escaped = false; in scs_output_work()
255 scs->buffer[0] = HSS1394_TAG_USER_DATA; in scs_output_work()
256 scs->buffer[i++] = byte; in scs_output_work()
257 scs->output_status = byte; in scs_output_work()
258 scs->output_escaped = false; in scs_output_work()
263 scs->output_bytes = 1; in scs_output_work()
264 scs->output_escaped = false; in scs_output_work()
266 scs->transaction_bytes = i; in scs_output_work()
268 scs->transaction_running = true; in scs_output_work()
269 generation = scs->fw_dev->generation; in scs_output_work()
271 fw_send_request(scs->fw_dev->card, &scs->transaction, in scs_output_work()
272 TCODE_WRITE_BLOCK_REQUEST, scs->fw_dev->node_id, in scs_output_work()
273 generation, scs->fw_dev->max_speed, HSS1394_ADDRESS, in scs_output_work()
274 scs->buffer, scs->transaction_bytes, in scs_output_work()
275 scs_write_callback, scs); in scs_output_work()
290 struct fw_scs1x *scs = stream->rmidi->private_data; in midi_capture_trigger() local
293 scs->input_escape_count = 0; in midi_capture_trigger()
294 WRITE_ONCE(scs->input, stream); in midi_capture_trigger()
296 WRITE_ONCE(scs->input, NULL); in midi_capture_trigger()
312 struct fw_scs1x *scs = stream->rmidi->private_data; in midi_playback_trigger() local
315 scs->output_status = 0; in midi_playback_trigger()
316 scs->output_bytes = 1; in midi_playback_trigger()
317 scs->output_escaped = false; in midi_playback_trigger()
318 scs->output_idle = false; in midi_playback_trigger()
319 scs->transaction_bytes = 0; in midi_playback_trigger()
320 scs->error = false; in midi_playback_trigger()
322 WRITE_ONCE(scs->output, stream); in midi_playback_trigger()
323 schedule_work(&scs->work); in midi_playback_trigger()
325 WRITE_ONCE(scs->output, NULL); in midi_playback_trigger()
330 struct fw_scs1x *scs = stream->rmidi->private_data; in midi_playback_drain() local
332 wait_event(scs->idle_wait, scs->output_idle); in midi_playback_drain()
337 struct fw_scs1x *scs = oxfw->spec; in register_address() local
341 scs->hss_handler.offset); in register_address()
348 struct fw_scs1x *scs = rmidi->private_data; in remove_scs1x() local
350 fw_core_remove_address_handler(&scs->hss_handler); in remove_scs1x()
372 struct fw_scs1x *scs; in snd_oxfw_scs1x_add() local
375 scs = kzalloc(sizeof(struct fw_scs1x), GFP_KERNEL); in snd_oxfw_scs1x_add()
376 if (scs == NULL) in snd_oxfw_scs1x_add()
378 scs->fw_dev = fw_parent_device(oxfw->unit); in snd_oxfw_scs1x_add()
379 oxfw->spec = scs; in snd_oxfw_scs1x_add()
382 scs->hss_handler.length = HSS1394_MAX_PACKET_SIZE; in snd_oxfw_scs1x_add()
383 scs->hss_handler.address_callback = handle_hss; in snd_oxfw_scs1x_add()
384 scs->hss_handler.callback_data = scs; in snd_oxfw_scs1x_add()
385 err = fw_core_add_address_handler(&scs->hss_handler, in snd_oxfw_scs1x_add()
398 rmidi->private_data = scs; in snd_oxfw_scs1x_add()
412 INIT_WORK(&scs->work, scs_output_work); in snd_oxfw_scs1x_add()
413 init_waitqueue_head(&scs->idle_wait); in snd_oxfw_scs1x_add()
414 scs->output_idle = true; in snd_oxfw_scs1x_add()
418 fw_core_remove_address_handler(&scs->hss_handler); in snd_oxfw_scs1x_add()