emuproc.c (24e4a1211f691fc671de44685430dbad757d8487) | emuproc.c (d97e1b78239c7e7e441088e0b644bd3b076002e6) |
---|---|
1/* 2 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 3 * Creative Labs, Inc. 4 * Routines for control of EMU10K1 chips / proc interface routines 5 * 6 * Copyright (c) by James Courtier-Dutton <James@superbug.co.uk> 7 * Added EMU 1010 support. 8 * --- 332 unchanged lines hidden (view full) --- 341#define TOTAL_SIZE_CODE (0x200*8) 342#define A_TOTAL_SIZE_CODE (0x400*8) 343 344static ssize_t snd_emu10k1_fx8010_read(struct snd_info_entry *entry, 345 void *file_private_data, 346 struct file *file, char __user *buf, 347 size_t count, loff_t pos) 348{ | 1/* 2 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 3 * Creative Labs, Inc. 4 * Routines for control of EMU10K1 chips / proc interface routines 5 * 6 * Copyright (c) by James Courtier-Dutton <James@superbug.co.uk> 7 * Added EMU 1010 support. 8 * --- 332 unchanged lines hidden (view full) --- 341#define TOTAL_SIZE_CODE (0x200*8) 342#define A_TOTAL_SIZE_CODE (0x400*8) 343 344static ssize_t snd_emu10k1_fx8010_read(struct snd_info_entry *entry, 345 void *file_private_data, 346 struct file *file, char __user *buf, 347 size_t count, loff_t pos) 348{ |
349 long size; | |
350 struct snd_emu10k1 *emu = entry->private_data; 351 unsigned int offset; 352 int tram_addr = 0; | 349 struct snd_emu10k1 *emu = entry->private_data; 350 unsigned int offset; 351 int tram_addr = 0; |
352 unsigned int *tmp; 353 long res; 354 unsigned int idx; |
|
353 354 if (!strcmp(entry->name, "fx8010_tram_addr")) { 355 offset = TANKMEMADDRREGBASE; 356 tram_addr = 1; 357 } else if (!strcmp(entry->name, "fx8010_tram_data")) { 358 offset = TANKMEMDATAREGBASE; 359 } else if (!strcmp(entry->name, "fx8010_code")) { 360 offset = emu->audigy ? A_MICROCODEBASE : MICROCODEBASE; 361 } else { 362 offset = emu->audigy ? A_FXGPREGBASE : FXGPREGBASE; 363 } | 355 356 if (!strcmp(entry->name, "fx8010_tram_addr")) { 357 offset = TANKMEMADDRREGBASE; 358 tram_addr = 1; 359 } else if (!strcmp(entry->name, "fx8010_tram_data")) { 360 offset = TANKMEMDATAREGBASE; 361 } else if (!strcmp(entry->name, "fx8010_code")) { 362 offset = emu->audigy ? A_MICROCODEBASE : MICROCODEBASE; 363 } else { 364 offset = emu->audigy ? A_FXGPREGBASE : FXGPREGBASE; 365 } |
364 size = count; 365 if (pos + size > entry->size) 366 size = (long)entry->size - pos; 367 if (size > 0) { 368 unsigned int *tmp; 369 long res; 370 unsigned int idx; 371 if ((tmp = kmalloc(size + 8, GFP_KERNEL)) == NULL) 372 return -ENOMEM; 373 for (idx = 0; idx < ((pos & 3) + size + 3) >> 2; idx++) 374 if (tram_addr && emu->audigy) { 375 tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0) >> 11; 376 tmp[idx] |= snd_emu10k1_ptr_read(emu, 0x100 + idx + (pos >> 2), 0) << 20; 377 } else 378 tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0); 379 if (copy_to_user(buf, ((char *)tmp) + (pos & 3), size)) 380 res = -EFAULT; 381 else { 382 res = size; | 366 367 tmp = kmalloc(count + 8, GFP_KERNEL); 368 if (!tmp) 369 return -ENOMEM; 370 for (idx = 0; idx < ((pos & 3) + count + 3) >> 2; idx++) { 371 unsigned int val; 372 val = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0); 373 if (tram_addr && emu->audigy) { 374 val >>= 11; 375 val |= snd_emu10k1_ptr_read(emu, 0x100 + idx + (pos >> 2), 0) << 20; |
383 } | 376 } |
384 kfree(tmp); 385 return res; | 377 tmp[idx] = val; |
386 } | 378 } |
387 return 0; | 379 if (copy_to_user(buf, ((char *)tmp) + (pos & 3), count)) 380 res = -EFAULT; 381 else 382 res = count; 383 kfree(tmp); 384 return res; |
388} 389 390static void snd_emu10k1_proc_voices_read(struct snd_info_entry *entry, 391 struct snd_info_buffer *buffer) 392{ 393 struct snd_emu10k1 *emu = entry->private_data; 394 struct snd_emu10k1_voice *voice; 395 int idx; --- 279 unchanged lines hidden --- | 385} 386 387static void snd_emu10k1_proc_voices_read(struct snd_info_entry *entry, 388 struct snd_info_buffer *buffer) 389{ 390 struct snd_emu10k1 *emu = entry->private_data; 391 struct snd_emu10k1_voice *voice; 392 int idx; --- 279 unchanged lines hidden --- |