OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [arch/] [armnommu/] [kernel/] [dma-arc.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 * arch/arm/kernel/dma-arc.c
3
 *
4
 * Copyright (C) 1998 Dave Gilbert / Russell King
5
 *
6
 * DMA functions specific to Archimedes architecture
7
 */
8
#include <linux/sched.h>
9
 
10
#include <asm/dma.h>
11
#include <asm/io.h>
12
#include <asm/hardware.h>
13
 
14
 
15
#include "dma.h"
16
 
17
int arch_get_dma_residue(dmach_t channel, dma_t *dma)
18
{
19
 if (channel != DMA_VIRTUAL_FLOPPY0 &&
20
     channel != DMA_VIRTUAL_FLOPPY1) {
21
    printk ("arch_dma_count: invalid channel %d\n", channel);
22
    return 0;
23
  } else {
24
    extern int fdc1772_bytestogo;
25
    return fdc1772_bytestogo;
26
  }
27
}
28
 
29
int arch_request_dma(dmach_t channel, dma_t *dma, const char *devname)
30
{
31
        if (channel == DMA_VIRTUAL_FLOPPY0 ||
32
            channel == DMA_VIRTUAL_FLOPPY1)
33
                return 0;
34
        else
35
                return -EINVAL;
36
}
37
 
38
void arch_free_dma(dmach_t channel, dma_t *dma)
39
{
40
        if (channel != DMA_VIRTUAL_FLOPPY0 &&
41
            channel != DMA_VIRTUAL_FLOPPY1)
42
                return 0;
43
        else
44
                return -EINVAL;
45
}
46
 
47
void arch_enable_dma(dmach_t channel, dma_t *dma)
48
{
49
        switch (channel) {
50
        case DMA_VIRTUAL_FLOPPY0: { /* Data DMA */
51
                switch (dma->dma_mode) {
52
                case DMA_MODE_READ: /* read */
53
                {
54
                        extern unsigned char fdc1772_dma_read, fdc1772_dma_read_end;
55
                        extern void fdc1772_setupdma(unsigned int count,unsigned int addr);
56
                        unsigned long flags;
57
#ifdef DEBUG
58
                        printk("enable_dma fdc1772 data read\n");
59
#endif
60
                        save_flags(flags);
61
                        cliIF();
62
 
63
                        memcpy ((void *)0x1c, (void *)&fdc1772_dma_read,
64
                                &fdc1772_dma_read_end - &fdc1772_dma_read);
65
                        fdc1772_setupdma(dma->buf.length, __bus_to_virt(dma->buf.address)); /* Sets data pointer up */
66
                        enable_irq (64);
67
                        restore_flags(flags);
68
                }
69
                break;
70
 
71
                case DMA_MODE_WRITE: /* write */
72
                {
73
                        extern unsigned char fdc1772_dma_write, fdc1772_dma_write_end;
74
                        extern void fdc1772_setupdma(unsigned int count,unsigned int addr);
75
                        unsigned long flags;
76
 
77
#ifdef DEBUG
78
                        printk("enable_dma fdc1772 data write\n");
79
#endif
80
                        save_flags(flags);
81
                        cliIF();
82
                        memcpy ((void *)0x1c, (void *)&fdc1772_dma_write,
83
                                &fdc1772_dma_write_end - &fdc1772_dma_write);
84
                        fdc1772_setupdma(dma->buf.length, __bus_to_virt(dma->buf.address)); /* Sets data pointer up */
85
                        enable_irq (64);
86
 
87
                        restore_flags(flags);
88
                }
89
                break;
90
                default:
91
                        printk ("enable_dma: dma%d not initialised\n", channel);
92
                        return;
93
                }
94
        }
95
        break;
96
 
97
        case DMA_VIRTUAL_FLOPPY1: { /* Command end FIQ - actually just sets a flag */
98
                /* Need to build a branch at the FIQ address */
99
                extern void fdc1772_comendhandler(void);
100
                unsigned long flags;
101
 
102
                /*printk("enable_dma fdc1772 command end FIQ\n");*/
103
                save_flags(flags);
104
                cliIF();
105
 
106
                *((unsigned int *)0x1c)=0xea000000 | (((unsigned int)fdc1772_comendhandler-(0x1c+8))/4); /* B fdc1772_comendhandler */
107
 
108
                restore_flags(flags);
109
        }
110
        break;
111
        }
112
}
113
 
114
void arch_disable_dma(dmach_t channel, dma_t *dma)
115
{
116
        if (channel != DMA_VIRTUAL_FLOPPY0 &&
117
            channel != DMA_VIRTUAL_FLOPPY1)
118
                printk("arch_disable_dma: invalid channel %d\n", channel);
119
        else
120
                disable_irq(dma->dma_irq);
121
}
122
 
123
void arch_dma_init(dma_t *dma)
124
{
125
        dma[DMA_VIRTUAL_FLOPPY0].dma_irq = 64;
126
        dma[DMA_VIRTUAL_FLOPPY1].dma_irq = 65;
127
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.