From: Frank Mori Hess Date: Sat, 22 Jan 2005 14:31:20 +0000 (+0000) Subject: mark initial buffer contents as written, remove some unused variables, X-Git-Tag: v0_8_0~137 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8f06878f5d028b17133609fd076deac4085affce;p=comedilib.git mark initial buffer contents as written, remove some unused variables, fixed buffer overrun --- 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");