Changeset 679 for GPL/trunk/lib32/sound.c
- Timestamp:
- Mar 18, 2021, 8:57:36 PM (4 years ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-linux-3.2.102 (added) merged: 611-614 /GPL/branches/uniaud32-next (added) merged: 615-678
- Property svn:mergeinfo changed
-
GPL/trunk/lib32/sound.c
r605 r679 37 37 #include <stdlib.h> 38 38 #include <proto.h> 39 //#include <dbgos2.h>39 #include <u32ioctl.h> 40 40 #include "soundoss.h" 41 41 … … 44 44 #define samples_to_bytes(a) ((a*pHandle->doublesamplesize)/2) 45 45 #define bytes_to_samples(a) (pHandle->doublesamplesize ? ((a*2)/pHandle->doublesamplesize) : a) 46 int GetMaxChannels(ULONG deviceid, int type);47 46 48 47 struct file_operations oss_devices[OSS32_MAX_DEVICES] = {0}; 49 struct file_operations *alsa_fops = NULL;48 const struct file_operations *alsa_fops = NULL; 50 49 int per_bytes = 0; 51 50 int prev_size = 0; … … 80 79 //****************************************************************************** 81 80 //****************************************************************************** 82 int register_chrdev(unsigned int version, const char *name, struct file_operations *fsop)81 int register_chrdev(unsigned int version, const char *name, const struct file_operations *fsop) 83 82 { 84 83 if(!strcmp(name, "alsa")) { … … 369 368 pHandle->file.f_flags = O_NONBLOCK; 370 369 371 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_INFO, (ULONG)pcminfo);370 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_INFO, (ULONG)pcminfo); 372 371 if(ret != 0) { 373 372 rprintf(("OSS32_QueryDevCaps: SNDRV_PCM_IOCTL_INFO error %i\n", ret)); … … 386 385 //get all hardware parameters 387 386 _snd_pcm_hw_params_any(params); 388 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)params);387 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)params); 389 388 if(ret != 0) { 390 389 rprintf(("OSS32_QueryDevCaps: SNDRV_PCM_IOCTL_HW_REFINE error %i\n", ret)); … … 539 538 540 539 ret = alsa_fops->open(&pHandle->inode, &pHandle->file); 540 541 541 //dprintf(("OSS32_WaveOpen. ret: %i\n", ret)); 542 542 /* check if PCM already opened (stupid uniaud16.sys doesnt closes it) */ … … 627 627 { 628 628 /* prepare for reuse */ 629 pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_RESET, 0);630 pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);629 pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_RESET, 0); 630 pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 631 631 } 632 632 break; … … 668 668 pHandle->file.f_flags = O_NONBLOCK; 669 669 670 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);670 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 671 671 if (ret) 672 672 rprintf(("Wave prepare ret = %i, streamid %X\n",ret,(ULONG)pHandle)); … … 687 687 //set operation to non-blocking 688 688 pHandle->file.f_flags = O_NONBLOCK; 689 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_START, 0);689 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_START, 0); 690 690 if (ret) 691 691 rprintf(("Wave start ret = %i, streamid %X\n",ret,(ULONG)pHandle)); … … 707 707 pHandle->file.f_flags = O_NONBLOCK; 708 708 709 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_DROP, 0);709 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_DROP, 0); 710 710 if (ret) 711 711 rprintf(("Wave stop ret = %i. streamid %X\n",ret,(ULONG)pHandle)); … … 727 727 pHandle->file.f_flags = O_NONBLOCK; 728 728 729 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PAUSE, 0);729 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PAUSE, 0); 730 730 if (ret) 731 731 rprintf(("Wave pause ret = %i, streamid %X\n",ret,(ULONG)pHandle)); … … 747 747 pHandle->file.f_flags = O_NONBLOCK; 748 748 749 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PAUSE, 1);749 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PAUSE, 1); 750 750 if (ret) 751 751 rprintf(("Wave resume ret = %i, streamid %X\n",ret,(ULONG)pHandle)); … … 815 815 _snd_pcm_hw_param_set(¶ms, SNDRV_PCM_HW_PARAM_CHANNELS, 816 816 pHwParams->ulNumChannels, 0); 817 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)__Stack32ToFlat(¶ms));817 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)¶ms); 818 818 if (ret == 0) break; 819 819 pHwParams->ulNumChannels--; … … 828 828 _snd_pcm_hw_param_set(¶ms, SNDRV_PCM_HW_PARAM_FORMAT, 829 829 OSSToALSADataType[pHwParams->ulDataType], 0); 830 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)__Stack32ToFlat(¶ms));830 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)¶ms); 831 831 if(ret != 0) { 832 832 rprintf(("invalid format %lx\n", OSSToALSADataType[pHwParams->ulDataType])); … … 835 835 _snd_pcm_hw_param_set(¶ms, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 836 836 pHwParams->ulBitsPerSample, 0); 837 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)__Stack32ToFlat(¶ms));837 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)¶ms); 838 838 if(ret != 0) { 839 839 rprintf(("invalid number of sample bits %d\n", pHwParams->ulBitsPerSample)); … … 842 842 _snd_pcm_hw_param_set(¶ms, SNDRV_PCM_HW_PARAM_FRAME_BITS, 843 843 pHwParams->ulBitsPerSample*pHwParams->ulNumChannels, 0); 844 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)__Stack32ToFlat(¶ms));844 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)¶ms); 845 845 if(ret != 0) { 846 846 rprintf(("invalid number of frame bits %d\n", pHwParams->ulBitsPerSample*pHwParams->ulNumChannels)); … … 859 859 _snd_pcm_hw_param_set(¶ms, SNDRV_PCM_HW_PARAM_RATE, 860 860 pHwParams->ulSampleRate, 0); 861 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)__Stack32ToFlat(¶ms));861 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)¶ms); 862 862 if(ret != 0) { 863 863 rprintf(("32_WSetHwPms (first pass) error %d bps:%d fmt: %d ch: %d sr: %d\n", … … 878 878 _snd_pcm_hw_param_set(¶ms, SNDRV_PCM_HW_PARAM_RATE, 879 879 pHwParams->ulSampleRate, 0); 880 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)__Stack32ToFlat(¶ms));880 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)¶ms); 881 881 if(ret == 0) 882 882 { … … 892 892 _snd_pcm_hw_param_set(¶ms, SNDRV_PCM_HW_PARAM_RATE, 893 893 pHwParams->ulSampleRate, 0); 894 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)__Stack32ToFlat(¶ms));894 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_REFINE, (ULONG)¶ms); 895 895 goto __next; 896 896 } … … 1000 1000 pHwParams->ulSampleRate, pHwParams->ulBitsPerSample, pHwParams->ulNumChannels, periodsize, nrperiods)); 1001 1001 1002 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_HW_PARAMS, (ULONG)__Stack32ToFlat(¶ms));1002 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_HW_PARAMS, (ULONG)¶ms); 1003 1003 if (ret == -77 && fTryAgain == FALSE) 1004 1004 { 1005 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);1005 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 1006 1006 fTryAgain = TRUE; 1007 1007 rprintf((" Error -77 from first IOCTL HW Parms")); … … 1045 1045 swparams.xfer_align = periodsize; 1046 1046 1047 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_SW_PARAMS, (ULONG)__Stack32ToFlat(&swparams));1047 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_SW_PARAMS, (ULONG)&swparams); 1048 1048 } 1049 1049 1050 1050 total = 0; 1051 1051 per_bytes = periodbytes; 1052 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1052 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1053 1053 if ( ((status.state != SNDRV_PCM_STATE_PREPARED) && 1054 1054 (status.state != SNDRV_PCM_STATE_SETUP) && … … 1056 1056 (status.state != SNDRV_PCM_STATE_DRAINING))) { 1057 1057 rprintf(("Device is not in proper state: %lx. Calling prepare\n", status.state)); 1058 ret = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);1058 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 1059 1059 } 1060 1060 return UNIXToOSSError(ret); … … 1094 1094 1095 1095 /* get the status of the circular dma buffer */ 1096 iRet = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1096 iRet = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1097 1097 1098 1098 if(iRet) { … … 1126 1126 if (status.state == SNDRV_PCM_STATE_XRUN) { 1127 1127 rprintf(("Internal Error: Xrun")); 1128 iRet = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);1128 iRet = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 1129 1129 if (iRet < 0) { 1130 1130 rprintf(("Prepare failed: state=%x avail=%x ReqSize=%x", status.state, status.avail, ulReqSize)); 1131 1131 return UNIXToOSSError(iRet); 1132 1132 } 1133 iRet = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1133 iRet = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1134 1134 rprintf(("Xrun restarted: state=%x avail=%x ReqSize=%x", status.state, status.avail, ulReqSize)); 1135 1135 if (iRet < 0) return UNIXToOSSError(iRet); … … 1165 1165 while (ulSize && ulJ && iRet) { 1166 1166 for (ulI=0; ulI < 1000; ulI++) { 1167 iRet1 = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1167 iRet1 = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1168 1168 // If here any state and have free buffer to any byte 1169 1169 if ((status.state != SNDRV_PCM_STATE_XRUN ) && samples_to_bytes(status.avail) ) break; … … 1173 1173 if (ulI > 998) { 1174 1174 rprintf(("timeout state=%x avail=%d hw=%d app=%d",status.state,samples_to_bytes(status.avail),samples_to_bytes(status.hw_ptr), samples_to_bytes(status.appl_ptr))); 1175 iRet1 = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);1175 iRet1 = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 1176 1176 } 1177 1177 } … … 1190 1190 if ( iRet != -11 ) { 1191 1191 rprintf(("Doing prepare")); 1192 iRet1 = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);1192 iRet1 = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 1193 1193 } 1194 1194 continue; … … 1231 1231 // { 1232 1232 // printk("warning: ulTransferred [%d] less than requested [%d]", *pulTransferred, ulSize); 1233 // iRet1 = pHandle->file.f_op-> ioctl(&pHandle->inode,&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0);1233 // iRet1 = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_PREPARE, 0); 1234 1234 // } 1235 1235 … … 1257 1257 1258 1258 //Get the status of the stream 1259 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1259 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1260 1260 1261 1261 if(ret) { … … 1289 1289 1290 1290 //Get the nr of bytes left in the audio buffer 1291 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1291 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1292 1292 1293 1293 if(ret) { … … 1321 1321 1322 1322 //Get the status of the stream 1323 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1323 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1324 1324 1325 1325 if(ret) { … … 1352 1352 1353 1353 //Get the status of the stream 1354 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)__Stack32ToFlat(&status));1354 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_STATUS, (ULONG)&status); 1355 1355 if(ret) return UNIXToOSSError(ret); 1356 1356 *pStatus = status.state; … … 1384 1384 1385 1385 dprintf(("OSS32_WaveSetVolume %x to (%d,%d)", streamid, leftvol, rightvol)); 1386 ret = pHandle->file.f_op-> ioctl(&pHandle->inode, &pHandle->file, SNDRV_PCM_IOCTL_SETVOLUME, (ULONG)__Stack32ToFlat(&pcm_volume));1386 ret = pHandle->file.f_op->unlocked_ioctl(&pHandle->file, SNDRV_PCM_IOCTL_SETVOLUME, (ULONG)&pcm_volume); 1387 1387 return UNIXToOSSError(ret); 1388 1388 }
Note:
See TracChangeset
for help on using the changeset viewer.