1/*- 2 * Copyright (c) 2003 Mathew Kanner 3 * Copyright (c) 1993 Hannu Savolainen 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * SUCH DAMAGE. 26 */ 27 28/* 29 * The sequencer personality manager. 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/dev/sound/midi/sequencer.c 194990 2009-06-25 18:46:30Z kib $"); |
34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/ioccom.h> 38 39#include <sys/filio.h> 40#include <sys/lock.h> 41#include <sys/sockio.h> --- 831 unchanged lines hidden (view full) --- 873 struct seq_softc *scp = i_dev->si_drv1; 874 875#define SEQ_RSIZE 32 876 u_char buf[SEQ_RSIZE]; 877 878 if (scp == NULL) 879 return ENXIO; 880 |
881 SEQ_DEBUG(7, printf("seq_read: unit %d, resid %zd.\n", |
882 scp->unit, uio->uio_resid)); 883 884 mtx_lock(&scp->seq_lock); 885 if ((scp->fflags & FREAD) == 0) { 886 SEQ_DEBUG(2, printf("seq_read: unit %d is not for reading.\n", 887 scp->unit)); 888 retval = EIO; 889 goto err1; --- 41 unchanged lines hidden (view full) --- 931 retval = uiomove(buf, used, uio); 932 if (retval) 933 goto err1; 934 } 935 936 retval = 0; 937err1: 938 mtx_unlock(&scp->seq_lock); |
939 SEQ_DEBUG(6, printf("seq_read: ret %d, resid %zd.\n", |
940 retval, uio->uio_resid)); 941 942 return retval; 943} 944 945int 946seq_write(struct cdev *i_dev, struct uio *uio, int ioflag) 947{ 948 u_char event[EV_SZ], newevent[EV_SZ], ev_code; 949 struct seq_softc *scp = i_dev->si_drv1; 950 int retval; 951 int used; 952 |
953 SEQ_DEBUG(7, printf("seq_write: unit %d, resid %zd.\n", |
954 scp->unit, uio->uio_resid)); 955 956 if (scp == NULL) 957 return ENXIO; 958 959 mtx_lock(&scp->seq_lock); 960 961 if ((scp->fflags & FWRITE) == 0) { --- 28 unchanged lines hidden (view full) --- 990 */ 991 if (scp != i_dev->si_drv1) 992 retval = ENXIO; 993#endif 994 } 995 996 used = MIN(uio->uio_resid, 4); 997 |
998 SEQ_DEBUG(8, printf("seqout: resid %zd len %jd avail %jd\n", |
999 uio->uio_resid, (intmax_t)MIDIQ_LEN(scp->out_q), 1000 (intmax_t)MIDIQ_AVAIL(scp->out_q))); 1001 1002 if (used != 4) { 1003 retval = ENXIO; 1004 goto err0; 1005 } 1006 retval = uiomove(event, used, uio); --- 103 unchanged lines hidden (view full) --- 1110 scp->playing = 1; 1111 cv_broadcast(&scp->state_cv); 1112 cv_broadcast(&scp->out_cv); 1113 1114 retval = 0; 1115 1116err0: 1117 SEQ_DEBUG(6, |
1118 printf("seq_write done: leftover buffer length %zd retval %d\n", |
1119 uio->uio_resid, retval)); 1120 mtx_unlock(&scp->seq_lock); 1121 return retval; 1122} 1123 1124int 1125seq_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, 1126 struct thread *td) --- 978 unchanged lines hidden --- |