--- /dev/null
+/*
+ * FUZIX audio core support
+ */
+
+#include <kernel.h>
+#include <kdata.h>
+#include <printf.h>
+#include <audio.h>
+
+#ifdef CONFIG_AUDIO
+
+struct sound sound;
+
+int audio_ioctl(uarg_t op, void *val)
+{
+ uint8_t i;
+
+ if ((op >> 8) != 0x02)
+ return -EINVAL;
+ switch(op) {
+ case AUDIOC_GETINFO:
+ return uput(&audio_info, val, sizeof(audio_info));
+ case AUDIOC_STOP:
+ for (i = 0; i < audio_info.channels;i++)
+ devaudio_stop(i);
+ return 0;
+ case AUDIOC_WAIT:
+ for (i = 0; i < audio_info.channels;i++)
+ devaudio_wait(i);
+ return 0;
+ case AUDIOC_PLAY:
+ if (uget(&sound, val, sizeof(sound)) == -1)
+ return -1;
+ if (sound.channel > audio_info.channels) {
+ udata.u_error = ERANGE;
+ return -1;
+ }
+ if (sound.flags & SND_WAIT)
+ if (devaudio_wait(sound.channel))
+ return -1;
+ return devaudio_play();
+ default:
+ return devaudio_ioctl(op, val);
+ }
+}
+
+void audio_tick(void)
+{
+ /* For now no core processing */
+ devaudio_tick();
+}
+
+/* TODO: read/write for DSP devices */
+
+#endif
#include <version.h>
#include <kdata.h>
#include <devsys.h>
+#include <audio.h>
/*
* System devices:
* Minor 1 mem
* Minor 2 zero
* Minor 3 proc
+ * Minor 64 audio
*
* Use Minor 128+ for platform specific devices
*/
int sys_ioctl(uint8_t minor, uarg_t request, char *data)
{
+#ifdef CONFIG_AUDIO
+ if (minor == 64)
+ return audio_ioctl(request, data);
+#endif
if (minor != 3) {
udata.u_error = ENOTTY;
return -1;
#include <kernel.h>
#include <kdata.h>
#include <printf.h>
+#include <audio.h>
/* psleep() puts a process to sleep on the given event. If another
* process is runnable, it switches out the current one and starts the
}
}
updatetod();
+#ifdef CONFIG_AUDIO
+ audio_tick();
+#endif
}
#ifndef CONFIG_SINGLETASK
/* Check run time of current process */