• Home
  • Raw
  • Download

Lines Matching refs:testio

44 	struct test_iodev *testio = (struct test_iodev *)iodev;  in frames_queued()  local
47 if (testio->fd < 0) in frames_queued()
49 ioctl(testio->fd, FIONREAD, &available); in frames_queued()
51 return available / testio->fmt_bytes; in frames_queued()
61 struct test_iodev *testio = (struct test_iodev *)iodev; in close_dev() local
63 byte_buffer_destroy(&testio->audbuff); in close_dev()
64 testio->audbuff = NULL; in close_dev()
71 struct test_iodev *testio = (struct test_iodev *)iodev; in configure_dev() local
77 testio->fmt_bytes = cras_get_format_bytes(iodev->format); in configure_dev()
78 testio->audbuff = in configure_dev()
79 byte_buffer_create(TEST_BUFFER_SIZE * testio->fmt_bytes); in configure_dev()
87 struct test_iodev *testio = (struct test_iodev *)iodev; in get_buffer() local
91 buff = buf_read_pointer_size(testio->audbuff, &readable); in get_buffer()
102 struct test_iodev *testio = (struct test_iodev *)iodev; in put_buffer() local
105 buf_increment_read(testio->audbuff, in put_buffer()
106 (size_t)frames * (size_t)testio->fmt_bytes); in put_buffer()
114 struct test_iodev *testio = (struct test_iodev *)iodev; in get_buffer_fd_read() local
119 if (testio->fd < 0) { in get_buffer_fd_read()
124 write_ptr = buf_write_pointer_size(testio->audbuff, &avail); in get_buffer_fd_read()
125 avail = MIN(avail, *frames * testio->fmt_bytes); in get_buffer_fd_read()
126 nread = read(testio->fd, write_ptr, avail); in get_buffer_fd_read()
129 audio_thread_rm_callback(testio->fd); in get_buffer_fd_read()
130 close(testio->fd); in get_buffer_fd_read()
131 testio->fd = -1; in get_buffer_fd_read()
134 buf_increment_write(testio->audbuff, nread); in get_buffer_fd_read()
135 *frames = nread / testio->fmt_bytes; in get_buffer_fd_read()
148 static void play_file_as_hotword(struct test_iodev *testio, const char *path) in play_file_as_hotword() argument
150 if (testio->fd >= 0) { in play_file_as_hotword()
153 cras_iodev_list_get_audio_thread(), testio->fd); in play_file_as_hotword()
154 close(testio->fd); in play_file_as_hotword()
157 testio->fd = open(path, O_RDONLY); in play_file_as_hotword()
158 buf_reset(testio->audbuff); in play_file_as_hotword()
168 struct test_iodev *testio; in test_iodev_create() local
175 testio = calloc(1, sizeof(*testio)); in test_iodev_create()
176 if (testio == NULL) in test_iodev_create()
178 iodev = &testio->base; in test_iodev_create()
180 testio->fd = -1; in test_iodev_create()
229 struct test_iodev *testio = (struct test_iodev *)iodev; in test_iodev_destroy() local
234 free(testio); in test_iodev_destroy()
237 unsigned int test_iodev_add_samples(struct test_iodev *testio, uint8_t *samples, in test_iodev_add_samples() argument
243 write_ptr = buf_write_pointer_size(testio->audbuff, &avail); in test_iodev_add_samples()
245 memcpy(write_ptr, samples, (size_t)count * (size_t)testio->fmt_bytes); in test_iodev_add_samples()
246 buf_increment_write(testio->audbuff, in test_iodev_add_samples()
247 (size_t)count * (size_t)testio->fmt_bytes); in test_iodev_add_samples()
255 struct test_iodev *testio = (struct test_iodev *)iodev; in test_iodev_command() local
262 play_file_as_hotword(testio, (char *)data); in test_iodev_command()