linux/sound/oss/dmasound/dmasound.h

263 lines
7.9 KiB
C
Raw Normal View History

License cleanup: add SPDX GPL-2.0 license identifier to files with no license Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _dmasound_h_
/*
* linux/sound/oss/dmasound/dmasound.h
*
*
* Minor numbers for the sound driver.
*
* Unfortunately Creative called the codec chip of SB as a DSP. For this
* reason the /dev/dsp is reserved for digitized audio use. There is a
* device for true DSP processors but it will be called something else.
* In v3.0 it's /dev/sndproc but this could be a temporary solution.
*/
#define _dmasound_h_
#include <linux/types.h>
#define SND_NDEVS 256 /* Number of supported devices */
#define SND_DEV_CTL 0 /* Control port /dev/mixer */
#define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM
synthesizer and MIDI output) */
#define SND_DEV_MIDIN 2 /* Raw midi access */
#define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */
#define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */
#define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */
#define SND_DEV_STATUS 6 /* /dev/sndstat */
/* #7 not in use now. Was in 2.4. Free for use after v3.0. */
#define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */
#define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */
#define SND_DEV_PSS SND_DEV_SNDPROC
/* switch on various prinks */
#define DEBUG_DMASOUND 1
#define MAX_AUDIO_DEV 5
#define MAX_MIXER_DEV 4
#define MAX_SYNTH_DEV 3
#define MAX_MIDI_DEV 6
#define MAX_TIMER_DEV 3
#define MAX_CATCH_RADIUS 10
#define le2be16(x) (((x)<<8 & 0xff00) | ((x)>>8 & 0x00ff))
#define le2be16dbl(x) (((x)<<8 & 0xff00ff00) | ((x)>>8 & 0x00ff00ff))
#define IOCTL_IN(arg, ret) \
do { int error = get_user(ret, (int __user *)(arg)); \
if (error) return error; \
} while (0)
#define IOCTL_OUT(arg, ret) ioctl_return((int __user *)(arg), ret)
static inline int ioctl_return(int __user *addr, int value)
{
return value < 0 ? value : put_user(value, addr);
}
/*
* Configuration
*/
#undef HAS_8BIT_TABLES
#if defined(CONFIG_DMASOUND_ATARI) || defined(CONFIG_DMASOUND_ATARI_MODULE) ||\
defined(CONFIG_DMASOUND_PAULA) || defined(CONFIG_DMASOUND_PAULA_MODULE) ||\
defined(CONFIG_DMASOUND_Q40) || defined(CONFIG_DMASOUND_Q40_MODULE)
#define HAS_8BIT_TABLES
#define MIN_BUFFERS 4
#define MIN_BUFSIZE (1<<12) /* in bytes (- where does this come from ?) */
#define MIN_FRAG_SIZE 8 /* not 100% sure about this */
#define MAX_BUFSIZE (1<<17) /* Limit for Amiga is 128 kb */
#define MAX_FRAG_SIZE 15 /* allow *4 for mono-8 => stereo-16 (for multi) */
#else /* is pmac and multi is off */
#define MIN_BUFFERS 2
#define MIN_BUFSIZE (1<<8) /* in bytes */
#define MIN_FRAG_SIZE 8
#define MAX_BUFSIZE (1<<18) /* this is somewhat arbitrary for pmac */
#define MAX_FRAG_SIZE 16 /* need to allow *4 for mono-8 => stereo-16 */
#endif
#define DEFAULT_N_BUFFERS 4
#define DEFAULT_BUFF_SIZE (1<<15)
/*
* Initialization
*/
extern int dmasound_init(void);
#ifdef MODULE
extern void dmasound_deinit(void);
#else
#define dmasound_deinit() do { } while (0)
#endif
/* description of the set-up applies to either hard or soft settings */
typedef struct {
int format; /* AFMT_* */
int stereo; /* 0 = mono, 1 = stereo */
int size; /* 8/16 bit*/
int speed; /* speed */
} SETTINGS;
/*
* Machine definitions
*/
typedef struct {
const char *name;
const char *name2;
struct module *owner;
void *(*dma_alloc)(unsigned int, gfp_t);
void (*dma_free)(void *, unsigned int);
int (*irqinit)(void);
#ifdef MODULE
void (*irqcleanup)(void);
#endif
void (*init)(void);
void (*silence)(void);
int (*setFormat)(int);
int (*setVolume)(int);
int (*setBass)(int);
int (*setTreble)(int);
int (*setGain)(int);
void (*play)(void);
void (*record)(void); /* optional */
void (*mixer_init)(void); /* optional */
int (*mixer_ioctl)(u_int, u_long); /* optional */
int (*write_sq_setup)(void); /* optional */
int (*read_sq_setup)(void); /* optional */
int (*sq_open)(fmode_t); /* optional */
int (*state_info)(char *, size_t); /* optional */
void (*abort_read)(void); /* optional */
int min_dsp_speed;
int max_dsp_speed;
int version ;
int hardware_afmts ; /* OSS says we only return h'ware info */
/* when queried via SNDCTL_DSP_GETFMTS */
int capabilities ; /* low-level reply to SNDCTL_DSP_GETCAPS */
SETTINGS default_hard ; /* open() or init() should set something valid */
SETTINGS default_soft ; /* you can make it look like old OSS, if you want to */
} MACHINE;
/*
* Low level stuff
*/
typedef struct {
ssize_t (*ct_ulaw)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_alaw)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_s8)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_u8)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_s16be)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_u16be)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_s16le)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
ssize_t (*ct_u16le)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
} TRANS;
struct sound_settings {
MACHINE mach; /* machine dependent things */
SETTINGS hard; /* hardware settings */
SETTINGS soft; /* software settings */
SETTINGS dsp; /* /dev/dsp default settings */
TRANS *trans_write; /* supported translations */
int volume_left; /* volume (range is machine dependent) */
int volume_right;
int bass; /* tone (range is machine dependent) */
int treble;
int gain;
int minDev; /* minor device number currently open */
spinlock_t lock;
};
extern struct sound_settings dmasound;
#ifdef HAS_8BIT_TABLES
extern char dmasound_ulaw2dma8[];
extern char dmasound_alaw2dma8[];
#endif
/*
* Mid level stuff
*/
static inline int dmasound_set_volume(int volume)
{
return dmasound.mach.setVolume(volume);
}
static inline int dmasound_set_bass(int bass)
{
return dmasound.mach.setBass ? dmasound.mach.setBass(bass) : 50;
}
static inline int dmasound_set_treble(int treble)
{
return dmasound.mach.setTreble ? dmasound.mach.setTreble(treble) : 50;
}
static inline int dmasound_set_gain(int gain)
{
return dmasound.mach.setGain ? dmasound.mach.setGain(gain) : 100;
}
/*
* Sound queue stuff, the heart of the driver
*/
struct sound_queue {
/* buffers allocated for this queue */
int numBufs; /* real limits on what the user can have */
int bufSize; /* in bytes */
char **buffers;
/* current parameters */
int locked ; /* params cannot be modified when != 0 */
int user_frags ; /* user requests this many */
int user_frag_size ; /* of this size */
int max_count; /* actual # fragments <= numBufs */
int block_size; /* internal block size in bytes */
int max_active; /* in-use fragments <= max_count */
/* it shouldn't be necessary to declare any of these volatile */
int front, rear, count;
int rear_size;
/*
* The use of the playing field depends on the hardware
*
* Atari, PMac: The number of frames that are loaded/playing
*
* Amiga: Bit 0 is set: a frame is loaded
* Bit 1 is set: a frame is playing
*/
int active;
wait_queue_head_t action_queue, open_queue, sync_queue;
int non_blocking;
int busy, syncing, xruns, died;
};
#define WAKE_UP(queue) (wake_up_interruptible(&queue))
extern struct sound_queue dmasound_write_sq;
#define write_sq dmasound_write_sq
extern int dmasound_catchRadius;
#define catchRadius dmasound_catchRadius
/* define the value to be put in the byte-swap reg in mac-io
when we want it to swap for us.
*/
#define BS_VAL 1
#define SW_INPUT_VOLUME_SCALE 4
#define SW_INPUT_VOLUME_DEFAULT (128 / SW_INPUT_VOLUME_SCALE)
extern int expand_read_bal; /* Balance factor for reading */
extern uint software_input_volume; /* software implemented recording volume! */
#endif /* _dmasound_h_ */