/src/adhd/cras/src/common/byte_buffer.h
Line | Count | Source |
1 | | /* Copyright 2014 The ChromiumOS Authors |
2 | | * Use of this source code is governed by a BSD-style license that can be |
3 | | * found in the LICENSE file. |
4 | | */ |
5 | | |
6 | | #ifndef CRAS_SRC_COMMON_BYTE_BUFFER_H_ |
7 | | #define CRAS_SRC_COMMON_BYTE_BUFFER_H_ |
8 | | |
9 | | #include <stdint.h> |
10 | | #include <stdlib.h> |
11 | | #include <sys/param.h> |
12 | | |
13 | | #ifdef __cplusplus |
14 | | extern "C" { |
15 | | #endif |
16 | | |
17 | | struct byte_buffer { |
18 | | unsigned int write_idx; |
19 | | unsigned int read_idx; |
20 | | unsigned int level; |
21 | | unsigned int max_size; |
22 | | unsigned int used_size; |
23 | | uint8_t bytes[]; |
24 | | }; |
25 | | |
26 | | // Create a byte buffer to hold buffer_size_bytes worth of data. |
27 | 1.26k | static inline struct byte_buffer* byte_buffer_create(size_t buffer_size_bytes) { |
28 | 1.26k | struct byte_buffer* buf; |
29 | 1.26k | buf = (struct byte_buffer*)calloc(1, sizeof(*buf) + buffer_size_bytes); |
30 | 1.26k | if (!buf) { |
31 | 0 | return buf; |
32 | 0 | } |
33 | 1.26k | buf->max_size = buffer_size_bytes; |
34 | 1.26k | buf->used_size = buffer_size_bytes; |
35 | 1.26k | return buf; |
36 | 1.26k | } Unexecuted instantiation: cras_a2dp_iodev.c:byte_buffer_create cras_fl_pcm_iodev.c:byte_buffer_create Line | Count | Source | 27 | 966 | static inline struct byte_buffer* byte_buffer_create(size_t buffer_size_bytes) { | 28 | 966 | struct byte_buffer* buf; | 29 | 966 | buf = (struct byte_buffer*)calloc(1, sizeof(*buf) + buffer_size_bytes); | 30 | 966 | if (!buf) { | 31 | 0 | return buf; | 32 | 0 | } | 33 | 966 | buf->max_size = buffer_size_bytes; | 34 | 966 | buf->used_size = buffer_size_bytes; | 35 | 966 | return buf; | 36 | 966 | } |
Unexecuted instantiation: cras_hfp_ag_profile.c:byte_buffer_create Unexecuted instantiation: cras_hfp_alsa_iodev.c:byte_buffer_create Unexecuted instantiation: cras_hfp_iodev.c:byte_buffer_create Unexecuted instantiation: cras_hfp_manager.c:byte_buffer_create Unexecuted instantiation: cras_iodev.c:byte_buffer_create cras_floop_iodev.c:byte_buffer_create Line | Count | Source | 27 | 40 | static inline struct byte_buffer* byte_buffer_create(size_t buffer_size_bytes) { | 28 | 40 | struct byte_buffer* buf; | 29 | 40 | buf = (struct byte_buffer*)calloc(1, sizeof(*buf) + buffer_size_bytes); | 30 | 40 | if (!buf) { | 31 | 0 | return buf; | 32 | 0 | } | 33 | 40 | buf->max_size = buffer_size_bytes; | 34 | 40 | buf->used_size = buffer_size_bytes; | 35 | 40 | return buf; | 36 | 40 | } |
Unexecuted instantiation: cras_lea_iodev.c:byte_buffer_create cras_loopback_iodev.c:byte_buffer_create Line | Count | Source | 27 | 18 | static inline struct byte_buffer* byte_buffer_create(size_t buffer_size_bytes) { | 28 | 18 | struct byte_buffer* buf; | 29 | 18 | buf = (struct byte_buffer*)calloc(1, sizeof(*buf) + buffer_size_bytes); | 30 | 18 | if (!buf) { | 31 | 0 | return buf; | 32 | 0 | } | 33 | 18 | buf->max_size = buffer_size_bytes; | 34 | 18 | buf->used_size = buffer_size_bytes; | 35 | 18 | return buf; | 36 | 18 | } |
Unexecuted instantiation: cras_sco.c:byte_buffer_create Unexecuted instantiation: dev_io.c:byte_buffer_create dev_stream.c:byte_buffer_create Line | Count | Source | 27 | 240 | static inline struct byte_buffer* byte_buffer_create(size_t buffer_size_bytes) { | 28 | 240 | struct byte_buffer* buf; | 29 | 240 | buf = (struct byte_buffer*)calloc(1, sizeof(*buf) + buffer_size_bytes); | 30 | 240 | if (!buf) { | 31 | 0 | return buf; | 32 | 0 | } | 33 | 240 | buf->max_size = buffer_size_bytes; | 34 | 240 | buf->used_size = buffer_size_bytes; | 35 | 240 | return buf; | 36 | 240 | } |
Unexecuted instantiation: input_data.c:byte_buffer_create test_iodev.c:byte_buffer_create Line | Count | Source | 27 | 5 | static inline struct byte_buffer* byte_buffer_create(size_t buffer_size_bytes) { | 28 | 5 | struct byte_buffer* buf; | 29 | 5 | buf = (struct byte_buffer*)calloc(1, sizeof(*buf) + buffer_size_bytes); | 30 | 5 | if (!buf) { | 31 | 0 | return buf; | 32 | 0 | } | 33 | 5 | buf->max_size = buffer_size_bytes; | 34 | 5 | buf->used_size = buffer_size_bytes; | 35 | 5 | return buf; | 36 | 5 | } |
Unexecuted instantiation: cras_stream_apm_noop.c:byte_buffer_create Unexecuted instantiation: cras_sr_bt_adapters_stub.c:byte_buffer_create Unexecuted instantiation: cras_sr_bt_util_stub.c:byte_buffer_create Unexecuted instantiation: cras_sr_stub.c:byte_buffer_create |
37 | | |
38 | | static inline void byte_buffer_set_used_size(struct byte_buffer* buf, |
39 | 0 | size_t used_size) { |
40 | 0 | buf->used_size = MIN(used_size, buf->max_size); |
41 | 0 | } Unexecuted instantiation: cras_a2dp_iodev.c:byte_buffer_set_used_size Unexecuted instantiation: cras_fl_pcm_iodev.c:byte_buffer_set_used_size Unexecuted instantiation: cras_hfp_ag_profile.c:byte_buffer_set_used_size Unexecuted instantiation: cras_hfp_alsa_iodev.c:byte_buffer_set_used_size Unexecuted instantiation: cras_hfp_iodev.c:byte_buffer_set_used_size Unexecuted instantiation: cras_hfp_manager.c:byte_buffer_set_used_size Unexecuted instantiation: cras_iodev.c:byte_buffer_set_used_size Unexecuted instantiation: cras_floop_iodev.c:byte_buffer_set_used_size Unexecuted instantiation: cras_lea_iodev.c:byte_buffer_set_used_size Unexecuted instantiation: cras_loopback_iodev.c:byte_buffer_set_used_size Unexecuted instantiation: cras_sco.c:byte_buffer_set_used_size Unexecuted instantiation: dev_io.c:byte_buffer_set_used_size Unexecuted instantiation: dev_stream.c:byte_buffer_set_used_size Unexecuted instantiation: input_data.c:byte_buffer_set_used_size Unexecuted instantiation: test_iodev.c:byte_buffer_set_used_size Unexecuted instantiation: cras_stream_apm_noop.c:byte_buffer_set_used_size Unexecuted instantiation: cras_sr_bt_adapters_stub.c:byte_buffer_set_used_size Unexecuted instantiation: cras_sr_bt_util_stub.c:byte_buffer_set_used_size Unexecuted instantiation: cras_sr_stub.c:byte_buffer_set_used_size |
42 | | |
43 | | // Destroy a byte_buffer created with byte_buffer_create. |
44 | 1.37k | static inline void byte_buffer_destroy(struct byte_buffer** buf) { |
45 | 1.37k | free(*buf); |
46 | 1.37k | *buf = NULL; |
47 | 1.37k | } Unexecuted instantiation: cras_a2dp_iodev.c:byte_buffer_destroy cras_fl_pcm_iodev.c:byte_buffer_destroy Line | Count | Source | 44 | 966 | static inline void byte_buffer_destroy(struct byte_buffer** buf) { | 45 | 966 | free(*buf); | 46 | | *buf = NULL; | 47 | 966 | } |
Unexecuted instantiation: cras_hfp_ag_profile.c:byte_buffer_destroy Unexecuted instantiation: cras_hfp_alsa_iodev.c:byte_buffer_destroy Unexecuted instantiation: cras_hfp_iodev.c:byte_buffer_destroy Unexecuted instantiation: cras_hfp_manager.c:byte_buffer_destroy Unexecuted instantiation: cras_iodev.c:byte_buffer_destroy Unexecuted instantiation: cras_floop_iodev.c:byte_buffer_destroy Unexecuted instantiation: cras_lea_iodev.c:byte_buffer_destroy Unexecuted instantiation: cras_loopback_iodev.c:byte_buffer_destroy Unexecuted instantiation: cras_sco.c:byte_buffer_destroy Unexecuted instantiation: dev_io.c:byte_buffer_destroy dev_stream.c:byte_buffer_destroy Line | Count | Source | 44 | 240 | static inline void byte_buffer_destroy(struct byte_buffer** buf) { | 45 | 240 | free(*buf); | 46 | | *buf = NULL; | 47 | 240 | } |
input_data.c:byte_buffer_destroy Line | Count | Source | 44 | 164 | static inline void byte_buffer_destroy(struct byte_buffer** buf) { | 45 | 164 | free(*buf); | 46 | | *buf = NULL; | 47 | 164 | } |
test_iodev.c:byte_buffer_destroy Line | Count | Source | 44 | 5 | static inline void byte_buffer_destroy(struct byte_buffer** buf) { | 45 | 5 | free(*buf); | 46 | | *buf = NULL; | 47 | 5 | } |
Unexecuted instantiation: cras_stream_apm_noop.c:byte_buffer_destroy Unexecuted instantiation: cras_sr_bt_adapters_stub.c:byte_buffer_destroy Unexecuted instantiation: cras_sr_bt_util_stub.c:byte_buffer_destroy Unexecuted instantiation: cras_sr_stub.c:byte_buffer_destroy |
48 | | |
49 | 3.24k | static inline unsigned int buf_writable(struct byte_buffer* buf) { |
50 | 3.24k | if (buf->level >= buf->used_size) { |
51 | 250 | return 0; |
52 | 250 | } |
53 | 2.99k | if (buf->write_idx < buf->read_idx) { |
54 | 393 | return buf->read_idx - buf->write_idx; |
55 | 393 | } |
56 | | |
57 | 2.60k | return buf->used_size - buf->write_idx; |
58 | 2.99k | } Unexecuted instantiation: cras_a2dp_iodev.c:buf_writable Unexecuted instantiation: cras_fl_pcm_iodev.c:buf_writable Unexecuted instantiation: cras_hfp_ag_profile.c:buf_writable Unexecuted instantiation: cras_hfp_alsa_iodev.c:buf_writable Unexecuted instantiation: cras_hfp_iodev.c:buf_writable Unexecuted instantiation: cras_hfp_manager.c:buf_writable Unexecuted instantiation: cras_iodev.c:buf_writable cras_floop_iodev.c:buf_writable Line | Count | Source | 49 | 400 | static inline unsigned int buf_writable(struct byte_buffer* buf) { | 50 | 400 | if (buf->level >= buf->used_size) { | 51 | 10 | return 0; | 52 | 10 | } | 53 | 390 | if (buf->write_idx < buf->read_idx) { | 54 | 2 | return buf->read_idx - buf->write_idx; | 55 | 2 | } | 56 | | | 57 | 388 | return buf->used_size - buf->write_idx; | 58 | 390 | } |
Unexecuted instantiation: cras_lea_iodev.c:buf_writable cras_loopback_iodev.c:buf_writable Line | Count | Source | 49 | 2.18k | static inline unsigned int buf_writable(struct byte_buffer* buf) { | 50 | 2.18k | if (buf->level >= buf->used_size) { | 51 | 240 | return 0; | 52 | 240 | } | 53 | 1.94k | if (buf->write_idx < buf->read_idx) { | 54 | 388 | return buf->read_idx - buf->write_idx; | 55 | 388 | } | 56 | | | 57 | 1.55k | return buf->used_size - buf->write_idx; | 58 | 1.94k | } |
Unexecuted instantiation: cras_sco.c:buf_writable Unexecuted instantiation: dev_io.c:buf_writable dev_stream.c:buf_writable Line | Count | Source | 49 | 195 | static inline unsigned int buf_writable(struct byte_buffer* buf) { | 50 | 195 | if (buf->level >= buf->used_size) { | 51 | 0 | return 0; | 52 | 0 | } | 53 | 195 | if (buf->write_idx < buf->read_idx) { | 54 | 2 | return buf->read_idx - buf->write_idx; | 55 | 2 | } | 56 | | | 57 | 193 | return buf->used_size - buf->write_idx; | 58 | 195 | } |
input_data.c:buf_writable Line | Count | Source | 49 | 469 | static inline unsigned int buf_writable(struct byte_buffer* buf) { | 50 | 469 | if (buf->level >= buf->used_size) { | 51 | 0 | return 0; | 52 | 0 | } | 53 | 469 | if (buf->write_idx < buf->read_idx) { | 54 | 1 | return buf->read_idx - buf->write_idx; | 55 | 1 | } | 56 | | | 57 | 468 | return buf->used_size - buf->write_idx; | 58 | 469 | } |
Unexecuted instantiation: test_iodev.c:buf_writable Unexecuted instantiation: cras_stream_apm_noop.c:buf_writable Unexecuted instantiation: cras_sr_bt_adapters_stub.c:buf_writable Unexecuted instantiation: cras_sr_bt_util_stub.c:buf_writable Unexecuted instantiation: cras_sr_stub.c:buf_writable |
59 | | |
60 | 579 | static inline unsigned int buf_readable(struct byte_buffer* buf) { |
61 | 579 | if (buf->level == 0) { |
62 | 0 | return 0; |
63 | 0 | } |
64 | | |
65 | 579 | if (buf->read_idx < buf->write_idx) { |
66 | 520 | return buf->write_idx - buf->read_idx; |
67 | 520 | } |
68 | | |
69 | 59 | return buf->used_size - buf->read_idx; |
70 | 579 | } Unexecuted instantiation: cras_a2dp_iodev.c:buf_readable Unexecuted instantiation: cras_fl_pcm_iodev.c:buf_readable Unexecuted instantiation: cras_hfp_ag_profile.c:buf_readable Unexecuted instantiation: cras_hfp_alsa_iodev.c:buf_readable Unexecuted instantiation: cras_hfp_iodev.c:buf_readable Unexecuted instantiation: cras_hfp_manager.c:buf_readable Unexecuted instantiation: cras_iodev.c:buf_readable cras_floop_iodev.c:buf_readable Line | Count | Source | 60 | 118 | static inline unsigned int buf_readable(struct byte_buffer* buf) { | 61 | 118 | if (buf->level == 0) { | 62 | 0 | return 0; | 63 | 0 | } | 64 | | | 65 | 118 | if (buf->read_idx < buf->write_idx) { | 66 | 115 | return buf->write_idx - buf->read_idx; | 67 | 115 | } | 68 | | | 69 | 3 | return buf->used_size - buf->read_idx; | 70 | 118 | } |
Unexecuted instantiation: cras_lea_iodev.c:buf_readable cras_loopback_iodev.c:buf_readable Line | Count | Source | 60 | 267 | static inline unsigned int buf_readable(struct byte_buffer* buf) { | 61 | 267 | if (buf->level == 0) { | 62 | 0 | return 0; | 63 | 0 | } | 64 | | | 65 | 267 | if (buf->read_idx < buf->write_idx) { | 66 | 213 | return buf->write_idx - buf->read_idx; | 67 | 213 | } | 68 | | | 69 | 54 | return buf->used_size - buf->read_idx; | 70 | 267 | } |
Unexecuted instantiation: cras_sco.c:buf_readable Unexecuted instantiation: dev_io.c:buf_readable dev_stream.c:buf_readable Line | Count | Source | 60 | 194 | static inline unsigned int buf_readable(struct byte_buffer* buf) { | 61 | 194 | if (buf->level == 0) { | 62 | 0 | return 0; | 63 | 0 | } | 64 | | | 65 | 194 | if (buf->read_idx < buf->write_idx) { | 66 | 192 | return buf->write_idx - buf->read_idx; | 67 | 192 | } | 68 | | | 69 | 2 | return buf->used_size - buf->read_idx; | 70 | 194 | } |
Unexecuted instantiation: input_data.c:buf_readable Unexecuted instantiation: test_iodev.c:buf_readable Unexecuted instantiation: cras_stream_apm_noop.c:buf_readable Unexecuted instantiation: cras_sr_bt_adapters_stub.c:buf_readable Unexecuted instantiation: cras_sr_bt_util_stub.c:buf_readable Unexecuted instantiation: cras_sr_stub.c:buf_readable |
71 | | |
72 | | // Adjust readable size to given value. Use with caution. |
73 | | static inline unsigned int buf_adjust_readable(struct byte_buffer* buf, |
74 | 0 | size_t readable) { |
75 | 0 | buf->level = MIN(readable, buf->used_size); |
76 | 0 | buf->write_idx = (buf->read_idx + buf->level) % buf->used_size; |
77 | 0 | return 0; |
78 | 0 | } Unexecuted instantiation: cras_a2dp_iodev.c:buf_adjust_readable Unexecuted instantiation: cras_fl_pcm_iodev.c:buf_adjust_readable Unexecuted instantiation: cras_hfp_ag_profile.c:buf_adjust_readable Unexecuted instantiation: cras_hfp_alsa_iodev.c:buf_adjust_readable Unexecuted instantiation: cras_hfp_iodev.c:buf_adjust_readable Unexecuted instantiation: cras_hfp_manager.c:buf_adjust_readable Unexecuted instantiation: cras_iodev.c:buf_adjust_readable Unexecuted instantiation: cras_floop_iodev.c:buf_adjust_readable Unexecuted instantiation: cras_lea_iodev.c:buf_adjust_readable Unexecuted instantiation: cras_loopback_iodev.c:buf_adjust_readable Unexecuted instantiation: cras_sco.c:buf_adjust_readable Unexecuted instantiation: dev_io.c:buf_adjust_readable Unexecuted instantiation: dev_stream.c:buf_adjust_readable Unexecuted instantiation: input_data.c:buf_adjust_readable Unexecuted instantiation: test_iodev.c:buf_adjust_readable Unexecuted instantiation: cras_stream_apm_noop.c:buf_adjust_readable Unexecuted instantiation: cras_sr_bt_adapters_stub.c:buf_adjust_readable Unexecuted instantiation: cras_sr_bt_util_stub.c:buf_adjust_readable Unexecuted instantiation: cras_sr_stub.c:buf_adjust_readable |
79 | | |
80 | 7.12k | static inline unsigned int buf_queued(struct byte_buffer* buf) { |
81 | 7.12k | return buf->level; |
82 | 7.12k | } Unexecuted instantiation: cras_a2dp_iodev.c:buf_queued Unexecuted instantiation: cras_fl_pcm_iodev.c:buf_queued Unexecuted instantiation: cras_hfp_ag_profile.c:buf_queued Unexecuted instantiation: cras_hfp_alsa_iodev.c:buf_queued Unexecuted instantiation: cras_hfp_iodev.c:buf_queued Unexecuted instantiation: cras_hfp_manager.c:buf_queued Unexecuted instantiation: cras_iodev.c:buf_queued cras_floop_iodev.c:buf_queued Line | Count | Source | 80 | 2.26k | static inline unsigned int buf_queued(struct byte_buffer* buf) { | 81 | 2.26k | return buf->level; | 82 | 2.26k | } |
Unexecuted instantiation: cras_lea_iodev.c:buf_queued cras_loopback_iodev.c:buf_queued Line | Count | Source | 80 | 2.00k | static inline unsigned int buf_queued(struct byte_buffer* buf) { | 81 | 2.00k | return buf->level; | 82 | 2.00k | } |
Unexecuted instantiation: cras_sco.c:buf_queued Unexecuted instantiation: dev_io.c:buf_queued Line | Count | Source | 80 | 2.36k | static inline unsigned int buf_queued(struct byte_buffer* buf) { | 81 | 2.36k | return buf->level; | 82 | 2.36k | } |
Line | Count | Source | 80 | 487 | static inline unsigned int buf_queued(struct byte_buffer* buf) { | 81 | 487 | return buf->level; | 82 | 487 | } |
Unexecuted instantiation: test_iodev.c:buf_queued Unexecuted instantiation: cras_stream_apm_noop.c:buf_queued Unexecuted instantiation: cras_sr_bt_adapters_stub.c:buf_queued Unexecuted instantiation: cras_sr_bt_util_stub.c:buf_queued Unexecuted instantiation: cras_sr_stub.c:buf_queued |
83 | | |
84 | 1.51k | static inline unsigned int buf_available(const struct byte_buffer* buf) { |
85 | 1.51k | return buf->used_size - buf->level; |
86 | 1.51k | } Unexecuted instantiation: cras_a2dp_iodev.c:buf_available Unexecuted instantiation: cras_fl_pcm_iodev.c:buf_available Unexecuted instantiation: cras_hfp_ag_profile.c:buf_available Unexecuted instantiation: cras_hfp_alsa_iodev.c:buf_available Unexecuted instantiation: cras_hfp_iodev.c:buf_available Unexecuted instantiation: cras_hfp_manager.c:buf_available Unexecuted instantiation: cras_iodev.c:buf_available Unexecuted instantiation: cras_floop_iodev.c:buf_available Unexecuted instantiation: cras_lea_iodev.c:buf_available Unexecuted instantiation: cras_loopback_iodev.c:buf_available Unexecuted instantiation: cras_sco.c:buf_available Unexecuted instantiation: dev_io.c:buf_available dev_stream.c:buf_available Line | Count | Source | 84 | 1.51k | static inline unsigned int buf_available(const struct byte_buffer* buf) { | 85 | 1.51k | return buf->used_size - buf->level; | 86 | 1.51k | } |
Unexecuted instantiation: input_data.c:buf_available Unexecuted instantiation: test_iodev.c:buf_available Unexecuted instantiation: cras_stream_apm_noop.c:buf_available Unexecuted instantiation: cras_sr_bt_adapters_stub.c:buf_available Unexecuted instantiation: cras_sr_bt_util_stub.c:buf_available Unexecuted instantiation: cras_sr_stub.c:buf_available |
87 | | |
88 | 579 | static inline uint8_t* buf_read_pointer(struct byte_buffer* buf) { |
89 | 579 | return &buf->bytes[buf->read_idx]; |
90 | 579 | } Unexecuted instantiation: cras_a2dp_iodev.c:buf_read_pointer Unexecuted instantiation: cras_fl_pcm_iodev.c:buf_read_pointer Unexecuted instantiation: cras_hfp_ag_profile.c:buf_read_pointer Unexecuted instantiation: cras_hfp_alsa_iodev.c:buf_read_pointer Unexecuted instantiation: cras_hfp_iodev.c:buf_read_pointer Unexecuted instantiation: cras_hfp_manager.c:buf_read_pointer Unexecuted instantiation: cras_iodev.c:buf_read_pointer cras_floop_iodev.c:buf_read_pointer Line | Count | Source | 88 | 118 | static inline uint8_t* buf_read_pointer(struct byte_buffer* buf) { | 89 | 118 | return &buf->bytes[buf->read_idx]; | 90 | 118 | } |
Unexecuted instantiation: cras_lea_iodev.c:buf_read_pointer cras_loopback_iodev.c:buf_read_pointer Line | Count | Source | 88 | 267 | static inline uint8_t* buf_read_pointer(struct byte_buffer* buf) { | 89 | 267 | return &buf->bytes[buf->read_idx]; | 90 | 267 | } |
Unexecuted instantiation: cras_sco.c:buf_read_pointer Unexecuted instantiation: dev_io.c:buf_read_pointer dev_stream.c:buf_read_pointer Line | Count | Source | 88 | 194 | static inline uint8_t* buf_read_pointer(struct byte_buffer* buf) { | 89 | 194 | return &buf->bytes[buf->read_idx]; | 90 | 194 | } |
Unexecuted instantiation: input_data.c:buf_read_pointer Unexecuted instantiation: test_iodev.c:buf_read_pointer Unexecuted instantiation: cras_stream_apm_noop.c:buf_read_pointer Unexecuted instantiation: cras_sr_bt_adapters_stub.c:buf_read_pointer Unexecuted instantiation: cras_sr_bt_util_stub.c:buf_read_pointer Unexecuted instantiation: cras_sr_stub.c:buf_read_pointer |
91 | | |
92 | | static inline uint8_t* buf_read_pointer_size(struct byte_buffer* buf, |
93 | 194 | unsigned int* readable) { |
94 | 194 | *readable = buf_readable(buf); |
95 | 194 | return buf_read_pointer(buf); |
96 | 194 | } Unexecuted instantiation: cras_a2dp_iodev.c:buf_read_pointer_size Unexecuted instantiation: cras_fl_pcm_iodev.c:buf_read_pointer_size Unexecuted instantiation: cras_hfp_ag_profile.c:buf_read_pointer_size Unexecuted instantiation: cras_hfp_alsa_iodev.c:buf_read_pointer_size Unexecuted instantiation: cras_hfp_iodev.c:buf_read_pointer_size Unexecuted instantiation: cras_hfp_manager.c:buf_read_pointer_size Unexecuted instantiation: cras_iodev.c:buf_read_pointer_size Unexecuted instantiation: cras_floop_iodev.c:buf_read_pointer_size Unexecuted instantiation: cras_lea_iodev.c:buf_read_pointer_size Unexecuted instantiation: cras_loopback_iodev.c:buf_read_pointer_size Unexecuted instantiation: cras_sco.c:buf_read_pointer_size Unexecuted instantiation: dev_io.c:buf_read_pointer_size dev_stream.c:buf_read_pointer_size Line | Count | Source | 93 | 194 | unsigned int* readable) { | 94 | 194 | *readable = buf_readable(buf); | 95 | 194 | return buf_read_pointer(buf); | 96 | 194 | } |
Unexecuted instantiation: input_data.c:buf_read_pointer_size Unexecuted instantiation: test_iodev.c:buf_read_pointer_size Unexecuted instantiation: cras_stream_apm_noop.c:buf_read_pointer_size Unexecuted instantiation: cras_sr_bt_adapters_stub.c:buf_read_pointer_size Unexecuted instantiation: cras_sr_bt_util_stub.c:buf_read_pointer_size Unexecuted instantiation: cras_sr_stub.c:buf_read_pointer_size |
97 | | |
98 | 1.06k | static inline void buf_increment_read(struct byte_buffer* buf, size_t inc) { |
99 | 1.06k | inc = MIN(inc, buf->level); |
100 | 1.06k | buf->read_idx += inc; |
101 | 1.06k | buf->read_idx %= buf->used_size; |
102 | 1.06k | buf->level -= inc; |
103 | 1.06k | } Unexecuted instantiation: cras_a2dp_iodev.c:buf_increment_read Unexecuted instantiation: cras_fl_pcm_iodev.c:buf_increment_read Unexecuted instantiation: cras_hfp_ag_profile.c:buf_increment_read Unexecuted instantiation: cras_hfp_alsa_iodev.c:buf_increment_read Unexecuted instantiation: cras_hfp_iodev.c:buf_increment_read Unexecuted instantiation: cras_hfp_manager.c:buf_increment_read Unexecuted instantiation: cras_iodev.c:buf_increment_read cras_floop_iodev.c:buf_increment_read Line | Count | Source | 98 | 118 | static inline void buf_increment_read(struct byte_buffer* buf, size_t inc) { | 99 | | inc = MIN(inc, buf->level); | 100 | 118 | buf->read_idx += inc; | 101 | 118 | buf->read_idx %= buf->used_size; | 102 | 118 | buf->level -= inc; | 103 | 118 | } |
Unexecuted instantiation: cras_lea_iodev.c:buf_increment_read cras_loopback_iodev.c:buf_increment_read Line | Count | Source | 98 | 267 | static inline void buf_increment_read(struct byte_buffer* buf, size_t inc) { | 99 | | inc = MIN(inc, buf->level); | 100 | 267 | buf->read_idx += inc; | 101 | 267 | buf->read_idx %= buf->used_size; | 102 | 267 | buf->level -= inc; | 103 | 267 | } |
Unexecuted instantiation: cras_sco.c:buf_increment_read Unexecuted instantiation: dev_io.c:buf_increment_read dev_stream.c:buf_increment_read Line | Count | Source | 98 | 194 | static inline void buf_increment_read(struct byte_buffer* buf, size_t inc) { | 99 | | inc = MIN(inc, buf->level); | 100 | 194 | buf->read_idx += inc; | 101 | 194 | buf->read_idx %= buf->used_size; | 102 | 194 | buf->level -= inc; | 103 | 194 | } |
input_data.c:buf_increment_read Line | Count | Source | 98 | 487 | static inline void buf_increment_read(struct byte_buffer* buf, size_t inc) { | 99 | | inc = MIN(inc, buf->level); | 100 | 487 | buf->read_idx += inc; | 101 | 487 | buf->read_idx %= buf->used_size; | 102 | 487 | buf->level -= inc; | 103 | 487 | } |
Unexecuted instantiation: test_iodev.c:buf_increment_read Unexecuted instantiation: cras_stream_apm_noop.c:buf_increment_read Unexecuted instantiation: cras_sr_bt_adapters_stub.c:buf_increment_read Unexecuted instantiation: cras_sr_bt_util_stub.c:buf_increment_read Unexecuted instantiation: cras_sr_stub.c:buf_increment_read |
104 | | |
105 | 949 | static inline uint8_t* buf_write_pointer(struct byte_buffer* buf) { |
106 | 949 | return &buf->bytes[buf->write_idx]; |
107 | 949 | } Unexecuted instantiation: cras_a2dp_iodev.c:buf_write_pointer Unexecuted instantiation: cras_fl_pcm_iodev.c:buf_write_pointer Unexecuted instantiation: cras_hfp_ag_profile.c:buf_write_pointer Unexecuted instantiation: cras_hfp_alsa_iodev.c:buf_write_pointer Unexecuted instantiation: cras_hfp_iodev.c:buf_write_pointer Unexecuted instantiation: cras_hfp_manager.c:buf_write_pointer Unexecuted instantiation: cras_iodev.c:buf_write_pointer cras_floop_iodev.c:buf_write_pointer Line | Count | Source | 105 | 129 | static inline uint8_t* buf_write_pointer(struct byte_buffer* buf) { | 106 | 129 | return &buf->bytes[buf->write_idx]; | 107 | 129 | } |
Unexecuted instantiation: cras_lea_iodev.c:buf_write_pointer cras_loopback_iodev.c:buf_write_pointer Line | Count | Source | 105 | 625 | static inline uint8_t* buf_write_pointer(struct byte_buffer* buf) { | 106 | 625 | return &buf->bytes[buf->write_idx]; | 107 | 625 | } |
Unexecuted instantiation: cras_sco.c:buf_write_pointer Unexecuted instantiation: dev_io.c:buf_write_pointer dev_stream.c:buf_write_pointer Line | Count | Source | 105 | 195 | static inline uint8_t* buf_write_pointer(struct byte_buffer* buf) { | 106 | 195 | return &buf->bytes[buf->write_idx]; | 107 | 195 | } |
Unexecuted instantiation: input_data.c:buf_write_pointer Unexecuted instantiation: test_iodev.c:buf_write_pointer Unexecuted instantiation: cras_stream_apm_noop.c:buf_write_pointer Unexecuted instantiation: cras_sr_bt_adapters_stub.c:buf_write_pointer Unexecuted instantiation: cras_sr_bt_util_stub.c:buf_write_pointer Unexecuted instantiation: cras_sr_stub.c:buf_write_pointer |
108 | | |
109 | | static inline uint8_t* buf_write_pointer_size(struct byte_buffer* buf, |
110 | 195 | unsigned int* writeable) { |
111 | 195 | *writeable = buf_writable(buf); |
112 | 195 | return buf_write_pointer(buf); |
113 | 195 | } Unexecuted instantiation: cras_a2dp_iodev.c:buf_write_pointer_size Unexecuted instantiation: cras_fl_pcm_iodev.c:buf_write_pointer_size Unexecuted instantiation: cras_hfp_ag_profile.c:buf_write_pointer_size Unexecuted instantiation: cras_hfp_alsa_iodev.c:buf_write_pointer_size Unexecuted instantiation: cras_hfp_iodev.c:buf_write_pointer_size Unexecuted instantiation: cras_hfp_manager.c:buf_write_pointer_size Unexecuted instantiation: cras_iodev.c:buf_write_pointer_size Unexecuted instantiation: cras_floop_iodev.c:buf_write_pointer_size Unexecuted instantiation: cras_lea_iodev.c:buf_write_pointer_size Unexecuted instantiation: cras_loopback_iodev.c:buf_write_pointer_size Unexecuted instantiation: cras_sco.c:buf_write_pointer_size Unexecuted instantiation: dev_io.c:buf_write_pointer_size dev_stream.c:buf_write_pointer_size Line | Count | Source | 110 | 195 | unsigned int* writeable) { | 111 | 195 | *writeable = buf_writable(buf); | 112 | 195 | return buf_write_pointer(buf); | 113 | 195 | } |
Unexecuted instantiation: input_data.c:buf_write_pointer_size Unexecuted instantiation: test_iodev.c:buf_write_pointer_size Unexecuted instantiation: cras_stream_apm_noop.c:buf_write_pointer_size Unexecuted instantiation: cras_sr_bt_adapters_stub.c:buf_write_pointer_size Unexecuted instantiation: cras_sr_bt_util_stub.c:buf_write_pointer_size Unexecuted instantiation: cras_sr_stub.c:buf_write_pointer_size |
114 | | |
115 | 1.41k | static inline void buf_increment_write(struct byte_buffer* buf, size_t inc) { |
116 | 1.41k | buf->write_idx += inc; |
117 | 1.41k | buf->write_idx %= buf->used_size; |
118 | 1.41k | if (buf->level + inc < buf->used_size) { |
119 | 1.36k | buf->level += inc; |
120 | 1.36k | } else { |
121 | 48 | buf->level = buf->used_size; |
122 | 48 | } |
123 | 1.41k | } Unexecuted instantiation: cras_a2dp_iodev.c:buf_increment_write Unexecuted instantiation: cras_fl_pcm_iodev.c:buf_increment_write Unexecuted instantiation: cras_hfp_ag_profile.c:buf_increment_write Unexecuted instantiation: cras_hfp_alsa_iodev.c:buf_increment_write Unexecuted instantiation: cras_hfp_iodev.c:buf_increment_write Unexecuted instantiation: cras_hfp_manager.c:buf_increment_write Unexecuted instantiation: cras_iodev.c:buf_increment_write cras_floop_iodev.c:buf_increment_write Line | Count | Source | 115 | 124 | static inline void buf_increment_write(struct byte_buffer* buf, size_t inc) { | 116 | 124 | buf->write_idx += inc; | 117 | 124 | buf->write_idx %= buf->used_size; | 118 | 124 | if (buf->level + inc < buf->used_size) { | 119 | 116 | buf->level += inc; | 120 | 116 | } else { | 121 | 8 | buf->level = buf->used_size; | 122 | 8 | } | 123 | 124 | } |
Unexecuted instantiation: cras_lea_iodev.c:buf_increment_write cras_loopback_iodev.c:buf_increment_write Line | Count | Source | 115 | 625 | static inline void buf_increment_write(struct byte_buffer* buf, size_t inc) { | 116 | 625 | buf->write_idx += inc; | 117 | 625 | buf->write_idx %= buf->used_size; | 118 | 625 | if (buf->level + inc < buf->used_size) { | 119 | 595 | buf->level += inc; | 120 | 595 | } else { | 121 | 30 | buf->level = buf->used_size; | 122 | 30 | } | 123 | 625 | } |
Unexecuted instantiation: cras_sco.c:buf_increment_write Unexecuted instantiation: dev_io.c:buf_increment_write dev_stream.c:buf_increment_write Line | Count | Source | 115 | 195 | static inline void buf_increment_write(struct byte_buffer* buf, size_t inc) { | 116 | 195 | buf->write_idx += inc; | 117 | 195 | buf->write_idx %= buf->used_size; | 118 | 195 | if (buf->level + inc < buf->used_size) { | 119 | 195 | buf->level += inc; | 120 | 195 | } else { | 121 | 0 | buf->level = buf->used_size; | 122 | 0 | } | 123 | 195 | } |
input_data.c:buf_increment_write Line | Count | Source | 115 | 469 | static inline void buf_increment_write(struct byte_buffer* buf, size_t inc) { | 116 | 469 | buf->write_idx += inc; | 117 | 469 | buf->write_idx %= buf->used_size; | 118 | 469 | if (buf->level + inc < buf->used_size) { | 119 | 459 | buf->level += inc; | 120 | 459 | } else { | 121 | 10 | buf->level = buf->used_size; | 122 | 10 | } | 123 | 469 | } |
Unexecuted instantiation: test_iodev.c:buf_increment_write Unexecuted instantiation: cras_stream_apm_noop.c:buf_increment_write Unexecuted instantiation: cras_sr_bt_adapters_stub.c:buf_increment_write Unexecuted instantiation: cras_sr_bt_util_stub.c:buf_increment_write Unexecuted instantiation: cras_sr_stub.c:buf_increment_write |
124 | | |
125 | 131 | static inline void buf_reset(struct byte_buffer* buf) { |
126 | 131 | buf->write_idx = 0; |
127 | 131 | buf->read_idx = 0; |
128 | 131 | buf->level = 0; |
129 | 131 | } Unexecuted instantiation: cras_a2dp_iodev.c:buf_reset Unexecuted instantiation: cras_fl_pcm_iodev.c:buf_reset Unexecuted instantiation: cras_hfp_ag_profile.c:buf_reset Unexecuted instantiation: cras_hfp_alsa_iodev.c:buf_reset Unexecuted instantiation: cras_hfp_iodev.c:buf_reset Unexecuted instantiation: cras_hfp_manager.c:buf_reset Unexecuted instantiation: cras_iodev.c:buf_reset cras_floop_iodev.c:buf_reset Line | Count | Source | 125 | 16 | static inline void buf_reset(struct byte_buffer* buf) { | 126 | 16 | buf->write_idx = 0; | 127 | 16 | buf->read_idx = 0; | 128 | 16 | buf->level = 0; | 129 | 16 | } |
Unexecuted instantiation: cras_lea_iodev.c:buf_reset cras_loopback_iodev.c:buf_reset Line | Count | Source | 125 | 115 | static inline void buf_reset(struct byte_buffer* buf) { | 126 | 115 | buf->write_idx = 0; | 127 | 115 | buf->read_idx = 0; | 128 | 115 | buf->level = 0; | 129 | 115 | } |
Unexecuted instantiation: cras_sco.c:buf_reset Unexecuted instantiation: dev_io.c:buf_reset Unexecuted instantiation: dev_stream.c:buf_reset Unexecuted instantiation: input_data.c:buf_reset Unexecuted instantiation: test_iodev.c:buf_reset Unexecuted instantiation: cras_stream_apm_noop.c:buf_reset Unexecuted instantiation: cras_sr_bt_adapters_stub.c:buf_reset Unexecuted instantiation: cras_sr_bt_util_stub.c:buf_reset Unexecuted instantiation: cras_sr_stub.c:buf_reset |
130 | | |
131 | | #ifdef __cplusplus |
132 | | } // extern "C" |
133 | | #endif |
134 | | |
135 | | #endif // CRAS_SRC_COMMON_BYTE_BUFFER_H_ |