亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dma.c

?? linux-2.6.15.6
?? C
字號:
/* * arch/arm/kernel/dma-sa1100.c * * Support functions for the SA11x0 internal DMA channels. * * Copyright (C) 2000, 2001 by Nicolas Pitre * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */#include <linux/module.h>#include <linux/interrupt.h>#include <linux/init.h>#include <linux/spinlock.h>#include <linux/errno.h>#include <asm/system.h>#include <asm/irq.h>#include <asm/hardware.h>#include <asm/dma.h>#undef DEBUG#ifdef DEBUG#define DPRINTK( s, arg... )  printk( "dma<%p>: " s, regs , ##arg )#else#define DPRINTK( x... )#endiftypedef struct {	const char *device_id;		/* device name */	u_long device;			/* this channel device, 0  if unused*/	dma_callback_t callback;	/* to call when DMA completes */	void *data;			/* ... with private data ptr */} sa1100_dma_t;static sa1100_dma_t dma_chan[SA1100_DMA_CHANNELS];static spinlock_t dma_list_lock;static irqreturn_t dma_irq_handler(int irq, void *dev_id, struct pt_regs *regs){	dma_regs_t *dma_regs = dev_id;	sa1100_dma_t *dma = dma_chan + (((u_int)dma_regs >> 5) & 7);	int status = dma_regs->RdDCSR;	if (status & (DCSR_ERROR)) {		printk(KERN_CRIT "DMA on \"%s\" caused an error\n", dma->device_id);		dma_regs->ClrDCSR = DCSR_ERROR;	}	dma_regs->ClrDCSR = status & (DCSR_DONEA | DCSR_DONEB);	if (dma->callback) {		if (status & DCSR_DONEA)			dma->callback(dma->data);		if (status & DCSR_DONEB)			dma->callback(dma->data);	}	return IRQ_HANDLED;}/** *	sa1100_request_dma - allocate one of the SA11x0's DMA chanels *	@device: The SA11x0 peripheral targeted by this request *	@device_id: An ascii name for the claiming device *	@callback: Function to be called when the DMA completes *	@data: A cookie passed back to the callback function *	@dma_regs: Pointer to the location of the allocated channel's identifier * * 	This function will search for a free DMA channel and returns the * 	address of the hardware registers for that channel as the channel * 	identifier. This identifier is written to the location pointed by * 	@dma_regs. The list of possible values for @device are listed into * 	linux/include/asm-arm/arch-sa1100/dma.h as a dma_device_t enum. * * 	Note that reading from a port and writing to the same port are * 	actually considered as two different streams requiring separate * 	DMA registrations. * * 	The @callback function is called from interrupt context when one * 	of the two possible DMA buffers in flight has terminated. That * 	function has to be small and efficient while posponing more complex * 	processing to a lower priority execution context. * * 	If no channels are available, or if the desired @device is already in * 	use by another DMA channel, then an error code is returned.  This * 	function must be called before any other DMA calls. **/int sa1100_request_dma (dma_device_t device, const char *device_id,			dma_callback_t callback, void *data,			dma_regs_t **dma_regs){	sa1100_dma_t *dma = NULL;	dma_regs_t *regs;	int i, err;	*dma_regs = NULL;	err = 0;	spin_lock(&dma_list_lock);	for (i = 0; i < SA1100_DMA_CHANNELS; i++) {		if (dma_chan[i].device == device) {			err = -EBUSY;			break;		} else if (!dma_chan[i].device && !dma) {			dma = &dma_chan[i];		}	}	if (!err) {	       if (dma)		       dma->device = device;	       else		       err = -ENOSR;	}	spin_unlock(&dma_list_lock);	if (err)		return err;	i = dma - dma_chan;	regs = (dma_regs_t *)&DDAR(i);	err = request_irq(IRQ_DMA0 + i, dma_irq_handler, SA_INTERRUPT,			  device_id, regs);	if (err) {		printk(KERN_ERR		       "%s: unable to request IRQ %d for %s\n",		       __FUNCTION__, IRQ_DMA0 + i, device_id);		dma->device = 0;		return err;	}	*dma_regs = regs;	dma->device_id = device_id;	dma->callback = callback;	dma->data = data;	regs->ClrDCSR =		(DCSR_DONEA | DCSR_DONEB | DCSR_STRTA | DCSR_STRTB |		 DCSR_IE | DCSR_ERROR | DCSR_RUN);	regs->DDAR = device;	return 0;}/** * 	sa1100_free_dma - free a SA11x0 DMA channel * 	@regs: identifier for the channel to free * * 	This clears all activities on a given DMA channel and releases it * 	for future requests.  The @regs identifier is provided by a * 	successful call to sa1100_request_dma(). **/void sa1100_free_dma(dma_regs_t *regs){	int i;	for (i = 0; i < SA1100_DMA_CHANNELS; i++)		if (regs == (dma_regs_t *)&DDAR(i))			break;	if (i >= SA1100_DMA_CHANNELS) {		printk(KERN_ERR "%s: bad DMA identifier\n", __FUNCTION__);		return;	}	if (!dma_chan[i].device) {		printk(KERN_ERR "%s: Trying to free free DMA\n", __FUNCTION__);		return;	}	regs->ClrDCSR =		(DCSR_DONEA | DCSR_DONEB | DCSR_STRTA | DCSR_STRTB |		 DCSR_IE | DCSR_ERROR | DCSR_RUN);	free_irq(IRQ_DMA0 + i, regs);	dma_chan[i].device = 0;}/** * 	sa1100_start_dma - submit a data buffer for DMA * 	@regs: identifier for the channel to use * 	@dma_ptr: buffer physical (or bus) start address * 	@size: buffer size * * 	This function hands the given data buffer to the hardware for DMA * 	access. If another buffer is already in flight then this buffer * 	will be queued so the DMA engine will switch to it automatically * 	when the previous one is done.  The DMA engine is actually toggling * 	between two buffers so at most 2 successful calls can be made before * 	one of them terminates and the callback function is called. * * 	The @regs identifier is provided by a successful call to * 	sa1100_request_dma(). * * 	The @size must not be larger than %MAX_DMA_SIZE.  If a given buffer * 	is larger than that then it's the caller's responsibility to split * 	it into smaller chunks and submit them separately. If this is the * 	case then a @size of %CUT_DMA_SIZE is recommended to avoid ending * 	up with too small chunks. The callback function can be used to chain * 	submissions of buffer chunks. * * 	Error return values: * 	%-EOVERFLOW:	Given buffer size is too big. * 	%-EBUSY:	Both DMA buffers are already in use. * 	%-EAGAIN:	Both buffers were busy but one of them just completed * 			but the interrupt handler has to execute first. * * 	This function returs 0 on success. **/int sa1100_start_dma(dma_regs_t *regs, dma_addr_t dma_ptr, u_int size){	unsigned long flags;	u_long status;	int ret;	if (dma_ptr & 3)		printk(KERN_WARNING "DMA: unaligned start address (0x%08lx)\n",		       (unsigned long)dma_ptr);	if (size > MAX_DMA_SIZE)		return -EOVERFLOW;	local_irq_save(flags);	status = regs->RdDCSR;	/* If both DMA buffers are started, there's nothing else we can do. */	if ((status & (DCSR_STRTA | DCSR_STRTB)) == (DCSR_STRTA | DCSR_STRTB)) {		DPRINTK("start: st %#x busy\n", status);		ret = -EBUSY;		goto out;	}	if (((status & DCSR_BIU) && (status & DCSR_STRTB)) ||	    (!(status & DCSR_BIU) && !(status & DCSR_STRTA))) {		if (status & DCSR_DONEA) {			/* give a chance for the interrupt to be processed */			ret = -EAGAIN;			goto out;		}		regs->DBSA = dma_ptr;		regs->DBTA = size;		regs->SetDCSR = DCSR_STRTA | DCSR_IE | DCSR_RUN;		DPRINTK("start a=%#x s=%d on A\n", dma_ptr, size);	} else {		if (status & DCSR_DONEB) {			/* give a chance for the interrupt to be processed */			ret = -EAGAIN;			goto out;		}		regs->DBSB = dma_ptr;		regs->DBTB = size;		regs->SetDCSR = DCSR_STRTB | DCSR_IE | DCSR_RUN;		DPRINTK("start a=%#x s=%d on B\n", dma_ptr, size);	}	ret = 0;out:	local_irq_restore(flags);	return ret;}/** * 	sa1100_get_dma_pos - return current DMA position * 	@regs: identifier for the channel to use * * 	This function returns the current physical (or bus) address for the * 	given DMA channel.  If the channel is running i.e. not in a stopped * 	state then the caller must disable interrupts prior calling this * 	function and process the returned value before re-enabling them to * 	prevent races with the completion interrupt handler and the callback * 	function. The validation of the returned value is the caller's * 	responsibility as well -- the hardware seems to return out of range * 	values when the DMA engine completes a buffer. * * 	The @regs identifier is provided by a successful call to * 	sa1100_request_dma(). **/dma_addr_t sa1100_get_dma_pos(dma_regs_t *regs){	int status;	/*	 * We must determine whether buffer A or B is active.	 * Two possibilities: either we are in the middle of	 * a buffer, or the DMA controller just switched to the	 * next toggle but the interrupt hasn't been serviced yet.	 * The former case is straight forward.  In the later case,	 * we'll do like if DMA is just at the end of the previous	 * toggle since all registers haven't been reset yet.	 * This goes around the edge case and since we're always	 * a little behind anyways it shouldn't make a big difference.	 * If DMA has been stopped prior calling this then the	 * position is exact.	 */	status = regs->RdDCSR;	if ((!(status & DCSR_BIU) &&  (status & DCSR_STRTA)) ||	    ( (status & DCSR_BIU) && !(status & DCSR_STRTB)))		return regs->DBSA;	else		return regs->DBSB;}/** * 	sa1100_reset_dma - reset a DMA channel * 	@regs: identifier for the channel to use * * 	This function resets and reconfigure the given DMA channel. This is * 	particularly useful after a sleep/wakeup event. * * 	The @regs identifier is provided by a successful call to * 	sa1100_request_dma(). **/void sa1100_reset_dma(dma_regs_t *regs){	int i;	for (i = 0; i < SA1100_DMA_CHANNELS; i++)		if (regs == (dma_regs_t *)&DDAR(i))			break;	if (i >= SA1100_DMA_CHANNELS) {		printk(KERN_ERR "%s: bad DMA identifier\n", __FUNCTION__);		return;	}	regs->ClrDCSR =		(DCSR_DONEA | DCSR_DONEB | DCSR_STRTA | DCSR_STRTB |		 DCSR_IE | DCSR_ERROR | DCSR_RUN);	regs->DDAR = dma_chan[i].device;}EXPORT_SYMBOL(sa1100_request_dma);EXPORT_SYMBOL(sa1100_free_dma);EXPORT_SYMBOL(sa1100_start_dma);EXPORT_SYMBOL(sa1100_get_dma_pos);EXPORT_SYMBOL(sa1100_reset_dma);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
丁香一区二区三区| av一区二区三区| 亚洲伦理在线免费看| 欧美一区二区三区色| 99久久99久久精品免费看蜜桃| 青青草成人在线观看| 一区二区三区 在线观看视频| 久久天天做天天爱综合色| 在线电影欧美成精品| 色综合咪咪久久| 国产99久久久国产精品潘金 | 久久久久久麻豆| 欧美日免费三级在线| 99视频精品在线| 粉嫩av亚洲一区二区图片| 久久se这里有精品| 日韩精品亚洲一区二区三区免费| 一区二区三区在线看| 欧美国产成人精品| 久久久99久久| 欧美v国产在线一区二区三区| 欧美日韩dvd在线观看| 欧美在线免费观看亚洲| 色哟哟一区二区在线观看| 成人av电影免费观看| 国产成人午夜精品5599| 国产一区二区在线看| 毛片不卡一区二区| 蜜桃av一区二区三区电影| 日本视频在线一区| 丝袜亚洲另类丝袜在线| 午夜电影一区二区三区| 亚洲国产日韩一级| 亚洲影院在线观看| 亚洲国产一区视频| 亚洲第一主播视频| 午夜精品一区二区三区电影天堂 | 亚洲丝袜精品丝袜在线| 国产精品你懂的在线| 日本一区二区三区国色天香| 国产清纯在线一区二区www| 久久综合九色综合97_久久久| 精品噜噜噜噜久久久久久久久试看 | 欧美精品一区男女天堂| 欧美不卡视频一区| 亚洲精品在线观| 国产日产欧产精品推荐色 | 亚洲精品高清在线观看| 一区二区三区四区视频精品免费| 亚洲毛片av在线| 亚洲一区自拍偷拍| 日韩国产成人精品| 免费人成精品欧美精品| 国产在线一区二区综合免费视频| 国产精品一卡二卡| av电影在线不卡| 欧美亚洲高清一区二区三区不卡| 欧美日韩免费观看一区三区| 日韩视频123| 国产亚洲美州欧州综合国| 日韩美女久久久| 天天亚洲美女在线视频| 国内不卡的二区三区中文字幕| 国产成人综合亚洲91猫咪| 91亚洲国产成人精品一区二三 | 欧美成人vr18sexvr| 久久精品一区二区三区av| 国产精品欧美久久久久一区二区| 亚洲精品一二三区| 亚洲成人www| 国产精品主播直播| 色激情天天射综合网| 91精品国产手机| 国产精品热久久久久夜色精品三区 | 99久久精品国产麻豆演员表| 欧美亚洲国产一区在线观看网站| 日韩一二三区视频| 亚洲欧洲精品一区二区精品久久久| 亚洲国产一区二区三区青草影视| 国产一本一道久久香蕉| 色狠狠一区二区三区香蕉| 久久综合成人精品亚洲另类欧美| 中文字幕在线不卡一区| 欧美96一区二区免费视频| 成人黄色在线视频| 制服丝袜在线91| 国产精品超碰97尤物18| 日韩av成人高清| 本田岬高潮一区二区三区| 91精品国产色综合久久久蜜香臀| 国产精品久久久久久久午夜片| 日韩电影一二三区| 懂色av一区二区在线播放| 91精品国产全国免费观看| 国产精品传媒视频| 国模娜娜一区二区三区| 欧美视频一区二区三区在线观看| 久久精品日韩一区二区三区| 亚洲成av人片观看| 97se亚洲国产综合自在线不卡| 日韩欧美国产电影| 午夜伦欧美伦电影理论片| 菠萝蜜视频在线观看一区| 日韩欧美123| 亚洲va国产天堂va久久en| av色综合久久天堂av综合| 亚洲精品在线免费观看视频| 五月激情综合色| 日本精品免费观看高清观看| 国产亚洲一区二区三区四区 | 一区二区三区日本| 成人性生交大片| 久久综合网色—综合色88| 日韩成人免费电影| 精品视频在线免费观看| 亚洲美女屁股眼交| 99re视频这里只有精品| 欧美国产日韩一二三区| 国产精品资源网站| 久久色在线观看| 久久精品99久久久| 日韩视频在线观看一区二区| 日韩高清不卡在线| 91麻豆精品国产自产在线 | 色噜噜夜夜夜综合网| 国产精品久久免费看| 高清免费成人av| 国产午夜亚洲精品午夜鲁丝片| 国产真实乱对白精彩久久| 久久亚洲捆绑美女| 国产综合色视频| 亚洲精品一线二线三线无人区| 麻豆视频观看网址久久| 欧美大度的电影原声| 精品写真视频在线观看| 精品国产乱码久久久久久夜甘婷婷| 美女视频黄免费的久久 | 97精品国产露脸对白| 国产精品嫩草影院av蜜臀| av一区二区三区黑人| 亚洲色图19p| 欧洲精品中文字幕| 午夜av电影一区| 日韩亚洲欧美在线观看| 狠狠色综合日日| 欧美高清在线一区| 97精品久久久久中文字幕 | 亚洲一区二区三区四区在线免费观看| 色综合婷婷久久| 一区二区三区四区激情| 91精品免费观看| 国内外成人在线| ...av二区三区久久精品| 在线视频综合导航| 美女在线观看视频一区二区| 国产日韩欧美a| 99久久精品久久久久久清纯| 亚洲成人激情自拍| 精品国产乱码久久久久久1区2区| 国产成人在线色| 亚洲一区在线看| 精品少妇一区二区三区在线播放 | 成人亚洲一区二区一| 一区二区三区在线观看欧美| 777午夜精品视频在线播放| 国产在线看一区| 亚洲日本va午夜在线电影| 在线成人av网站| 成人av手机在线观看| 亚洲成av人片一区二区梦乃| 久久久久久久久一| 在线视频一区二区三| 精品无人区卡一卡二卡三乱码免费卡| 国产精品麻豆欧美日韩ww| 欧美三级视频在线观看| 国产最新精品免费| 一区二区免费视频| 欧美精品少妇一区二区三区| 国产a视频精品免费观看| 亚洲va韩国va欧美va| 国产日韩av一区| 欧美一区二区日韩| 91在线观看视频| 精品亚洲国产成人av制服丝袜 | 一色屋精品亚洲香蕉网站| 欧美日产国产精品| 精品写真视频在线观看| 亚洲国产精品久久人人爱| 日本一区免费视频| 欧美一级片在线观看| 99免费精品在线| 国产一区二区在线电影| 亚洲成a人片在线观看中文| 中文字幕精品三区| 91精品在线观看入口| 国产999精品久久久久久绿帽| 日韩黄色在线观看| 中文字幕综合网| 国产欧美精品在线观看| 欧美一区二区三区视频免费 |