File: dma.c

package info (click to toggle)
kernel-source-2.4.14 2.4.14-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 139,160 kB
  • ctags: 428,423
  • sloc: ansic: 2,435,554; asm: 141,119; makefile: 8,258; sh: 3,099; perl: 2,561; yacc: 1,177; cpp: 755; tcl: 577; lex: 352; awk: 251; lisp: 218; sed: 72
file content (49 lines) | stat: -rw-r--r-- 1,171 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/kd.h>
#include <linux/tty.h>
#include <linux/console.h>

#include <asm/setup.h>
#include <asm/bootinfo.h>
#include <asm/system.h>
#include <asm/pgtable.h>
#include <asm/apollodma.h>

/* note only works for 16 Bit 1 page DMA's */

static unsigned short next_free_xlat_entry=0;

unsigned short dma_map_page(unsigned long phys_addr,int count,int type) {

	unsigned long page_aligned_addr=phys_addr & (~((1<<12)-1));
	unsigned short start_map_addr=page_aligned_addr >> 10;
	unsigned short free_xlat_entry, *xlat_map_entry;
	int i;

	free_xlat_entry=next_free_xlat_entry;
	for(i=0,xlat_map_entry=addr_xlat_map+(free_xlat_entry<<2);i<8;i++,xlat_map_entry++) {
#if 0
		printk("phys_addr: %x, page_aligned_addr: %x, start_map_addr: %x\n",phys_addr,page_aligned_addr,start_map_addr+i);
#endif
		outw(start_map_addr+i, xlat_map_entry);
	}

	next_free_xlat_entry+=2;
	if(next_free_xlat_entry>125)
		next_free_xlat_entry=0;
	
#if 0
	printk("next_free_xlat_entry: %d\n",next_free_xlat_entry);
#endif

	return free_xlat_entry<<10;
}

void dma_unmap_page(unsigned short dma_addr) {

	return ;

}