Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


sb16_csp.h
001: #ifndef __SOUND_SB16_CSP_H
002: #define __SOUND_SB16_CSP_H
003: 
004: /*
005:  *  Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
006:  *                        Takashi Iwai <tiwai@suse.de>
007:  *
008:  *  SB16ASP/AWE32 CSP control
009:  *
010:  *   This program is free software; you can redistribute it and/or modify 
011:  *   it under the terms of the GNU General Public License as published by
012:  *   the Free Software Foundation; either version 2 of the License, or
013:  *   (at your option) any later version.
014:  *
015:  *   This program is distributed in the hope that it will be useful,
016:  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
017:  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
018:  *   GNU General Public License for more details.
019:  *
020:  *   You should have received a copy of the GNU General Public License
021:  *   along with this program; if not, write to the Free Software
022:  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
023:  *
024:  */
025: 
026: /* CSP modes */
027: #define SNDRV_SB_CSP_MODE_NONE          0x00
028: #define SNDRV_SB_CSP_MODE_DSP_READ      0x01    /* Record from DSP */
029: #define SNDRV_SB_CSP_MODE_DSP_WRITE     0x02    /* Play to DSP */
030: #define SNDRV_SB_CSP_MODE_QSOUND                0x04    /* QSound */
031: 
032: /* CSP load flags */
033: #define SNDRV_SB_CSP_LOAD_FROMUSER      0x01
034: #define SNDRV_SB_CSP_LOAD_INITBLOCK     0x02
035: 
036: /* CSP sample width */
037: #define SNDRV_SB_CSP_SAMPLE_8BIT                0x01
038: #define SNDRV_SB_CSP_SAMPLE_16BIT               0x02
039: 
040: /* CSP channels */
041: #define SNDRV_SB_CSP_MONO                       0x01
042: #define SNDRV_SB_CSP_STEREO             0x02
043: 
044: /* CSP rates */
045: #define SNDRV_SB_CSP_RATE_8000          0x01
046: #define SNDRV_SB_CSP_RATE_11025         0x02
047: #define SNDRV_SB_CSP_RATE_22050         0x04
048: #define SNDRV_SB_CSP_RATE_44100         0x08
049: #define SNDRV_SB_CSP_RATE_ALL           0x0f
050: 
051: /* CSP running state */
052: #define SNDRV_SB_CSP_ST_IDLE            0x00
053: #define SNDRV_SB_CSP_ST_LOADED          0x01
054: #define SNDRV_SB_CSP_ST_RUNNING         0x02
055: #define SNDRV_SB_CSP_ST_PAUSED          0x04
056: #define SNDRV_SB_CSP_ST_AUTO            0x08
057: #define SNDRV_SB_CSP_ST_QSOUND          0x10
058: 
059: /* maximum QSound value (180 degrees right) */
060: #define SNDRV_SB_CSP_QSOUND_MAX_RIGHT   0x20
061: 
062: /* maximum microcode RIFF file size */
063: #define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE    0x3000
064: 
065: /* microcode header */
066: struct snd_sb_csp_mc_header {
067:         char codec_name[16];            /* id name of codec */
068:         unsigned short func_req;        /* requested function */
069: };
070: 
071: /* microcode to be loaded */
072: struct snd_sb_csp_microcode {
073:         struct snd_sb_csp_mc_header info;
074:         unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
075: };
076: 
077: /* start CSP with sample_width in mono/stereo */
078: struct snd_sb_csp_start {
079:         int sample_width;       /* sample width, look above */
080:         int channels;           /* channels, look above */
081: };
082: 
083: /* CSP information */
084: struct snd_sb_csp_info {
085:         char codec_name[16];            /* id name of codec */
086:         unsigned short func_nr;         /* function number */
087:         unsigned int acc_format;        /* accepted PCM formats */
088:         unsigned short acc_channels;    /* accepted channels */
089:         unsigned short acc_width;       /* accepted sample width */
090:         unsigned short acc_rates;       /* accepted sample rates */
091:         unsigned short csp_mode;        /* CSP mode, see above */
092:         unsigned short run_channels;    /* current channels  */
093:         unsigned short run_width;       /* current sample width */
094:         unsigned short version;         /* version id: 0x10 - 0x1f */
095:         unsigned short state;           /* state bits */
096: };
097: 
098: /* HWDEP controls */
099: /* get CSP information */
100: #define SNDRV_SB_CSP_IOCTL_INFO         _IOR('H', 0x10, struct snd_sb_csp_info)
101: /* load microcode to CSP */
102: /* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits)
103:  * defined for some architectures like MIPS, and it leads to build errors.
104:  * (x86 and co have 14-bit size, thus it's valid, though.)
105:  * As a workaround for skipping the size-limit check, here we don't use the
106:  * normal _IOW() macro but _IOC() with the manual argument.
107:  */
108: #define SNDRV_SB_CSP_IOCTL_LOAD_CODE    \
109:         _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode))
110: /* unload microcode from CSP */
111: #define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE  _IO('H', 0x12)
112: /* start CSP */
113: #define SNDRV_SB_CSP_IOCTL_START                _IOW('H', 0x13, struct snd_sb_csp_start)
114: /* stop CSP */
115: #define SNDRV_SB_CSP_IOCTL_STOP         _IO('H', 0x14)
116: /* pause CSP and DMA transfer */
117: #define SNDRV_SB_CSP_IOCTL_PAUSE                _IO('H', 0x15)
118: /* restart CSP and DMA transfer */
119: #define SNDRV_SB_CSP_IOCTL_RESTART      _IO('H', 0x16)
120: 
121: 
122: #endif /* __SOUND_SB16_CSP */
123: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/