[dahdi-commits] sruffell: branch linux/sruffell/dahdi-linux-chainedvb r7089 - /linux/team/sru...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Thu Sep 3 15:30:31 CDT 2009


Author: sruffell
Date: Thu Sep  3 15:30:28 2009
New Revision: 7089

URL: http://svn.asterisk.org/svn-view/dahdi?view=rev&rev=7089
Log:
wip: Stubbed out the code to implement the ringed descriptors.

Modified:
    linux/team/sruffell/dahdi-linux-chainedvb/drivers/dahdi/voicebus/voicebus.c

Modified: linux/team/sruffell/dahdi-linux-chainedvb/drivers/dahdi/voicebus/voicebus.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/team/sruffell/dahdi-linux-chainedvb/drivers/dahdi/voicebus/voicebus.c?view=diff&rev=7089&r1=7088&r2=7089
==============================================================================
--- linux/team/sruffell/dahdi-linux-chainedvb/drivers/dahdi/voicebus/voicebus.c (original)
+++ linux/team/sruffell/dahdi-linux-chainedvb/drivers/dahdi/voicebus/voicebus.c Thu Sep  3 15:30:28 2009
@@ -62,10 +62,12 @@
 #endif
 #endif
 
-/* Uncomment this to use the ring descriptors. */
+/* Uncomment this to use the previous method of chained descriptors. */
 #define USE_CHAINED_DESCRIPTORS
 
 #if defined(USE_CHAINED_DESCRIPTORS)
+
+#define DLIST_SIZE 	128
 
 #else
 
@@ -122,9 +124,15 @@
 	u32 des0;
 	u32 des1;
 	u32 buffer1;
-	u32 container; /* Unused */
+	u32 buffer2; /* Unused */
 } __attribute__((packed));
 
+#if defined(USE_CHAINED_DESCRIPTORS)
+struct voicebus_descriptor_list {
+	/*! The number of bytes to pad each descriptor for cache alignment. */
+	unsigned int	padding;
+};
+#else
 struct voicebus_descriptor_list {
 	/* Pointer to an array of descriptors to give to hardware. */
 	struct voicebus_descriptor *desc;
@@ -144,6 +152,7 @@
 	unsigned int	padding;
 };
 
+#endif
 
 /*!  * \brief Represents a VoiceBus interface on a Digium telephony card.
  */
@@ -290,6 +299,7 @@
 #define stop_vb_deferred(_x_) do {; } while (0)
 #endif
 
+#if !defined(USE_CHAINED_DESCRIPTORS)
 static inline struct voicebus_descriptor *
 vb_descriptor(struct voicebus_descriptor_list *dl, int index)
 {
@@ -298,7 +308,16 @@
 		((sizeof(*d) + dl->padding) * index));
 	return d;
 }
-
+#endif
+
+#if defined(USE_CHAINED_DESCRIPTORS)
+static int
+vb_initialize_descriptors(struct voicebus *vb, struct voicebus_descriptor_list *dl,
+	u32 des1, unsigned int direction)
+{
+	return -EFAULT;
+}
+#else
 static int
 vb_initialize_descriptors(struct voicebus *vb, struct voicebus_descriptor_list *dl,
 	u32 des1, unsigned int direction)
@@ -337,6 +356,7 @@
 	atomic_set(&dl->count, 0);
 	return 0;
 }
+#endif
 
 static int
 vb_initialize_tx_descriptors(struct voicebus *vb)
