changeset 124:f2ae5ddeed7e

minor improvement: - extend yielding period - unroll loop where copying from micro-packet
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 16 Feb 2012 13:11:38 +0900
parents 313d8551b66c
children a910b49dfbee
files driver/pt1_pci.c
diffstat 1 files changed, 19 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/driver/pt1_pci.c	Wed Feb 15 00:03:33 2012 +0900
+++ b/driver/pt1_pci.c	Thu Feb 16 13:11:38 2012 +0900
@@ -74,10 +74,10 @@
 #define		MAX_READ_BLOCK	4			// 1度に読み出す最大DMAバッファ数
 #define		MAX_PCI_DEVICE		128		// 最大64枚
 #define		DMA_SIZE	4096			// DMAバッファサイズ
-#define		DMA_RING_SIZE	128			// RINGサイズ
-#define		DMA_RING_MAX	511			// 1RINGにいくつ詰めるか(1023はNGで511まで)
-#define		CHANEL_DMA_SIZE	(2*1024*1024)	// 地デジ用(16Mbps)
-#define		BS_CHANEL_DMA_SIZE	(4*1024*1024)	// BS用(32Mbps)
+#define		DMA_RING_SIZE	128			// number of DMA RINGS
+#define		DMA_RING_MAX	511			// number of DMA entries in a RING(1023はNGで511まで)
+#define		CHANNEL_DMA_SIZE	(2*1024*1024)	// 地デジ用(16Mbps)
+#define		BS_CHANNEL_DMA_SIZE	(4*1024*1024)	// BS用(32Mbps)
 #define		READ_SIZE	(16*DMA_SIZE)
 
 typedef	struct	_DMA_CONTROL{
@@ -184,7 +184,6 @@
 	int		data_pos = 0 ;
 	int		lp ;
 	int		chno ;
-	int		lp2 ;
 	int		dma_channel ;
 	int		packet_pos ;
 	__u32	*dataptr ;
@@ -267,10 +266,10 @@
 					channel->packet_size = 0 ;
 				}
 				// データコピー
-				for(lp2 = 2 ; lp2 >= 0 ; lp2--){
-					channel->packet_buf[channel->packet_size] = micro.packet.data[lp2] ;
-					channel->packet_size += 1 ;
-				}
+				channel->packet_buf[channel->packet_size]   = micro.packet.data[2];
+				channel->packet_buf[channel->packet_size+1] = micro.packet.data[1];
+				channel->packet_buf[channel->packet_size+2] = micro.packet.data[0];
+				channel->packet_size += 3;
 
 				// パケットが出来たらコピーする
 				if(channel->packet_size >= PACKET_SIZE){
@@ -315,7 +314,7 @@
 				}
 			}
 		}
-		schedule_timeout_interruptible(msecs_to_jiffies(10));
+		schedule_timeout_interruptible(msecs_to_jiffies(100));
 	}
 	return 0 ;
 }
@@ -349,7 +348,7 @@
 					set_sleepmode(channel->ptr->regs, &channel->lock,
 								  channel->address, channel->type,
 								  TYPE_WAKEUP);
-					schedule_timeout_interruptible(msecs_to_jiffies(50));
+					schedule_timeout_interruptible(msecs_to_jiffies(100));
 
 					channel->drop  = 0 ;
 					channel->valid = TRUE ;
@@ -393,7 +392,7 @@
 	/* send tuner to sleep */
 	set_sleepmode(channel->ptr->regs, &channel->lock,
 				  channel->address, channel->type, TYPE_SLEEP);
-	schedule_timeout_interruptible(msecs_to_jiffies(50));
+	schedule_timeout_interruptible(msecs_to_jiffies(100));
 
 	return 0;
 }
@@ -775,10 +774,10 @@
 	}
 	// チューナリセット
 	settuner_reset(dev_conf->regs, dev_conf->cardtype, LNB_OFF, TUNER_POWER_ON_RESET_ENABLE);
-	schedule_timeout_interruptible(msecs_to_jiffies(50));
+	schedule_timeout_interruptible(msecs_to_jiffies(100));
 
 	settuner_reset(dev_conf->regs, dev_conf->cardtype, LNB_OFF, TUNER_POWER_ON_RESET_DISABLE);
-	schedule_timeout_interruptible(msecs_to_jiffies(10));
+	schedule_timeout_interruptible(msecs_to_jiffies(100));
 	mutex_init(&dev_conf->lock);
 
 	// Tuner 初期化処理
@@ -794,7 +793,7 @@
 		set_sleepmode(dev_conf->regs, &dev_conf->lock,
 						i2c_address[lp], channeltype[lp], TYPE_SLEEP);
 
-		schedule_timeout_interruptible(msecs_to_jiffies(50));
+		schedule_timeout_interruptible(msecs_to_jiffies(100));
 	}
 	rc = alloc_chrdev_region(&dev_conf->dev, 0, MAX_CHANNEL, DEV_NAME);
 	if(rc < 0){
@@ -844,13 +843,13 @@
 
 		switch(channel->type){
 			case CHANNEL_TYPE_ISDB_T:
-				channel->maxsize = CHANEL_DMA_SIZE ;
-				channel->buf = vmalloc(CHANEL_DMA_SIZE);
+				channel->maxsize = CHANNEL_DMA_SIZE ;
+				channel->buf = vmalloc(CHANNEL_DMA_SIZE);
 				channel->pointer = 0;
 				break ;
 			case CHANNEL_TYPE_ISDB_S:
-				channel->maxsize = BS_CHANEL_DMA_SIZE ;
-				channel->buf = vmalloc(BS_CHANEL_DMA_SIZE);
+				channel->maxsize = BS_CHANNEL_DMA_SIZE ;
+				channel->buf = vmalloc(BS_CHANNEL_DMA_SIZE);
 				channel->pointer = 0;
 				break ;
 		}
@@ -939,7 +938,7 @@
 			if(!(val & (1 << 6))){
 				break ;
 			}
-			schedule_timeout_interruptible(msecs_to_jiffies(1));
+			schedule_timeout_interruptible(msecs_to_jiffies(100));
 		}
 		pt1_dma_free(pdev, dev_conf);
 		for(lp = 0 ; lp < MAX_CHANNEL ; lp++){