From 8f06878f5d028b17133609fd076deac4085affce Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Sat, 22 Jan 2005 14:31:20 +0000 Subject: [PATCH] mark initial buffer contents as written, remove some unused variables, fixed buffer overrun --- demo/ao_mmap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/demo/ao_mmap.c b/demo/ao_mmap.c index 82493e0..1646c76 100644 --- a/demo/ao_mmap.c +++ b/demo/ao_mmap.c @@ -70,8 +70,6 @@ int main(int argc, char *argv[]) { comedi_cmd cmd; int err; - int n,m; - int total=0; comedi_t *dev; unsigned int chanlist[16]; unsigned int maxdata; @@ -150,12 +148,17 @@ int main(int argc, char *argv[]) perror("mmap"); exit(1); } - write_waveform(map, size, amplitude, offset, maxdata); + write_waveform(map, size / sizeof(sampl_t), amplitude, offset, maxdata); if(msync(map, size, MS_SYNC) < 0) { perror("msync"); exit(1); } + if(comedi_mark_buffer_written(dev, subdevice, size) < 0) + { + comedi_perror("comedi_mark_buffer_written"); + exit(1); + } ret = comedi_internal_trigger(dev, subdevice, 0); if(ret<0){ comedi_perror("comedi_internal_trigger\n"); -- 2.26.2