@@ -358,6 +378,10 @@
 int
 voicebus_set_minlatency(struct voicebus *vb, unsigned int ms)
 {
+#if defined(USE_CHAINED_DESCRIPTORS)
+	dev_err(&vb->pdev->dev, "%s is not implemented.\n", __func__);
+	return -EFAULT;
+#else
 	LOCKS_VOICEBUS;
 	/*
 	 * One millisecond of latency means that we have 3 buffers pending,
@@ -377,6 +401,7 @@
 	vb->min_tx_buffer_count = ms;
 	VBUNLOCK(vb);
 	return 0;
+#endif
 }
 EXPORT_SYMBOL(voicebus_set_minlatency);
 
@@ -471,6 +496,8 @@
 static void
 vb_cleanup_descriptors(struct voicebus *vb, struct voicebus_descriptor_list *dl)
 {
+#if defined(USE_CHAINED_DESCRIPTORS)
+#else
 	unsigned int i;
 	struct voicebus_descriptor *d;
 
@@ -489,20 +516,23 @@
 	dl->head = 0;
 	dl->tail = 0;
 	atomic_set(&dl->count, 0);
+#endif
 }
 
 static void
 vb_free_descriptors(struct voicebus *vb, struct voicebus_descriptor_list *dl)
 {
-	if (NULL == dl->desc) {
-		WARN_ON(1);
+#if defined(USE_CHAINED_DESCRIPTORS)
+#else
+	if (NULL == dl->desc)
 		return;
-	}
+
 	vb_cleanup_descriptors(vb, dl);
 	pci_free_consistent(
 		vb->pdev,
 		(sizeof(struct voicebus_descriptor)+dl->padding)*DRING_SIZE,
 		dl->desc, dl->desc_dma);
+#endif
 }
 
 /*!
@@ -673,9 +703,12 @@
 	/* ...disable jabber and the receive watchdog. */
 	vb_setctl(vb, 0x0078, 0x00000013);
 
+#	if defined(USE_CHAINED_DESCRIPTORS)
+#	else
 	/* Tell the card where the descriptors are in host memory. */
 	vb_setctl(vb, 0x0020, (u32)vb->txd.desc_dma);
 	vb_setctl(vb, 0x0018, (u32)vb->rxd.desc_dma);
+#	endif
 
 	reg = vb_getctl(vb, 0x00fc);
 	vb_setctl(vb, 0x00fc, (reg & ~0x7) | 0x7);
@@ -732,6 +765,10 @@
 static inline int
 vb_submit(struct voicebus *vb, struct voicebus_descriptor_list *dl, void *vbb)
 {
+#if defined(USE_CHAINED_DESCRIPTORS)
+	dev_err(&vb->pdev->dev, "%s is not implemented.\n", __func__);
+	return -EFAULT;
+#else
 	volatile struct voicebus_descriptor *d;
 	unsigned int tail = dl->tail;
 	assert_in_vb_deferred(vb);
@@ -752,11 +789,16 @@
 	SET_OWNED(d); /* That's it until the hardware is done with it. */
 	atomic_inc(&dl->count);
 	return 0;
+#endif
 }
 
 static inline void*
 vb_retrieve(struct voicebus *vb, struct voicebus_descriptor_list *dl)
 {
+#if defined(USE_CHAINED_DESCRIPTORS)
+	dev_err(&vb->pdev->dev, "%s is not implemented.\n", __func__);
+	return NULL;
+#else
 	volatile struct voicebus_descriptor *d;
 	void *vbb;
 	unsigned int head = dl->head;
@@ -773,6 +815,7 @@
 	} else {
 		return NULL;
 	}
+#endif
 }
 
 /*!
@@ -913,6 +956,11 @@
 	int i;
 	void *vbb;
 	int ret;
+#if defined(USE_CHAINED_DESCRIPTORS)
+	const int MAX_DESCRIPTORS = DLIST_SIZE;
+#else
+	const int MAX_DESCRIPTORS = DRING_SIZE;
+#endif
 
 	assert(!in_interrupt());
 
@@ -939,7 +987,7 @@
 	 */
 	start_vb_deferred(vb);
 	/* Ensure that all the rx slots are ready for a buffer. */
-	for (i = 0; i < DRING_SIZE; ++i) {
+	for (i = 0; i < MAX_DESCRIPTORS; ++i) {
 		vbb = voicebus_alloc(vb);
 		if (unlikely(NULL == vbb)) {
 			BUG_ON(1);
@@ -1108,6 +1156,11 @@
 }
 EXPORT_SYMBOL(voicebus_release);
 
+#if defined(USE_CHAINED_DESCRIPTORS)
+static void __vb_increase_latency(struct voicebus *vb)
+{
+}
+#else
 static void
 __vb_increase_latency(struct voicebus *vb)
 {
@@ -1155,6 +1208,7 @@
 
 	}
 }
+#endif
 
 /*!
  * \brief Actually process the completed transmit and receive buffers.
@@ -1504,11 +1558,8 @@
 #endif
 	/* Cleanup memory and software resources. */
 
-	if (vb->txd.desc)
-		vb_free_descriptors(vb, &vb->txd);
-
-	if (vb->rxd.desc)
-		vb_free_descriptors(vb, &vb->rxd);
+	vb_free_descriptors(vb, &vb->txd);
+	vb_free_descriptors(vb, &vb->rxd);
 
 	if (vb->buffer_cache)
 		kmem_cache_destroy(vb->buffer_cache);




More information about the dahdi-commits mailing list