Update of /cvsroot/alsa/alsa-kernel/core
In directory sc8-pr-cvs1:/tmp/cvs-serv27284

Modified Files:
        memalloc.c 
Log Message:
- enabled the pre-allocation of hammerfall buffers.
- shows the contents of buffer list via proc file.



Index: memalloc.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/memalloc.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- memalloc.c  6 Jun 2003 11:54:27 -0000       1.12
+++ memalloc.c  18 Jun 2003 13:46:08 -0000      1.13
@@ -37,18 +37,12 @@
 MODULE_LICENSE("GPL");
 
 
-/* so far, pre-defined allocation is only for hammerfall cards... */
-/* #define ENABLE_PREALLOC */
-
-
-#ifdef ENABLE_PREALLOC
 #ifndef SNDRV_CARDS
 #define SNDRV_CARDS    8
 #endif
 static int enable[8] = {[0 ... (SNDRV_CARDS-1)] = 1};
 MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(enable, "Enable cards to allocate buffers.");
-#endif
 
 
 /*
@@ -154,6 +148,7 @@
                return a->dev.flags == b->dev.flags;
 #ifdef CONFIG_PCI
        case SNDRV_DMA_TYPE_PCI:
+       case SNDRV_DMA_TYPE_PCI_SG:
                return a->dev.pci == b->dev.pci;
 #endif
 #ifdef CONFIG_SBUS
@@ -336,7 +331,7 @@
  * and replaced with the new one.
  *
  * When NULL buffer pointer or zero buffer size is given, the existing
- * release buffer is released and the entry is removed.
+ * buffer is released and the entry is removed.
  * 
  * Returns zero if successful, or a negative code at error.
  */
@@ -785,7 +780,6 @@
 #endif /* CONFIG_SBUS */
 
 
-#ifdef ENABLE_PREALLOC
 /*
  * allocation of buffers for pre-defined devices
  */
@@ -861,7 +855,6 @@
                }
        }
 }
-#endif
 
 
 #ifdef CONFIG_PROC_FS
@@ -873,9 +866,56 @@
 {
        int len = 0;
        long pages = snd_allocated_pages >> (PAGE_SHIFT-12);
+       struct list_head *p;
+       struct snd_mem_list *mem;
+       int devno;
 
+       down(&list_mutex);
        len += sprintf(page + len, "pages  : %li bytes (%li pages per %likB)\n",
                       pages * PAGE_SIZE, pages, PAGE_SIZE / 1024);
+       devno = 0;
+       list_for_each(p, &mem_list_head) {
+               mem = list_entry(p, struct snd_mem_list, list);
+               devno++;
+               len += sprintf(page + len, "buffer %d : ", devno);
+               if (mem->dev.id == SNDRV_DMA_DEVICE_UNUSED)
+                       len += sprintf(page + len, "UNUSED");
+               else
+                       len += sprintf(page + len, "ID %08x", mem->dev.id);
+               len += sprintf(page + len, " : type ");
+               switch (mem->dev.type) {
+               case SNDRV_DMA_TYPE_CONTINUOUS:
+                       len += sprintf(page + len, "CONT [%x]", mem->dev.dev.flags);
+                       break;
+#ifdef CONFIG_PCI
+               case SNDRV_DMA_TYPE_PCI:
+               case SNDRV_DMA_TYPE_PCI_SG:
+                       if (mem->dev.dev.pci) {
+                               len += sprintf(page + len, "PCI [%04x:%04x]",
+                                              mem->dev.dev.pci->vendor,
+                                              mem->dev.dev.pci->device);
+                       }
+                       break;
+#endif
+#ifdef CONFIG_ISA
+               case SNDRV_DMA_TYPE_ISA:
+                       len += sprintf(page + len, "ISA [%x]", mem->dev.dev.flags);
+                       break;
+#endif
+#ifdef CONFIG_SBUS
+               case SNDRV_DMA_TYPE_SBUS:
+                       len += sprintf(page + len, "SBUS [%x]", 
mem->dev.dev.sbus->slot);
+                       break;
+#endif
+               default:
+                       len += sprintf(page + len, "UNKNOWN");
+                       break;
+               }
+               len += sprintf(page + len, "\n  addr = 0x%lx, size = %d bytes, used = 
%s\n",
+                              (unsigned long)mem->buffer.addr, (int)mem->buffer.bytes,
+                              mem->used ? "yes" : "no");
+       }
+       up(&list_mutex);
        return len;
 }
 #endif /* CONFIG_PROC_FS */
@@ -887,9 +927,7 @@
 static int __init snd_mem_init(void)
 {
        create_proc_read_entry("driver/snd-page-alloc", 0, 0, snd_mem_proc_read, NULL);
-#ifdef ENABLE_PREALLOC
        preallocate_cards();
-#endif
        return 0;
 }
 



-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to