Lines Matching refs:scs

54 static void midi_input_byte(struct fw_scs1x *scs,  in midi_input_byte()  argument
59 if (scs->input_escape_count > 0) { in midi_input_byte()
61 scs->input_escape_count--; in midi_input_byte()
62 if (scs->input_escape_count == 0) in midi_input_byte()
69 scs->input_escape_count = 3; in midi_input_byte()
75 static void midi_input_packet(struct fw_scs1x *scs, in midi_input_packet() argument
84 midi_input_byte(scs, stream, data[i]); in midi_input_packet()
99 struct fw_scs1x *scs = callback_data; in handle_hss() local
103 if (offset != scs->hss_handler.offset) { in handle_hss()
114 stream = READ_ONCE(scs->input); in handle_hss()
116 midi_input_packet(scs, stream, data, length); in handle_hss()
127 struct fw_scs1x *scs = callback_data; in scs_write_callback() local
132 scs->transaction_bytes = 0; in scs_write_callback()
134 scs->error = true; in scs_write_callback()
137 scs->transaction_running = false; in scs_write_callback()
138 schedule_work(&scs->work); in scs_write_callback()
176 struct fw_scs1x *scs = container_of(work, struct fw_scs1x, work); in scs_output_work() local
182 if (scs->transaction_running) in scs_output_work()
185 stream = READ_ONCE(scs->output); in scs_output_work()
186 if (!stream || scs->error) { in scs_output_work()
187 scs->output_idle = true; in scs_output_work()
188 wake_up(&scs->idle_wait); in scs_output_work()
192 if (scs->transaction_bytes > 0) in scs_output_work()
195 i = scs->output_bytes; in scs_output_work()
198 scs->output_bytes = i; in scs_output_work()
199 scs->output_idle = true; in scs_output_work()
200 wake_up(&scs->idle_wait); in scs_output_work()
207 if (scs->output_escaped && byte < 0x80) { in scs_output_work()
208 if (scs->output_escape_high_nibble) { in scs_output_work()
210 scs->buffer[i] = byte << 4; in scs_output_work()
211 scs->output_escape_high_nibble = false; in scs_output_work()
214 scs->buffer[i++] |= byte & 0x0f; in scs_output_work()
215 scs->output_escape_high_nibble = true; in scs_output_work()
220 scs->output_status)) in scs_output_work()
222 scs->buffer[0] = HSS1394_TAG_USER_DATA; in scs_output_work()
223 scs->buffer[i++] = scs->output_status; in scs_output_work()
225 scs->buffer[i++] = byte; in scs_output_work()
226 if ((i == 3 && is_two_bytes_cmd(scs->output_status)) || in scs_output_work()
227 (i == 4 && is_three_bytes_cmd(scs->output_status))) in scs_output_work()
230 !memcmp(scs->buffer + 1, sysex_escape_prefix, in scs_output_work()
232 scs->output_escaped = true; in scs_output_work()
233 scs->output_escape_high_nibble = true; in scs_output_work()
239 if (scs->output_escaped) { in scs_output_work()
240 if (i >= 1 && scs->output_escape_high_nibble && in scs_output_work()
241 scs->buffer[0] != in scs_output_work()
245 if (i > 1 && scs->output_status == 0xf0) { in scs_output_work()
246 scs->buffer[i++] = 0xf7; in scs_output_work()
251 scs->output_escaped = false; in scs_output_work()
254 scs->buffer[0] = HSS1394_TAG_USER_DATA; in scs_output_work()
255 scs->buffer[i++] = byte; in scs_output_work()
256 scs->output_status = byte; in scs_output_work()
257 scs->output_escaped = false; in scs_output_work()
262 scs->output_bytes = 1; in scs_output_work()
263 scs->output_escaped = false; in scs_output_work()
265 scs->transaction_bytes = i; in scs_output_work()
267 scs->transaction_running = true; in scs_output_work()
268 generation = scs->fw_dev->generation; in scs_output_work()
270 fw_send_request(scs->fw_dev->card, &scs->transaction, in scs_output_work()
271 TCODE_WRITE_BLOCK_REQUEST, scs->fw_dev->node_id, in scs_output_work()
272 generation, scs->fw_dev->max_speed, HSS1394_ADDRESS, in scs_output_work()
273 scs->buffer, scs->transaction_bytes, in scs_output_work()
274 scs_write_callback, scs); in scs_output_work()
289 struct fw_scs1x *scs = stream->rmidi->private_data; in midi_capture_trigger() local
292 scs->input_escape_count = 0; in midi_capture_trigger()
293 WRITE_ONCE(scs->input, stream); in midi_capture_trigger()
295 WRITE_ONCE(scs->input, NULL); in midi_capture_trigger()
311 struct fw_scs1x *scs = stream->rmidi->private_data; in midi_playback_trigger() local
314 scs->output_status = 0; in midi_playback_trigger()
315 scs->output_bytes = 1; in midi_playback_trigger()
316 scs->output_escaped = false; in midi_playback_trigger()
317 scs->output_idle = false; in midi_playback_trigger()
318 scs->transaction_bytes = 0; in midi_playback_trigger()
319 scs->error = false; in midi_playback_trigger()
321 WRITE_ONCE(scs->output, stream); in midi_playback_trigger()
322 schedule_work(&scs->work); in midi_playback_trigger()
324 WRITE_ONCE(scs->output, NULL); in midi_playback_trigger()
329 struct fw_scs1x *scs = stream->rmidi->private_data; in midi_playback_drain() local
331 wait_event(scs->idle_wait, scs->output_idle); in midi_playback_drain()
336 struct fw_scs1x *scs = oxfw->spec; in register_address() local
340 scs->hss_handler.offset); in register_address()
347 struct fw_scs1x *scs = rmidi->private_data; in remove_scs1x() local
349 fw_core_remove_address_handler(&scs->hss_handler); in remove_scs1x()
371 struct fw_scs1x *scs; in snd_oxfw_scs1x_add() local
374 scs = devm_kzalloc(&oxfw->card->card_dev, sizeof(struct fw_scs1x), in snd_oxfw_scs1x_add()
376 if (!scs) 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()