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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? dma.c

?? 是關(guān)于linux2.5.1的完全源碼
?? 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/init.h>#include <linux/sched.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 void 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);	}}/** *	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 __FUNCTION__		       "unable to request IRQ %d for %s\n",		       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 __FUNCTION__ ": bad DMA identifier\n");		return;	}	if (!dma_chan[i].device) {		printk(KERN_ERR __FUNCTION__ "Trying to free free DMA\n");		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){	long flags;	u_long status;	int ret;	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 __FUNCTION__ ": bad DMA identifier\n");		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);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品影院在线观看| 久久精品日韩一区二区三区| 91精品国产综合久久婷婷香蕉| 欧美一区二区在线免费观看| 久久一夜天堂av一区二区三区| 欧美激情一区二区三区在线| 亚洲免费观看视频| 免费观看日韩av| 国产伦精一区二区三区| 91视频免费观看| 91精品国产91久久久久久最新毛片 | 97久久精品人人做人人爽50路| 欧美丝袜丝交足nylons图片| 日韩欧美高清在线| 国产精品私房写真福利视频| 亚洲午夜免费视频| 国产原创一区二区| 欧美午夜一区二区三区免费大片| 亚洲精品在线一区二区| 亚洲天堂精品视频| 久久99国产精品久久| 97se亚洲国产综合自在线不卡| 7777精品久久久大香线蕉| 国产欧美一区二区精品忘忧草| 亚洲一卡二卡三卡四卡 | 欧美成人猛片aaaaaaa| 中文字幕制服丝袜成人av| 日韩中文字幕av电影| 丁香婷婷综合色啪| 日韩三区在线观看| 亚洲午夜影视影院在线观看| 国产99久久久久| 欧美一区二区久久| 亚洲精品你懂的| 国产精品亚洲视频| 欧美一区国产二区| 一区二区三区在线不卡| 国产精品一区二区久久不卡| 欧美日韩一区二区三区视频| 国产精品青草综合久久久久99| 日本美女视频一区二区| 99国产精品久| 国产日韩欧美精品综合| 蜜臀久久99精品久久久久久9| 色综合久久久久综合体| 欧美激情一区二区| 久久黄色级2电影| 欧美一区二区三区公司| 亚洲一级二级三级在线免费观看| 成人黄色片在线观看| 26uuu亚洲| 免费看欧美女人艹b| 欧美日韩在线播放一区| 亚洲欧美激情在线| 成人综合在线网站| 国产色综合久久| 精品一区二区精品| 亚洲私人黄色宅男| 国产凹凸在线观看一区二区| 精品久久99ma| 青青草原综合久久大伊人精品优势| 欧美三级在线视频| 亚洲午夜精品在线| 91福利国产精品| 亚洲女人小视频在线观看| 成人sese在线| 国产精品毛片a∨一区二区三区| 国产一区二区在线视频| 欧美变态tickling挠脚心| 日韩精品视频网| 欧美日韩极品在线观看一区| 亚洲一级电影视频| 欧美三级韩国三级日本一级| 亚洲香蕉伊在人在线观| 欧美午夜宅男影院| 亚洲成国产人片在线观看| 欧美影视一区二区三区| 亚洲成人动漫精品| 欧美一级欧美一级在线播放| 三级不卡在线观看| 日韩视频一区二区三区在线播放 | 欧美日韩国产一级| 首页亚洲欧美制服丝腿| 91精品欧美一区二区三区综合在| 五月婷婷激情综合网| 日韩一区二区三区电影在线观看| 日本aⅴ免费视频一区二区三区| 337p亚洲精品色噜噜噜| 日本一区中文字幕| 久久先锋资源网| 成人免费va视频| 亚洲欧美另类在线| 欧美日韩一区二区不卡| 美女网站在线免费欧美精品| 精品国产91乱码一区二区三区| 国产在线播放一区三区四| 国产人伦精品一区二区| 91小视频免费观看| 亚洲国产精品久久一线不卡| 欧美日韩精品一区视频| 热久久免费视频| 久久精品人人做人人爽人人| 成人免费视频视频在线观看免费| 18涩涩午夜精品.www| 欧美在线不卡一区| 美女尤物国产一区| 国产精品欧美久久久久无广告| 99久久精品免费| 亚洲成人精品在线观看| 精品久久久网站| 成人精品免费网站| 视频精品一区二区| 久久久久久**毛片大全| 91一区一区三区| 免费观看在线色综合| 七七婷婷婷婷精品国产| 国产清纯在线一区二区www| 色素色在线综合| 久久精品噜噜噜成人av农村| 中文幕一区二区三区久久蜜桃| 91激情五月电影| 国内精品视频666| 亚洲另类在线制服丝袜| 日韩三区在线观看| 91农村精品一区二区在线| 肉肉av福利一精品导航| 国产精品久久一级| 这里只有精品电影| 不卡的av中国片| 青青草97国产精品免费观看 | a4yy欧美一区二区三区| 午夜精品福利在线| 国产精品福利在线播放| 91精品国产综合久久婷婷香蕉| 成人久久视频在线观看| 男男成人高潮片免费网站| 综合久久一区二区三区| 日韩视频123| 欧美专区亚洲专区| 国产不卡高清在线观看视频| 天天av天天翘天天综合网 | 99久久99久久久精品齐齐| 三级亚洲高清视频| 亚洲欧美综合另类在线卡通| 欧美一级高清片在线观看| 色综合久久久久久久久| 国产美女精品一区二区三区| 五月激情丁香一区二区三区| 国产精品国产三级国产a | 成人永久aaa| 蜜臀av一区二区三区| 亚洲成人综合视频| 亚洲欧美日本韩国| 日本一二三四高清不卡| 欧美成人福利视频| 欧美日韩国产系列| 在线观看亚洲a| 99久久亚洲一区二区三区青草 | 久久久久亚洲综合| 欧美一级二级三级乱码| 欧美色中文字幕| 91美女在线看| 成人性生交大片免费看中文 | 久久精品亚洲一区二区三区浴池| 在线成人av影院| 欧美午夜视频网站| 91精彩视频在线| 91丨九色porny丨蝌蚪| 国产不卡在线视频| 国产精品伊人色| 国产精品一区二区免费不卡| 紧缚奴在线一区二区三区| 免费不卡在线视频| 欧美aaaaa成人免费观看视频| 香港成人在线视频| 亚洲一区二区成人在线观看| 一区二区三区欧美久久| 亚洲欧美视频在线观看视频| 综合久久久久久| 一区二区三区在线高清| 亚洲综合区在线| 亚洲高清视频的网址| 亚洲电影你懂得| 亚洲成av人影院| 日韩1区2区3区| 免费看日韩a级影片| 麻豆精品久久久| 久久国产成人午夜av影院| 麻豆高清免费国产一区| 九九国产精品视频| 国产在线精品国自产拍免费| 激情小说亚洲一区| 国产成人av影院| 成人免费看黄yyy456| 久久精品99国产精品日本| 亚洲精品菠萝久久久久久久| 中文字幕一区二区三区不卡| 精品国产凹凸成av人导航| 久久品道一品道久久精品| 久久久青草青青国产亚洲免观|