summaryrefslogtreecommitdiff
path: root/kernel/framework/osscore
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-05-03 21:08:42 +0400
committerIgor Pashev <pashev.igor@gmail.com>2013-05-03 21:08:42 +0400
commit1058def8e7827e56ce4a70afb4aeacb5dc44148f (patch)
tree4495d23e7b54ab5700e3839081e797c1eafe0db9 /kernel/framework/osscore
downloadoss4-upstream.tar.gz
Imported Upstream version 4.2-build2006upstream/4.2-build2006upstream
Diffstat (limited to 'kernel/framework/osscore')
-rw-r--r--kernel/framework/osscore/.config1
-rw-r--r--kernel/framework/osscore/oss_core_options.c73
-rw-r--r--kernel/framework/osscore/oss_core_services.c84
-rw-r--r--kernel/framework/osscore/oss_memblk.c100
4 files changed, 258 insertions, 0 deletions
diff --git a/kernel/framework/osscore/.config b/kernel/framework/osscore/.config
new file mode 100644
index 0000000..c10d582
--- /dev/null
+++ b/kernel/framework/osscore/.config
@@ -0,0 +1 @@
+bus=VIRTUAL
diff --git a/kernel/framework/osscore/oss_core_options.c b/kernel/framework/osscore/oss_core_options.c
new file mode 100644
index 0000000..9cbce31
--- /dev/null
+++ b/kernel/framework/osscore/oss_core_options.c
@@ -0,0 +1,73 @@
+/*
+ * Purpose: Configuration options for OSS (osscore.conf)
+ *
+ * Description:
+ * This file contains various configuration options for the osscore module.
+ * They can be set in the osscore.conf configuration file.
+ *
+ * Each option variable must also be defined as extern in the proper header
+ * file (of the subsystem that uses them) or in the source file that uses them.
+ */
+/*
+ *
+ * This file is part of Open Sound System.
+ *
+ * Copyright (C) 4Front Technologies 1996-2008.
+ *
+ * This this source file is released under GPL v2 license (no other versions).
+ * See the COPYING file included in the main directory of this source
+ * distribution for the license terms and conditions.
+ *
+ */
+
+#include <oss_config.h>
+
+#ifndef NO_GLOBAL_OPTIONS
+/***********************************************************************************
+ ***********************************************************************************
+ ***********************************************************************************
+ ***********************************************************************************
+ * Core settings
+ *
+ * Remember to update kernel/drv/osscore/.params when adding, removing or
+ * changing the following options. The .params file is used when generating the
+ * driver.conf files. Also don't forget to update osscore.man.
+ *
+ * For Linux it's also necessary to add a module_param() line to Linux/osscore.c
+ * For FreeBSD it's also necessary to add a TUNABLE_INT() line to FreeBSD/osscore.c
+ ***********************************************************************************
+ ***********************************************************************************
+ ***********************************************************************************
+ ***********************************************************************************/
+
+int max_intrate = 100; /* 10 msec minimum interrupt interval */
+int src_quality = 3; /* Sample rate conversion quality (0-5) */
+int ac97_amplifier = -1; /* External amplifier enable for AC97 */
+int ac97_recselect = 0; /* Enables independent L/R ch rec source selection */
+int cooked_enable = 1;
+int dma_buffsize = 0; /* Size of the DMA buffer in kbytes (0=use default) */
+int flat_device_model = 0; /* 0=new audio device model, 1=old model */
+int detect_trace = 0; /* Se to 1 if detection tracing is required */
+int vmix_disabled = 0; /* 1=disable virtual mixer, 0=enable */
+int vmix_loopdevs = 0; /* Number of vmix loopback devices for all instances (0 to 2) */
+int vmix_no_autoattach = 0; /* Do not attach vmix devices during boot */
+int excl_policy = 0; /* Allow O_EXCL to occupy soundcard */
+int mixer_muted = 0; /* Set all mixer controls to a low level when OSS modules are loaded */
+
+oss_option_map_t oss_global_options[] = {
+ {"max_intrate", &max_intrate},
+ {"detect_trace", &detect_trace},
+ {"src_quality", &src_quality},
+ {"ac97_amplifier", &ac97_amplifier},
+ {"ac97_recselect", &ac97_recselect},
+ {"cooked_enable", &cooked_enable},
+ {"dma_buffsize", &dma_buffsize},
+ {"flat_device_model", &flat_device_model},
+ {"vmix_disabled", &vmix_disabled},
+ {"vmix_loopdevs", &vmix_loopdevs},
+ {"vmix_no_autoattach", &vmix_no_autoattach},
+ {"excl_policy", &excl_policy},
+ {"mixer_muted", &mixer_muted},
+ {NULL, NULL}
+};
+#endif
diff --git a/kernel/framework/osscore/oss_core_services.c b/kernel/framework/osscore/oss_core_services.c
new file mode 100644
index 0000000..f049b57
--- /dev/null
+++ b/kernel/framework/osscore/oss_core_services.c
@@ -0,0 +1,84 @@
+/*
+ * Purpose: Various global services for OSS.
+ *
+ * This source file contains some initialization and cleanup code
+ * that is called by the OS modules for all operating systems.
+ */
+/*
+ *
+ * This file is part of Open Sound System.
+ *
+ * Copyright (C) 4Front Technologies 1996-2008.
+ *
+ * This this source file is released under GPL v2 license (no other versions).
+ * See the COPYING file included in the main directory of this source
+ * distribution for the license terms and conditions.
+ *
+ */
+
+#include <oss_config.h>
+#include "midi_core.h"
+
+#ifdef DO_TIMINGS
+extern oss_mutex_t oss_timing_mutex;
+#endif
+
+oss_history_t oss_history[OSS_HISTORY_SIZE] = { {0} };
+int oss_history_p = 0;
+
+int oss_num_cdevs = 0;
+oss_cdev_t **oss_cdevs = NULL;
+int oss_max_cdevs = 0;
+
+static int drivers_loaded = 0;
+
+void
+oss_unload_drivers (void)
+{
+
+ if (!drivers_loaded)
+ return;
+ drivers_loaded = 0;
+
+#ifdef CONFIG_OSS_VMIX
+ vmix_core_uninit ();
+#endif
+
+ oss_audio_uninit ();
+
+ /* oss_midi_uninit(); *//* TODO: This causes crashes */
+#ifdef DO_TIMINGS
+ MUTEX_CLEANUP (oss_timing_mutex);
+#endif
+
+ /*
+ * Release all global memory
+ */
+ oss_memblk_unalloc(&oss_global_memblk);
+}
+
+/*ARGSUSED*/
+void
+create_new_card (char *shortname, char *longname)
+{
+}
+
+void
+oss_common_init (oss_device_t * osdev)
+{
+ if (drivers_loaded)
+ return;
+#ifdef DO_TIMINGS
+ MUTEX_INIT (osdev, oss_timing_mutex, MH_TOP);
+#endif
+ drivers_loaded = 1;
+ oss_audio_init (osdev);
+ install_sndstat (osdev);
+ install_vdsp (osdev);
+ oss_midi_init (osdev);
+ install_vmidi (osdev);
+ install_dev_mixer (osdev);
+#ifdef CONFIG_OSS_VMIX
+ vmix_core_init (osdev);
+#endif
+}
diff --git a/kernel/framework/osscore/oss_memblk.c b/kernel/framework/osscore/oss_memblk.c
new file mode 100644
index 0000000..57da1d0
--- /dev/null
+++ b/kernel/framework/osscore/oss_memblk.c
@@ -0,0 +1,100 @@
+/*
+ * Purpose: OSS memory block allocation and management routines.
+ */
+/*
+ *
+ * This file is part of Open Sound System.
+ *
+ * Copyright (C) 4Front Technologies 1996-2008.
+ *
+ * This this source file is released under GPL v2 license (no other versions).
+ * See the COPYING file included in the main directory of this source
+ * distribution for the license terms and conditions.
+ *
+ */
+
+#include <oss_config.h>
+
+struct _oss_memblk_t
+{
+ oss_memblk_t *next;
+ void *addr;
+};
+
+oss_memblk_t *oss_global_memblk=NULL;
+
+void
+*oss_memblk_malloc(oss_memblk_t **blk, int size)
+{
+ oss_memblk_t *newblk;
+
+ newblk = KERNEL_MALLOC (sizeof(oss_memblk_t) + size);
+
+ newblk->addr = newblk +1;
+ newblk->next = NULL;
+
+ if (*blk == NULL)
+ {
+ /*
+ * No earlier memory blocks in the chain.
+ */
+ *blk = newblk;
+ return newblk->addr;
+ }
+
+/*
+ * Add this block to the chain.
+ */
+ newblk->next = *blk;
+ *blk = newblk;
+
+ return newblk->addr;
+}
+
+void
+oss_memblk_free(oss_memblk_t **blk, void *addr)
+{
+ oss_memblk_t *this_one = *blk, *prev = NULL;
+
+ while (this_one != NULL)
+ {
+ if (this_one->addr == addr)
+ {
+ if (prev == NULL) /* First one in the chain */
+ {
+ *blk = this_one->next;
+ KERNEL_FREE (this_one);
+ }
+ else
+ {
+ prev->next = this_one->next;
+ KERNEL_FREE (this_one);
+ }
+
+ return;
+ }
+
+ this_one = this_one->next;
+ }
+}
+
+void
+oss_memblk_unalloc(oss_memblk_t **blk)
+{
+/*
+ * Free all memory allocations on the chain.
+ */
+ oss_memblk_t *this_one = *blk;
+
+ while (this_one != NULL)
+ {
+ oss_memblk_t *next_one;
+
+ next_one = this_one->next;
+
+ KERNEL_FREE(this_one);
+ this_one = next_one;
+ }
+
+ *blk = NULL;
+}