Home
last modified time | relevance | path

Searched refs:iodev (Results 1 – 25 of 52) sorted by relevance

123

/external/adhd/cras/src/server/
Dcras_iodev.c67 static void cras_iodev_alloc_dsp(struct cras_iodev *iodev);
105 static int cras_iodev_start(struct cras_iodev *iodev) in cras_iodev_start() argument
108 if (!cras_iodev_is_open(iodev)) in cras_iodev_start()
110 if (!iodev->start) { in cras_iodev_start()
113 iodev->info.name); in cras_iodev_start()
116 rc = iodev->start(iodev); in cras_iodev_start()
119 iodev->state = CRAS_IODEV_STATE_NORMAL_RUN; in cras_iodev_start()
301 static size_t get_best_rate(struct cras_iodev *iodev, size_t rrate) in get_best_rate() argument
306 if (iodev->supported_rates[0] == 0) /* No rates supported */ in get_best_rate()
309 for (i = 0, best = 0; iodev->supported_rates[i] != 0; i++) { in get_best_rate()
[all …]
Dcras_empty_iodev.c43 static unsigned int current_level(const struct cras_iodev *iodev) in current_level() argument
45 struct empty_iodev *empty_iodev = (struct empty_iodev *)iodev; in current_level()
48 if (iodev->active_node->type == CRAS_NODE_TYPE_HOTWORD) in current_level()
52 &empty_iodev->dev_start_time, iodev->format->frame_rate); in current_level()
54 if (iodev->direction == CRAS_STREAM_INPUT) { in current_level()
69 static int frames_queued(const struct cras_iodev *iodev, in frames_queued() argument
73 return current_level(iodev); in frames_queued()
76 static int delay_frames(const struct cras_iodev *iodev) in delay_frames() argument
81 static int close_dev(struct cras_iodev *iodev) in close_dev() argument
83 struct empty_iodev *empty_iodev = (struct empty_iodev *)iodev; in close_dev()
[all …]
Dcras_iodev.h237 void (*set_volume)(struct cras_iodev *iodev);
238 void (*set_mute)(struct cras_iodev *iodev);
239 void (*set_capture_gain)(struct cras_iodev *iodev);
240 void (*set_capture_mute)(struct cras_iodev *iodev);
241 int (*set_swap_mode_for_node)(struct cras_iodev *iodev,
243 int (*open_dev)(struct cras_iodev *iodev);
244 int (*configure_dev)(struct cras_iodev *iodev);
245 int (*close_dev)(struct cras_iodev *iodev);
246 int (*update_supported_formats)(struct cras_iodev *iodev);
247 int (*frames_queued)(const struct cras_iodev *iodev,
[all …]
Dcras_hfp_iodev.c43 static int update_supported_formats(struct cras_iodev *iodev) in update_supported_formats() argument
45 struct hfp_io *hfpio = (struct hfp_io *)iodev; in update_supported_formats()
48 iodev->format->format = SND_PCM_FORMAT_S16_LE; in update_supported_formats()
50 free(iodev->supported_rates); in update_supported_formats()
51 iodev->supported_rates = (size_t *)malloc(2 * sizeof(size_t)); in update_supported_formats()
53 iodev->supported_rates[0] = in update_supported_formats()
57 iodev->supported_rates[1] = 0; in update_supported_formats()
59 free(iodev->supported_channel_counts); in update_supported_formats()
60 iodev->supported_channel_counts = (size_t *)malloc(2 * sizeof(size_t)); in update_supported_formats()
61 iodev->supported_channel_counts[0] = 1; in update_supported_formats()
[all …]
Dcras_hfp_alsa_iodev.c36 static int hfp_alsa_open_dev(struct cras_iodev *iodev) in hfp_alsa_open_dev() argument
38 struct hfp_alsa_io *hfp_alsa_io = (struct hfp_alsa_io *)iodev; in hfp_alsa_open_dev()
44 static int hfp_alsa_update_supported_formats(struct cras_iodev *iodev) in hfp_alsa_update_supported_formats() argument
46 struct hfp_alsa_io *hfp_alsa_io = (struct hfp_alsa_io *)iodev; in hfp_alsa_update_supported_formats()
81 free(iodev->supported_rates); in hfp_alsa_update_supported_formats()
82 iodev->supported_rates = malloc(2 * sizeof(*iodev->supported_rates)); in hfp_alsa_update_supported_formats()
83 if (!iodev->supported_rates) in hfp_alsa_update_supported_formats()
85 iodev->supported_rates[0] = 8000; in hfp_alsa_update_supported_formats()
86 iodev->supported_rates[1] = 0; in hfp_alsa_update_supported_formats()
88 free(iodev->supported_channel_counts); in hfp_alsa_update_supported_formats()
[all …]
Dcras_a2dp_iodev.c70 static int update_supported_formats(struct cras_iodev *iodev) in update_supported_formats() argument
72 struct a2dp_io *a2dpio = (struct a2dp_io *)iodev; in update_supported_formats()
79 iodev->format->format = SND_PCM_FORMAT_S16_LE; in update_supported_formats()
91 free(iodev->supported_rates); in update_supported_formats()
92 iodev->supported_rates = (size_t *)malloc(2 * sizeof(rate)); in update_supported_formats()
93 iodev->supported_rates[0] = rate; in update_supported_formats()
94 iodev->supported_rates[1] = 0; in update_supported_formats()
96 free(iodev->supported_channel_counts); in update_supported_formats()
97 iodev->supported_channel_counts = (size_t *)malloc(2 * sizeof(channel)); in update_supported_formats()
98 iodev->supported_channel_counts[0] = channel; in update_supported_formats()
[all …]
Dcras_loopback_iodev.c97 static void device_enabled_hook(struct cras_iodev *iodev, void *cb_data) in device_enabled_hook() argument
101 if (iodev->direction != CRAS_STREAM_OUTPUT) in device_enabled_hook()
107 static void device_disabled_hook(struct cras_iodev *iodev, void *cb_data) in device_disabled_hook() argument
111 if (loopdev->sender_idx != iodev->info.idx) in device_disabled_hook()
125 static int frames_queued(const struct cras_iodev *iodev, in frames_queued() argument
128 struct loopback_iodev *loopdev = (struct loopback_iodev *)iodev; in frames_queued()
130 unsigned int frame_bytes = cras_get_format_bytes(iodev->format); in frames_queued()
136 &loopdev->dev_start_time, iodev->format->frame_rate); in frames_queued()
153 static int delay_frames(const struct cras_iodev *iodev) in delay_frames() argument
157 return frames_queued(iodev, &tstamp); in delay_frames()
[all …]
Dtest_iodev.c41 static int frames_queued(const struct cras_iodev *iodev, in frames_queued() argument
44 struct test_iodev *testio = (struct test_iodev *)iodev; in frames_queued()
54 static int delay_frames(const struct cras_iodev *iodev) in delay_frames() argument
59 static int close_dev(struct cras_iodev *iodev) in close_dev() argument
61 struct test_iodev *testio = (struct test_iodev *)iodev; in close_dev()
65 cras_iodev_free_audio_area(iodev); in close_dev()
69 static int configure_dev(struct cras_iodev *iodev) in configure_dev() argument
71 struct test_iodev *testio = (struct test_iodev *)iodev; in configure_dev()
73 if (iodev->format == NULL) in configure_dev()
76 cras_iodev_init_audio_area(iodev, iodev->format->num_channels); in configure_dev()
[all …]
Dcras_bt_io.c48 static struct cras_iodev *active_profile_dev(const struct cras_iodev *iodev) in active_profile_dev() argument
50 struct bt_node *active = (struct bt_node *)iodev->active_node; in active_profile_dev()
124 static int open_dev(struct cras_iodev *iodev) in open_dev() argument
126 struct bt_io *btio = (struct bt_io *)iodev; in open_dev()
127 struct cras_iodev *dev = active_profile_dev(iodev); in open_dev()
132 iodev->direction == CRAS_STREAM_INPUT) { in open_dev()
135 cras_bt_device_switch_profile_enable_dev(btio->device, iodev); in open_dev()
145 static int update_supported_formats(struct cras_iodev *iodev) in update_supported_formats() argument
147 struct cras_iodev *dev = active_profile_dev(iodev); in update_supported_formats()
156 *dev->format = *iodev->format; in update_supported_formats()
[all …]
Dcras_alsa_io.c173 static int alsa_iodev_set_active_node(struct cras_iodev *iodev,
272 static int set_hwparams(struct cras_iodev *iodev) in set_hwparams() argument
274 struct alsa_io *aio = (struct alsa_io *)iodev; in set_hwparams()
283 period_wakeup = (iodev->active_node->type == CRAS_NODE_TYPE_HOTWORD); in set_hwparams()
287 rc = cras_alsa_set_hwparams(aio->handle, iodev->format, in set_hwparams()
288 &iodev->buffer_size, period_wakeup, in set_hwparams()
301 static int frames_queued(const struct cras_iodev *iodev, in frames_queued() argument
304 struct alsa_io *aio = (struct alsa_io *)iodev; in frames_queued()
310 iodev->info.name, &frames, tstamp); in frames_queued()
318 if (iodev->direction == CRAS_STREAM_INPUT) in frames_queued()
[all …]
Dcras_alsa_card.c33 struct cras_iodev *iodev; member
94 if (alsa_iodev_index(node->iodev) == device_index) { in create_iodev_for_device()
98 return node->iodev; in create_iodev_for_device()
107 new_dev->iodev = alsa_iodev_create( in create_iodev_for_device()
112 if (new_dev->iodev == NULL) { in create_iodev_for_device()
124 return new_dev->iodev; in create_iodev_for_device()
135 if (alsa_iodev_has_hctl_jacks(node->iodev)) in card_has_hctl_jack()
255 struct cras_iodev *iodev = create_iodev_for_device( in add_controls_and_iodevs_by_matching() local
260 if (iodev) { in add_controls_and_iodevs_by_matching()
261 rc = alsa_iodev_legacy_complete_init(iodev); in add_controls_and_iodevs_by_matching()
[all …]
Dcras_alsa_io.h58 int alsa_iodev_legacy_complete_init(struct cras_iodev *iodev);
67 int alsa_iodev_ucm_add_nodes_and_jacks(struct cras_iodev *iodev,
76 void alsa_iodev_ucm_complete_init(struct cras_iodev *iodev);
79 void alsa_iodev_destroy(struct cras_iodev *iodev);
82 unsigned alsa_iodev_index(struct cras_iodev *iodev);
85 int alsa_iodev_has_hctl_jacks(struct cras_iodev *iodev);
Dcras_bt_device.c374 struct cras_iodev *iodev, in cras_bt_device_append_iodev() argument
379 bt_iodev = device->bt_iodevs[iodev->direction]; in cras_bt_device_append_iodev()
382 cras_bt_io_append(bt_iodev, iodev, profile); in cras_bt_device_append_iodev()
384 device->bt_iodevs[iodev->direction] = in cras_bt_device_append_iodev()
385 cras_bt_io_create(device, iodev, profile); in cras_bt_device_append_iodev()
394 struct cras_iodev *iodev) in cras_bt_device_rm_iodev() argument
399 bt_iodev = device->bt_iodevs[iodev->direction]; in cras_bt_device_rm_iodev()
404 try_profile = cras_bt_io_try_remove(bt_iodev, iodev); in cras_bt_device_rm_iodev()
416 rc = cras_bt_io_remove(bt_iodev, iodev); in cras_bt_device_rm_iodev()
426 device->bt_iodevs[iodev->direction] = NULL; in cras_bt_device_rm_iodev()
[all …]
Dcras_a2dp_endpoint.c25 struct cras_iodev *iodev; member
155 if (connected_a2dp.iodev && transport) { in a2dp_transport_state_changed()
197 if (connected_a2dp.iodev) { in cras_a2dp_start()
200 a2dp_iodev_destroy(connected_a2dp.iodev); in cras_a2dp_start()
203 connected_a2dp.iodev = a2dp_iodev_create(transport); in cras_a2dp_start()
206 if (!connected_a2dp.iodev) in cras_a2dp_start()
220 if (connected_a2dp.iodev) { in cras_a2dp_suspend_connected_device()
222 a2dp_iodev_destroy(connected_a2dp.iodev); in cras_a2dp_suspend_connected_device()
223 connected_a2dp.iodev = NULL; in cras_a2dp_suspend_connected_device()
/external/adhd/cras/src/tests/
Diodev_unittest.cc121 int update_channel_layout(struct cras_iodev* iodev) { in update_channel_layout() argument
486 static int get_buffer(cras_iodev* iodev, in get_buffer() argument
505 static int put_buffer(struct cras_iodev* iodev, unsigned int nframes) { in put_buffer() argument
551 struct cras_iodev iodev; in TEST() local
556 memset(&iodev, 0, sizeof(iodev)); in TEST()
562 iodev.format = &fmt; in TEST()
563 iodev.put_buffer = put_buffer; in TEST()
564 iodev.rate_est = reinterpret_cast<struct rate_estimator*>(0xdeadbeef); in TEST()
566 rc = cras_iodev_put_output_buffer(&iodev, frames, 20, NULL, nullptr); in TEST()
574 struct cras_iodev iodev; in TEST() local
[all …]
Da2dp_iodev_unittest.cc90 int iodev_set_format(struct cras_iodev* iodev, struct cras_audio_format* fmt) { in iodev_set_format() argument
94 iodev->format = fmt; in iodev_set_format()
116 struct cras_iodev* iodev; in TEST_F() local
119 iodev = a2dp_iodev_create(fake_transport); in TEST_F()
121 ASSERT_NE(iodev, (void*)NULL); in TEST_F()
122 ASSERT_EQ(iodev->direction, CRAS_STREAM_OUTPUT); in TEST_F()
131 ASSERT_STREQ(FAKE_OBJECT_PATH, iodev->info.name); in TEST_F()
133 a2dp_iodev_destroy(iodev); in TEST_F()
142 iodev = a2dp_iodev_create(fake_transport); in TEST_F()
143 ASSERT_STREQ(fake_device_name, iodev->info.name); in TEST_F()
[all …]
Dhfp_alsa_iodev_unittest.cc145 struct cras_iodev* iodev; in TEST_F() local
149 iodev = hfp_alsa_iodev_create(&fake_sco_out, fake_device, fake_slc, in TEST_F()
151 hfp_alsa_io = (struct hfp_alsa_io*)iodev; in TEST_F()
153 EXPECT_EQ(CRAS_STREAM_OUTPUT, iodev->direction); in TEST_F()
159 hfp_alsa_iodev_destroy(iodev); in TEST_F()
167 struct cras_iodev* iodev; in TEST_F() local
171 iodev = hfp_alsa_iodev_create(&fake_sco_in, fake_device, fake_slc, in TEST_F()
173 hfp_alsa_io = (struct hfp_alsa_io*)iodev; in TEST_F()
175 EXPECT_EQ(CRAS_STREAM_INPUT, iodev->direction); in TEST_F()
181 EXPECT_EQ(0, iodev->software_volume_needed); in TEST_F()
[all …]
Dhfp_iodev_unittest.cc16 static struct cras_iodev* iodev; variable
95 iodev = hfp_iodev_create(CRAS_STREAM_OUTPUT, fake_device, fake_slc, in TEST_F()
98 ASSERT_EQ(CRAS_STREAM_OUTPUT, iodev->direction); in TEST_F()
103 hfp_iodev_destroy(iodev); in TEST_F()
111 iodev = hfp_iodev_create(CRAS_STREAM_INPUT, fake_device, fake_slc, in TEST_F()
114 ASSERT_EQ(CRAS_STREAM_INPUT, iodev->direction); in TEST_F()
119 ASSERT_EQ(0, iodev->software_volume_needed); in TEST_F()
121 hfp_iodev_destroy(iodev); in TEST_F()
129 iodev = hfp_iodev_create(CRAS_STREAM_OUTPUT, fake_device, fake_slc, in TEST_F()
131 iodev->format = &fake_format; in TEST_F()
[all …]
Daudio_thread_unittest.cc149 virtual void SetupDevice(cras_iodev* iodev, in SetupDevice() argument
151 memset(iodev, 0, sizeof(*iodev)); in SetupDevice()
152 iodev->info.idx = ++device_id_; in SetupDevice()
153 iodev->direction = direction; in SetupDevice()
154 iodev->configure_dev = configure_dev; in SetupDevice()
155 iodev->close_dev = close_dev; in SetupDevice()
156 iodev->frames_queued = frames_queued; in SetupDevice()
157 iodev->delay_frames = delay_frames; in SetupDevice()
158 iodev->get_buffer = get_buffer; in SetupDevice()
159 iodev->put_buffer = put_buffer; in SetupDevice()
[all …]
Diodev_stub.cc32 void iodev_stub_frames_queued(cras_iodev* iodev, int ret, timespec ts) { in iodev_stub_frames_queued() argument
34 frames_queued_map.insert({iodev, data}); in iodev_stub_frames_queued()
37 void iodev_stub_valid_frames(cras_iodev* iodev, int ret, timespec ts) { in iodev_stub_valid_frames() argument
39 valid_frames_map.insert({iodev, data}); in iodev_stub_valid_frames()
42 bool iodev_stub_get_drop_time(cras_iodev* iodev, timespec* ts) { in iodev_stub_get_drop_time() argument
43 auto elem = drop_time_map.find(iodev); in iodev_stub_get_drop_time()
53 int cras_iodev_add_stream(struct cras_iodev* iodev, struct dev_stream* stream) { in cras_iodev_add_stream() argument
54 DL_APPEND(iodev->streams, stream); in cras_iodev_add_stream()
58 int cras_iodev_get_valid_frames(struct cras_iodev* iodev, in cras_iodev_get_valid_frames() argument
60 auto elem = valid_frames_map.find(iodev); in cras_iodev_get_valid_frames()
[all …]
Dempty_iodev_unittest.cc21 struct cras_iodev* iodev; in TEST() local
26 iodev = empty_iodev_create(CRAS_STREAM_INPUT, CRAS_NODE_TYPE_FALLBACK_NORMAL); in TEST()
31 iodev->format = &fake_format; in TEST()
32 iodev->configure_dev(iodev); in TEST()
35 nframes = iodev->frames_queued(iodev, &ts); in TEST()
42 iodev->get_buffer(iodev, &area, &nframes); in TEST()
45 iodev->close_dev(iodev); in TEST()
46 empty_iodev_destroy(iodev); in TEST()
53 void cras_iodev_free_format(struct cras_iodev* iodev) {} in cras_iodev_free_format() argument
59 void cras_iodev_init_audio_area(struct cras_iodev* iodev, int num_channels) { in cras_iodev_init_audio_area() argument
[all …]
Dalsa_io_unittest.cc388 struct cras_iodev* iodev; in TEST() local
393 iodev = alsa_iodev_create_with_default_parameters( in TEST()
396 ASSERT_EQ(0, alsa_iodev_legacy_complete_init(iodev)); in TEST()
398 aio = (struct alsa_io*)iodev; in TEST()
401 cras_iodev_set_format(iodev, &format); in TEST()
406 iodev->open_dev(iodev); in TEST()
408 iodev->configure_dev(iodev); in TEST()
419 alsa_iodev_destroy(iodev); in TEST()
424 struct cras_iodev* iodev; in TEST() local
427 iodev = alsa_iodev_create_with_default_parameters( in TEST()
[all …]
Dbt_io_unittest.cc89 static int update_supported_formats(struct cras_iodev* iodev) { in update_supported_formats() argument
90 free(iodev->supported_rates); in update_supported_formats()
91 free(iodev->supported_channel_counts); in update_supported_formats()
92 free(iodev->supported_formats); in update_supported_formats()
93 iodev->supported_rates = in update_supported_formats()
94 (size_t*)calloc(2, sizeof(*iodev->supported_rates)); in update_supported_formats()
95 iodev->supported_rates[0] = 48000; in update_supported_formats()
96 iodev->supported_rates[1] = 0; in update_supported_formats()
97 iodev->supported_channel_counts = in update_supported_formats()
98 (size_t*)calloc(2, sizeof(*iodev->supported_channel_counts)); in update_supported_formats()
[all …]
Dloopback_iodev_unittest.cc77 struct cras_iodev iodev; in TEST_F() local
80 iodev.direction = CRAS_STREAM_OUTPUT; in TEST_F()
81 iodev.format = &fmt_; in TEST_F()
82 iodev.streams = NULL; in TEST_F()
83 iodev.info.idx = 123; in TEST_F()
84 enabled_dev = &iodev; in TEST_F()
92 device_enabled_callback_cb(&iodev, device_enabled_callback_cb_data); in TEST_F()
101 device_disabled_callback_cb(&iodev, device_enabled_callback_cb_data); in TEST_F()
106 device_enabled_callback_cb(&iodev, device_enabled_callback_cb_data); in TEST_F()
179 struct cras_iodev iodev; in TEST_F() local
[all …]
Ddev_io_stubs.cc97 int delay_frames_stub(const struct cras_iodev* iodev) { in delay_frames_stub() argument
108 int fake_flush_buffer(struct cras_iodev* iodev) { in fake_flush_buffer() argument
116 IodevPtr iodev(reinterpret_cast<cras_iodev*>(calloc(1, sizeof(cras_iodev))), in create_open_iodev() local
118 iodev->is_enabled = 1; in create_open_iodev()
119 iodev->direction = direction; in create_open_iodev()
120 iodev->format = format; in create_open_iodev()
121 iodev->state = CRAS_IODEV_STATE_OPEN; in create_open_iodev()
122 iodev->delay_frames = delay_frames_stub; in create_open_iodev()
123 iodev->active_node = active_node; in create_open_iodev()
124 iodev->buffer_size = cb_threshold * 2; in create_open_iodev()
[all …]

123