/* * The DSP56001 Device Driver, saviour of the Free World(tm) * * Authors: Fredrik Noring <noring@nocrew.org> * lars brinkhoff <lars@nocrew.org> * Tomas Berndtsson <tomas@nocrew.org> * * First version May 1996 * * History: * 97-01-29 Tomas Berndtsson, * Integrated with Linux 2.1.21 kernel sources. * 97-02-15 Tomas Berndtsson, * Fixed for kernel 2.1.26 * * BUGS: * Hmm... there must be something here :) * * Copyright (C) 1996,1997 Fredrik Noring, lars brinkhoff & Tomas Berndtsson * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in the main directory of this archive * for more details.
*/
/* minor devices */ #define DSP56K_DEV_56001 0 /* The only device so far */
#define TIMEOUT 10 /* Host port timeout in number of tries */ #define MAXIO 2048 /* Maximum number of words before sleep */ #define DSP56K_MAX_BINARY_LENGTH (3*64*1024)
/* Power down the DSP */
sound_ym.rd_data_reg_sel = 14;
status = sound_ym.rd_data_reg_sel & 0xef;
sound_ym.wd_data = status;
sound_ym.wd_data = status | 0x10;
udelay(10);
/* Power up the DSP */
sound_ym.rd_data_reg_sel = 14;
sound_ym.wd_data = sound_ym.rd_data_reg_sel & 0xef;
return 0;
}
staticint dsp56k_upload(u_char __user *bin, int len)
{ struct platform_device *pdev; conststruct firmware *fw; constchar fw_name[] = "dsp56k/bootstrap.bin"; int err; int i;
dsp56k_reset();
pdev = platform_device_register_simple("dsp56k", 0, NULL, 0); if (IS_ERR(pdev)) {
printk(KERN_ERR "Failed to register device for \"%s\"\n",
fw_name); return -EINVAL;
}
err = request_firmware(&fw, fw_name, &pdev->dev);
platform_device_unregister(pdev); if (err) {
printk(KERN_ERR "Failed to load image \"%s\" err %d\n",
fw_name, err); return err;
} if (fw->size % 3) {
printk(KERN_ERR "Bogus length %d in image \"%s\"\n",
fw->size, fw_name);
release_firmware(fw); return -EINVAL;
} for (i = 0; i < fw->size; i = i + 3) { /* tx_wait(10); */
dsp56k_host_interface.data.b[1] = fw->data[i];
dsp56k_host_interface.data.b[2] = fw->data[i + 1];
dsp56k_host_interface.data.b[3] = fw->data[i + 2];
}
release_firmware(fw); for (; i < 512; i++) { /* tx_wait(10); */
dsp56k_host_interface.data.b[1] = 0;
dsp56k_host_interface.data.b[2] = 0;
dsp56k_host_interface.data.b[3] = 0;
}
for (i = 0; i < len; i++) {
tx_wait(10);
get_user(dsp56k_host_interface.data.b[1], bin++);
get_user(dsp56k_host_interface.data.b[2], bin++);
get_user(dsp56k_host_interface.data.b[3], bin++);
}
/* As of 2.1.26 this should be dsp56k_poll, * but how do I then check device minor number? * Do I need this function at all???
*/ #if 0 static __poll_t dsp56k_poll(struct file *file, poll_table *wait)
{ int dev = iminor(file_inode(file)) & 0x0f;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.