Lines Matching refs:f

125 void msnd_fifo_init(msnd_fifo *f)  in msnd_fifo_init()  argument
127 f->data = NULL; in msnd_fifo_init()
130 void msnd_fifo_free(msnd_fifo *f) in msnd_fifo_free() argument
132 if (f->data) { in msnd_fifo_free()
133 vfree(f->data); in msnd_fifo_free()
134 f->data = NULL; in msnd_fifo_free()
138 int msnd_fifo_alloc(msnd_fifo *f, size_t n) in msnd_fifo_alloc() argument
140 msnd_fifo_free(f); in msnd_fifo_alloc()
141 f->data = (char *)vmalloc(n); in msnd_fifo_alloc()
142 f->n = n; in msnd_fifo_alloc()
143 f->tail = 0; in msnd_fifo_alloc()
144 f->head = 0; in msnd_fifo_alloc()
145 f->len = 0; in msnd_fifo_alloc()
147 if (!f->data) in msnd_fifo_alloc()
153 void msnd_fifo_make_empty(msnd_fifo *f) in msnd_fifo_make_empty() argument
155 f->len = f->tail = f->head = 0; in msnd_fifo_make_empty()
158 int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len) in msnd_fifo_write() argument
162 while ((count < len) && (f->len != f->n)) { in msnd_fifo_write()
166 if (f->head <= f->tail) { in msnd_fifo_write()
168 if (nwritten > f->n - f->tail) in msnd_fifo_write()
169 nwritten = f->n - f->tail; in msnd_fifo_write()
172 nwritten = f->head - f->tail; in msnd_fifo_write()
177 isa_memcpy_fromio(f->data + f->tail, (unsigned long) buf, nwritten); in msnd_fifo_write()
181 f->len += nwritten; in msnd_fifo_write()
182 f->tail += nwritten; in msnd_fifo_write()
183 f->tail %= f->n; in msnd_fifo_write()
189 int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len) in msnd_fifo_read() argument
193 while ((count < len) && (f->len > 0)) { in msnd_fifo_read()
197 if (f->tail <= f->head) { in msnd_fifo_read()
199 if (nread > f->n - f->head) in msnd_fifo_read()
200 nread = f->n - f->head; in msnd_fifo_read()
203 nread = f->tail - f->head; in msnd_fifo_read()
208 isa_memcpy_toio((unsigned long) buf, f->data + f->head, nread); in msnd_fifo_read()
212 f->len -= nread; in msnd_fifo_read()
213 f->head += nread; in msnd_fifo_read()
214 f->head %= f->n; in msnd_fifo_read()