### patch number: 23 ### area: Aaxp server. ### severity: med. ### comments: patch using command "(cd ; patch -p < thisfile)" ### Fixes input selection and disables sidetone. *** ./patchlevel.h Wed Mar 3 16:02:55 1993 --- /crl/audio/./patchlevel.h Fri Mar 5 11:30:15 1993 *************** *** 1 **** ! #define PATCHLEVEL 22 --- 1 ---- ! #define PATCHLEVEL 23 *** ./AF/server/dda/axp/max_io.c Tue Apr 20 14:36:12 1993 --- /crl/audio/./AF/server/dda/axp/max_io.c Thu Apr 29 09:55:47 1993 *************** *** 38,44 **** * SOFTWARE. */ #if !defined(lint) && !defined(SABER) ! static char lofiio_c_rcsid[]="$Header: /crl/audio/AF/server/dda/axp/RCS/max_io.c,v 1.5 1993/04/20 17:15:14 tml Exp $"; #endif /* !lint && !SABER */ /* Revision History --- 38,44 ---- * SOFTWARE. */ #if !defined(lint) && !defined(SABER) ! static char lofiio_c_rcsid[]="$Header: /crl/audio/AF/server/dda/axp/RCS/max_io.c,v 1.6 1993/04/29 13:55:31 tml Exp $"; #endif /* !lint && !SABER */ /* Revision History *************** *** 146,151 **** --- 146,153 ---- if (axpIoctl (pDev->fd, ISDNIOC_SPEAKER_OUTPUT, &data [0], sizeof (int)*2) < 0) { FatalError("dda can't enable speaker output on %s, errno message \" %d \"\n", devName, errno); } + axp_disable_stg(pDev->fd); + /* sleep(5); give circuit time for setup */ #endif __alpha #else SUN *** ./AF/server/dda/axp/pscodec.c Tue Apr 20 14:36:12 1993 --- /crl/audio/./AF/server/dda/axp/pscodec.c Thu Apr 29 09:55:48 1993 *************** *** 38,44 **** * SOFTWARE. */ #if !defined(lint) && !defined(SABER) ! static char pscodec_c_rcsid[] = "$Header: /crl/audio/AF/server/dda/axp/RCS/pscodec.c,v 1.11 1993/04/20 17:15:14 tml Exp $"; #endif /* !lint && !SABER */ /* Revision History --- 38,44 ---- * SOFTWARE. */ #if !defined(lint) && !defined(SABER) ! static char pscodec_c_rcsid[] = "$Header: /crl/audio/AF/server/dda/axp/RCS/pscodec.c,v 1.12 1993/04/29 13:55:31 tml Exp $"; #endif /* !lint && !SABER */ /* Revision History *************** *** 298,304 **** cPtr->ftg[1] = 0; /* XXX */ cPtr->Mute = 0; /* XXX */ - return TRUE; } --- 298,303 ---- *************** *** 314,320 **** --- 313,323 ---- return FALSE; aDev->numberOfInputs = 2; + #if 1 + aDev->numberOfOutputs = 1; + #else aDev->numberOfOutputs = 2; + #endif aDev->inputsFromPhone = 0x0000; /* Input 0. */ aDev->outputsToPhone = 0x0000; /* Input 0. */ *************** *** 468,494 **** int nmask, *omaskp, *amaskp; { maxPhysDevice *pDev=(maxPhysDevice *)aDev->devPtr; - CodecPrivate *cPtr= (CodecPrivate *) aDev->privPtr; ! if(onoff) { ! /* ! * 0 is speaker, 1 is handset ! */ ! #ifdef SUN ! ioctl(sunctl, AUDIO_GETINFO, &sun_gapo); ! *omaskp = sun_gapo.play.port; ! if(nmask == 1) { ! sun_gapo.play.port = AUDIO_SPEAKER; ! } else { ! sun_gapo.play.port = AUDIO_HEADPHONE; ! } ! ioctl(sunctl, AUDIO_SETINFO, &sun_gapo); ! *amaskp = sun_gapo.play.port; #else ! if(omaskp) *omaskp = 3; ! if(amaskp) *amaskp = 3; ! #endif SUN ! } } void --- 471,487 ---- int nmask, *omaskp, *amaskp; { maxPhysDevice *pDev=(maxPhysDevice *)aDev->devPtr; ! #if 1 ! if(omaskp) *omaskp = 1; ! if(amaskp) *amaskp = 1; #else ! if(omaskp) *omaskp = axp_get_output(pDev->fd) ! & TOMASK(aDev->numberOfOutputs); ! axp_set_output(pDev->fd, onoff, nmask&OUTMASK); ! if(amaskp) *amaskp = axp_get_output(pDev->fd) ! & TOMASK(aDev->numberOfOutputs); ! #endif } void *************** *** 498,516 **** int nmask, *omaskp, *amaskp; { maxPhysDevice *pDev=(maxPhysDevice *)aDev->devPtr; - CodecPrivate *cPtr= (CodecPrivate *) aDev->privPtr; - #if 0 - /* Only 1 input - sorry */ - if(omaskp) *omaskp = 1; - if(amaskp) *amaskp = 1; - #else *omaskp = axp_get_input(pDev->fd) & TOMASK(aDev->numberOfInputs); axp_set_input(pDev->fd, onoff, nmask&INMASK); *amaskp = axp_get_input(pDev->fd) & TOMASK(aDev->numberOfInputs); - #endif } #ifdef __alpha --- 491,502 ---- *************** *** 530,536 **** int sgain; maxPhysDevice *pDev=(maxPhysDevice *)aDev->devPtr; ! CodecPrivate *cPtr= (CodecPrivate *) aDev->privPtr; #ifdef SUN ioctl(sunctl, AUDIO_GETINFO, &sun_gapo); sgain = ((sun_gapo.play.gain*31)/255)-10; --- 516,522 ---- int sgain; maxPhysDevice *pDev=(maxPhysDevice *)aDev->devPtr; ! #ifdef SUN ioctl(sunctl, AUDIO_GETINFO, &sun_gapo); sgain = ((sun_gapo.play.gain*31)/255)-10; *************** *** 554,560 **** int sgain; maxPhysDevice *pDev=(maxPhysDevice *)aDev->devPtr; - CodecPrivate *cPtr= (CodecPrivate *) aDev->privPtr; #ifdef SUN sgain = ((gdB+10)*255)/31; --- 540,545 ---- *************** *** 590,596 **** int sgain; maxPhysDevice *pDev=(maxPhysDevice *)aDev->devPtr; - CodecPrivate *cPtr= (CodecPrivate *) aDev->privPtr; #ifdef SUN ioctl(sunctl, AUDIO_GETINFO, &sun_gapo); --- 575,580 ---- *************** *** 613,619 **** int sgain; maxPhysDevice *pDev=(maxPhysDevice *)aDev->devPtr; - CodecPrivate *cPtr= (CodecPrivate *) aDev->privPtr; #ifdef SUN sgain = ((gdB)*255)/24; --- 597,602 ---- *** ./AF/server/dda/axp/axp_ioctl.c Tue Apr 20 14:36:12 1993 --- /crl/audio/./AF/server/dda/axp/axp_ioctl.c Thu Apr 29 09:55:46 1993 *************** *** 38,44 **** * SOFTWARE. */ #if !defined(lint) && !defined(SABER) ! static char pscodec_c_rcsid[] = "$Header: /crl/audio/AF/server/dda/axp/RCS/axp_ioctl.c,v 1.1 1993/04/20 17:15:14 tml Exp $"; #endif /* !lint && !SABER */ #include --- 38,44 ---- * SOFTWARE. */ #if !defined(lint) && !defined(SABER) ! static char pscodec_c_rcsid[] = "$Header: /crl/audio/AF/server/dda/axp/RCS/axp_ioctl.c,v 1.2 1993/04/29 13:55:31 tml Exp $"; #endif /* !lint && !SABER */ #include *************** *** 74,79 **** --- 74,80 ---- return ioctl (fd, I_STR, &ioc); } + codec_read(int fd, int creg, unsigned char *data, int num) { int i; *************** *** 116,121 **** --- 117,131 ---- } } + axp_disable_stg(int fd) + { + unsigned char data[2]; + + data[0] = 0x08; + data[1] = 0x90; + codec_write(fd, MAP_STG, data, 2); + } + axp_get_input(int fd) { unsigned char d0,mute; *************** *** 172,176 **** --- 182,250 ---- else d0 |= ((mask&0x1)!=0 ? MAP_MMR2_BITS_AINB : 0); data[0] = d0; codec_write(fd, MAP_MMR2, data, 1); + } + + axp_get_output(int fd) + { + unsigned char data[2]; + int mask=0; + + codec_read(fd, MAP_MMR3, data, 1); + mask |= ((data[0]&MAP_MMR3_BITS_BOTH) != 0 ? 0x03 : 0); + codec_read(fd, MAP_MMR2, data, 1); + mask |= ((data[0]&MAP_MMR2_BITS_LS) != 0 ? 0x02 : 0x01); + + return mask; + } + + axp_set_output(int fd, int enable, int rmask) + { + unsigned char data[2]; + int mask; + + if (rmask == 0) return; + + mask=axp_get_output(fd); + if (enable==TRUE){ + if (mask == rmask) + return; + mask |= rmask; /* Leave old on and turn on requested. */ + if(mask == 0x3){ + codec_read(fd, MAP_MMR3, data, 1); + data[0] &= ~(MAP_MMR3_BITS_BOTH); + data[0] |= MAP_MMR3_BITS_BOTH; + codec_write(fd, MAP_MMR3, data, 1); + } + else + { /* speaker or ear */ + codec_read(fd, MAP_MMR2, data, 1); + data[0] &= ~(MAP_MMR2_BITS_LS); + data[0] |= (mask == 0x2 ? MAP_MMR2_BITS_LS : 0); + codec_write(fd, MAP_MMR2, data, 1); + codec_read(fd, MAP_MMR3, data, 1); + data[0] &= ~(MAP_MMR3_BITS_BOTH); + codec_write(fd, MAP_MMR3, data, 1); + } + }else{ + mask &= rmask; /* Turn off requested. */ + if (mask == 0) + return; + /* When disabling outputs on CODEC, 1 must remain enabled. */ + if(mask == 0x3){ + codec_read(fd, MAP_MMR3, data, 1); + data[0] &= ~(MAP_MMR3_BITS_BOTH); + codec_write(fd, MAP_MMR3, data, 1); + } + else + { /* speaker or ear */ + codec_read(fd, MAP_MMR2, data, 1); + data[0] &= ~(MAP_MMR2_BITS_LS); + data[0] |= (mask == 0x2 ? 0 : MAP_MMR2_BITS_LS); + codec_write(fd, MAP_MMR2, data, 1); + codec_read(fd, MAP_MMR3, data, 1); + data[0] &= ~(MAP_MMR3_BITS_BOTH); + codec_write(fd, MAP_MMR3, data, 1); + } + } }